/* atlas-theme-contract:v1
   Shared verbatim with ovm/site/theme.css. Keep this module framework-free. */
:root,
:root[data-theme="white"] {
  color-scheme: light;
  --canvas: #ffffff;
  --surface: #f5f5f2;
  --surface-raised: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.94);
  --text: #1a1714;
  --text-strong: #2c2622;
  --text-muted: #6e6962;
  --text-faint: #77716a;
  --rule: #dfdfdc;
  --action: #a84f2b;
  --timezone-accent: #8c4fc4;
  --series-claude: #a84f2b;
  --series-claude-soft: #d98055;
  --series-codex: #2f6f6b;
  --series-codex-soft: #5aa39b;
  --hover-fill: rgba(26, 23, 20, 0.035);
  --tap-fill: rgba(26, 23, 20, 0.08);
  --shadow-color: rgba(26, 23, 20, 0.14);
  --chart-shade: rgba(223, 223, 220, 0.38);
  --terminal-bg: #1a1714;
  --terminal-surface: #26221e;
  --terminal-fg: #f4f0e8;
  --terminal-muted: #a8a298;
  --terminal-rule: #4f4740;
}

:root[data-theme="black"] {
  color-scheme: dark;
  --canvas: #11100e;
  --surface: #1a1714;
  --surface-raised: #201d18;
  --surface-overlay: rgba(32, 29, 24, 0.94);
  --text: #f4f0e8;
  --text-strong: #fffaf1;
  --text-muted: #b5ada0;
  --text-faint: #a8a298;
  --rule: #39342c;
  --action: #d98055;
  --timezone-accent: #c69aff;
  --series-claude: #e08b63;
  --series-claude-soft: #efad89;
  --series-codex: #70b8b0;
  --series-codex-soft: #94d2cb;
  --hover-fill: rgba(244, 240, 232, 0.055);
  --tap-fill: rgba(244, 240, 232, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.38);
  --chart-shade: rgba(57, 52, 44, 0.42);
}

:root[data-theme="paper"] {
  color-scheme: light;
  --canvas: #f3eee4;
  --surface: #ece5d7;
  --surface-raised: #faf5eb;
  --surface-overlay: rgba(243, 238, 228, 0.94);
  --text: #1a1714;
  --text-strong: #2c2622;
  --text-muted: #6e6962;
  --text-faint: #6f6a5f;
  --rule: #ddd6c8;
  --action: #a84f2b;
  --timezone-accent: #9b5fd9;
  --series-claude: #a84f2b;
  --series-claude-soft: #d98055;
  --series-codex: #2f6f6b;
  --series-codex-soft: #5aa39b;
  --hover-fill: rgba(26, 23, 20, 0.035);
  --tap-fill: rgba(26, 23, 20, 0.08);
  --shadow-color: rgba(26, 23, 20, 0.18);
  --chart-shade: rgba(221, 214, 200, 0.42);
}

:root {
  /* Compatibility aliases let each adapter migrate without duplicating the
     palette. New work should use the semantic names above. */
  --paper: var(--canvas);
  --paper-2: var(--surface);
  --ink: var(--text);
  --ink-2: var(--text-strong);
  --mut-1: var(--text-muted);
  --mut-2: var(--text-faint);
  --mut-3: var(--text-faint);
  --line: var(--rule);
  --accent: var(--action);
  --agent: var(--action);
  --human: var(--text);
  --teal: var(--series-codex);
  --timezone: var(--timezone-accent);
}

body,
.atlas-bar,
.atlas-mobile-menu {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.theme-cycle {
  appearance: none;
  background: var(--canvas);
  border: 1px solid var(--rule);
  cursor: pointer;
  flex: none;
  height: 26px;
  margin-left: 18px;
  order: 2;
  padding: 3px;
  position: relative;
  width: 26px;
}

.theme-cycle::before {
  background: var(--cycle-swatch);
  border: 1px solid var(--cycle-edge);
  content: "";
  display: block;
  height: 18px;
  width: 18px;
}

.theme-cycle::after {
  background: var(--action);
  bottom: 2px;
  content: "";
  height: 3px;
  position: absolute;
  right: 2px;
  width: 3px;
}

.theme-cycle[data-theme-current="white"] {
  --cycle-swatch: #ffffff;
  --cycle-edge: #d8d5cf;
}
.theme-cycle[data-theme-current="black"] {
  --cycle-swatch: #11100e;
  --cycle-edge: #f4f0e8;
}
.theme-cycle[data-theme-current="paper"] {
  --cycle-swatch: #f3eee4;
  --cycle-edge: #1a1714;
}
.theme-cycle:hover { border-color: var(--text-muted); }
.theme-cycle:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.atlas-bar nav { order: 1; }
.atlas-menu-btn,
.nav-burger { order: 3; }

@media (max-width: 820px) {
  .theme-cycle { margin-left: auto; }
  .atlas-menu-btn,
  .nav-burger { margin-left: 6px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .atlas-bar,
  .atlas-mobile-menu { transition: none; }
}
