/* ==========================================================================
   The Grand Tutor — "Game Night" design system
   Direction: vintage board-game revival. Everything on this site is built from
   the tokens in :root. Change a token here and it changes everywhere.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand palette.
     Two tiers on purpose: the bright brand tones (--cherry, --teal) are for
     artwork, borders and shadows, where contrast rules don't apply. Anything
     carrying text uses the -ink / -band tones, which all clear WCAG AA
     against the surface they sit on. */
  --cream:      #FFF6E3;  /* page ground */
  --cream-hi:   #FFFDF6;  /* raised surfaces: cards, inputs */
  --cherry:     #E0402A;  /* decorative: box shadows, illustration accent */
  --cherry-ink: #B22F1D;  /* text + button ground on cream — 5.9:1 */
  --cherry-deep:#8E2415;  /* button hover/pressed */
  --mustard:    #F2B33D;  /* accent, sunbursts, highlights */
  --teal:       #1F8A8C;  /* decorative: shadows, focus ring */
  --teal-band:  #125557;  /* ground under text — cream on it is 7.9:1 */
  --teal-ink:   #16696B;  /* teal text on cream — 6.0:1 */
  --navy:       #22333F;  /* ink: text, outlines, hard shadows */
  --navy-soft:  #45535D;  /* secondary text — cream-biased warm grey, 7.4:1 */

  /* Type */
  --font-display: "Alfa Slab One", Rockwell, "Roboto Slab", Georgia, serif;
  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* A 1.25 scale, clamped so it works from 320px up without media queries */
  --t-xs:   0.8125rem;
  --t-sm:   0.9375rem;
  --t-base: clamp(1.0625rem, 0.4vw + 1rem, 1.1875rem);
  --t-lg:   clamp(1.1875rem, 0.6vw + 1.05rem, 1.375rem);
  --t-xl:   clamp(1.4rem, 1.2vw + 1.1rem, 1.75rem);
  --t-2xl:  clamp(1.75rem, 2.2vw + 1.2rem, 2.5rem);
  --t-3xl:  clamp(2.1rem, 4vw + 1.2rem, 3.5rem);
  --t-4xl:  clamp(2.5rem, 6vw + 1.1rem, 4.5rem);

  /* Spacing — one 8px-based scale, used via gap wherever possible */
  --s-1: 0.5rem;  --s-2: 0.75rem; --s-3: 1rem;   --s-4: 1.5rem;
  --s-5: 2rem;    --s-6: 3rem;    --s-7: 4rem;   --s-8: 6rem;

  /* Shape — the "lift the game-box lid" hard offset shadow */
  --radius:    12px;
  --radius-sm: 8px;
  --border:    2.5px solid var(--navy);
  --lift:      5px 5px 0 var(--navy);
  --lift-sm:   3px 3px 0 var(--navy);
  --wrap:      1120px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background-color: var(--cream);
  /* Paper grain, kept faint so text contrast is never affected */
  background-image: url("../assets/img/texture-paper.webp");
  background-size: 400px;
  background-repeat: repeat;
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, picture, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;      /* Alfa Slab One ships one weight; it is already heavy */
  line-height: 1.05;
  text-wrap: balance;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-3xl); }
h3 { font-size: var(--t-xl); line-height: 1.15; }
p  { margin: 0; max-width: 65ch; }

a { color: var(--cherry-ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--cherry-deep); }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--navy); color: var(--cream);
  padding: var(--s-2) var(--s-3); border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; }

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

/* ---------- 3. Layout primitives ---------- */
.wrap {
  width: 100%; max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s-3);
}
@media (min-width: 40em) { .wrap { padding-inline: var(--s-5); } }

.section { padding-block: var(--s-7); }
@media (min-width: 48em) { .section { padding-block: var(--s-8); } }

.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s-5); }

.section-head { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-6); }
.section-head p { font-size: var(--t-lg); color: var(--navy-soft); }

.eyebrow {
  font-size: var(--t-sm); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--teal-ink);
  margin: 0;
}

.lede { font-size: var(--t-lg); color: var(--navy-soft); }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-1);
  font-family: var(--font-display); font-size: var(--t-base);
  line-height: 1.2; text-align: center; text-decoration: none;
  background: var(--cherry-ink); color: var(--cream);
  padding: 0.85em 1.4em;
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--lift);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:hover { background: var(--cherry-deep); color: var(--cream); transform: translate(2px, 2px); box-shadow: var(--lift-sm); }
.btn:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--navy); }

