/* site.css — LAST WORDS, play route. "A dying-but-readable archive."
   Decisions: docs/superpowers/plans/2026-08-07-m6-play-ui-decisions.md
   Tokens below are the ONLY colors/fonts in the game: no neon, no #000/#fff,
   no generic-AI cyan-on-dark. Erosion is the only motion dialect. */

/* ---------- tokens ---------- */
:root {
  /* paper & ink, warm-tinted (never pure) */
  --paper:        oklch(0.935 0.014 85);     /* bone */
  --parchment:    oklch(0.90 0.016 82);
  --ink:          oklch(0.20 0.018 65);      /* warm umber-black */
  --ink-soft:     oklch(0.30 0.018 64);
  --ink-faint:    oklch(0.38 0.014 70);      /* still-legible body of eroded text */
  --umber:        oklch(0.24 0.02 58);
  /* single live accent (Eaters + final gate only) */
  --ember:        oklch(0.60 0.17 35);       /* ash/ember vermillion */
  --ember-soft:   oklch(0.66 0.13 38);
  /* state tints share the palette */
  --gold:         oklch(0.72 0.10 78);       /* gold-tier chips (ink-on-parchment world) */
  --void-chip:    oklch(0.74 0.012 85);      /* consumed chip: same paper, emptied ink */

  /* type */
  --disp: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 5rem;
  --line: 0.25px solid color-mix(in oklch, var(--ink) 38%, transparent);

  color-scheme: light; /* parchment world */
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--disp);
  font-size: 18px; /* body = smaller optical size of the display serif */
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 500; letter-spacing: 0.02em; margin: 0 0 var(--space-2); }

/* paper texture: very subtle grain, not glass, not glow */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.5;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(0,0,0,0.028) 0, transparent 42%),
    radial-gradient(circle at 82% 86%, rgba(255,255,255,0.35) 0, transparent 38%);
  mix-blend-mode: multiply;
}

/* ---------- three-layer anatomy ---------- */
#app { flex: 1; display: flex; flex-direction: column; z-index: 2; }

.lw-header {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-2);
  border-bottom: var(--line);
}
.lw-chapter { font-size: clamp(0.95rem, 2vw, 1.3rem); letter-spacing: 0.08em; }
.lw-night, .lw-tide { font-size: 0.85rem; color: var(--ink-soft); }
.lw-tide em { color: var(--ember); font-style: normal; font-weight: 600; }
.lw-seed { font-family: var(--mono); font-size: 0.65rem; color: var(--ink-faint); }

.lw-world {
  flex: 1;
  display: grid; place-items: center;
  padding: var(--space-3) var(--space-4);
  min-height: 220px;
}
.lw-board { max-width: min(620px, 88vw); width: 100%; touch-action: none; }

.lw-scriptorium {
  display: grid; gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: var(--line);
}
.lw-hand { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.lw-hint { font-size: 0.8rem; color: var(--ink-faint); text-align: center; letter-spacing: 0.04em; }
.lw-verb-legend {
  font-size: 0.78rem; color: var(--ink-soft); text-align: center;
  letter-spacing: 0.03em; margin: 0 0 var(--space-1);
}
.lw-chip-tip {
  display: block; font-size: 0.62rem; color: var(--ink-faint);
  letter-spacing: 0.02em; margin-top: 0.25rem; line-height: 1.2;
}

/* ---------- just-in-time popover help (persona: help where the task happens) ---------- */
.lw-popover {
  position: fixed; z-index: 10000;
  max-width: 300px;
  padding: 0.7rem 0.9rem;
  background: var(--parchment);
  border: 1px solid var(--ink);
  border-radius: 2px;
  box-shadow: 0 4px 18px rgba(36, 30, 24, 0.18);
  font-size: 0.82rem; line-height: 1.45; color: var(--ink);
  pointer-events: none; /* never blocks the game */
  animation: breathe-in 160ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.lw-popover-title {
  display: block; font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink); margin-bottom: 0.2rem;
}
.lw-popover-body { color: var(--ink-soft); }
.lw-popover .lw-popover-kbd {
  font-family: var(--mono); font-size: 0.72em;
  border: 1px solid var(--ink-faint); border-radius: 2px;
  padding: 0 0.25em; margin: 0 0.1em;
}
@media (prefers-reduced-motion: reduce) {
  .lw-popover { animation: none; }
}

/* ---------- hand chips: living word, fading, glyph, void ---------- */
.chip {
  width: min(7.5rem, 22vw);
  min-height: 6.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-1);
  border: 1px solid var(--ink);
  border-radius: 0.1rem;           /* book-carton radius, not UI pill */
  background: var(--parchment);
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: transform 180ms ease-out-quart, filter 180ms ease;
}
.chip:hover, .chip:focus-visible { transform: translateY(-3px); outline: none; }
.chip[aria-selected="true"] {
  border-width: 2px; border-color: var(--ink);
  transform: translateY(-4px);
}
.chip .word {
  font-size: 1.15rem; letter-spacing: 0.14em; font-weight: 600;
  word-break: break-all; line-height: 1.1;
}
.chip .letters { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-soft); }
.chip .tier { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: transparent; border: 1px solid var(--ink-soft); }
.chip.tier-1 .tier { background: transparent; }
.chip.tier-2 .tier { background: color-mix(in oklch, var(--gold) 60%, var(--paper)); }
.chip.tier-3 .tier { background: var(--gold); border-color: var(--gold); }

