/*
 * THE SITE. It is the same machine as the game, seen from outside (DESIGN_ASK.md): the void, the
 * signal that lives, the gold that proves, sharp corners, and nothing on it drawn by hand. What
 * differs from the game's screens is the reading: a site is read by someone who has not played, so
 * its words are set to be read, large and in a face made for it, and the machine's own face
 * (monospace, the mark, the atoms) is kept for what the machine says.
 *
 * The colors are the machine's ramps, the same numbers the game computes its screens from
 * (src/components/ui/tokens.ts). Nothing here tells two things apart by color alone: a state has
 * a shape and a word (Pedro is colourblind).
 *
 * The textures and the figures are landing/brand/, written by scripts/build-brand.ts.
 */
:root {
  --void-0: #030303;
  --void-1: #050505;
  --void-2: #0a0a0a;
  --void-3: #111111;
  --void-4: #18181b;
  --rule: #27272a;
  --rule-strong: #3f3f46;
  --signal-0: #004323;
  --signal-1: #069855;
  --signal-2: #10c470;
  --signal-3: #20de81;
  --signal-4: #8cefc1;
  --proof-0: #4d4000;
  --proof-3: #ffd700;
  --proof-4: #ffef85;
  --loss-1: #7f1d1d;
  --loss-3: #ef4444;
  --loss-4: #fca5a5;
  --bright: #f2f2ee;
  --body: #d6d6cf;
  --dim: #9b9ba4;
  --ghost: #6b6b74;

  --read: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif;
  --show: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --page: 70rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--void-1);
  color: var(--body);
  font: 1.0625rem/1.6 var(--read);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* What an old screen leaves behind, over everything, and in nobody's way */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/brand/residue.png');
  pointer-events: none;
  z-index: 10;
}

/* The ground under the page: strata, plotted in atoms, four screen pixels to the atom */
.ground {
  position: absolute;
  inset: 0 0 auto 0;
  height: 720px;
  background: url('/brand/strata.png') repeat-x center top / 1024px 720px;
  image-rendering: pixelated;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26%, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26%, #000 58%, transparent 100%);
  z-index: 0;
}

a { color: var(--bright); text-decoration: underline; text-decoration-color: var(--ghost); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--signal-3); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--signal-3);
  outline-offset: 3px;
}

/* --- the top ------------------------------------------------------------------------------- */

.top {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand { display: block; line-height: 0; }
.brand img { display: block; }

.top-nav { display: flex; gap: clamp(1rem, 3vw, 2rem); }
.top-nav a {
  font: 0.8125rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--dim);
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
}
.top-nav a:hover { color: var(--bright); border-bottom-color: var(--signal-3); }

/* --- the first screen ---------------------------------------------------------------------- */

main { position: relative; z-index: 1; }

.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) var(--gutter) clamp(3rem, 7vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(19rem, 25rem);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font: 0.8125rem var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal-3);
}
/* One atom of signal before it */
.kicker::before { content: ''; width: 0.5rem; height: 0.5rem; background: var(--signal-3); flex: none; }

h1 {
  margin: 0;
  font: 700 clamp(2.5rem, 5.4vw, 4.25rem)/1.03 var(--show);
  letter-spacing: -0.028em;
  color: var(--bright);
  text-wrap: balance;
}
h1 .proof { color: var(--proof-3); display: block; }

.lede {
  margin: 1.5rem 0 0;
  max-width: 36rem;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--body);
}

.facts {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.facts li {
  font: 0.8125rem var(--mono);
  letter-spacing: 0.04em;
  color: var(--body);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--rule);
  background: rgba(5, 5, 5, 0.6);
}

/* --- panels -------------------------------------------------------------------------------- */

.card {
  position: relative;
  margin: 0;
  padding: 1.5rem;
  background: var(--void-2);
  border: 1px solid var(--rule);
}

/* A ledger's ruling, faint, under what is written on it */
.ruled {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(255, 255, 255, 0.03) 27px, rgba(255, 255, 255, 0.03) 28px);
}

/* The four brackets the machine marks its subject with, a little off the panel's corners */
.you::before {
  content: '';
  position: absolute;
  inset: -9px;
  pointer-events: none;
  --c: var(--signal-3);
  --w: 2px;
  --l: 16px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l) no-repeat;
}

