/* Theme toggle and dark mode.
   Dark mode swaps the tokens used by light surfaces. Blocks that are already dark
   (header, footer, heroes, dark sections, panels) get the original tokens back,
   so they look the same in both modes. */

.site-nav-desktop { margin-left: auto; }
.theme-toggle {
  display: none; align-items: center; gap: .45rem; flex: none;
  background: transparent; color: var(--stone); border: 1px solid #3a3734; border-radius: 0;
  font: inherit; font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  padding: .45rem .7rem; min-height: 2.4rem; min-width: 2.4rem; justify-content: center; cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover, .theme-toggle:focus-visible { color: #ffffff; border-color: var(--orange); outline: none; }
.theme-toggle:focus-visible { box-shadow: 0 0 0 2px var(--orange); }
.theme-toggle[aria-pressed="true"] { color: var(--orange); border-color: var(--orange); }
.tt-icon { display: block; flex: none; }
@media (max-width: 1099px) { .nav-wrap { margin-left: auto; } }
@media (max-width: 479px) { .tt-label { display: none; } .theme-toggle { padding: .45rem; } }

html[data-theme="dark"] {
  color-scheme: dark;
  --white: #171615;
  --paper: #1e1c1b;
  --black: #efebe6;
  --ink: #e4dfd8;
  --muted: #a8a299;
  --hair: #34312e;
}
html[data-theme="dark"] :is(.site-header, .site-footer, .hero, .page-hero, .sd-hero, .section.dark, .overview,
  .commitments, .contact, .data-panel, .markets, .preview, .checker, .map-panel, .out, .page-404, .page-sd) {
  --white: #ffffff;
  --paper: #f7f5f2;
  --black: #121110;
  --ink: #1a1918;
  --muted: #5e5a55;
  --hair: #e4e0da;
}
/* Light-mode-only hardcoded colors */
html[data-theme="dark"] .check { border-color: #4a4744; }
html[data-theme="dark"] .check:has(input:checked) { background: #2a1d14; }
html[data-theme="dark"] .seg button:hover, html[data-theme="dark"] .seg button:focus-visible { background: #2a2826; }
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="number"], html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="email"], html[data-theme="dark"] input[type="tel"], html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select, html[data-theme="dark"] textarea { border-color: #57524d; }
/* Dark text on orange stays dark */
html[data-theme="dark"] :is(.btn:not(.btn-ghost), .skip, .tag, .js .code.is-copied, .copy-all:hover, .copy-all:focus-visible,
  .mini-btn:hover, .mini-btn:focus-visible, .out.is-key, .out.is-key .out-v, .tile.is-home, .lk-hit) { color: #121110; }
html[data-theme="dark"] .kit-grid .copy-all:hover, html[data-theme="dark"] .kit-grid .copy-all:focus-visible { color: #121110; }

@media print {
  html[data-theme="dark"] { color-scheme: light; --white: #ffffff; --paper: #ffffff; --black: #121110; --ink: #1a1918; --muted: #5e5a55; --hair: #d8d3cc; }
  .theme-toggle { display: none !important; }
}
