/* Shared surfaces keep the page, navigation, and project dialogs in sync. */
:root {
  color-scheme: light;
  --header-bg: rgba(247, 248, 250, .96);
  --surface-hover: #e9edfc;
  --primary-bg: #191c24;
  --primary-hover: #3155df;
  --primary-text: #fff;
}

.site-header { background: var(--header-bg); }
.header-inner > .wordmark { margin-right: auto; }
.button-dark { background: var(--primary-bg); color: var(--primary-text); }
.button-dark:hover { background: var(--primary-hover); }
.button-outline { border-color: var(--line); }
.button-outline:hover, .dialog-close { background: var(--white); }
.dialog-close:hover { background: var(--surface-hover); }
.skip-link { background: var(--white); color: var(--ink); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background .18s, color .18s;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: var(--surface-hover); color: var(--ink); }
.theme-toggle:focus-visible { border-radius: 50%; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }

/* A blue charcoal palette, with brighter accents for legible links and labels. */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #11151e;
    --ink: #edf0f7;
    --muted: #aab3c5;
    --blue: #94adff;
    --line: #30394c;
    --white: #1a202d;
    --header-bg: rgba(17, 21, 30, .96);
    --surface-hover: #28344c;
    --primary-bg: #94adff;
    --primary-hover: #b2c3ff;
    --primary-text: #111a33;
  }
  [data-theme="dark"] .project-description,
  [data-theme="dark"] #case-content p,
  [data-theme="dark"] #case-content li { color: #bec7d9; }
  [data-theme="dark"] .subtle-link,
  [data-theme="dark"] .private-note,
  [data-theme="dark"] .engineering-bottom > span,
  [data-theme="dark"] .art-caption,
  [data-theme="dark"] .copyright,
  [data-theme="dark"] .site-footer > div { color: var(--muted); }
  [data-theme="dark"] .tags > li { border-color: var(--line); color: #b9c3d6; }
  [data-theme="dark"] .project-state { background: #203a2e; color: #a1dbb3; }
  [data-theme="dark"] .project-state.neutral { background: #293145; color: #c1c9dc; }
  [data-theme="dark"] .engineering-card { border-color: var(--line); }
  [data-theme="dark"] .engineering-icon { background: #212c48; border-color: #334366; }
  [data-theme="dark"] .experience-section { background: #171d29; border-color: var(--line); }
  [data-theme="dark"] .timeline,
  [data-theme="dark"] .timeline-item { border-color: #354059; }
  [data-theme="dark"] .timeline-item::before { background: #171d29; border-color: #8293b3; }
  [data-theme="dark"] .timeline-item:first-child::before { background: var(--blue); border-color: var(--blue); }
  [data-theme="dark"] .role-meta { color: #aab6cd; }
  [data-theme="dark"] .role-meta > span,
  [data-theme="dark"] .toolkit-group h3 { color: #c9d3e8; }
  [data-theme="dark"] .toolkit-group p > span,
  [data-theme="dark"] .foot-divider { color: #8190ab; }
  [data-theme="dark"] .availability-dot { background: #7bc69b; box-shadow: 0 0 0 4px #7bc69b12; }
  [data-theme="dark"] .contact-section { background: #1b2540; }
  [data-theme="dark"] .stack-sheet { box-shadow: 0 12px 30px #0003; }
  [data-theme="dark"] .sheet-data { background: #212c40; border-color: #3c4a62; color: #b2c1db; }
  [data-theme="dark"] .sheet-api { background: #2d3b55; border-color: #536585; color: #e1e8fa; }
  [data-theme="dark"] .sheet-ui { background: #4966d4; color: #fff; }
  [data-theme="dark"] .stack-orbit { border-color: #35435e; }

  /* Keep the project illustrations recognizable without bright white panels. */
  [data-theme="dark"] .map-preview { background: #1c302a; }
  [data-theme="dark"] .map-preview .preview-header { color: #a8dcb8; }
  [data-theme="dark"] .map-preview .preview-label,
  [data-theme="dark"] .map-legend { color: #b2c9bb; }
  [data-theme="dark"] .map-svg { --map-block: #293e35; --map-road: #17281f; --map-ground: #203129; --map-water: #284759; --map-route-glow: #3f6b51; --map-route: #8aca9e; }
  [data-theme="dark"] .map-callout { background: #1b2e27f2; border-color: #46614f; }
  [data-theme="dark"] .map-callout strong,
  [data-theme="dark"] .map-pin { color: #b6e4c4; }
  [data-theme="dark"] .map-callout div > span { color: #a9c3b3; }
  [data-theme="dark"] .map-legend i { background: #8aca9e; }
  [data-theme="dark"] .map-legend > span:last-child i { background: #718e7b; }
  [data-theme="dark"] .mova-preview { background: #29273d; }
  [data-theme="dark"] .mova-logo { color: #ddd5fa; }
  [data-theme="dark"] .mova-preview .preview-label { color: #bcb4d7; }
  [data-theme="dark"] .practice-card { background: #35314d; border-color: #62577d; box-shadow: 12px 15px 0 #211f33, 0 15px 45px #0002; }
  [data-theme="dark"] .practice-card > p { color: #eee6ff; }
  [data-theme="dark"] .practice-eyebrow,
  [data-theme="dark"] .pronunciation,
  [data-theme="dark"] .practice-flow { color: #c9bfdf; }
  [data-theme="dark"] .practice-flow b { color: #a399bc; }
  [data-theme="dark"] .waveform i { background: #b7a6e8; }
}

@media (max-width: 620px) {
  .header-inner { gap: 12px; }
  .theme-toggle { order: 2; }
  .menu-toggle { order: 3; min-height: 44px; }
}
@media (max-width: 360px) {
  .site-header .wordmark-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
}
@media print {
  .theme-toggle { display: none !important; }
}
