/* Shared design tokens + theme handling for every page.
   Theme = the visitor's choice (data-theme on <html>, set by theme.js) or, until they choose, the system setting. */
:root {
  color-scheme: light;
  --page: #f4f3f0; --surface: #fcfcfb; --border: #e4e2dc; --grid: #e9e7e1;
  --text: #0b0b0b; --text-2: #52514e; --text-3: #8a8983;
  --s1: #2a78d6; --s2: #eb6834; --critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #111110; --surface: #1a1a19; --border: #2e2e2b; --grid: #2a2a27;
    --text: #ffffff; --text-2: #c3c2b7; --text-3: #8a8983;
    --s1: #3987e5; --s2: #d95926; --critical: #e66767;
  }
  :root:not([data-theme="light"]) .only-light { display: none !important; }
  :root:not([data-theme="light"]) .only-dark { display: block !important; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111110; --surface: #1a1a19; --border: #2e2e2b; --grid: #2a2a27;
  --text: #ffffff; --text-2: #c3c2b7; --text-3: #8a8983;
  --s1: #3987e5; --s2: #d95926; --critical: #e66767;
}
.only-dark { display: none !important; }   /* !important: must beat layout rules such as .brand img */
:root[data-theme="dark"] .only-light { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }

/* Header brand: Scigrow + the lodge */
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { display: block; width: auto; }
.brand .scigrow { height: 30px; }
.brand .lodge { height: 54px; }
.brand .rule { width: 1px; height: 34px; background: var(--border); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.iconbtn svg { width: 17px; height: 17px; }
@media (max-width: 560px) { .brand .scigrow { height: 22px; } .brand .lodge { height: 40px; } .brand { gap: 10px; } }

/* Three-way theme control (System / Light / Dark), built by theme.js */
.themeseg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.themeseg button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border: 0; background: transparent; color: var(--text-3); cursor: pointer; }
.themeseg button + button { border-left: 1px solid var(--border); }
.themeseg button[aria-pressed="true"] { background: var(--grid); color: var(--text); }
.themeseg svg { width: 16px; height: 16px; }
