:root,
[data-theme="light"] {
  --ink: #1a140a;
  --muted: rgba(26, 20, 10, 0.62);
  --line: rgba(26, 20, 10, 0.12);
  --accent: #b8862e;
  --accent-ink: #1a140a;
  --deep: #f4efe6;
  --panel: rgba(255, 252, 247, 0.9);
  --panel-solid: #fffcf7;
  --focus: #b8862e;
  --danger: #b5523c;
  --glow-gold: rgba(212, 164, 90, 0.2);
  --glow-green: rgba(74, 120, 102, 0.1);
  --ghost-border: rgba(26, 20, 10, 0.28);
  --input-bg: #ffffff;
  --cover-bg: #e8e2d6;
  --success-bg: rgba(74, 120, 102, 0.12);
  --success-border: rgba(74, 120, 102, 0.32);
  --check-border: rgba(26, 20, 10, 0.35);
  --accent-ring: rgba(184, 134, 46, 0.18);
  --logo-filter: invert(1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f4efe6;
    --muted: rgba(244, 239, 230, 0.68);
    --line: rgba(244, 239, 230, 0.14);
    --accent: #d4a45a;
    --accent-ink: #1a140a;
    --deep: #0c1411;
    --panel: rgba(18, 32, 27, 0.72);
    --panel-solid: rgba(16, 28, 24, 0.94);
    --focus: #e8c27a;
    --danger: #e8a090;
    --glow-gold: rgba(212, 164, 90, 0.16);
    --glow-green: rgba(74, 120, 102, 0.22);
    --ghost-border: rgba(244, 239, 230, 0.35);
    --input-bg: rgba(8, 14, 12, 0.55);
    --cover-bg: #0a100e;
    --success-bg: rgba(90, 140, 120, 0.2);
    --success-border: rgba(126, 183, 160, 0.35);
    --check-border: rgba(244, 239, 230, 0.45);
    --accent-ring: rgba(212, 164, 90, 0.15);
    --logo-filter: none;
    color-scheme: dark;
  }
}

[data-theme="dark"] {
  --ink: #f4efe6;
  --muted: rgba(244, 239, 230, 0.68);
  --line: rgba(244, 239, 230, 0.14);
  --accent: #d4a45a;
  --accent-ink: #1a140a;
  --deep: #0c1411;
  --panel: rgba(18, 32, 27, 0.72);
  --panel-solid: rgba(16, 28, 24, 0.94);
  --focus: #e8c27a;
  --danger: #e8a090;
  --glow-gold: rgba(212, 164, 90, 0.16);
  --glow-green: rgba(74, 120, 102, 0.22);
  --ghost-border: rgba(244, 239, 230, 0.35);
  --input-bg: rgba(8, 14, 12, 0.55);
  --cover-bg: #0a100e;
  --success-bg: rgba(90, 140, 120, 0.2);
  --success-border: rgba(126, 183, 160, 0.35);
  --check-border: rgba(244, 239, 230, 0.45);
  --accent-ring: rgba(212, 164, 90, 0.15);
  --logo-filter: none;
  color-scheme: dark;
}

html {
  background: var(--deep);
}

html,
body {
  transition: background-color 0.28s var(--ease, ease), color 0.28s var(--ease, ease);
}

@media (prefers-reduced-motion: reduce) {
  html,
  body {
    transition: none;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.78;
  flex-shrink: 0;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  opacity: 1;
}

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

.theme-toggle__icon {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
}

[data-theme="light"] .theme-toggle__icon--moon,
[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

.theme-toggle--float {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 6;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  opacity: 1;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

[data-theme="light"] .nav-logo img,
[data-theme="light"] .footer-brand img,
[data-theme="light"] .err404-logo,
[data-theme="light"] .thnx-logo {
  filter: var(--logo-filter);
}

/* Photo heroes stay light-on-dark regardless of page theme */
.hero,
.hero .site-nav,
.hero .nav {
  --ink: #f4efe6;
  --muted: rgba(244, 239, 230, 0.72);
  --line: rgba(244, 239, 230, 0.14);
  --ghost-border: rgba(244, 239, 230, 0.35);
  --input-bg: rgba(8, 14, 12, 0.55);
  --check-border: rgba(244, 239, 230, 0.45);
  --accent-ring: rgba(226, 179, 106, 0.15);
  --logo-filter: none;
  color: var(--ink);
}

.hero .nav-logo img,
.hero .hero-brand img {
  filter: none;
}

.hero .theme-toggle {
  color: rgba(244, 239, 230, 0.78);
}

.hero .theme-toggle:hover,
.hero .theme-toggle:focus-visible {
  color: #f4efe6;
}

.err404-card,
.thnx-card {
  background: var(--panel-solid);
  border-color: var(--line);
}

.thnx-close {
  color: var(--muted);
  border-color: var(--line);
}

.thnx-close:hover {
  color: var(--ink);
}