.card h2 {
  margin: 0 0 0.75rem;
  font: 0.8125rem var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.card h3 { margin: 0 0 0.4rem; font: 600 1.125rem/1.3 var(--show); color: var(--bright); }
.card p { margin: 0.5rem 0 0; }

.said { min-height: 1.6em; margin: 0 0 0.75rem; color: var(--bright); }
.hint { color: var(--dim); font-size: 0.9375rem; line-height: 1.5; }
.card .hint { margin-top: 0.75rem; }
.center { text-align: center; }

/* --- a state's shape. Each is its own shape, so none is told from another by color ---------- */

.mark, .glyph { display: inline-block; flex: none; }
.mark { width: 0.62em; height: 0.62em; margin-right: 0.6em; }
.glyph { width: 1.5rem; height: 1.5rem; margin-bottom: 1rem; }

[data-mark='ok'] { background: var(--signal-3); }
[data-mark='note'] { background: var(--body); transform: rotate(45deg) scale(0.8); }
[data-mark='none'] { box-shadow: inset 0 0 0 2px var(--dim); }
.glyph[data-mark='none'] { box-shadow: inset 0 0 0 3px var(--dim); }
[data-mark='warn'] { background: var(--loss-3); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
[data-mark='busy'] {
  height: 0.2em;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--dim) 0 24%, transparent 24% 38%, var(--dim) 38% 62%, transparent 62% 76%, var(--dim) 76%);
}

/* --- what is pressed and what is written in -------------------------------------------------- */

