/* ==========================================================================
   Quarry Sports Bar — "Matchday Print" design system
   Production stylesheet (Phase 1). Tokens per approved design system doc.
   ========================================================================== */

:root {
  /* Paper */
  --paper: #F3F3F3;
  --paper-high: #FFFFFF;
  --ink: #141414;
  --ink-muted: #4E4E4E;
  --rule: #141414;
  --rule-soft: #C9C9C9;
  /* Brand accent */
  --primary: #FFB300;
  --primary-hover: #FFC233;
  --primary-active: #E6A200;
  --primary-wash: #FFF3D6;
  /* Night (draw panel + footer only) */
  --night: #000000;
  --night-surface: #161616;
  --night-text: #F3F3F3;
  --night-muted: #ABABAB;
  --night-border: #2E2E2E;
  --night-focus: #FFD666;
  /* Semantic */
  --success: #1E7A47;
  --success-night: #58C98A;
  --error: #B3261E;
  --error-night: #FF7A76;
  --focus: #8A5B00;
  /* Type */
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: clamp(2.75rem, 7vw + 1rem, 5rem);
  --h1: clamp(2rem, 4vw + 0.75rem, 3rem);
  --h2: clamp(1.5rem, 2.5vw + 0.5rem, 2.125rem);
  --h3: clamp(1.185rem, 1vw + 0.9rem, 1.375rem);
  --body-lg: 1.125rem;
  --body: 1rem;
  --small: 0.875rem;
  --tracking-caps: 0.08em;
  --measure: 65ch;
  /* Space */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
  /* Layout */
  --container: 1100px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-gap: clamp(48px, 8vw, 96px);
  /* Shape */
  --r: 2px;
  --r-full: 999px;
  /* Motion */
  --t-fast: 120ms ease-out;
  --t-med: 240ms ease-out;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

/* ---------- Utilities ---------- */
.wrap { max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: var(--s-3) var(--s-4);
  font-weight: 600; border-radius: var(--r); transition: top var(--t-fast);
}
.skip-link:focus { top: var(--s-4); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.hl { background: var(--primary); color: var(--ink); font-weight: 600; padding: 0 4px; }
.marker { box-shadow: inset 0 -0.28em var(--primary); }
.muted { color: var(--ink-muted); }
.small { font-size: var(--small); }
.caps {
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  font-weight: 700; font-size: 0.8125rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
  position: relative; z-index: 50;
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); min-height: 72px;
}
.brand { display: inline-flex; align-items: center; }
.brand img { height: 40px; width: auto; }
.site-nav { display: flex; align-items: center; gap: var(--s-5); }
.site-nav a {
  text-decoration: none; font-weight: 600; padding: var(--s-2) 0;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule-soft); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--primary); }
.nav-toggle {
  display: none; background: none; border: 2px solid var(--ink);
  border-radius: var(--r); min-height: 44px; min-width: 44px;
  font: inherit; font-weight: 700; cursor: pointer; padding: 0 var(--s-3);
}
@media (max-width: 820px) {
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper); border-bottom: 2px solid var(--rule);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--s-4) var(--gutter) var(--s-6);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: var(--s-4) 0; border-bottom: 1px solid var(--rule-soft); font-size: var(--body-lg); }
  .site-nav .btn { margin-top: var(--s-4); }
  .nav-toggle { display: inline-flex; align-items: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 48px; padding: 0 var(--s-5);
  border: 2px solid var(--ink); border-radius: var(--r);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn-primary { background: var(--primary); color: var(--ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); transform: translateY(1px); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--paper); }
.btn-ghost {
  border: none; background: none; text-decoration: underline;
  text-underline-offset: 4px; font-weight: 600; padding: 0 var(--s-2);
}
.btn-ghost:hover { background: var(--primary); text-decoration: none; }
.btn-lg { min-height: 56px; font-size: var(--body-lg); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 560px) { .cta-group .btn { width: 100%; } }
.cta-group { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }

