/* Hunniford Chalmers — editorial skin.
   Off-white page, ink type, hairline rules, one cobalt accent. Serif for display, grotesk for UI. */

@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/Archivo-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --bg-2: #ffffff;
  --ink: #101010;
  --ink-2: #3a3a38;
  --muted: #6f6f6a;
  --rule: #d6d6d1;
  --rule-strong: #101010;
  --accent: #2337ff;
  --accent-ink: #ffffff;
  --good: #1b8f4e;
  --bad: #d7263d;
  --tile: #e9e9e5;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0f; --bg-2: #171716; --ink: #f2f2ee; --ink-2: #c9c9c3; --muted: #8f8f89;
    --rule: #2b2b29; --rule-strong: #f2f2ee; --accent: #7c8aff; --accent-ink: #0f0f0f;
    --good: #4fc37f; --bad: #ff5c6c; --tile: #222220;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f; --bg-2: #171716; --ink: #f2f2ee; --ink-2: #c9c9c3; --muted: #8f8f89;
  --rule: #2b2b29; --rule-strong: #f2f2ee; --accent: #7c8aff; --accent-ink: #0f0f0f;
  --good: #4fc37f; --bad: #ff5c6c; --tile: #222220;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.45; min-height: 100dvh;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Masthead */
.masthead {
  max-width: 760px; margin: 0 auto; padding: 18px var(--gutter) 14px;
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule-strong);
}
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; text-decoration: none; }
.nav { display: flex; gap: 18px; }
.navlink { background: none; border: 0; padding: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); cursor: pointer; }
.navlink:hover { color: var(--accent); }

#app { max-width: 760px; margin: 0 auto; padding-block: 28px 64px; padding-inline: var(--gutter); }
.screen { animation: rise .28s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Type */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.title {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.025em; line-height: 0.9;
  font-size: clamp(60px, 15vw, 128px); margin: 0 0 22px; text-wrap: balance;
}
.title em { font-style: italic; color: var(--accent); }
.title.small-title { font-size: clamp(40px, 9vw, 64px); line-height: .95; margin-bottom: 14px; }
.lede { font-size: 20px; line-height: 1.4; color: var(--ink-2); max-width: 34ch; margin: 0 0 26px; text-wrap: pretty; }
.lede em { font-family: var(--serif); font-style: italic; font-size: 1.15em; color: var(--ink); }
.h3 { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; padding-top: 12px; border-top: 1px solid var(--rule-strong); }
.fine { font-size: 13px; color: var(--muted); }
.prose { font-size: 18px; line-height: 1.5; max-width: 60ch; }

/* Buttons */
.btn {
  background: transparent; color: var(--ink); border: 1px solid var(--rule-strong);
  border-radius: 999px; padding: 12px 22px; cursor: pointer; font-weight: 600; font-size: 15px; letter-spacing: .01em;
  transition: background .15s, color .15s, transform .08s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { padding: 16px 30px; font-size: 17px; }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }
.link.small { font-size: 13px; }
.home-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.home-actions .btn { flex: 1 1 150px; }

/* Facts strip (home) */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 22px; padding: 0; border-top: 1px solid var(--rule-strong); }
.facts div { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--rule); }
.facts div + div { padding-left: 12px; border-left: 1px solid var(--rule); }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-family: var(--serif); font-size: 22px; line-height: 1.1; }
@media (max-width: 460px) { .facts { grid-template-columns: 1fr 1fr; } .facts div:nth-child(3) { padding-left: 0; border-left: 0; } }

/* Level */
.level-layout { display: grid; gap: 18px; }
.status { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.ladder { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex: 1; }
.ladder li {
  flex: 1; height: 26px; display: grid; place-items: center; font-size: 11px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--rule); background: var(--bg-2); font-variant-numeric: tabular-nums;
}
.ladder li.done { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ladder li.now { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lives { display: flex; gap: 6px; flex: none; }
.lives span { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 1px solid var(--ink); transition: background .2s; }
.lives span.lost { background: transparent; }

.level-name { display: flex; align-items: baseline; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule-strong); }
.lv-num { font-family: var(--serif); font-size: 64px; line-height: .8; letter-spacing: -0.03em; }
.lv-label { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.anchors { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: start; }
.anchors.compact { margin: 6px 0 4px; }
.between { align-self: center; display: grid; place-items: center; }
.between span { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); }
.card { min-width: 0; }
.card .photo {
  display: block; width: 100%; aspect-ratio: 1; background: var(--tile); overflow: hidden; text-decoration: none;
  position: relative; border: 1px solid var(--rule);
}
.card .photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; filter: saturate(.9) contrast(1.05); }
.card .photo .initials { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--serif); font-size: 52px; color: var(--ink); }
.card .name { font-weight: 600; font-size: 16px; line-height: 1.2; margin-top: 10px; letter-spacing: -0.005em; }
.card .dob { font-family: var(--serif); font-size: 19px; margin-top: 2px; line-height: 1.1; }
.card .desc { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.3; }
.card.good .photo { border-color: var(--good); box-shadow: 0 0 0 3px var(--good); }
.card.bad .photo { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad); }
.card.boundary .photo { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }

