﻿/* Daily Dig â€” museum-catalogue look. No external fonts or CDNs. */

:root {
  --bg: #f3eee4;
  --paper: #fbf8f2;
  --ink: #2a251f;
  --ink-2: #5b5246;
  --ink-3: #6f665a;
  --rule: #d9cfbf;
  --accent: #8a4f24;
  --accent-ink: #ffffff;
  --accent-soft: #efe2d2;
  --hit: #2f6b3a;
  --hot: #8a6a00;
  --warm: #a1501a;
  --cool: #6c4a3a;
  --cold: #4a4642;
  --band-1: #e6dccb;
  --band-2: #d8c8b0;
  --band-3: #c6b091;
  --shadow: 0 1px 0 rgba(60, 40, 20, .06), 0 8px 24px -12px rgba(60, 40, 20, .25);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1815; --paper: #23201c; --ink: #eee6d8; --ink-2: #c9bfae; --ink-3: #a99f8f;
    --rule: #3b352d; --accent: #d9995a; --accent-ink: #1a1815; --accent-soft: #3a2c1f;
    --hit: #7fc28a; --hot: #e2c35a; --warm: #e59a62; --cool: #c9a594; --cold: #b9b3ab;
    --band-1: #3b352d; --band-2: #4a4136; --band-3: #5b4e3f;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1815; --paper: #23201c; --ink: #eee6d8; --ink-2: #c9bfae; --ink-3: #a99f8f;
  --rule: #3b352d; --accent: #d9995a; --accent-ink: #1a1815; --accent-soft: #3a2c1f;
  --hit: #7fc28a; --hot: #e2c35a; --warm: #e59a62; --cool: #c9a594; --cold: #b9b3ab;
  --band-1: #3b352d; --band-2: #4a4136; --band-3: #5b4e3f;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--serif);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- masthead ---------- */
.masthead {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 4px; padding: 8px 12px; max-width: 1080px; margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.brand-mark { display: inline-grid; gap: 2px; width: 18px; align-self: center; }
.brand-mark i { display: block; height: 3px; border-radius: 2px; background: var(--accent); }
.brand-mark i:nth-child(2) { opacity: .7; margin-left: 3px; }
.brand-mark i:nth-child(3) { opacity: .45; margin-right: 4px; }
.brand-name { font-size: 1.45rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; }
.brand-sub { font: 600 .7rem/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.masthead > .icon-btn { justify-self: start; }
.masthead-actions { display: flex; gap: 0; justify-self: end; }
@media (max-width: 420px) {
  .brand-name { font-size: 1.2rem; letter-spacing: .14em; }
  .brand-sub { display: none; }
  .brand-name { font-size: 1.1rem; letter-spacing: .12em; }
  .masthead { grid-template-columns: auto 1fr auto; }
  .brand { justify-content: flex-start; }
  .icon-btn { width: 40px; height: 44px; }
}
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }

.banner {
  max-width: 640px; margin: 10px auto 0; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-soft); font: .95rem/1.4 var(--sans); display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.banner button { font: 600 .9rem var(--sans); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer; }

/* ---------- layout ---------- */
main > * { min-width: 0; }
main.done .plate { display: none; }
main {
  max-width: 1080px; margin: 0 auto; padding: 16px;
  display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr);
}
main:focus { outline: none; }
@media (min-width: 900px) {
  main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; padding: 28px 24px; gap: 28px; }
  main.done { grid-template-columns: minmax(0, 720px); justify-content: center; }
}

