/* ==========================================================================
   All 22 Football — design system
   Single source of truth for colour, spacing, type and elevation.
   Components never hardcode a colour; they reference a token below.
   ========================================================================== */

/* ---- 1. Colour tokens ---------------------------------------------------- */
:root {
  /* Neutrals: stadium slate (dark surfaces) */
  --ink-900: #1c1c1e;
  --ink-850: #212124;
  --ink-800: #26262a;
  --ink-700: #2f2f35;
  --ink-600: #3b3b43;
  --ink-500: #55555f;

  /* Neutrals: playbook paper (light surfaces + text) */
  --paper-50: #f6f2ea;
  --paper-100: #ece5d8;
  --paper-200: #ddd3c1;
  --paper-300: #c4b8a1;
  --paper-400: #9c8f78;

  /* Accent: coral (primary action) */
  --coral-300: #f6a79b;
  --coral-400: #ef8372;
  --coral-500: #e85d4e;
  --coral-550: #db5a49;
  --coral-600: #c94535;

  --coral-700: #9e3226;

  /* Support hues */
  --field-500: #3e9e6b;
  --field-700: #256b47;
  --gold-500: #e7b44a;
  --sky-500: #5aa2e8;
  --plum-500: #a97ad6;

  /* Semantic aliases — use these in components */
  --bg: var(--ink-900);
  --bg-elevated: var(--ink-850);
  --surface: var(--ink-800);
  --surface-2: var(--ink-700);
  --border: #34343c;
  --border-strong: #6d6d7a;

  --fg: var(--paper-50);
  --fg-muted: #bdb4a4;
  --fg-subtle: #9a9184;
  --fg-inverse: var(--ink-900);

  --accent: var(--coral-500);
  --accent-hover: var(--coral-400);
  --accent-press: var(--coral-550);
  --on-accent: var(--ink-900);

  --success: var(--field-500);
  --warning: var(--gold-500);
  --danger: var(--coral-500);

  --focus-ring: var(--sky-500);

  /* Typography */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* 8px spacing grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-9: 64px;
  --space-10: 80px;
  --space-11: 120px;

  /* Type colours — chip background plus the text colour that clears 4.5:1 on it */
  --type-normal: #9fa07a;    --type-on-normal: #1c1c1e;
  --type-fire: #f08030;      --type-on-fire: #1c1c1e;
  --type-water: #5f8ee8;     --type-on-water: #1c1c1e;
  --type-electric: #f7d02c;  --type-on-electric: #1c1c1e;
  --type-grass: #63bc5a;     --type-on-grass: #1c1c1e;
  --type-ice: #76d7c4;       --type-on-ice: #1c1c1e;
  --type-fighting: #c22e28;  --type-on-fighting: #f6f2ea;
  --type-poison: #a33ea1;    --type-on-poison: #f6f2ea;
  --type-ground: #e2bf65;    --type-on-ground: #1c1c1e;
  --type-flying: #a98ff3;    --type-on-flying: #1c1c1e;
  --type-psychic: #f95587;   --type-on-psychic: #1c1c1e;
  --type-bug: #a6b91a;       --type-on-bug: #1c1c1e;
  --type-rock: #b6a136;      --type-on-rock: #1c1c1e;
  --type-ghost: #735797;     --type-on-ghost: #f6f2ea;
  --type-dragon: #6f35fc;    --type-on-dragon: #f6f2ea;
  --type-dark: #705746;      --type-on-dark: #f6f2ea;
  --type-steel: #b7b7ce;     --type-on-steel: #1c1c1e;
  --type-fairy: #d685ad;     --type-on-fairy: #1c1c1e;

  /* Layout */
  --page-max: 1200px;
  --page-gutter: clamp(16px, 4vw, 32px);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow: 0 10px 30px -18px rgb(0 0 0 / 70%);
  --shadow-lg: 0 30px 60px -30px rgb(0 0 0 / 80%);

  --ring: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 55%, transparent);
  --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---- 2. Reset ------------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--coral-300); text-underline-offset: 3px; }
a:hover { color: var(--coral-400); }

:where(a, button, [tabindex], summary, input, select):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--coral-500); color: var(--on-accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius); font-weight: 600; text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: var(--space-4); }

