:root {
  color-scheme: dark;
  --bg: #100f0d;
  --bg-deep: #0c0b0a;
  --panel: #171511;
  --panel-2: #0c0b0a;
  --panel-warm: #1c1811;
  --panel-soft: #14120f;
  --border: #2e2a24;
  --border-soft: #221f1a;
  --text: #f3eee5;
  --muted: #b4ada1;
  --soft: #8a8276;
  --dim: #6f685e;
  --gold: #e6a92e;
  --gold-light: #f1c467;
  --green: #77b18c;
  --grid-line: rgba(255, 255, 255, 0.018);
  --gold-glow: rgba(230, 169, 46, 0.09);
  --gold-glow-strong: rgba(230, 169, 46, 0.17);
  --header-border: rgba(46, 42, 36, 0.86);
  --header-bg: rgba(16, 15, 13, 0.88);
  --nav-bg: rgba(16, 15, 13, 0.98);
  --nav-shadow: 0 22px 40px -30px #000;
  --border-strong: #4b443a;
  --card-border: #3a3329;
  --card-gradient: linear-gradient(145deg, rgba(29, 26, 21, 0.96), rgba(18, 17, 14, 0.98));
  --card-text: #d7d0c5;
  --success-border: rgba(119, 177, 140, 0.25);
  --success-bg: rgba(57, 105, 75, 0.1);
  --success-text: #c6ddce;
  --section-alt: rgba(12, 11, 10, 0.6);
  --warm-border: #473923;
  --theme-toggle-bg: rgba(23, 21, 17, 0.84);
  --theme-toggle-border: #3b352c;
  --theme-toggle-track: #2c2821;
  --theme-toggle-thumb: #f3eee5;
  --theme-toggle-icon: #8a8276;
  --theme-toggle-hover: #211d17;
  --brand-shadow: rgba(0, 0, 0, 0.36);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f0e7;
  --bg-deep: #ebe3d5;
  --panel: #fffdf8;
  --panel-2: #ebe3d5;
  --panel-warm: #e4dacb;
  --panel-soft: #eee8dd;
  --border: #d8cebd;
  --border-soft: #d3c7b6;
  --text: #211d17;
  --muted: #6f675b;
  --soft: #7d7468;
  --dim: #6f675b;
  --gold: #8a5907;
  --gold-light: #a96d0b;
  --green: #356c4a;
  --grid-line: rgba(33, 29, 23, 0.055);
  --gold-glow: rgba(138, 89, 7, 0.1);
  --gold-glow-strong: rgba(138, 89, 7, 0.16);
  --header-border: rgba(216, 206, 189, 0.92);
  --header-bg: rgba(244, 240, 231, 0.9);
  --nav-bg: rgba(255, 253, 248, 0.98);
  --nav-shadow: 0 16px 34px -24px rgba(54, 45, 32, 0.28);
  --border-strong: #a96d0b;
  --card-border: #d8cebd;
  --card-gradient: linear-gradient(145deg, rgba(255, 253, 248, 0.98), rgba(238, 232, 221, 0.98));
  --card-text: #2a251e;
  --success-border: rgba(53, 108, 74, 0.26);
  --success-bg: rgba(53, 108, 74, 0.1);
  --success-text: #356c4a;
  --section-alt: rgba(235, 228, 216, 0.72);
  --warm-border: #d3c7b6;
  --theme-toggle-bg: rgba(255, 253, 248, 0.82);
  --theme-toggle-border: #d8cebd;
  --theme-toggle-track: #ebe4d8;
  --theme-toggle-thumb: #fffdf8;
  --theme-toggle-icon: #6f675b;
  --theme-toggle-hover: #eee8dd;
  --brand-shadow: rgba(54, 45, 32, 0.18);
}

.header-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-icon);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--gold);
  background: var(--theme-toggle-hover);
  color: var(--text);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.theme-toggle-symbol {
  display: grid;
  width: 14px;
  height: 16px;
  place-items: center;
  line-height: 1;
}

.theme-toggle-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.theme-toggle-track {
  display: inline-flex;
  width: 30px;
  height: 17px;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: var(--theme-toggle-track);
}

.theme-toggle-thumb {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--theme-toggle-thumb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  transform: translateX(0);
  transition: transform 180ms ease;
}

:root[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(13px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Legal pages keep their own layout but share the same theme tokens. */
.site-header {
  border-color: var(--header-border);
  background: var(--header-bg);
}

.header-inner {
  position: relative;
}

.legal-hero {
  background:
    linear-gradient(180deg, var(--gold-glow), transparent 70%),
    var(--bg);
}

.footer-grid {
  border-color: var(--border-soft) !important;
}

.footer-bottom {
  color: var(--dim) !important;
}

.brand {
  filter: drop-shadow(0 8px 18px var(--brand-shadow));
}

@media (max-width: 980px) {
  .header-controls {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .header-inner > .header-controls {
    position: absolute;
    top: 18px;
    right: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle-thumb {
    transition: none;
  }
}