.btn-lg { font-size: var(--t-lg); padding: 0.9em 1.6em; }
.btn-sm { font-size: var(--t-sm); padding: 0.6em 1em; box-shadow: var(--lift-sm); }
.btn-sm:hover { box-shadow: 1px 1px 0 var(--navy); }

.btn-teal { background: var(--teal-band); }
.btn-teal:hover { background: #0D4143; }

.btn-ghost { background: var(--cream-hi); color: var(--navy); }
.btn-ghost:hover { background: var(--mustard); color: var(--navy); }

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--cream);
  border-bottom: 3px solid var(--navy);
}
.header-inner {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 68px;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  color: var(--cherry-ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-right: auto;
}
.wordmark img { width: 30px; height: 30px; }
.wordmark:hover { color: var(--cherry-deep); }

.nav-list {
  display: flex; gap: var(--s-4); list-style: none;
  margin: 0; padding: 0; font-weight: 700; font-size: var(--t-sm);
}
.nav-list a { color: var(--navy); text-decoration: none; }
.nav-list a:hover, .nav-list a[aria-current="page"] {
  color: var(--cherry-ink);
  text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px;
}
/* Below 34em the nav wraps to its own full-width row rather than shrinking away */
@media (max-width: 34em) {
  .header-inner { padding-block: var(--s-2); }
  .site-nav { order: 3; width: 100%; }
  .nav-list { justify-content: space-between; gap: var(--s-2); }
}

/* ---------- 6. Hero ---------- */
.hero { padding-block: var(--s-6) var(--s-7); }
.hero-grid { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 54em) {
  .hero-grid { grid-template-columns: 1.05fr 1fr; gap: var(--s-6); }
}
.hero h1 { margin-bottom: var(--s-3); }
.hero .lede { margin-bottom: var(--s-4); }
.hero-actions { display: flex; flex-direction: column; gap: var(--s-2); align-items: flex-start; }
.reassure { font-size: var(--t-sm); color: var(--navy-soft); font-weight: 600; }

/* Hero image sits in a game-box frame with a mustard sunburst behind it */
.hero-figure { position: relative; margin: 0; }
.hero-figure::before {
  content: ""; position: absolute;
  inset: -6% -6% -6% -6%;
  background: url("../assets/img/sunburst.svg") center / cover no-repeat;
  opacity: 0.5;
  z-index: 0;
  border-radius: 50%;
}
.hero-figure img {
  position: relative; z-index: 1;
  width: 100%;
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--teal);
}
/* The homepage hero swaps a 4:5 mobile crop for a 16:9 desktop one, so the
   box must be reserved per breakpoint — the img's width/height attributes
   only describe one of them, and the mismatch shows up as layout shift. */
.hero-figure--split img { aspect-ratio: 4 / 5; object-fit: cover; height: auto; }
@media (min-width: 46em) {
  .hero-figure--split img { aspect-ratio: 16 / 9; }
}

/* ---------- 7. Cards ---------- */
.card {
  background: var(--cream-hi);
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--lift);
  padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-2);
  height: 100%;
}
.card h3 { color: var(--cherry-ink); }
.card p { color: var(--navy-soft); font-size: var(--t-sm); }
.card-media { border-bottom: var(--border); margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) 0; }
.card-media img { width: 100%; border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0; }

.card-accent { box-shadow: 5px 5px 0 var(--mustard); }

.grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

/* Step cards carry an illustration and a numbered pip — the order is real:
   you print, then play, then celebrate. */
.step { text-align: center; align-items: center; }
.step img { width: 150px; }
.step .pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem;
  background: var(--teal-band); color: var(--cream);
  font-family: var(--font-display); font-size: var(--t-base);
  border: var(--border); border-radius: 50%;
}
.step p { text-align: center; }

