/* Shared appearance controls. Light remains the default regardless of OS theme. */
:root {
  color-scheme: light;
  --surface: #ffffff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1a18;
  --surface: #22211e;
  --ink: #f0ede6;
  --ink-2: #c5c0b6;
  --ink-3: #a9a398;
  --ink-muted: #c5c0b6;
  --rule: #3c3933;
  --rule-strong: #625d53;
  --red: #ee8174;
  --red-dim: rgba(238, 129, 116, 0.1);
}
.nav-inner { gap: 20px; }
.nav-logo { flex-shrink: 0; }
.nav-links, .nav-back, .nav-home { margin-left: auto; }
.nav-links { gap: 24px; }
.theme-toggle {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font: 400 11px/1.4 var(--font);
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.theme-toggle-track {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 18px;
  border: 1px solid var(--ink-3);
  border-radius: 10px;
  background: var(--surface);
}
.theme-toggle-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: transform 160ms ease-out;
}
.theme-toggle[aria-checked="true"] .theme-toggle-track { border-color: var(--red); }
.theme-toggle[aria-checked="true"] .theme-toggle-track::before {
  background: var(--red);
  transform: translateX(12px);
}
/* Inverse surfaces retain their role rather than turning white in dark mode. */
:root[data-theme="dark"] #contact,
:root[data-theme="dark"] .site-footer { background: #151412; }
:root[data-theme="dark"] .contact-link { --cta-color: #151412; }
:root[data-theme="dark"] .contact-link:hover { background: #f49a8f; }
:root[data-theme="dark"] .nav-logo:hover,
:root[data-theme="dark"] .nav-back:hover,
:root[data-theme="dark"] .skip-link { color: var(--surface); }
@media (max-width: 1000px) {
  .nav-links { gap: 6px; }
}
@media (max-width: 700px) {
  .nav-inner { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
  .nav-links { order: 3; width: 100%; flex-wrap: wrap; gap: 6px 10px; margin-left: 0; }
  .nav-links a { padding: 0 6px; }
  .theme-toggle { margin-left: auto; }
  .nav-back, .nav-home { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle-track::before { transition: none; }
}
@media (forced-colors: active) {
  .theme-toggle-track::before { background: ButtonText; }
  .theme-toggle[aria-checked="true"] .theme-toggle-track::before { background: Highlight; }
}