.plate, .guess, .results {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 20px;
}
.kicker {
  margin: 0; font: 600 .72rem/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
}
.plate-title { margin: 4px 0 2px; font-size: 1.6rem; line-height: 1.15; font-weight: 500; }
.plate-date { margin: 0; color: var(--ink-3); font: .85rem var(--sans); }
.plate-head { padding-bottom: 12px; border-bottom: 1px double var(--rule); margin-bottom: 4px; }
.section-label {
  margin: 0 0 8px; font: 600 .72rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.section-label .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---------- clues ---------- */
.clues { list-style: none; margin: 0; padding: 0; }
.clue { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.clue:last-child { border-bottom: 0; }
.clue-num {
  font-size: 1.05rem; font-style: italic; color: var(--accent); text-align: center;
  border: 1px solid var(--rule); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center;
}
.clue h3 { margin: 0 0 2px; font: 600 .72rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.clue p { margin: 0; font-size: 1.12rem; line-height: 1.4; }
.clue.locked p { color: var(--ink-3); font-style: italic; font-size: .98rem; }
.clue.locked .clue-num { color: var(--ink-3); border-style: dashed; }
.clue.fresh { animation: reveal .5s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.clue-img {
  margin-top: 8px; background: var(--bg); border-radius: 6px;
  height: min(36vh, 320px); width: 100%; display: block; overflow: hidden;
}
.clue-img img { width: 100%; height: 100%; object-fit: contain; }
.dlg h2:focus { outline: none; }

/* ---------- guess ---------- */
.guess-readout { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.year-out { font-size: 2.1rem; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.century-out { color: var(--ink-3); font: .9rem var(--sans); }

.timeline { position: relative; padding: 10px 0 22px; }
.track {
  position: absolute; left: 0; right: 0; top: 10px; height: 36px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(90deg, var(--band-3) 0 30.3%, var(--band-2) 30.3% 60.6%, var(--band-1) 60.6% 80.8%, var(--band-2) 80.8% 100%);
}
.track::after { /* strata hatching */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 8px, rgba(0,0,0,.05) 8px 9px);
}
.window { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 35%, transparent); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); min-width: 4px; }
.mark { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--ink-2); }
.mark span { position: absolute; top: 2px; left: 3px; font: 700 .7rem var(--sans); color: var(--ink); }
.timeline input[type=range] {
  position: relative; width: 100%; height: 36px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.timeline input[type=range]::-webkit-slider-runnable-track { height: 36px; background: transparent; }
.timeline input[type=range]::-moz-range-track { height: 36px; background: transparent; }
.timeline input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 44px; margin-top: -4px; border-radius: 8px;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.timeline input[type=range]::-moz-range-thumb {
  width: 24px; height: 40px; border-radius: 8px; background: var(--paper); border: 2px solid var(--ink);
}
.ticks { position: relative; height: 16px; margin-top: 6px; font: .68rem var(--sans); color: var(--ink-3); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }
.ticks .t0 { left: 0; } .ticks .t1 { left: 30.3%; } .ticks .t2 { left: 60.6%; } .ticks .t3 { left: 80.8%; } .ticks .t4 { left: 100%; }

.nudges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 2px 0 14px; }
.nudges button, .chip {
  min-height: 44px; border: 1px solid var(--rule); background: var(--bg); border-radius: 8px; cursor: pointer;
  font: 600 .95rem var(--sans); font-variant-numeric: tabular-nums;
}
.nudges button:hover, .chip:hover { border-color: var(--ink-3); }
.ranges { border: 0; padding: 0; margin: 0 0 14px; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip { display: grid; gap: 0; padding: 6px 4px; line-height: 1.15; }
.chip small { font-weight: 400; font-size: .72rem; color: var(--ink-3); }
.chip[aria-checked="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-checked="true"] small { color: inherit; opacity: .8; }

.primary, .secondary {
  width: 100%; min-height: 50px; border-radius: 999px; cursor: pointer;
  font: 700 1rem var(--sans); letter-spacing: .04em;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.primary:hover { filter: brightness(1.06); }
.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

.history { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.history li {
  display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: start;
  padding: 10px 12px; border-radius: 8px; background: var(--bg); font: .92rem/1.35 var(--sans);
  border-left: 4px solid var(--band-color, var(--rule));
}
.history .sym { font-size: 1.3rem; line-height: 1; color: var(--band-color); text-align: center; }
.history b { font-weight: 700; }
.band-hit { --band-color: var(--hit); }
.band-hot { --band-color: var(--hot); }
.band-warm { --band-color: var(--warm); }
.band-cool { --band-color: var(--cool); }
.band-cold { --band-color: var(--cold); }

/* ---------- results ---------- */
.results:focus { outline: none; }
.results-heading { margin: 4px 0 4px; font-size: 1.75rem; font-weight: 500; line-height: 1.15; }
.score-line { font: .95rem var(--sans); color: var(--ink-2); margin-bottom: 14px; }
.score-line strong { font: 700 1.35rem var(--serif); color: var(--ink); }
.specimen { margin: 0 0 14px; }
.specimen img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 6px; }
.obj-title { margin: 12px 0 6px; font-size: 1.3rem; font-style: italic; line-height: 1.25; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font: .9rem/1.4 var(--sans); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.answer-scale { position: relative; height: 44px; margin: 6px 0 18px; }
.answer-scale .bar { position: absolute; left: 0; right: 0; top: 18px; height: 8px; border-radius: 4px; background: var(--band-2); }
.answer-scale .ans { position: absolute; top: 12px; height: 20px; min-width: 6px; background: var(--hit); border-radius: 3px; }
.answer-scale .g { position: absolute; top: 4px; transform: translateX(-50%); font: 700 .72rem var(--sans); color: var(--ink-2); }
.answer-scale .g::after { content: ""; display: block; width: 2px; height: 26px; margin: 1px auto 0; background: var(--ink-2); }
.answer-scale .lbl { position: absolute; bottom: -6px; font: .68rem var(--sans); color: var(--ink-3); }
.about { margin: 0 0 8px; font-size: 1.02rem; }
.credit { margin: 0 0 16px; font: .82rem/1.45 var(--sans); color: var(--ink-3); }
.credit a { color: var(--accent); }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-preview {
  margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 8px; border: 1px dashed var(--rule);
  font: .85rem/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; color: var(--ink-2);
}
.next { margin: 14px 0 0; text-align: center; font: .9rem var(--sans); color: var(--ink-3); }

.colophon a { color: var(--accent); }
.colophon p { margin: 0 0 4px; }
.colophon { max-width: 720px; margin: 8px auto 28px; padding: 0 16px; text-align: center; font: .75rem/1.5 var(--sans); color: var(--ink-3); }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--rule); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(20, 16, 12, .55); }
.dlg { padding: 6px 18px 18px; }
.dlg header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px double var(--rule); margin-bottom: 12px; }
.dlg h2 { margin: 0; font-weight: 500; font-size: 1.35rem; }
.close { font-size: 1.6rem; }
.howto { padding-left: 1.2em; margin: 0 0 12px; }
.howto li { margin-bottom: 6px; }
.legend { width: 100%; border-collapse: collapse; font: .9rem var(--sans); }
.legend caption { text-align: left; }
.legend td { padding: 4px 6px; border-top: 1px solid var(--rule); }
.legend .sym { color: var(--band-color); font-size: 1.15rem; width: 28px; text-align: center; }
.fine { font: .82rem/1.45 var(--sans); color: var(--ink-3); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { text-align: center; padding: 8px 4px; background: var(--bg); border-radius: 8px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font: .72rem var(--sans); color: var(--ink-3); }
.dist { display: grid; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; font: .85rem var(--sans); }
.dist-bar { background: var(--ink-3); color: var(--paper); padding: 2px 8px; border-radius: 4px; text-align: right; min-width: 28px; font-weight: 700; }
.dist-bar.cur { background: var(--accent); color: var(--accent-ink); }
.archive-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.archive-list li + li { border-top: 1px solid var(--rule); }
.archive-list button {
  width: 100%; display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 4px; background: none; border: 0; text-align: left; cursor: pointer; font: .95rem var(--sans);
}
.archive-list button:hover { background: var(--bg); }
.archive-list .no { font: italic 1rem var(--serif); color: var(--accent); }
.archive-list .st { font-size: .82rem; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font: 600 .9rem var(--sans);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* dev-only share card preview */
.card-preview { width: min(540px, 100%); max-width: 100%; margin: 0 auto; border-radius: 12px; box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