/* ---- 3. Type scale ------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5.2vw, 3.75rem); }
h2 { font-size: clamp(1.65rem, 3.4vw, 2.5rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }
h4 { font-size: 1.0625rem; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); color: var(--fg-muted); }
p.lead { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); color: var(--fg-muted); max-width: 68ch; }
strong { color: var(--fg); font-weight: 600; }
small { font-size: 0.8125rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--coral-300);
  margin-bottom: var(--space-3);
}


/* ---- 4. Layout ----------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-gutter); }
.section { padding-block: clamp(48px, 7vw, 96px); }
.section--tight { padding-block: clamp(32px, 4vw, 56px); }

.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.center { text-align: center; margin-inline: auto; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: var(--space-8); }
.prose h3 { margin-top: var(--space-6); }
.prose ul, .prose ol { color: var(--fg-muted); padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }

/* ---- 5. Header / footer -------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--ink-900) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--fg); font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.brand__mark { width: 32px; height: 32px; flex: none; }
.brand__name { font-size: 1.0625rem; white-space: nowrap; }
.nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
.nav__link { color: var(--fg-muted); text-decoration: none; font-size: 0.9375rem; padding: var(--space-2) 0; }
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--fg); }
.nav__link[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

.nav-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-2) var(--space-3); cursor: pointer;
}
.nav-toggle__bars { display: block; width: 18px; height: 2px; background: var(--fg); box-shadow: 0 6px 0 var(--fg), 0 -6px 0 var(--fg); }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--page-gutter) var(--space-5);
  }
  .nav[data-open="true"] { display: flex; }
  .nav__link { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
}

.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-9) var(--space-7); margin-top: var(--space-11); }
.site-footer__grid { display: grid; gap: var(--space-7); grid-template-columns: minmax(220px, 1.4fr) repeat(auto-fit, minmax(150px, 1fr)); }
.site-footer h4 { font-family: var(--font-body); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-subtle); margin-bottom: var(--space-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: var(--space-2); }
.site-footer a { color: var(--fg-muted); text-decoration: none; font-size: 0.9375rem; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
.site-footer__legal { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; color: var(--fg-subtle); font-size: 0.8125rem; }

/* ---- 6. Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  border-radius: var(--radius); border: 1px solid transparent;
  padding: 12px 20px; font-family: var(--font-display); font-weight: 600; font-size: 0.9375rem;
  line-height: 1; text-decoration: none; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn--primary:active { background: var(--accent-press); }
.btn--secondary { background: transparent; border-color: var(--border-strong); color: var(--fg); }
.btn--secondary:hover { border-color: var(--fg-muted); background: var(--surface); color: var(--fg); }
.btn--lg { padding: 15px 26px; font-size: 1rem; }
.btn--sm { padding: 9px 14px; font-size: 0.875rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---- 7. Cards / panels --------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-5);
}
.card h3 { margin-bottom: var(--space-2); }
.card p:last-child { margin-bottom: 0; }
.card__meta { font-size: 0.8125rem; color: var(--fg-subtle); letter-spacing: 0.04em; text-transform: uppercase; }

.panel {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 32px);
}

.callout {
  border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0; padding: var(--space-4) var(--space-5);
}
.callout p:last-child { margin-bottom: 0; }

.stat-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); }
.stat__value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; color: var(--fg); letter-spacing: -0.02em; }
.stat__label { font-size: 0.8125rem; color: var(--fg-subtle); }

/* ---- 8. Tags / type chips ------------------------------------------------ */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  padding: 4px 10px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--fg-muted);
}
.type-chip {
  display: inline-flex; align-items: center;
  border-radius: var(--radius-pill); padding: 2px 9px;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--type-color, var(--ink-600)); color: var(--type-on, var(--fg));
}

/* ---- 9. Tables ----------------------------------------------------------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
caption { text-align: left; padding: var(--space-3) var(--space-4); color: var(--fg-subtle); font-size: 0.8125rem; }
th, td { text-align: left; padding: 10px var(--space-4); border-bottom: 1px solid var(--border); }
th { background: var(--surface); color: var(--fg); font-family: var(--font-display); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 10. Tool: roster board ---------------------------------------------- */
.tool { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.tool__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); background: var(--surface);
}
.tool__bar .spacer { margin-left: auto; }
.tool__body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 980px) { .tool__body { grid-template-columns: 1fr; } }

.field-grid {
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--field-500) 12%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--field-500) 12%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  padding: var(--space-5);
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 186px), 1fr));
}