/* ---------- 8. Coloured bands ---------- */
.band-teal { background: var(--teal-band); color: var(--cream); border-block: 3px solid var(--navy); }
.band-teal h2, .band-teal h3 { color: var(--cream); }
.band-teal .eyebrow { color: var(--mustard); }
.band-teal p { color: #E6F4F4; }
/* Cards keep their cream ground inside the band, so their text reverts to ink */
.band-teal .card p { color: var(--navy-soft); }
.band-teal .card h3 { color: var(--cherry-ink); }
.band-teal a:not(.btn) { color: var(--mustard); }

.band-navy { background: var(--navy); color: var(--cream); border-block: 3px solid var(--navy); }
.band-navy h2 { color: var(--mustard); }
.band-navy p { color: #D8DFE4; }

/* Ticket-stub divider between major sections */
.divider {
  height: 34px;
  background: url("../assets/img/divider-tickets.webp") center / auto 100% repeat-x;
  border-block: 3px solid var(--navy);
}

/* ---------- 9. Badges & feature rows ---------- */
.subject-row { display: grid; gap: var(--s-5); }
@media (min-width: 44em) { .subject-row { grid-template-columns: 1fr 1fr; } }
.subject { display: flex; gap: var(--s-3); align-items: flex-start; }
.subject img { width: 84px; flex: none; }
.subject h3 { margin-bottom: var(--s-1); }

/* ---------- 10. Signup form ---------- */
.signup {
  background: var(--cream-hi);
  border: 3px solid var(--navy); border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--cherry);
  padding: var(--s-5);
  display: grid; gap: var(--s-4);
}
@media (min-width: 48em) {
  .signup { grid-template-columns: 1fr 1fr; align-items: center; gap: var(--s-6); }
}
.signup h2 { color: var(--cherry-ink); }
.signup-cover { margin: 0; }
.signup-cover img {
  width: 100%; max-width: 320px; margin-inline: auto;
  border: 3px solid var(--navy); border-radius: var(--radius-sm);
  box-shadow: var(--lift);
}
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field label { font-weight: 700; font-size: var(--t-sm); }
.field input {
  font: inherit; font-size: var(--t-base);
  padding: 0.7em 0.9em;
  background: var(--cream);
  color: var(--navy);
  border: var(--border); border-radius: var(--radius-sm);
}
.field input::placeholder { color: #6E675C; }
.form-note { font-size: var(--t-xs); color: var(--navy-soft); }
.form-status { font-weight: 700; font-size: var(--t-sm); }
.form-status[data-state="error"] { color: var(--cherry-ink); }
.form-status[data-state="ok"] { color: var(--teal-ink); }

/* ---------- 11. Quote ---------- */
.quote {
  font-family: var(--font-display);
  font-size: var(--t-2xl); line-height: 1.2;
  max-width: 24ch; margin: 0;
}
.quote-cite { font-family: var(--font-body); font-size: var(--t-sm); font-weight: 700; font-style: normal; }

/* ---------- 12. Blog ---------- */
.post-list { display: grid; gap: var(--s-5); list-style: none; margin: 0; padding: 0; }
@media (min-width: 44em) { .post-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); } }
.post-card a { text-decoration: none; color: inherit; }
.post-card a:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.post-meta { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; color: var(--teal-ink); }

.prose { max-width: 68ch; display: flex; flex-direction: column; gap: var(--s-3); }
.prose h2 { font-size: var(--t-2xl); margin-top: var(--s-4); }
.prose h3 { margin-top: var(--s-3); }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: var(--s-1); }
.prose li { max-width: 62ch; }
.prose figure { margin: var(--s-3) 0; }
.prose figcaption { font-size: var(--t-xs); color: var(--navy-soft); margin-top: var(--s-1); }
.prose img { border: 3px solid var(--navy); border-radius: var(--radius); }

.callout {
  background: var(--cream-hi);
  border: var(--border); border-left-width: 10px; border-radius: var(--radius-sm);
  box-shadow: var(--lift-sm);
  padding: var(--s-3) var(--s-4);
}
.callout p { max-width: none; }

/* ---------- 13. Footer ---------- */
.site-footer {
  background: var(--navy); color: #D8DFE4;
  border-top: 3px solid var(--navy);
  padding-block: var(--s-6);
  font-size: var(--t-sm);
}
.footer-grid { display: grid; gap: var(--s-4); }
@media (min-width: 44em) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s-6); } }
.site-footer h2 { font-size: var(--t-lg); color: var(--mustard); margin-bottom: var(--s-2); }
.site-footer a { color: var(--mustard); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.footer-mark { font-family: var(--font-display); font-size: var(--t-lg); color: var(--cream); }
.footer-legal { margin-top: var(--s-5); font-size: var(--t-xs); color: #9FAAB2; }

/* ---------- 14. Reveal on scroll (progressive enhancement) ---------- */
/* Only ever applies when JS is confirmed alive, so a JS failure cannot hide content.
   `.reveal-done` on <html> switches the whole system off statically — no transition
   involved — which is what the JS safety net uses if the observer never fires. */
.js:not(.reveal-done) .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.js:not(.reveal-done) .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
