/* An understated charcoal-and-sage counterpart to the original light palette. */
:root { color-scheme: light; }
:root[data-theme='dark'] {
  color-scheme: dark;
  --background: #151d1b;
  --surface: #151d1b;
  --foreground: #e4ede8;
  --primary: #9dcfc0;
  --primary-foreground: #15251f;
  --border: #354640;
  --muted: #afc0b8;
}
[data-theme='dark'] .site-header { background: rgb(21 29 27 / 96%); }
[data-theme='dark'] .intro-prose,
[data-theme='dark'] .research-page .page-intro,
[data-theme='dark'] .teaching-page .page-intro,
[data-theme='dark'] .abstract-body { color: #c0cec7; }
[data-theme='dark'] .intro-prose p:first-child { color: var(--foreground); }
[data-theme='dark'] .abstract-body { background: #1e2a25; }
[data-theme='dark'] .research-group,
[data-theme='dark'] .teaching-group,
[data-theme='dark'] .cv-toolbar { border-color: #4c6559; }
[data-theme='dark'] .recognition,
[data-theme='dark'] .paper-notes li,
[data-theme='dark'] .abstract-body { border-left-color: #648877; }
[data-theme='dark'] .paper-abstract summary,
[data-theme='dark'] .cv-download { border-color: #4c6559; }
[data-theme='dark'] .paper-link:hover,
[data-theme='dark'] .paper-abstract summary:hover,
[data-theme='dark'] .paper-abstract[open] summary,
[data-theme='dark'] .cv-download:hover { background: #283c32; border-color: #7fa792; }
[data-theme='dark'] .intro-prose a,
[data-theme='dark'] .abstract-attribution a,
[data-theme='dark'] .paper-notes a,
[data-theme='dark'] .cv-preview-note a { text-decoration-color: #648877; }
[data-theme='dark'] .primary-button,
[data-theme='dark'] .skip-link { color: #15251f; }
[data-theme='dark'] .primary-button:hover { background: #b3dfd0; }
[data-theme='dark'] ::selection { background: #365b4c; color: #f1f7f4; }
/* Keep the navigation anchored; the switch occupies its own header column. */
.site-header .header-inner { display: grid; grid-template-columns: 1fr auto 44px; gap: 24px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: transparent; color: var(--primary); cursor: pointer;
}
.theme-toggle:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
[data-theme='dark'] .theme-sun { display: block; }
[data-theme='dark'] .theme-moon { display: none; }
@media (max-width: 760px) { .site-header .header-inner { gap: 16px; } .site-header .main-nav { gap: 20px; } }
@media (max-width: 640px) {
  .site-header .header-inner { grid-template-columns: 1fr 44px; gap: 6px 16px; padding-top: 17px; padding-bottom: 4px; align-items: center; }
  .site-header .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: space-between; gap: 16px; }
  .theme-toggle { grid-column: 2; grid-row: 1; }
}
@media print { .theme-toggle { display: none; } }
