/*
 * The site's own pages — About, Privacy, 404 — dressed like the game: the
 * cream table, the moulded cards, Archivo Black and the green PLAY key
 * (src/hud/tokens.css is the source of every colour here). Plain HTML and one
 * stylesheet: everything a crawler reads stays text in the page.
 */

@font-face {
  font-family: "Archivo Black";
  src: url("fonts/archivo-black.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fee5bb;
  --bg-hi: #fff0cb;
  --grid: rgba(120, 88, 52, 0.07);
  --card: #fdf6e7;
  --card-stroke: #e2c88f;
  --card-inner: rgba(255, 255, 255, 0.7);
  --card-drop: rgba(120, 88, 52, 0.22);
  --ink: #5c4838;
  --ink-dim: #7f6b55;
  --rule: rgba(120, 88, 52, 0.18);
  --chip: rgba(120, 88, 52, 0.08);
  --accent: #9ad13f;
  --accent-hi: #b9e36a;
  --accent-ink: #2f6b12;
  --key-ink: #2b3d10;
  --key-drop: #6a9b28;
  --title-shadow: #9ad13f;
  --p0: #2ce1c9; --p1: #ff6f83; --p2: #fc993d; --p3: #fee257;
  --p4: #9ad13f; --p5: #4e8ee3; --p6: #a97fe8; --p7: #f56fd0;
  --font-display: "Archivo Black", "Archivo", system-ui, sans-serif;
  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/*
 * The violet table, when the player picked it in the game's Settings: the
 * game keeps that choice in localStorage ("ppong.ground", src/render/theme.ts)
 * and each page's head script mirrors it onto <html data-theme>. The values
 * are the violet ground's own (hudKitFor, hudInkFor, screenChromeFor and the
 * candy seat set). Not the OS dark mode: the game ignores that too, so a
 * visitor who never chose sees the cream table here as in the game.
 */
:root[data-theme="violet"] {
  color-scheme: dark;
  --bg: #13081a;
  --bg-hi: #2e1440;
  --grid: rgba(169, 89, 224, 0.09);
  --card: #15091e;
  --card-stroke: #3a2450;
  --card-inner: rgba(255, 255, 255, 0.14);
  --card-drop: rgba(0, 0, 0, 0.55);
  --ink: #f8f1ff;
  --ink-dim: #bb9ecb;
  --rule: rgba(255, 255, 255, 0.12);
  --chip: rgba(255, 255, 255, 0.07);
  --accent: #7be04b;
  --accent-hi: #a3ef7d;
  --accent-ink: #7be04b;
  --key-ink: #0b1a08;
  --key-drop: #4a8f26;
  --title-shadow: #7be04b;
  --p0: #2fd9d0; --p1: #ff5c6e; --p2: #ff8a3d; --p3: #ffc93c;
  --p4: #7be04b; --p5: #3e86ff; --p6: #8b5cf6; --p7: #f45cd4;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 17px/1.65 var(--font-ui);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 0%, var(--bg-hi), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 60rem, 48px 48px, 48px 48px;
  background-repeat: no-repeat, repeat, repeat;
}

a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--p5); outline-offset: 3px; border-radius: 6px; }

/* ---- Header ------------------------------------------------------------ */

.site-header {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}
.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--card-drop);
}
.wordmark {
  font: 400 1.6rem/1 var(--font-display);
  letter-spacing: 0.02em;
  text-shadow: 0 3px 0 var(--title-shadow);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.site-nav a:not(.key) {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-nav a:not(.key):hover { background: var(--chip); }
.site-nav a[aria-current="page"] { background: var(--chip); box-shadow: inset 0 0 0 2px var(--rule); }

/* ---- The PLAY key: the game's own primary button ----------------------- */

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.4rem;
  border-radius: 14px;
  background: linear-gradient(var(--accent-hi), var(--accent));
  color: var(--key-ink);
  font: 400 1rem/1 var(--font-display);
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 5px 0 var(--key-drop);
  transition: transform 0.08s, box-shadow 0.08s;
}
.key:hover { color: var(--key-ink); filter: brightness(1.04); }
.key:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 1px 0 var(--key-drop); }
.key-lg { min-height: 56px; padding: 0.8rem 2.2rem; font-size: 1.25rem; border-radius: 16px; }