/* THE rot: labels decay letter-by-letter via .letters value; glyph mode = only glyph, ink drained to faint; void = emptied parchment slot */
.chip.glyph { color: var(--ink-faint); font-size: 1.5rem; letter-spacing: 0; }
.chip.glyph .word { font-size: 1.5rem; letter-spacing: 0; }
.chip.void {
  background: var(--void-chip); border-style: dashed; border-color: var(--ink-faint);
  color: var(--ink-faint);
}
.chip.void::after { content: "—"; font-size: 0.9rem; }
.chip.dead { opacity: 0.55; }

/* ---------- verbs ---------- */
.lw-verbs { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }
button.lw-verb {
  font-family: var(--disp); font-size: 0.95rem; letter-spacing: 0.1em;
  padding: 0.55rem 1.1rem;
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 0.1rem;
  cursor: pointer;
  transition: transform 180ms ease-out-quart, background 180ms ease;
}
button.lw-verb:hover:not(:disabled), button.lw-verb:focus-visible {
  transform: translateY(-2px); outline: none;
}
button.lw-verb:disabled { opacity: 0.35; cursor: default; }
button.lw-verb[data-hotkey]::after {
  content: " (" attr(data-hotkey) ")"; font-family: var(--mono); font-size: 0.6em;
  color: var(--ink-faint);
}

/* ---------- title & wall (typographic, no cards, no gradient) ---------- */
.lw-title-screen {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  align-items: flex-start; gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  max-width: 34em;
}
.lw-title-kicker { letter-spacing: 0.34em; font-size: 0.75rem; color: var(--ink-soft); }
.lw-title { font-size: clamp(2.6rem, 9vw, 5.2rem); line-height: 0.95; letter-spacing: 0.06em; margin: 0; }
.lw-one-liner { color: var(--ink-soft); max-width: 30em; font-size: clamp(1rem, 2.2vw, 1.2rem); }
.lw-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.lw-wall {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  max-width: 40em;
}
.lw-wall .lw-wall-words { columns: 3; gap: 0 1.5rem; font-size: 0.9rem; color: var(--ink-faint); max-height: 42vh; overflow: hidden; }
.lw-wall-final {
  font-size: clamp(1.6rem, 5vw, 3rem); letter-spacing: 0.08em;
  margin-top: var(--space-4); color: var(--ink);
}

/* erosion motion language: reveal slow, vanish instantly */
@keyframes breathe-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.lw-title-screen, .lw-wall { animation: breathe-in 900ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > * { animation: breathe-in 900ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > *:nth-child(2) { animation-delay: 120ms; }
.stagger > *:nth-child(3) { animation-delay: 240ms; }
.stagger > *:nth-child(4) { animation-delay: 360ms; }

@media (prefers-reduced-motion: reduce) {
  .lw-title-screen, .lw-wall, .stagger > *, .chip, button.lw-verb { animation: none; transition: none; transform: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .lw-header { flex-direction: column; align-items: flex-start; gap: var(--space-1); padding: var(--space-2); }
  .lw-world, .lw-scriptorium { padding: var(--space-2); }
  .lw-wall .lw-wall-words { columns: 1; }
}
