/* Reading pages inherit the site canvas. A directory has a slightly deeper
   blue wash, with an opaque base so that it can also serve as a mobile drawer. */
:root {
  --ui-directory-fill: linear-gradient(155deg, #eff6ff 0%, #e2edfb 100%);
  --ui-directory-heading: #dceafa;
}
html[data-theme=dark] {
  --ui-directory-fill: linear-gradient(155deg, #202e40 0%, #1a283a 100%);
  --ui-directory-heading: #2b4059;
}
@media print, (forced-colors: active) {
  :root, html[data-theme] {
    --ui-directory-fill: none;
    --ui-directory-heading: var(--ui-surface);
  }
}

@media screen and (forced-colors: none) {
  body .unified-site-header .site-analytics-privacy { color: var(--ui-muted); }
  body .unified-site-header .site-analytics-privacy:hover { color: var(--ui-blue); }

  /* These are full-width catalog containers. Let the page gradient show in
     the gutters, and reserve the paper surface for individual cards and prose. */
  body.topic-learning .tl-layout > .tl-main,
  body .l-shell > .l-main,
  body .w-shell > .w-main.is-catalog {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  body .w-shell > .w-main:not(.is-catalog),
  body .diagram-interpretation,
  body .diagram-visual .image-frame {
    background: var(--ui-surface);
    color: var(--ui-ink);
    border-color: var(--ui-line);
  }
  body .diagram-interpretation {
    padding: clamp(16px, 2vw, 28px);
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
  }
  body .diagram-description { color: var(--ui-ink); }
  body.deck-page .tl-layout > .deck-main:fullscreen {
    background: var(--ui-bg) var(--ui-canvas) no-repeat;
  }

  body .tl-layout > :is(.tl-directory, .tl-series-directory),
  body .l-shell > .tl-directory,
  body .w-shell > :is(.w-directory, .w-products),
  body #w-reading-sidebar,
  body .documentation-shell:not(.admin-focus) .docs-sidebar,
  body #deck-directory {
    background: var(--ui-bg) var(--ui-directory-fill);
    color: var(--ui-ink);
    border-color: var(--ui-line);
  }
  body #w-reading-sidebar .w-sidebar-heading {
    background: var(--ui-directory-heading);
    color: var(--ui-ink);
  }
  @media (min-width: 1100px) {
    body #w-reading-sidebar {
      padding: 16px;
      border: 1px solid var(--ui-line);
      border-radius: 12px;
    }
    body #w-reading-sidebar .w-sidebar-heading {
      padding: 8px 10px;
      border-radius: 6px;
    }
  }
  body .w-products > .tl-directory,
  body .docs-sidebar .sidebar-content,
  body .shared-learning-mount .tl-directory {
    background: transparent;
  }
  body .tl-directory .tl-filter-group > summary,
  body #w-tree > .w-library-group > summary {
    border-radius: 6px;
    background: var(--ui-directory-heading);
    color: var(--ui-ink);
    font-weight: 650;
  }
  body #w-tree .w-library-children { border-color: var(--ui-line); }
  body #w-tree .w-library-children .w-library-group > summary {
    background: transparent;
    color: var(--ui-ink);
    font-weight: 600;
  }
  body #w-tree .w-library-page > a { color: var(--ui-muted); }
  body #w-tree .w-library-group > summary:hover,
  body #w-tree .w-library-page > a:hover,
  body .tl-directory .tl-filter-group > summary:hover,
  body .tl-topic-choice:hover {
    background: var(--ui-hover);
    color: var(--ui-blue);
  }
  body #w-tree a[aria-current=page],
  body #w-tree .w-library-page > a[aria-current=page],
  body .w-products .tl-topic-choice[aria-current=page],
  body .tl-directory .tl-topic-choice:has(input:checked),
  body .tl-series-directory .tl-topic-choice:has(input:checked) {
    background: var(--ui-selected);
    color: var(--ui-blue);
    box-shadow: inset 3px 0 var(--ui-primary);
    font-weight: 600;
  }
  body .tl-topic-choice:has(input:checked) label { color: var(--ui-blue); }
  body .documentation-shell:not(.admin-focus) .docs-sidebar .directory-folder {
    color: var(--ui-ink);
    font-weight: 600;
  }
  body .docs-sidebar .directory-document { color: var(--ui-muted); }
  body .documentation-shell:not(.admin-focus) .docs-sidebar .directory-document.active {
    background: var(--ui-selected);
    color: var(--ui-blue);
    box-shadow: inset 3px 0 var(--ui-primary);
  }
  body :is(.tl-directory, .tl-series-directory) input[type=checkbox] {
    accent-color: var(--ui-primary);
  }
  body .w-shell :is(#w-products-close, #w-directory-close) {
    background: var(--ui-directory-heading);
    color: var(--ui-blue);
  }

  /* The learning library uses its own local palette for non-artwork accents. */
  body.learning-home {
    --lh-accent: var(--ui-blue);
    --lh-line: var(--ui-line);
    --lh-muted: var(--ui-muted);
  }
  html body.experience-page {
    background: var(--ui-bg) var(--ui-canvas) no-repeat;
    color: var(--ui-ink);
  }
  body.experience-page .experience-shell > .experience-heading {
    background: transparent;
  }
  body.experience-page :is(.experience-entry p, .experience-placeholder,
      .experience-heading p, .experience-frame-note) { color: var(--ui-muted); }
  body.experience-page .experience-placeholder h2 { color: var(--ui-ink); }
  body.experience-page :is(input, select, button):not(.experience-primary) {
    background: var(--ui-surface);
    border-color: var(--ui-line);
    color: var(--ui-ink);
  }
  body.learning-home :is(.lh-collection-card, .lh-card, .lh-empty),
  body :is(.experience-entry, .experience-credentials, .experience-view,
           .experience-admin-card, .analytics-privacy) {
    background: var(--ui-surface);
    color: var(--ui-ink);
    border-color: var(--ui-line);
  }
  body.learning-home :is(.lh-recent, .lh-card-tags span, .lh-ecosystem) {
    background: var(--ui-subtle);
    color: var(--ui-blue);
    border-color: var(--ui-line);
  }
}
