:root {
  color-scheme: light;
  --copy: #65665d;
  --photo-bg: #d5d2c9;
  --overlay: #e7e3dbed;
  --grid-line: #b9b8ae35;
  --guide-line: #c2412350;
  --accent-fill: #c24123;
  --accent-hover: #a6321a;
  --accent-ink: #fff3e5;
  --viewer-bg: #20221e;
  --menu-shadow: 0 12px 32px #292a2620;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b1f1b;
  --ink: #e9e4d8;
  --muted: #a3a79b;
  --line: #454b40;
  --soft: #30362c;
  --red: #e78b69;
  --copy: #b5b9ac;
  --photo-bg: #292e26;
  --overlay: #20251fed;
  --grid-line: #757e6435;
  --guide-line: #e78b6960;
  --accent-fill: #b74227;
  --accent-hover: #a2351d;
  --accent-ink: #fff3e5;
  --viewer-bg: #11140f;
  --menu-shadow: 0 12px 32px #0007;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #1b1f1b;
    --ink: #e9e4d8;
    --muted: #a3a79b;
    --line: #454b40;
    --soft: #30362c;
    --red: #e78b69;
    --copy: #b5b9ac;
    --photo-bg: #292e26;
    --overlay: #20251fed;
    --grid-line: #757e6435;
    --guide-line: #e78b6960;
    --accent-fill: #b74227;
    --accent-hover: #a2351d;
    --accent-ink: #fff3e5;
    --viewer-bg: #11140f;
    --menu-shadow: 0 12px 32px #0007;
  }
}

/* UI surfaces share a palette; photograph pixels are never recoloured. */
.hero-intro, .about-copy p { color: var(--copy); }
.hero-photo, .photo-visual, .curated-image, .list-mode .photo-open img { background: var(--photo-bg); }
.hero-photo-hint, .favorite-button { background: var(--overlay); }
.stage-grid {
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px), linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
}
.measure-x i, .measure-x::after { background: var(--guide-line); }
.primary-action, .specimen-tag, .favorite-button.saved, .outline-action.saved {
  background: var(--accent-fill);
  color: var(--accent-ink);
}
.outline-action.saved { border-color: var(--accent-fill); }
.primary-action:hover, .outline-action.saved:hover { background: var(--accent-hover); }
.year-index button:hover { background: var(--accent-fill); color: var(--accent-ink); }
.year-index button:hover span { color: var(--accent-ink); }
.viewer-image-panel { background: var(--viewer-bg); }
.photo-open:hover img { filter: none; }
input::placeholder { color: var(--muted); opacity: 1; }
::selection { background: var(--accent-fill); color: var(--accent-ink); }

.header-actions { display: flex; align-items: center; gap: 23px; flex: none; }
.theme-picker { position: relative; z-index: 30; }
.theme-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  font-size: 11px;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.theme-trigger::-webkit-details-marker { display: none; }
.theme-trigger::marker { content: ''; }
.theme-trigger .icon { width: 15px; height: 15px; }
.theme-trigger:hover, .theme-picker[open] > .theme-trigger { color: var(--red); border-color: var(--red); }
.theme-trigger:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.theme-caret { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); margin-left: 3px; margin-top: -3px; }
.theme-picker[open] .theme-caret { transform: rotate(225deg); margin-top: 3px; }
.theme-options {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 178px;
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--menu-shadow);
}
.theme-menu-title { display: block; color: var(--muted); font-size: 9px; letter-spacing: .12em; padding: 5px 10px 10px; }
.theme-choice { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 11px 10px; text-align: left; font-size: 11px; }
.theme-choice .icon { width: 16px; height: 16px; }
.theme-choice:hover { background: var(--soft); }
.theme-choice[aria-pressed="true"] { color: var(--red); background: var(--soft); }
.theme-choice .theme-check { margin-left: auto; opacity: 0; width: 14px; height: 14px; }
.theme-choice[aria-pressed="true"] .theme-check { opacity: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1150px) {
  .site-header { gap: 22px; }
  .main-nav { gap: 20px; }
  .header-actions { gap: 15px; }
  .header-source { padding-left: 18px; gap: 12px; }
}
@media (max-width: 760px) {
  .site-header { gap: 16px; }
  .main-nav { gap: 14px; }
  .main-nav span { display: none; }
  .theme-trigger { padding: 9px; font-size: 10px; }
}
@media (max-width: 620px) {
  .site-header { display: grid; grid-template-columns: 1fr auto; column-gap: 20px; row-gap: 13px; height: auto; padding: 24px 0 0; }
  .site-header .brand { grid-column: 1; grid-row: 1; }
  .header-actions { grid-column: 2; grid-row: 1; justify-self: end; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; border-top: 1px solid var(--line); gap: 16px; }
  .main-nav a, .main-nav button { padding: 13px 0; font-size: 11px; }
  .theme-trigger { min-height: 39px; padding: 9px 11px; }
  .theme-options { top: calc(100% + 8px); }
}