.slot {
  position: relative; display: grid; grid-template-columns: 56px 1fr; gap: var(--space-3);
  align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3); cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.slot:hover { border-color: var(--border-strong); background: var(--surface-2); }
.slot[data-filled="true"] { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.slot[data-empty="true"] { border-style: dashed; }
.slot__art {
  width: 56px; height: 56px; border-radius: var(--radius); flex: none;
  background: var(--surface-2); display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--border);
}
.slot__art img { width: 52px; height: 52px; image-rendering: pixelated; }
.slot__art .fallback { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--fg-subtle); }
.slot__pos { font-family: var(--font-display); font-size: 0.6875rem; letter-spacing: 0.1em; color: var(--coral-300); text-transform: uppercase; }
.slot__name { font-weight: 600; font-size: 0.9375rem; line-height: 1.25; }
.slot__rating { font-size: 0.75rem; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }

.tool__side { border-left: 1px solid var(--border); padding: var(--space-5); background: var(--bg-elevated); }
@media (max-width: 980px) { .tool__side { border-left: 0; border-top: 1px solid var(--border); } }
.side-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.side-list li + li { margin-top: var(--space-2); }
.pool-item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-2) var(--space-3); cursor: pointer; text-align: left;
}
.pool-item:hover { border-color: var(--border-strong); }
.pool-item img { width: 40px; height: 40px; image-rendering: pixelated; }
.pool-item__name { font-size: 0.875rem; font-weight: 600; }
.pool-item__sub { font-size: 0.75rem; color: var(--fg-subtle); }

input[type="search"], select, input[type="text"] {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 9px 12px; color: var(--fg); width: 100%;
}
input[type="search"]::placeholder { color: var(--fg-subtle); }

.scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); text-align: center; }
.scoreboard__cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); }
.scoreboard__n { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.scoreboard__l { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle); }

.schedule { list-style: none; margin: 0; padding: 0; font-size: 0.875rem; max-height: 300px; overflow-y: auto; }
.schedule li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 8px var(--space-3); border-bottom: 1px solid var(--border); }
.schedule li[data-result="W"] .schedule__res { color: var(--success); }
.schedule li[data-result="L"] .schedule__res { color: var(--accent); }
.schedule__res { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- 11. Shared lineups (result showcase) -------------------------------- */
.lineup-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4); display: grid; gap: var(--space-3);
}
.lineup-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.lineup-card__name { font-family: var(--font-display); font-weight: 600; }
.lineup-card__record { font-variant-numeric: tabular-nums; color: var(--fg-muted); font-size: 0.875rem; }
.lineup-card__row { display: flex; flex-wrap: wrap; gap: 6px; }
.lineup-card__row img { width: 32px; height: 32px; image-rendering: pixelated; background: var(--surface-2); border-radius: var(--radius-sm); }

/* ---- 12. Comparison ------------------------------------------------------ */
.compare { display: grid; gap: 0; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.compare > div { padding: var(--space-4) var(--space-5); }
.compare > div:nth-child(odd) { background: var(--surface); border-right: 1px solid var(--border); }
.compare > div:nth-child(even) { background: var(--bg-elevated); }

/* ---- 13. FAQ ------------------------------------------------------------- */
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  cursor: pointer; padding: var(--space-4) 0; font-family: var(--font-display);
  font-weight: 600; font-size: 1.0625rem; color: var(--fg); list-style: none;
  display: flex; justify-content: space-between; gap: var(--space-4);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.25rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > p { margin: 0 0 var(--space-4); max-width: 76ch; }

/* ---- 14. Hero ------------------------------------------------------------ */
.hero { position: relative; overflow: hidden; padding-block: clamp(56px, 9vw, 120px) clamp(40px, 6vw, 80px); }
.hero::before {
  content: ""; position: absolute; inset: auto -20% 40% 50%; height: 520px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--coral-500) 22%, transparent), transparent 70%);
  filter: blur(10px); z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero__grid { display: grid; gap: clamp(32px, 5vw, 64px); grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 980px) { .hero__grid { grid-template-columns: 1fr; } }
.hero__actions { margin-top: var(--space-6); }
.hero__note { margin-top: var(--space-4); font-size: 0.875rem; color: var(--fg-subtle); }

.badge-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }

/* ---- 15. Motion / print -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
  .site-header, .site-footer, .tool__side, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}
