/* Spitefall — one stylesheet, no build step.
 *
 * The colours are the game's own, copied out of data/tuning/palette.json, and
 * tools/check_site.py fails the deploy if they drift apart. The site and the game should look
 * like one thing; matching them by eye is how they stop matching six months later.
 *
 * The layout rule that matters: the header is the tightest thing on any page. A wordmark plus
 * four links is around 500px that cannot break, which is wider than a phone, so below 680px it
 * becomes two rows. Test at 375px and check scrollWidth, not appearance.
 */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap");

:root {
  --ink: #16102E;
  --field: #8A83C0;
  --accent: #57F2DE;
  --hazard: #FF5A44;
  --player: #FFC93F;
  --exit: #8CEA6B;
  --text: #F5F0E4;

  --dim: #B9B2D6;
  --rule: rgba(245, 240, 228, 0.16);
  --panel: rgba(245, 240, 228, 0.04);

  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.75rem;
  --s4: 3rem;
  --s5: 5rem;
  --wide: 1080px;

  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--s3);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }

h1, h2, h3, nav, .label, .btn { font-family: var(--sans); }
h1 { font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1.05; margin: 0 0 var(--s2); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.15; margin: 0 0 var(--s2); }
h3 { font-size: 1.1rem; margin: 0 0 var(--s1); }

p { margin: 0 0 var(--s2); max-width: 68ch; }

.label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 var(--s1);
}

/* --- header --- */

header {
  border-bottom: 1px solid var(--rule);
  padding: var(--s2) 0;
}
.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}
.mark {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
nav { display: flex; gap: var(--s3); flex-wrap: wrap; }
nav a { color: var(--dim); text-decoration: none; font-size: 0.95rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }

@media (max-width: 680px) {
  .bar { flex-direction: column; align-items: flex-start; gap: var(--s1); }
  nav { gap: var(--s2); }
}

/* --- sections --- */

section { padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: 0; }

.hero { padding-top: var(--s5); }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: var(--text); max-width: 58ch; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s3);
}

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: var(--s3);
}
.card p:last-child { margin-bottom: 0; }

/* The four colours the game teaches. Used here so the site says the same thing the screen
 * does, and so anyone reading /tells can check them against a screenshot. */
.swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.4em;
  vertical-align: -0.05em;
  border: 1px solid var(--ink);
}
.sw-hazard { background: var(--hazard); }
.sw-tell { background: var(--accent); }
.sw-player { background: var(--player); }
.sw-exit { background: var(--exit); }

table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
th, td { text-align: left; padding: var(--s1) var(--s2) var(--s1) 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); font-weight: 500; }

.wide-scroll { overflow-x: auto; }

figure { margin: 0 0 var(--s3); }
figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  /* Pixel art scaled up by the browser has to stay pixels. Smoothing a 32 px tile at three
     times its size is exactly the grey smear the game spends its whole art pipeline avoiding,
     and it would be the first thing anyone sees. */
  image-rendering: pixelated;
}
figcaption { color: var(--dim); font-size: 0.92rem; margin-top: var(--s1); max-width: 68ch; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--panel);
  padding: 0.1em 0.35em;
  border: 1px solid var(--rule);
}

.note {
  border-left: 2px solid var(--accent);
  padding-left: var(--s2);
  color: var(--dim);
}

ul { max-width: 68ch; padding-left: 1.2em; }
li { margin-bottom: var(--s1); }

footer {
  border-top: 1px solid var(--rule);
  padding: var(--s3) 0 var(--s4);
  color: var(--dim);
  font-size: 0.92rem;
}
footer nav { gap: var(--s2); }

/* --- reveal, opt-in only ---
 *
 * Content is visible by default. reveal.js adds .reveal-on to <html> and only then does
 * anything hide, so a page with the script blocked, throttled or simply slow is a readable
 * page rather than a blank one.
 */
.reveal-on section { opacity: 0; transform: translateY(10px); transition: opacity 520ms ease, transform 520ms ease; }
.reveal-on section.shown { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal-on section { opacity: 1; transform: none; transition: none; }
}
