/* World Cup 2026 — landing styles.
   Editorial / data-story vibe. Single accent, generous whitespace, readable column.
   Palette lives here in :root; the chart colours in make-landing.py (PALETTE) mirror these. */

:root {
  --paper:      #f6f3ec;   /* warm off-white background */
  --paper-2:    #fffdf8;   /* cards / raised surfaces   */
  --ink:        #1b1b22;   /* main text                 */
  --muted:      #6c6c78;   /* captions, secondary       */
  --line:       #e3ddd1;   /* hairlines, borders        */
  --accent:     #e0533a;   /* primary accent (warm red) */
  --accent-ink: #b23b26;   /* accent text on paper      */
  --accent-soft:#f4cabf;   /* light accent fill         */
  --cool:       #3a6f6a;   /* secondary / "below avg"   */

  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  --col: 42rem;            /* reading column width */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(16px, 1rem + 0.2vw, 18px);
  line-height: 1.65;
}

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 4vw, 1.5rem) 5rem;
}

/* --- Hero ------------------------------------------------------------ */
.hero { margin: clamp(1rem, 6vw, 4rem) 0 2.5rem; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.4rem + 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.hero .subtitle {
  font-size: clamp(1.05rem, 1rem + 0.6vw, 1.3rem);
  color: var(--muted);
  margin: 0;
  max-width: 34rem;
}

/* --- Text blocks ----------------------------------------------------- */
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  line-height: 1.15;
  margin: 3.2rem 0 0.4rem;
  padding-top: 1.4rem;
  border-top: 2px solid var(--ink);
}
h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.4rem;
  letter-spacing: 0.01em;
}
p { margin: 0 0 1.1rem; }

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

.note {
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  padding: 0.8rem 1rem;
  margin: 1.4rem 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* --- Figures / charts ------------------------------------------------ */
figure.chart {
  margin: 1.8rem 0 2.6rem;
}
figure.chart .chart-title {
  font-weight: 650;
  font-size: 1.05rem;
  margin: 0 0 0.15rem;
}
figure.chart .caption {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

/* Wide figures (figure.bleed): on desktop the scrolling table sizes to its content
   and breaks out of the reading column, centred on screen. Title/caption stay in the
   column. On narrow screens nothing changes — the table scrolls inside the column. */
@media (min-width: 48rem) {
  figure.bleed .heatmap-scroll {
    width: max-content;
    max-width: 94vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* --- Leaderboard (superlatives) ------------------------------------- */
.leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.8rem;
}
.record {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.record .metric { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.record .value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--accent-ink);
  margin: 0.2rem 0;
}
.record .who { font-size: 0.95rem; }
.record .who .tie { color: var(--muted); }

.record.wide { grid-column: 1 / -1; }
.record .namelist {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 1.2rem;
}
.record .namelist li { break-inside: avoid; margin: 0 0 0.25rem; font-size: 0.95rem; }
.who-meta { color: var(--muted); font-size: 0.82rem; }

/* signature-letter cards (affinity) */
.leaderboard.sigs { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.record.sig { text-align: center; }
.record.sig .value { font-size: 2.6rem; }
.record.sig .who { font-size: 0.88rem; }

/* --- Stats table ----------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.stats {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
table.stats th, table.stats td {
  padding: 0.35rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
table.stats th:first-child, table.stats td:first-child { text-align: left; font-weight: 600; }
table.stats thead th { color: var(--muted); font-weight: 600; }

/* --- Heatmap (affinity letters) ------------------------------------- */
.heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0.4rem 0; }
table.heatmap {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
table.heatmap th {
  font-weight: 600;
  color: var(--muted);
  padding: 2px 4px;
  text-align: center;
}
table.heatmap th.team { text-align: right; position: sticky; left: 0; background: var(--paper); }
table.heatmap td {
  width: 1.1rem; height: 1.1rem;
  text-align: center;
  color: #00000088;
}

/* diaspora matrix: nations (rows) x club countries (columns) */
table.matrix th { vertical-align: bottom; line-height: 1.1; }
table.matrix th .cflag { font-size: 0.85rem; }
table.matrix th.other { color: var(--muted); font-style: italic; }
table.matrix td { width: 1.3rem; height: 1.3rem; }
table.matrix td.local { outline: 2px solid var(--ink); outline-offset: -2px; }

/* --- Footer ---------------------------------------------------------- */
.page-footer {
  margin-top: 4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Narrow screens -------------------------------------------------- */
@media (max-width: 640px) {
  h2 { margin-top: 2.4rem; }
  .record .value { font-size: 1.9rem; }
}