/* ---------- Sections (programme grammar) ---------- */
main { display: block; }
.section { padding-block: var(--section-gap); }
.section + .section { border-top: 2px solid var(--rule); }
.sec-label { margin-bottom: var(--s-3); }
.sec-label em { font-style: normal; background: var(--primary); padding: 1px 8px; margin-right: 8px; }
.section h2 { font-size: var(--h2); font-weight: 600; margin-bottom: var(--s-5); max-width: 24ch; line-height: 1.15; }
.section .lede { max-width: var(--measure); font-size: var(--body-lg); }
p + p { margin-top: var(--s-4); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--s-8) var(--section-gap); }
.hero .kicker { margin-bottom: var(--s-4); }
.hero .kicker span { background: var(--primary); padding: 2px 8px; }
.hero h1 {
  font-size: var(--h1); font-weight: 700; line-height: 1.1; max-width: 18ch;
}
.hero .money {
  font-size: var(--display); font-weight: 700; line-height: 1.05;
  margin-block: var(--s-3) var(--s-4);
}
.hero .sub { max-width: 52ch; font-size: var(--body-lg); margin-bottom: var(--s-6); }
.hero-media {
  margin-top: var(--s-7); border: 2px solid var(--ink); border-radius: var(--r);
  background: var(--paper-high); padding: var(--s-3);
}
.hero-media .ph {
  background: repeating-linear-gradient(45deg, #E7E7E7, #E7E7E7 12px, #EFEFEF 12px, #EFEFEF 24px);
  min-height: 240px; display: grid; place-items: center;
  color: var(--ink-muted); text-align: center; padding: var(--s-5);
}
.hero-media figcaption { padding-top: var(--s-3); }

/* ---------- Cards & panels ---------- */
.card {
  background: var(--paper-high); border: 1px solid var(--rule);
  border-radius: var(--r); padding: var(--s-5);
}
.extract { border-left: 6px solid var(--primary); }
.frame2 { border: 2px solid var(--ink); }

/* ---------- Steps ---------- */
.steps { list-style: none; counter-reset: step; display: grid; gap: var(--s-4); max-width: 640px; }
.steps li {
  counter-increment: step; display: grid; grid-template-columns: 48px 1fr;
  gap: var(--s-4); align-items: start;
  background: var(--paper-high); border: 1px solid var(--rule); border-radius: var(--r);
  padding: var(--s-4);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums;
  background: var(--primary); display: grid; place-items: center;
  min-height: 48px; border: 2px solid var(--ink); border-radius: var(--r);
}
.steps strong { display: block; margin-bottom: 2px; }

/* ---------- Two-up games ---------- */
.two-up { display: grid; gap: var(--s-4); }
@media (min-width: 768px) { .two-up { grid-template-columns: 1fr 1fr; } }
.game-panel h3 { font-size: var(--h3); font-weight: 600; margin-bottom: var(--s-3); }
.game-panel .prize { font-size: 1.5rem; font-weight: 700; }
.game-panel ul { list-style: none; margin-top: var(--s-3); }
.game-panel li { padding: var(--s-2) 0; border-top: 1px solid var(--rule-soft); }
.game-panel li:first-child { border-top: none; }

/* ---------- Fixtures & picks ---------- */
.league-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--rule); padding-bottom: var(--s-2);
  margin: var(--s-6) 0 var(--s-3);
}
.fixture {
  background: var(--paper-high); border: 1px solid var(--rule); border-radius: var(--r);
  padding: var(--s-4); margin-top: var(--s-3);
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  align-items: center; justify-content: space-between;
}
.fixture .teams { font-weight: 600; }
.fixture .ko { color: var(--ink-muted); font-size: var(--small); }
.fixture.err { outline: 2px solid var(--error); }
.seg { display: flex; gap: 6px; }
.seg button {
  font: inherit; font-weight: 600; min-width: 56px; min-height: 44px;
  border-radius: var(--r); border: 1.5px solid var(--ink);
  background: var(--paper-high); color: var(--ink); cursor: pointer;
  transition: background var(--t-fast);
}
.seg button:hover { background: var(--paper); }
.seg button[aria-checked="true"] { background: var(--primary); }
.fixture .result { font-weight: 700; }
.fixture .hit { color: var(--success); }
.fixture .miss { color: var(--error); }

