/* v0.4.5 — switchable color theme. Screenshots and video retain their own colors. */
html[data-theme="light"] { color-scheme: light; }

/* The switch remains visible beside the navigation in both themes. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#site-nav { margin-left: auto; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 78px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #b7beb1;
  border-radius: 25px;
  background: transparent;
  color: #34513f;
  font: 12px/1.5 var(--sans);
  white-space: nowrap;
  transition: background .18s, border-color .18s;
}
.theme-toggle:hover { background: #e7edde; border-color: #8c9d82; }
.theme-toggle svg { display: block; width: 17px; height: 17px; flex: none; }
.theme-toggle .theme-icon--sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon--sun { display: block; }
html[data-theme="dark"] .theme-toggle .theme-icon--moon { display: none; }

/* Slate surfaces, mint accents, and cool neutral text. */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #232832;
  --ink: #f0f3f7;
  --muted: #b8c1cd;
  --line: #444d5a;
  --lime: #60dbc6;
  --green: #62dfce;
  --theme-surface: #303642;
  --theme-raised: #383f4c;
  --theme-deep: #1d222b;
  --theme-accent: #68e0d0;
  --theme-control-border: #788899;
}
html[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] ::selection { background: #60dbc6; color: #142c31; }
html[data-theme="dark"] :focus-visible { outline-color: #79ebda; }
html[data-theme="dark"] .skip-link { background: var(--theme-accent); color: #142c31; }

/* A cyan-to-mint header echoes the reference without changing the page layout. */
html[data-theme="dark"] .site-header {
  background: linear-gradient(110deg, #32c4d5 0%, #36cbbf 56%, #49d2af 100%);
  border-bottom-color: #54d7c6;
  color: #12343b;
  box-shadow: 0 4px 20px #0c151d26;
}
html[data-theme="dark"] .site-header :focus-visible { outline-color: #173c47; }
html[data-theme="dark"] .brand { color: #10323a; }
html[data-theme="dark"] .brand small { color: #204a50; }
html[data-theme="dark"] .brand-symbol { background: #173b43; color: #89f1dd; }
html[data-theme="dark"] #site-nav > a { color: #163b42; }
html[data-theme="dark"] #site-nav > a:hover,
html[data-theme="dark"] #site-nav a[aria-current="page"] { color: #092a32; }
html[data-theme="dark"] #site-nav > a::after { background: #153d44; }
html[data-theme="dark"] .nav-contact,
html[data-theme="dark"] .theme-toggle {
  color: #12343b;
  border-color: #25767c;
  background: #ffffff24;
}
html[data-theme="dark"] .nav-contact:hover,
html[data-theme="dark"] .theme-toggle:hover { background: #ffffff5c; border-color: #1b545f; }
html[data-theme="dark"] .menu-toggle { border-color: #25767c; }
html[data-theme="dark"] .menu-toggle span { background: #12343b; }

/* Shared typography and actions. */
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .archive-caption,
html[data-theme="dark"] .catalog-total,
html[data-theme="dark"] .catalog-endnote,
html[data-theme="dark"] .no-js-note,
html[data-theme="dark"] .index-meta,
html[data-theme="dark"] .index-card-copy > p,
html[data-theme="dark"] .library-pagination p,
html[data-theme="dark"] .footer-inner p,
html[data-theme="dark"] .footer-meta,
html[data-theme="dark"] .case-gallery-footer,
html[data-theme="dark"] .case-simple-zoom > span,
html[data-theme="dark"] .image-caption { color: var(--muted); }
html[data-theme="dark"] .domain-number,
html[data-theme="dark"] .working-steps li > span,
html[data-theme="dark"] .case-simple-number { color: #91adbd; }
html[data-theme="dark"] .text-link,
html[data-theme="dark"] .back-link,
html[data-theme="dark"] .case-simple-back a,
html[data-theme="dark"] .card-foot > span:last-child,
html[data-theme="dark"] .domain-link h3 > span,
html[data-theme="dark"] .footer-brand span { color: var(--theme-accent); }
html[data-theme="dark"] .text-link:hover,
html[data-theme="dark"] .back-link:hover,
html[data-theme="dark"] .case-simple-back a:hover,
html[data-theme="dark"] .case-simple-zoom:hover > span { color: #b7fff0; }
html[data-theme="dark"] .button {
  color: var(--ink);
  border-color: var(--theme-control-border);
  background: transparent;
}
html[data-theme="dark"] .button:hover { background: var(--theme-raised); border-color: var(--theme-accent); }
html[data-theme="dark"] .button.dark {
  background: #61dbc6;
  border-color: #61dbc6;
  color: #132f34;
}
html[data-theme="dark"] .button.dark:hover { background: #87ead8; border-color: #87ead8; }
html[data-theme="dark"] .small-dot,
html[data-theme="dark"] .version-dot { background: var(--theme-accent); }

/* Home page and project cards. */
html[data-theme="dark"] .domain-section { border-top-color: transparent; }
html[data-theme="dark"] .domain-link:hover h3 { color: var(--theme-accent); }
html[data-theme="dark"] .domain-count {
  color: #c8d4df;
  background: var(--theme-surface);
}
html[data-theme="dark"] .home-about { background: #2b323d; }
html[data-theme="dark"] .working-steps li { border-color: #4c5866; }
html[data-theme="dark"] .site-footer { background: var(--theme-deep); }
html[data-theme="dark"] .index-card {
  background: var(--theme-surface);
  border-color: #414a58;
}
html[data-theme="dark"] .index-card:hover {
  border-color: #6a9d9f;
  box-shadow: 0 13px 30px -15px #071016b3;
}
html[data-theme="dark"] .index-card-copy { border-top-color: #454e5b; }
html[data-theme="dark"] .index-art,
html[data-theme="dark"] .index-art--full-interface { background: #262d37; }
html[data-theme="dark"] .card-foot { color: #b2bfcd; border-top-color: #46505e; }
html[data-theme="dark"] .stage-label { background: #284b48; color: #a1e5d6; }
html[data-theme="dark"] .stage-history { background: #4b4538; color: #e6d5ad; }
html[data-theme="dark"] .stage-research { background: #443e57; color: #d7c7f1; }
html[data-theme="dark"] .art-caption,
html[data-theme="dark"] .card-arrow { background: #222d35ed; color: #c7eee4; }

/* Catalog controls: selected, hover, focus, empty, and pagination states. */
html[data-theme="dark"] .category-sidebar nav > a { color: #d2dae4; }
html[data-theme="dark"] .category-sidebar nav small,
html[data-theme="dark"] .category-sidebar nav > a > span:last-child { color: #a8b9c9; }
html[data-theme="dark"] .category-sidebar nav > a:hover { background: #303a46; }
html[data-theme="dark"] .category-sidebar nav > a.active {
  background: #2b494c;
  color: #91ecdc;
  border-color: #4a8c87;
}
html[data-theme="dark"] .category-sidebar nav > a.active > span:last-child,
html[data-theme="dark"] .category-sidebar nav > a.active small { color: #91ecdc; }
html[data-theme="dark"] .search-control,
html[data-theme="dark"] .stage-control select {
  background: var(--theme-surface);
  border-color: var(--theme-control-border);
  color: var(--ink);
}
html[data-theme="dark"] .search-control > span:first-child { color: #b5c4d3; }
html[data-theme="dark"] .search-control input { color: var(--ink); }
html[data-theme="dark"] .search-control input::placeholder { color: #aebac8; opacity: 1; }
html[data-theme="dark"] .search-control:focus-within { outline-color: var(--theme-accent); }
html[data-theme="dark"] .stage-control select option { background: var(--theme-surface); color: var(--ink); }
html[data-theme="dark"] .reset-filters { color: #b7c9d5; }
html[data-theme="dark"] .reset-filters:hover { color: var(--theme-accent); }
html[data-theme="dark"] .version-pill { color: #b7d8d5; border-color: #637c83; }
html[data-theme="dark"] .catalog-total i { color: #8f9eae; }
html[data-theme="dark"] .sidebar-note,
html[data-theme="dark"] .sidebar-note p,
html[data-theme="dark"] .sidebar-note p > span { color: #acbecb; }
html[data-theme="dark"] .library-empty { background: #2b323d; border-color: #657583; }
html[data-theme="dark"] .library-empty > span { color: #91adbd; }
html[data-theme="dark"] .library-pagination .button { background: var(--theme-surface); }
html[data-theme="dark"] .library-pagination .button:hover { background: #3b4955; }

/* Concise cases: frame the media, but never recolor its pixels. */
html[data-theme="dark"] .case-simple-zoom img,
html[data-theme="dark"] .case-gallery-viewport,
html[data-theme="dark"] .case-simple-video { border-color: #4c5968; }
html[data-theme="dark"] .case-gallery-viewport,
html[data-theme="dark"] .case-simple-video { background: #1a2029; }
html[data-theme="dark"] .case-gallery-slide img { border: 0; }
html[data-theme="dark"] .case-gallery-controls button {
  background: var(--theme-surface);
  border-color: var(--theme-control-border);
  color: var(--theme-accent);
}
html[data-theme="dark"] .case-gallery-controls button:hover { background: #354c52; border-color: var(--theme-accent); }
html[data-theme="dark"] .case-gallery-count { color: #c2d4df; }
html[data-theme="dark"] .case-simple-zoom:focus-visible,
html[data-theme="dark"] .case-simple-video:focus-visible,
html[data-theme="dark"] .case-gallery-controls button:focus-visible { outline-color: var(--theme-accent); }

/* Contact and image dialogs, release notes, and 404 use the same surfaces. */
html[data-theme="dark"] dialog { background: #2c3440; border-color: #596878; box-shadow: 0 24px 100px #060d19b3; }
html[data-theme="dark"] dialog::backdrop { background: #0b111bb3; }
html[data-theme="dark"] .dialog-close { background: #303b48f5; color: #e0e8f0; border-color: #7b8b9b; }
html[data-theme="dark"] .dialog-close:hover { background: #41515d; }
html[data-theme="dark"] .contact-pending,
html[data-theme="dark"] .version-pending { background: #35424c; border-color: #536675; }
html[data-theme="dark"] .contact-pending p { color: var(--muted); }
html[data-theme="dark"] .contact-dialog .contact-value { color: #d8e4ed; }
html[data-theme="dark"] .contact-dialog .copy-feedback { color: #93e6d1; }

/* Make room for the persistent switch; navigation folds at 800px. */
@media (min-width: 801px) and (max-width: 1050px) {
  .header-inner { gap: 14px; }
  #site-nav { gap: 21px; }
}
@media (max-width: 800px) {
  .header-inner { gap: 12px; }
  .header-actions { margin-left: auto; gap: 8px; }
  .menu-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .menu-toggle span { width: 17px; height: 1px; background: var(--ink); transition: transform .2s; }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }
  #site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 82px;
    margin-left: 0;
    background: var(--paper);
    padding: 15px 18px 22px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 25px #202c2010;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  #site-nav.open { display: flex; }
  #site-nav > a { padding: 9px 10px; }
  #site-nav a[aria-current="page"]::after { display: none; }
  .nav-contact { justify-content: center; margin: 6px 8px 0; }
  html[data-theme="dark"] #site-nav { background: #2b323e; border-color: #53616f; box-shadow: 0 16px 30px #07101980; }
  html[data-theme="dark"] #site-nav > a { color: #dae3ed; }
  html[data-theme="dark"] #site-nav > a:hover,
  html[data-theme="dark"] #site-nav a[aria-current="page"] { color: #85ead8; }
  html[data-theme="dark"] #site-nav > a::after { background: #85ead8; }
  html[data-theme="dark"] #site-nav .nav-contact { background: #344a50; color: #a3f0df; border-color: #759d9c; }
  html[data-theme="dark"] #site-nav .nav-contact:hover { background: #3b5a5d; }
  html[data-theme="dark"] #site-nav :focus-visible { outline-color: #79ebda; }
}
@media (max-width: 640px) {
  #site-nav { top: 72px; }
  html[data-theme="dark"] .category-sidebar nav > a { background: #2d3541; border-color: #4a5665; }
  html[data-theme="dark"] .category-sidebar nav > a:hover { background: #35434d; }
  html[data-theme="dark"] .category-sidebar nav > a.active { background: #2b494c; border-color: #4a8c87; }
}
@media (max-width: 360px) {
  .theme-toggle { min-width: 44px; width: 44px; padding: 0; }
  .theme-toggle [data-theme-label] { display: none; }
  .header-inner { gap: 8px; }
  .header-actions { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .menu-toggle span { transition: none; }
}
