/* Light / dark theme layer. Loaded after site.css; remaps its tokens. */
html[data-theme="light"] {
  color-scheme: light;
  /* "night" stages become light stages */
  --night: #fbfbfd;
  --night-2: #f5f5f7;
  --night-card: #ffffff;
  --night-line: #d2d2d7;
  --night-ink: #1d1d1f;
  --night-ink-2: #6e6e73;
  --link-dark: #0066cc;
  --paper: #ffffff;
  --paper-2: #f5f5f7;
  --paper-3: #e8e8ed;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f7;
  --ink-2: #a1a1a6;
  --ink-3: #86868b;
  --paper: #000000;
  --paper-2: #1c1c1e;
  --paper-3: #2c2c2e;
  --line: #38383a;
  --link: #2997ff;
}
html[data-theme="light"], html[data-theme="light"] body { background: var(--night); }
html[data-theme="dark"] .nav, html[data-theme="dark"] .nav.is-light {
  background: rgba(0,0,0,.72); color: #f5f5f7; border-bottom-color: rgba(255,255,255,.1);
}
html[data-theme="light"] .nav, html[data-theme="light"] .nav.is-light {
  background: rgba(251,251,253,.78); color: #1d1d1f; border-bottom-color: rgba(0,0,0,.08);
}

/* ---- Toggle button (inline in nav, right of the Download button) ---------- */
.theme-toggle {
  flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  margin-left: 4px; border: 0; border-radius: 50%; background: transparent; color: inherit;
  cursor: pointer; opacity: .8; transition: opacity .2s, background-color .2s;
}
.theme-toggle:hover { opacity: 1; background: rgba(128,128,128,.18); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-moon { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: none; }
html[data-theme="light"] .theme-toggle .i-moon { display: block; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
@media (max-width: 860px) { .theme-toggle { margin-left: 4px; } }