/* ---------- Number picker ---------- */
.tray { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-block: var(--s-4); }
.tray .slot {
  width: 44px; height: 44px; border-radius: var(--r-full);
  border: 1.5px dashed var(--ink-muted); background: var(--paper-high);
  display: grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tray .slot.full { background: var(--primary); border: 1.5px solid var(--ink); }
.grid50 { display: grid; grid-template-columns: repeat(10, 1fr); gap: var(--s-2); max-width: 620px; }
@media (max-width: 620px) { .grid50 { grid-template-columns: repeat(5, 1fr); } }
.grid50 button {
  aspect-ratio: 1; min-width: 0; border-radius: var(--r-full);
  border: 1px solid var(--rule-soft); background: var(--paper-high); color: var(--ink);
  font: inherit; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer;
}
.grid50 button:hover { border-color: var(--ink); }
.grid50 button[aria-pressed="true"] {
  background: var(--primary); border: 1.5px solid var(--ink); font-weight: 700;
}

/* ---------- Forms ---------- */
.field { max-width: 440px; margin-top: var(--s-4); }
.field label { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: var(--s-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; font: inherit; color: var(--ink);
  background: var(--paper-high); border: 2px solid var(--ink); border-radius: var(--r);
  padding: 0 var(--s-4);
}
.field textarea { padding-block: var(--s-3); }
.field .help { color: var(--ink-muted); font-size: var(--small); margin-top: var(--s-2); }
.field.error input { border-color: var(--error); }
.field .msg { color: var(--error); font-weight: 500; font-size: var(--small); margin-top: var(--s-2); }
.code-input { font-size: 1.5rem; letter-spacing: 0.2em; text-align: center; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.check { display: flex; gap: var(--s-3); align-items: start; margin-top: var(--s-4); max-width: 440px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--ink); }

/* ---------- Status bar (Play) ---------- */
.status-bar { background: var(--paper-high); border-bottom: 2px solid var(--rule); }
.status-bar .in {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5);
  align-items: center; justify-content: space-between; padding-block: var(--s-3);
}
.status-bar .state em { font-style: normal; background: var(--primary); padding: 1px 8px; margin-right: 8px; }
.status-bar .clock { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Progress rail ---------- */
.progress-rail {
  position: sticky; bottom: 0; z-index: 40;
  background: var(--ink); color: var(--paper);
  padding: var(--s-3) var(--gutter);
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
}
.progress-rail .btn { border-color: var(--paper); }

/* ---------- Leaderboard ---------- */
.scoreboard { background: var(--paper-high); border: 2px solid var(--ink); border-radius: var(--r); padding: var(--s-5); }
.scoreboard h3 { font-size: var(--h3); font-weight: 600; display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); padding: 2px 8px;
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em;
}
.live-badge .dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .live-badge .dot { animation: pulse 1.6s infinite; }
  @keyframes pulse { 50% { opacity: 0.35; } }
}
.lrow {
  display: grid; grid-template-columns: 2.5rem 1fr auto; gap: var(--s-3);
  padding: var(--s-3); border-top: 1px solid var(--rule-soft);
  font-variant-numeric: tabular-nums; align-items: center;
}
.lrow:first-of-type { border-top: none; }
.lrow .rank { color: var(--ink-muted); font-weight: 600; }
.lrow .pts { font-weight: 700; }
.lrow.you { background: var(--primary-wash); }
.lrow .tag {
  display: inline-block; background: var(--ink); color: var(--primary);
  font-size: 0.6875rem; font-weight: 700; border-radius: var(--r);
  padding: 1px 6px; margin-left: 8px; letter-spacing: 0.04em;
}
.lrow.winner { border-left: 6px solid var(--primary); }

/* ---------- Night panel (draw) ---------- */
.night-panel {
  background: var(--night); color: var(--night-text);
  border-radius: var(--r); padding: var(--s-6);
}
.night-panel h3 { font-size: var(--h3); font-weight: 600; margin-bottom: var(--s-4); }
.night-panel .muted { color: var(--night-muted); }
.night-panel :focus-visible { outline-color: var(--night-focus); }
.balls { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.ball {
  width: clamp(52px, 10vw, 72px); height: clamp(52px, 10vw, 72px);
  border-radius: var(--r-full); background: var(--primary); color: var(--night);
  display: grid; place-items: center;
  font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------- Slip ---------- */
.slip {
  border: 2px dashed var(--ink); border-radius: var(--r);
  padding: var(--s-5); max-width: 460px; position: relative;
  background: var(--paper-high);
}
.slip .stamp {
  position: absolute; top: var(--s-4); right: var(--s-4);
  border: 2px solid var(--success); color: var(--success);
  font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.1em;
  padding: 2px 8px; border-radius: var(--r); transform: rotate(6deg);
}
.slip .ref { font-size: 2rem; font-weight: 700; letter-spacing: 0.15em; font-variant-numeric: tabular-nums; margin-block: var(--s-3); }

/* ---------- Badges & stats ---------- */
.badge {
  display: inline-block; font-size: 0.8125rem; font-weight: 700;
  letter-spacing: 0.05em; border-radius: var(--r); padding: 4px 10px;
  border: 1.5px solid var(--ink);
}
.badge.win { background: var(--primary); }
.badge.closed { border-color: var(--ink-muted); color: var(--ink-muted); }
.stat .n { font-size: var(--h1); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; display: inline-block; }
.stat .l { color: var(--ink-muted); margin-top: 6px; }
.stat-grid { display: flex; gap: var(--s-7); flex-wrap: wrap; }

/* ---------- Winners archive ---------- */
.week-entry { border-top: 2px solid var(--rule); padding-block: var(--s-6); }
.week-entry:first-of-type { border-top: none; }
.week-entry header { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: space-between; align-items: baseline; margin-bottom: var(--s-4); }
.winner-line { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }
.winner-photo {
  width: 96px; aspect-ratio: 4 / 5; border: 2px solid var(--ink); border-radius: var(--r);
  background: repeating-linear-gradient(45deg, #E7E7E7, #E7E7E7 8px, #EFEFEF 8px, #EFEFEF 16px);
  display: grid; place-items: center; color: var(--ink-muted); font-size: 0.75rem; text-align: center; padding: var(--s-2);
}
.numbers-line { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-3); }
.numbers-line .n7 {
  width: 40px; height: 40px; border-radius: var(--r-full); border: 1.5px solid var(--ink);
  display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--paper-high);
}

/* ---------- FAQ ---------- */
.faq-item { border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper-high); margin-top: var(--s-3); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: var(--s-4);
  font-weight: 600; display: flex; justify-content: space-between; gap: var(--s-3); align-items: center;
  min-height: 48px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.4rem; font-weight: 500; }