.prompt { font-family: var(--serif); font-size: 24px; line-height: 1.2; margin: 6px 0 12px; text-wrap: pretty; }
.prompt strong { font-weight: 400; font-style: italic; color: var(--accent); }
.prompt .fine { font-family: var(--sans); font-size: 12px; display: block; margin-top: 6px; letter-spacing: .04em; text-transform: uppercase; }

.search { position: relative; }
#guess {
  width: 100%; font: inherit; font-size: 18px; padding: 14px 0; background: transparent; color: var(--ink);
  border: 0; border-bottom: 2px solid var(--rule-strong); outline: none; border-radius: 0;
}
#guess:focus { border-bottom-color: var(--accent); }
#guess::placeholder { color: var(--muted); }
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 0; padding: 0; list-style: none;
  background: var(--bg-2); border: 1px solid var(--rule-strong); box-shadow: 0 16px 40px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto;
}
.suggest li { padding: 11px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--rule); }
.suggest li:last-child { border-bottom: 0; }
.suggest li .d { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest li.active, .suggest li:hover { background: var(--ink); color: var(--bg); }
.suggest li.active .d, .suggest li:hover .d { color: var(--bg); opacity: .7; }
.suggest li.wd { border-left: 3px solid var(--accent); }
.suggest .tag { color: var(--accent); font-size: 12px; margin-left: 6px; font-weight: 600; }
.suggest li.active .tag, .suggest li:hover .tag { color: var(--bg); }
.note { min-height: 1.4em; color: var(--muted); font-size: 14px; margin: 10px 0 18px; }
.note.warn { color: var(--ink); }
.note .link { color: var(--accent); font-size: inherit; }

/* Flash */
.flash {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: end center; padding: 16px;
  background: rgba(16,16,16,.55); cursor: pointer; animation: rise .18s ease-out;
}
@media (min-width: 640px) { .flash { place-items: center; } }
.flash-inner { width: min(380px, 100%); }
.flash .card { background: var(--bg); padding: 16px; border: 1px solid var(--rule-strong); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.flash .card .photo { max-width: 200px; margin: 0 auto; }
.flash .card .name, .flash .card .dob, .flash .card .desc { text-align: center; }
.flash .verdict { font-family: var(--serif); font-size: 34px; line-height: 1; margin-top: 14px; text-align: center; letter-spacing: -0.02em; }
.flash .card.good .verdict { color: var(--good); }
.flash .card.bad .verdict { color: var(--bad); }
.flash .card.boundary .verdict { color: var(--accent); }
.flash .why { color: var(--muted); font-size: 14px; margin-top: 6px; text-align: center; }
.flash .tap { color: rgba(255,255,255,.75); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; text-align: center; margin-top: 12px; }

/* Over */
.answers { list-style: none; padding: 0; margin: 0 0 22px; border-top: 1px solid var(--rule); }
.answers li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.answers .thumb { width: 52px; height: 52px; overflow: hidden; flex: none; background: var(--tile); border: 1px solid var(--rule); text-decoration: none; display: block; }
.answers .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.answers .thumb .initials { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--serif); font-size: 20px; }
.answers .who { line-height: 1.25; font-weight: 600; }
.answers .who small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.share-preview { background: var(--bg-2); border: 1px solid var(--rule); padding: 12px 14px; white-space: pre-wrap; font-size: 14px; font-family: var(--mono); }

/* High scores — the ledger */
.arcade { border-top: 1px solid var(--rule-strong); padding: 16px 0 6px; margin: 0 0 22px; }
.arcade-head { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.arcade-blink { font-family: var(--serif); font-size: 28px; letter-spacing: -0.01em; margin: 6px 0 14px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.initials { display: flex; gap: 12px; align-items: center; }
#hs-initials {
  width: 4.6ch; font-family: var(--mono); font-size: 40px; font-weight: 700; letter-spacing: .25ch; text-align: center; text-transform: uppercase;
  padding: 4px 0 4px .25ch; background: transparent; border: 0; border-bottom: 3px solid var(--rule-strong); border-radius: 0; color: var(--ink); outline: none; caret-color: var(--accent);
}
#hs-initials:focus { border-bottom-color: var(--accent); }
#hs-initials::placeholder { color: var(--rule); }
.scores { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.scores th { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px 8px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.scores td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.scores td:first-child, .scores th:first-child { color: var(--muted); width: 3ch; }
.scores td.name { font-family: var(--mono); font-weight: 700; letter-spacing: .12em; }
.scores td.when { color: var(--muted); font-size: 13px; }
.scores tr.you td { background: color-mix(in srgb, var(--accent) 14%, transparent); animation: pulse 1.2s ease-in-out 3; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--accent) 40%, transparent); } }
.scores tr.first td.name { color: var(--accent); }
@media (max-width: 400px) { .scores th:last-child, .scores td:last-child { display: none; } }

.rules { padding-left: 18px; font-size: 17px; }
.rules li { margin-bottom: 10px; }

@media (max-width: 420px) {
  .card .desc { display: none; }
  .lv-num { font-size: 52px; }
  .btn.big { padding: 14px 20px; font-size: 16px; }
  .between span { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
