@media screen {
  :root { color-scheme: light; }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #131d29;
    --ink: #f0ede3;
    --gold: #dbb568;
    --line: #526172;
    --muted: #afbbc8;
    --accent: var(--ink);
    --bg: var(--paper);
    --text: var(--ink);
    --theme-secondary: #c0cbd6;
    --theme-surface: #202e3e;
    --theme-footer: #182433;
    --theme-focus: #e4bd75;
    --theme-error: #ffaaa1;
  }
  /* The system preference also works when JavaScript is unavailable. */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
      color-scheme: dark;
      --paper: #131d29;
      --ink: #f0ede3;
      --gold: #dbb568;
      --line: #526172;
      --muted: #afbbc8;
      --accent: var(--ink);
      --bg: var(--paper);
      --text: var(--ink);
      --theme-secondary: #c0cbd6;
      --theme-surface: #202e3e;
      --theme-footer: #182433;
      --theme-focus: #e4bd75;
      --theme-error: #ffaaa1;
    }
  }

  .lead-perex { color: var(--theme-secondary, #425064); }
  .opinion-column p { color: var(--theme-secondary, #495566); }
  .story-card > p, .gallery-copy > p { color: var(--theme-secondary, #4c5966); }
  .article-perex { color: var(--theme-secondary, #435164); }
  .column-heading > span { color: var(--theme-focus, #9a7028); }
  .portrait-initial { background: var(--theme-surface, #e0e3dd); }
  .glosa-box { background: var(--theme-surface, #ebe6d6); }
  .author-badge { background: var(--theme-surface, #e9e9df); }
  .site-footer { background: var(--theme-footer, #e9e7dc); }
  .footer-bottom { border-color: var(--theme-surface, #c1c4bd); }
  .edition-bar, .podcast-section { background: #192b41; color: #f6f3e9; }
  .solid-button, .photo-tag { color: #192b41; }
  .skip-link { color: var(--theme-footer, white); }

  .vp-dialog { background: var(--theme-surface, #fbfcf8); color: var(--theme-secondary, #183c3b); border-color: var(--theme-secondary, #b6c2c4); }
  .vp-dialog h2, .vp-close { color: var(--theme-secondary, #183c3b); }
  .vp-search-input { background: var(--theme-footer, white); color: var(--theme-secondary, #183c3b); border-color: var(--theme-secondary, #809a96); }
  .vp-result, .vp-demo-note { border-color: var(--theme-secondary, #cbd6cf); }
  .vp-result small, .vp-kicker { color: var(--theme-secondary, #526b66); }
  .vp-demo-note { color: var(--theme-secondary, #586d66); }
  .field-validation-error, .validation-summary-errors { color: var(--theme-error, #a32622); }
  .input-validation-error { border-color: var(--theme-error, #a32622) !important; }
  :where(input, textarea, select, summary):focus-visible {
    outline: 3px solid var(--theme-focus, #2278b6);
    outline-offset: 4px;
  }
  a:focus-visible, button:focus-visible {
    outline-color: var(--theme-focus, #a07324);
  }
}

.theme-control { padding-bottom: 24px; }
.theme-switch {
  display: inline-flex;
  gap: 1px;
  margin: 0;
  padding: 3.5px;
  border: 1px solid var(--theme-surface, #dfe5ed);
  border-radius: 999px;
  background: var(--theme-footer, #f1f4f8);
}
.theme-switch-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.theme-switch label { position: relative; cursor: pointer; }
.theme-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.theme-switch-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--theme-secondary, #626e7e);
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.theme-switch-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-switch label:hover .theme-switch-icon { color: var(--theme-focus, #945c09); }
.theme-switch input:checked + .theme-switch-icon {
  background: var(--theme-surface, #fff);
  color: var(--theme-focus, #945c09);
  box-shadow: 0 1px 2.5px #192b4112;
}
.theme-switch input:focus-visible + .theme-switch-icon {
  outline: 2px solid var(--theme-focus, #945c09);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch-icon { transition: none; }
}
@media (forced-colors: active) {
  .theme-switch input:checked + .theme-switch-icon { outline: 2px solid Highlight; }
}