.faq-item[open] summary::after { content: "–"; }
.faq-item .a { padding: 0 var(--s-4) var(--s-4); max-width: var(--measure); }

/* ---------- Rules typography ---------- */
.prose { max-width: var(--measure); }
.prose h3 { font-size: var(--h3); font-weight: 600; margin: var(--s-6) 0 var(--s-3); }
.prose ul, .prose ol { margin: var(--s-3) 0 0 1.25rem; }
.prose li { margin-top: var(--s-2); }
.prose table { width: 100%; border-collapse: collapse; margin-top: var(--s-4); }
.prose th, .prose td { text-align: left; border: 1px solid var(--rule); padding: var(--s-3); }
.prose th { background: var(--paper-high); font-weight: 600; }
.anchor-pills { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-block: var(--s-5); }
.anchor-pills a {
  text-decoration: none; font-weight: 600; font-size: var(--small);
  border: 1.5px solid var(--ink); border-radius: var(--r); padding: 6px 12px;
  background: var(--paper-high);
}
.anchor-pills a:hover { background: var(--primary); }

/* ---------- Visit ---------- */
.timeline { list-style: none; max-width: 560px; }
.timeline li {
  display: grid; grid-template-columns: 88px 1fr; gap: var(--s-4);
  padding: var(--s-3) 0; border-top: 1px solid var(--rule-soft);
}
.timeline li:first-child { border-top: none; }
.timeline .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.map-frame { border: 2px solid var(--ink); border-radius: var(--r); background: var(--paper-high); padding: var(--s-3); }
.map-frame .ph { min-height: 220px; background: repeating-linear-gradient(45deg, #E7E7E7, #E7E7E7 12px, #EFEFEF 12px, #EFEFEF 24px); display: grid; place-items: center; color: var(--ink-muted); text-align: center; padding: var(--s-4); }

/* ---------- Notices ---------- */
.notice {
  border: 2px solid var(--ink); border-left: 8px solid var(--primary);
  background: var(--paper-high); border-radius: var(--r);
  padding: var(--s-4) var(--s-5); max-width: 720px;
}
.demo-banner {
  background: var(--ink); color: var(--paper); text-align: center;
  padding: var(--s-2) var(--s-4); font-size: var(--small); font-weight: 600;
  letter-spacing: 0.04em;
}
.demo-banner .hl { padding: 0 6px; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--section-gap);
  background: var(--night); color: var(--night-muted);
  padding: var(--s-8) 0 var(--s-6); font-size: var(--small);
}
.site-footer .cols {
  display: grid; gap: var(--s-6); align-items: start;
}
@media (min-width: 768px) { .site-footer .cols { grid-template-columns: auto 1fr 1fr 1fr; } }
.site-footer img { height: 88px; width: auto; }
.site-footer h4 { color: var(--night-text); font-size: var(--body); font-weight: 600; margin-bottom: var(--s-3); }
.site-footer a { color: var(--night-text); text-underline-offset: 3px; }
.site-footer a:hover { color: var(--primary); }
.site-footer ul { list-style: none; }
.site-footer li { margin-top: var(--s-2); }
.site-footer .legal {
  border-top: 1px solid var(--night-border); margin-top: var(--s-6); padding-top: var(--s-5);
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); justify-content: space-between;
}