/* ---- Page and cards ---------------------------------------------------- */

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.card {
  background: var(--card);
  border: 2px solid var(--card-stroke);
  border-radius: 22px;
  box-shadow: inset 0 2px 0 var(--card-inner), 0 4px 0 var(--card-drop), 0 18px 40px -12px var(--card-drop);
  padding: clamp(1.25rem, 5vw, 2.25rem);
}
.card + .card { margin-top: 1.5rem; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: 0.01em; }
h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}
/* Each heading wears a seat colour, the way every player's side does. */
h2::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 1.1rem;
  border-radius: 4px;
  background: var(--pip, var(--accent));
  box-shadow: 0 2px 0 var(--card-drop);
}
.card > h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; letter-spacing: 0.02em; }

p, ul { margin: 0.75rem 0; }
ul { padding-left: 1.25rem; }
li + li { margin-top: 0.35rem; }
li::marker { color: var(--ink-dim); }
strong { font-weight: 750; }

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lede { font-size: 1.1rem; }
.muted { color: var(--ink-dim); font-size: 0.92rem; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  border: 2px solid var(--card-stroke);
  border-radius: 6px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--card-stroke);
  font: 700 0.85em/1.4 var(--font-ui);
  text-align: center;
}

code { font-size: 0.9em; padding: 0.05em 0.35em; border-radius: 6px; background: var(--chip); }

/* ---- Hero -------------------------------------------------------------- */

.hero { text-align: center; }
/* The title card's own headline: the wordmark with its seat-colour drop. */
.hero h1 {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 0 var(--title-shadow);
}
.hero .tagline {
  margin: 0.5rem 0 0;
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-wrap: balance;
}
.hero .lede { max-width: 34rem; margin: 1rem auto 1.5rem; }

.shot {
  margin: 1.75rem 0 0;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 2px solid var(--card-stroke);
  box-shadow: 0 4px 0 var(--card-drop);
}
.shot figcaption { margin-top: 0.6rem; color: var(--ink-dim); font-size: 0.9rem; }

/* ---- Tiles: modes, power-ups, hazards ---------------------------------- */

.tiles {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
}
.tiles li {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: var(--chip);
  box-shadow: inset 0 0 0 2px var(--rule);
}
.tiles h3 { display: flex; align-items: center; gap: 0.55rem; }
.tiles p { margin: 0.35rem 0 0; font-size: 0.95rem; }

/* A token, like the ones that float over the felt. */
.token {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--pip, var(--accent));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 2px 0 var(--card-drop);
  color: #3a2a1c;
}
.token svg { width: 1.05rem; height: 1.05rem; }

/* ---- Q&A --------------------------------------------------------------- */

.qa h3 { margin-top: 1.25rem; }
.qa h3 + p { margin-top: 0.3rem; }

/* ---- Policy page ------------------------------------------------------- */

.policy h1 { font-size: clamp(1.7rem, 5vw, 2.2rem); }
.policy .updated { margin-top: 0.4rem; color: var(--ink-dim); font-size: 0.92rem; }
.policy h2:nth-of-type(8n + 1) { --pip: var(--p4); }
.policy h2:nth-of-type(8n + 2) { --pip: var(--p0); }
.policy h2:nth-of-type(8n + 3) { --pip: var(--p2); }
.policy h2:nth-of-type(8n + 4) { --pip: var(--p5); }
.policy h2:nth-of-type(8n + 5) { --pip: var(--p1); }
.policy h2:nth-of-type(8n + 6) { --pip: var(--p6); }
.policy h2:nth-of-type(8n + 7) { --pip: var(--p3); }
.policy h2:nth-of-type(8n + 8) { --pip: var(--p7); }

/* ---- Footer ------------------------------------------------------------ */

.site-footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin-bottom: 0.5rem; }
.site-footer p { margin: 0.25rem 0; }

/* ---- Small screens ----------------------------------------------------- */

@media (max-width: 480px) {
  body { font-size: 16px; }
  .site-header { flex-wrap: nowrap; }
  .wordmark { font-size: 1.35rem; }
  .brand img { width: 38px; height: 38px; }
  .site-nav a:not(.key) { padding: 0.4rem 0.55rem; font-size: 0.78rem; }
  .site-nav .key { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.9rem; }
}
/* Too narrow for the wordmark and the nav on one row: the icon alone is the
   home link (its alt text names it). */
@media (max-width: 400px) {
  .wordmark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .key { transition: none; }
}
