/* NBA Stat Cherry-Picker — paper / typewriter base, modern underlined claims */

:root {
  --paper: #ffffff;
  --ink: #141414;
  --muted: #7c7c7c;
  --rule: #141414;
  --dot: #cfcfcf;
  --accent: #b5392b;   /* cherry red — the one accent */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 680px; margin: 0 auto; padding: 72px 24px 96px; }

/* ---- masthead ---- */
.masthead { text-align: center; padding-bottom: 26px; }
.masthead h1 {
  margin: 0 0 12px;
  font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
}
.sub {
  margin: 0 auto; max-width: 50ch;
  font-size: 13px; font-style: italic; line-height: 1.7; color: var(--muted);
}

/* ---- ask form ---- */
.ask {
  margin: 44px auto 0;
  display: flex; align-items: stretch; justify-content: center;
  gap: 14px; flex-wrap: wrap;
}
.combo { position: relative; width: 320px; max-width: 100%; }
#player {
  width: 100%;
  border: none; border-bottom: 1.5px solid var(--ink);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 18px; text-align: center; padding: 8px 4px;
}
#player::placeholder { color: #b6b6b6; }
#player:focus { outline: none; }
#go {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  padding: 10px 18px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
#go:hover { background: var(--paper); color: var(--ink); }

/* clear (×) button inside the combo */
.clear-btn {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  background: none; border: none; padding: 4px 6px;
  font-size: 13px; line-height: 1; color: var(--muted);
  cursor: pointer; transition: color 0.12s ease;
}
.clear-btn:hover { color: var(--ink); }

/* ---- search suggestions ---- */
.suggestions {
  position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; right: 0;
  margin: 0; padding: 0; list-style: none;
  background: var(--paper); border: 1px solid var(--ink);
  max-height: 264px; overflow-y: auto; text-align: left;
}
.suggestions[hidden] { display: none; }
.suggestions li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 13px; font-size: 14px; cursor: pointer;
}
.suggestions li + li { border-top: 1px solid #ededed; }
.suggestions li.active { background: var(--ink); color: var(--paper); }
.s-jersey { color: var(--muted); font-size: 12px; white-space: nowrap; }
.suggestions li.active .s-jersey { color: #cfcfcf; }
.suggestions .s-empty { padding: 11px 13px; font-size: 13px; font-style: italic; color: var(--muted); cursor: default; }

/* ---- results region ---- */
.results { margin-top: 56px; min-height: 130px; text-align: center; }

/* loading */
.loader { padding: 14px 0; }
.loader-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--ink); margin-bottom: 16px;
}
.loader-line { font-size: 14px; font-style: italic; color: var(--muted); }
.ell::after { content: ""; animation: ell 1.25s steps(4, end) infinite; }
@keyframes ell { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.cursor { display: inline-block; margin-left: 2px; animation: blink 1s steps(1, end) infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ---- claim ---- */
.claim-block { padding: 8px 0; }

.jersey-tag { font-size: 12px; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 14px; }

.claim {
  margin: 0 auto; max-width: 32ch;
  font-size: clamp(20px, 3.3vw, 27px); line-height: 1.95; color: var(--ink);
  min-height: 2em;   /* reserve a line so the block doesn't jump as it types */
}

/* emphasis: bold for the rarity word; an underline under figures + the player name */
.b { font-weight: 700; }

/* Underlines: color is overridable per segment via --u-color (defaults to cherry red).
   Add a modifier class to recolor a single underline:
     .u-ink   -> black        .u-accent -> red (default)
     .u-muted -> grey
   e.g. give a segment cls "u u-ink" for a black underline. */
.u { border-bottom: 2px solid var(--u-color, var(--accent)); padding-bottom: 1px; }
.u-ink    { --u-color: var(--ink); }
.u-accent { --u-color: var(--accent); }
.u-muted  { --u-color: var(--muted); }

/* typewriter: the whole sentence is laid out up front (every char is its own box,
   so wrapping/centering are fixed from the start), imprinted invisibly, then inked
   in place one char at a time. Reveal only flips opacity -> never any reflow. */
.ch { opacity: 0; }
.ch.inked { opacity: 1; }

/* caret rides the most-recent char as an absolutely-positioned pseudo-element, so it
   adds no inline box and can never change line breaks or nudge text. */
.ch.caret { position: relative; }
.ch.caret::after {
  content: "";
  position: absolute; left: 100%; top: 0.1em;
  width: 0.45em; height: 0.8em;
  background: var(--ink); pointer-events: none;
  animation: blink 1s steps(1, end) infinite;
}

.c-no { font-size: 16px; font-style: italic; color: var(--muted); }

/* the rule + "also achieved by" list fade in after the claim finishes typing */
.after { opacity: 0; transition: opacity 0.55s ease; }
.after.show { opacity: 1; }

.rule-short { width: 56px; height: 1px; background: var(--ink); margin: 34px auto; }

/* who else did it */
.others { max-width: 360px; margin: 0 auto; }
.others-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--muted); margin-bottom: 16px;
}
.leader { display: flex; align-items: baseline; font-size: 15px; margin: 8px 0; text-align: left; }
.leader .name { white-space: nowrap; }
.leader .fill { flex: 1; border-bottom: 1px dotted var(--dot); margin: 0 8px; position: relative; top: -4px; }
.leader .count { white-space: nowrap; color: var(--muted); }
.unique-note { font-size: 15px; font-style: italic; color: var(--muted); }

/* footer */
.foot { margin-top: 80px; text-align: center; font-size: 11px; letter-spacing: 0.08em; color: #bdbdbd; }

.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 (prefers-reduced-motion: reduce) {
  .cursor, .ell::after { animation: none; }
  .after { transition: none; }
}