button, .button {
  display: inline-block;
  font: 600 0.9375rem/1.2 var(--read);
  letter-spacing: 0.01em;
  color: var(--bright);
  background: transparent;
  border: 1px solid var(--rule-strong);
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
button:hover, .button:hover { border-color: var(--bright); }

.primary { color: #03170c; background: var(--signal-3); border-color: var(--signal-3); }
.primary:hover { background: var(--signal-4); border-color: var(--signal-4); }

.quiet { color: var(--dim); border-color: var(--rule); padding: 0.45rem 0.8rem; font-weight: 500; }
.quiet:hover { color: var(--bright); }

.danger { color: var(--loss-4); border-color: var(--loss-3); }
.danger:hover { background: var(--loss-1); border-color: var(--loss-4); color: var(--bright); }

button:disabled { color: var(--ghost); background: transparent; border-style: dashed; border-color: var(--rule-strong); cursor: progress; }

.play { display: block; text-align: center; font-size: 1.0625rem; padding: 0.95rem 1.1rem; }
#play-go { margin: 1rem 0 0.75rem; }

.choice { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.9rem 0 0; }

form { display: flex; flex-direction: column; gap: 0.7rem; }
.card form { margin-top: 1rem; }
form .hint { margin: -0.3rem 0 0; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9375rem; color: var(--body); }

input {
  font: 1rem var(--read);
  color: var(--bright);
  background: var(--void-1);
  border: 1px solid var(--rule-strong);
  padding: 0.6rem 0.7rem;
  width: 100%;
}
input:focus { border-color: var(--signal-3); outline: none; }
input:focus-visible { outline: 2px solid var(--signal-3); outline-offset: 2px; }

#clerk-mount { margin-top: 1rem; }

/* --- the bands below ------------------------------------------------------------------------- */

.band {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) 0;
}
.band > h2, .band > div > h2 {
  margin: 0;
  max-width: 44rem;
  font: 700 clamp(1.75rem, 3.4vw, 2.625rem)/1.12 var(--show);
  letter-spacing: -0.02em;
  color: var(--bright);
  text-wrap: balance;
}
.wide { max-width: 44rem; margin: 1.25rem 0 0; }

.three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.notes { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; color: var(--dim); font-size: 0.9375rem; }
.notes li { display: flex; align-items: baseline; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.split p { margin: 0 0 1rem; }

/* --- the cast -------------------------------------------------------------------------------- */

/* An atom stays an atom at any size */
.atoms { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

.cast {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}
.cast .card { padding: 1.25rem; }
.faces { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; min-height: 136px; }
.cast figcaption { margin-top: 1rem; color: var(--dim); font-size: 0.9375rem; line-height: 1.45; }
.cast figcaption b { display: block; margin-bottom: 0.2rem; font: 600 1.0625rem var(--show); color: var(--bright); }
.brackets-note { margin: 1rem 0 0; }

/* What walks out there, standing on the ground the first screen showed from above */
.wild {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(1rem, 4vw, 3rem);
  margin-top: 3rem;
  padding: 3.5rem 1rem 0.75rem;
  border-bottom: 2px solid var(--rule-strong);
}
.wild::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/brand/strata.png') repeat-x center 38% / 1024px 720px;
  image-rendering: pixelated;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 70%), linear-gradient(to right, transparent 0, #000 18%, #000 82%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent 0, #000 70%), linear-gradient(to right, transparent 0, #000 18%, #000 82%, transparent 100%);
  mask-composite: intersect;
  z-index: -1;
}
.wild + .hint { margin: 0.75rem 0 0; }

/* --- what the hub holds ---------------------------------------------------------------------- */

.marks { list-style: none; margin: 0; padding: 0; }
.marks li { display: flex; align-items: baseline; line-height: 28px; color: var(--bright); }
.held { margin-top: 1.75rem; max-width: 44rem; padding: 1rem 1.5rem; }

.loss { margin-top: 1.5rem; max-width: 30rem; border-color: var(--loss-1); }
.loss button { align-self: flex-start; }
.loss .said { margin: 0; min-height: 0; }

/* --- the developers' page (/dev/): the same machine, read as a ledger ------------------------- */

.dev-main { position: relative; z-index: 1; }
.dev h1 { font-size: clamp(1.75rem, 3.4vw, 2.625rem); line-height: 1.12; }
.dev .band:first-child { padding-top: clamp(2rem, 5vw, 3.5rem); }
.dev code, .dev-table, .dev-pre, .dev-list button, .link { font-family: var(--mono); }
.dev code { font-size: 0.875em; color: var(--bright); overflow-wrap: anywhere; }
#who-key { margin-top: 1rem; max-width: 44rem; }
#key-text { font-size: 1rem; padding: 0.1rem 0.35rem; border: 1px solid var(--rule-strong); }

.dev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-top: 1.75rem; }
.dev-counts { margin-top: 1rem; }
.dev-marks li { align-items: flex-start; line-height: 1.5; padding: 0.3rem 0; border-bottom: 1px solid var(--rule); }
.dev-marks li:last-child { border-bottom: 0; }
.dev-marks .mark { margin-top: 0.45em; }
.dev-marks .hint { font-size: 0.875rem; }
.dev-sub { margin: 1.75rem 0 0.6rem; font: 0.8125rem var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }

.dev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dev-list.dev-column { flex-direction: column; gap: 0.35rem; color: var(--dim); font-size: 0.875rem; }
.dev-list button { font-size: 0.8125rem; font-weight: 400; padding: 0.4rem 0.65rem; }

.dev-scroll { overflow-x: auto; max-width: 100%; }
.dev-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.dev-table th, .dev-table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.dev-table th { color: var(--dim); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.dev-table td { color: var(--body); }

/* An id that opens its row: underlined like a link, so it is told by shape and not by color */
.link { background: none; border: 0; padding: 0; color: var(--bright); font-size: inherit; font-weight: 400; text-align: left; text-decoration: underline; text-decoration-color: var(--ghost); text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; }
.link:hover { text-decoration-color: var(--signal-3); }

.dev-pre { margin: 0; min-height: 4rem; max-height: 40rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem; background: var(--void-0); border: 1px solid var(--rule); color: var(--bright); font-size: 0.8125rem; line-height: 1.5; }
.dev-pre:empty { display: none; }
.dev-find { max-width: 30rem; margin-top: 1.5rem; }
.dev-find button { align-self: flex-start; }
#find-out { margin-top: 1rem; }

/* --- the foot -------------------------------------------------------------------------------- */

.foot {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: clamp(4rem, 9vw, 7rem) auto 0;
  padding: 1.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--dim);
}
.foot .said { margin: 0; font: 0.8125rem var(--mono); color: var(--dim); overflow-wrap: anywhere; }

/* --- narrower screens ------------------------------------------------------------------------ */

@media (max-width: 60rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero .card { max-width: 30rem; }
  .cast { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
}

@media (max-width: 40rem) {
  .top-nav { display: none; }
  .three { grid-template-columns: minmax(0, 1fr); }
  .cast { grid-template-columns: minmax(0, 1fr); }
  .faces { justify-content: flex-start; gap: 1.5rem; }
}
