/* Explicit choice overrides the initial system preference set by theme.js. */
:root[data-theme="light"]:not(.auth-page) {
  color-scheme: light;
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-text: #17212f;
  --color-muted: #526176;
  --color-border: #cbd3de;
  --color-accent: #245bb0;
  --color-accent-contrast: #ffffff;
  --color-danger: #a52b26;
  --color-danger-bg: #ffebe9;
  --ash-bg-canvas: #f4f6f9;
  --ash-bg-sidebar: #e9edf4;
  --ash-bg-panel: #ffffff;
  --ash-bg-panel-raised: #edf1f7;
  --ash-border: #cbd3de;
  --ash-border-strong: #9ba9bd;
  --ash-text-primary: #17212f;
  --ash-text-muted: #526176;
  --ash-text-faint: #606d80;
  --ash-accent: #245bb0;
  --ash-accent-strong: #194889;
  --ash-accent-ink: #ffffff;
  --ash-ok: #20733d;
  --ash-attention: #805900;
  --ash-degraded: #a52b26;
  --ash-unknown: #526176;
}
:root[data-theme="light"] .admin-page,
:root[data-theme="light"].admin-page {
  --admin-panel: #ffffff;
  --admin-panel-raised: #edf1f7;
  --admin-focus: #245bb0;
  --admin-ok: #20733d;
  --admin-warn: #805900;
  --admin-block: #a52b26;
}
.theme-control {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--color-border); border-radius: 10px;
  background: var(--color-surface); color: var(--color-text);
  cursor: pointer;
}
.theme-control[hidden] { display: none; }
.theme-control:hover { border-color: var(--color-accent); }
.theme-control:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.theme-control svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.theme-control .theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-control .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-control .theme-icon-moon { display: block; }
:root[data-theme="light"] .ash-brand-wordmark { filter: invert(1); }
:root[data-theme="light"] .ash-brand-mark { filter: brightness(.45); }
:root[data-theme="light"] .brand-word img { filter: invert(1); }
.topbar-actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
:root[data-theme="light"] .topbar { background: var(--color-surface); }
:root[data-theme="light"] .board-hero { background: var(--color-surface); }
:root[data-theme="light"] .board-lede,
:root[data-theme="light"] .evidence-list blockquote { color: var(--color-muted); }
:root[data-theme="light"] .board-question,
:root[data-theme="light"] .edition-picker select,
:root[data-theme="light"] .board-editor-form input,
:root[data-theme="light"] .board-editor-form textarea { background: var(--color-surface); }
:root[data-theme="light"] .hypothesis-label,
:root[data-theme="light"] .fork-card > span,
:root[data-theme="light"] .fork-editor-card > span { color: #805900; }
:root[data-theme="light"] .ew-warning { background: #fff3d6; color: #674600; }
:root[data-theme="light"] .ew-workspace del { background: #ffebe9; color: #a52b26; }
:root[data-theme="light"] .ew-workspace ins { background: #e1f3e8; color: #20733d; }
@media (max-width: 600px) {
  .topbar { grid-template-columns: minmax(0, 1fr); }
  .topbar .brand { grid-column: 1; grid-row: 1; }
  .topbar .reader { display: none; }
  .topbar .topnav, .topbar .showcase-nav { grid-column: 1; grid-row: 2; }
  .topbar-actions { grid-column: 1; grid-row: 3; justify-content: flex-end; }
}
@media print { .theme-control { display: none; } }
