/* ============================================================
   The 2026 World Cup Brand Mobilization — Executive Case Study
   Cream-paper, hand-drawn aesthetic matching the colored-pencil art.
   ============================================================ */

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.85rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.3vw, 0.95rem);
  --text-base: clamp(1.02rem, 0.97rem + 0.35vw, 1.18rem);
  --text-lg: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  --text-xl: clamp(1.6rem, 1.2rem + 1.7vw, 2.5rem);
  --text-2xl: clamp(2.1rem, 1.3rem + 3.4vw, 4rem);
  --text-hero: clamp(2.6rem, 1.2rem + 6vw, 5.5rem);

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem; --space-20: 5rem; --space-24: 6rem; --space-32: 8rem;

  --content: 760px;
  --content-wide: 1020px;

  --font-hand: 'Architects Daughter', 'Comic Sans MS', cursive;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Work Sans', 'Helvetica Neue', Arial, sans-serif;

  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* LIGHT MODE — cream paper, tuned to blend with the drawings */
:root, [data-theme="light"] {
  --paper: #f6f2e6;          /* page — matches PDF PAPER */
  --paper-2: #f1ece0;        /* slightly deeper panel */
  --img-bg: #fbfaf6;         /* chart white — for image plinths */
  --photo-bg: #f9f6eb;       /* matches the hand-drawn ball photos' own paper */
  --ink: #23211d;            /* primary text */
  --ink-2: #55524c;          /* secondary */
  --ink-3: #7c7970;          /* faint */
  --rule: #cbc4b2;           /* warm hairline */
  --rule-soft: #ddd6c4;
  --accent: #2a5a8c;         /* link blue, echoes PDF */
  --accent-warm: #b4541f;    /* the warm pitch/ball orange */
  --est-bg: #efe7cf;         /* estimate highlight */
  --shadow: 0 18px 40px rgba(60, 50, 25, 0.10);
  --shadow-sm: 0 6px 18px rgba(60, 50, 25, 0.08);
  --header-bg: rgba(246, 242, 230, 0.82);
}

/* DARK MODE — warm charcoal, paper recedes; images keep their cream */
[data-theme="dark"] {
  --paper: #1a1916;
  --paper-2: #211f1b;
  --img-bg: #f6f2e6;         /* images stay on a light card so the art reads */
  --photo-bg: #f9f6eb;       /* photo paper — kept bright so the drawings read in dark mode too */
  --ink: #ece7da;
  --ink-2: #b3ad9e;
  --ink-3: #837d70;
  --rule: #3a3730;
  --rule-soft: #2c2a25;
  --accent: #8fb6dd;
  --accent-warm: #e08a52;
  --est-bg: #322d20;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(26, 25, 22, 0.82);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #1a1916; --paper-2: #211f1b; --img-bg: #f6f2e6;
    --ink: #ece7da; --ink-2: #b3ad9e; --ink-3: #837d70;
    --rule: #3a3730; --rule-soft: #2c2a25; --accent: #8fb6dd; --accent-warm: #e08a52;
    --est-bg: #322d20; --header-bg: rgba(26,25,22,0.82);
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
body {
  min-height: 100dvh; line-height: 1.62;
  font-family: var(--font-serif); font-size: var(--text-base);
  color: var(--ink); background: var(--paper);
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
img, svg, figure { display: block; max-width: 100%; height: auto; }
ol[role="list"] { list-style: none; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button { cursor: pointer; background: none; border: none; color: inherit; font: inherit; }
::selection { background: rgba(180, 84, 31, 0.18); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.wrap { max-width: var(--content); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }

/* ---------- progress bar ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; background: transparent; }
.progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-warm), var(--accent)); transition: width 0.1s linear; }

/* ---------- header ---------- */
.header {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  background: var(--header-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule-soft);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.header--hidden { transform: translateY(-105%); }
.header--scrolled { box-shadow: var(--shadow-sm); }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { color: var(--accent-warm); }
.brand-text { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm); letter-spacing: 0.01em; }
.brand-thin { color: var(--ink-3); font-weight: 400; }
.header-nav { display: flex; gap: 0.15rem; margin-inline: auto; overflow-x: auto; scrollbar-width: none; }
.header-nav::-webkit-scrollbar { display: none; }
.header-nav a {
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 500;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
  padding: 0.4rem 0.6rem; border-radius: 8px; transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.header-nav a:hover { color: var(--ink); background: var(--paper-2); }
.header-nav a.active { color: var(--accent-warm); }
.header-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.pdf-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600;
  color: var(--ink-2); text-decoration: none;
  padding: 0.4rem 0.7rem; border: 1px solid var(--rule); border-radius: 999px;
  transition: all 0.2s var(--ease);
}
.pdf-link:hover { color: var(--ink); border-color: var(--ink-3); background: var(--paper-2); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px; color: var(--ink-2);
  border: 1px solid var(--rule); transition: all 0.2s var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }

@media (max-width: 860px) {
  .header-nav { display: none; }
  .brand-text { display: none; }
  .header { gap: 0.5rem; }
  .pdf-link-text { display: none; }
  .pdf-link { padding: 0.4rem 0.55rem; }
}

/* ---------- cover ---------- */
.cover { min-height: calc(100dvh - 56px); display: grid; place-items: center; padding: var(--space-12) 0 var(--space-20); position: relative; }
.cover-inner { max-width: 820px; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); text-align: center; }
.cover-kicker { font-family: var(--font-hand); font-size: var(--text-lg); color: var(--ink-2); letter-spacing: 0.02em; margin-bottom: 0.4rem; }
.cover-title { font-family: var(--font-hand); font-weight: 400; font-size: var(--text-hero); line-height: 1.04; color: var(--ink); letter-spacing: -0.01em; margin-bottom: clamp(1.4rem, 4vw, 2.4rem); }
/* Photo plinths: the drawings carry their own brighter paper (#f9f6eb), which
   used to sit as a separate lighter card against the page cream. Instead of a
   framed card, let the image float directly on the page and feather its edges
   so the bright paper dissolves into the page rather than ending at a hard
   rectangle. No container background, no shadow, no border. */
.cover-hero { margin-inline: auto; max-width: 640px; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.cover-hero img, .back-ball img {
  width: 100%;
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-composite: intersect;
}
.cover-sub { font-size: var(--text-lg); line-height: 1.5; color: var(--ink-2); max-width: 38ch; margin: clamp(1.4rem, 4vw, 2.2rem) auto 0; text-wrap: pretty; }
.cover-meta { font-family: var(--font-hand); font-size: var(--text-base); color: var(--ink-3); margin-top: 1.1rem; }
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; gap: 0.3rem; margin-top: clamp(2rem, 6vw, 3.5rem); font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); text-decoration: none; }
.scroll-cue svg { animation: bob 1.8s var(--ease) infinite; }
.scroll-cue:hover { color: var(--accent-warm); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- contents ---------- */
.contents { padding: clamp(3rem, 8vw, 6rem) 0; border-top: 1px solid var(--rule-soft); background: var(--paper-2); }
.contents .wrap { max-width: var(--content); }
.contents-title { font-family: var(--font-hand); font-weight: 400; font-size: var(--text-2xl); color: var(--ink); line-height: 1; }
.contents-intro { font-size: var(--text-base); color: var(--ink-2); margin: 0.6rem 0 1.6rem; max-width: 54ch; }
.toc { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.toc li a {
  display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; align-items: start;
  padding: 1rem 0.25rem; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: var(--ink); transition: background 0.2s var(--ease), padding-left 0.2s var(--ease);
}
.toc li a:hover { background: var(--paper); padding-left: 0.75rem; }
.toc-num { font-family: var(--font-hand); font-size: var(--text-lg); color: var(--ink-3); }
.toc-body { display: flex; flex-direction: column; gap: 0.15rem; }
.toc-name { font-family: var(--font-serif); font-weight: 600; font-size: var(--text-lg); line-height: 1.2; }
.toc-desc { font-size: var(--text-sm); color: var(--ink-2); }
.contents-foot { font-family: var(--font-sans); font-size: var(--text-xs); color: var(--ink-3); margin-top: 1.6rem; }

/* ---------- sections ---------- */
.section { padding: clamp(3.5rem, 9vw, 7rem) 0; border-top: 1px solid var(--rule-soft); scroll-margin-top: 80px; }
.kicker { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-warm); margin-bottom: 0.6rem; }
.h2 { font-family: var(--font-hand); font-weight: 400; font-size: var(--text-xl); line-height: 1.12; color: var(--ink); letter-spacing: -0.005em; }
.h3 { font-family: var(--font-serif); font-weight: 700; font-size: var(--text-lg); color: var(--ink); margin: 1.8rem 0 0.5rem; }
.cite-grp { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin: 2rem 0 0.8rem; }
.rule { border: none; height: 1px; background: var(--rule); margin: 1rem 0 1.6rem; }
.section p { margin-bottom: 1.1rem; max-width: 66ch; color: var(--ink); }
.lead { font-size: var(--text-lg); line-height: 1.55; color: var(--ink); }
.section p:last-child { margin-bottom: 0; }

/* footnote markers */
.fn {
  font-family: var(--font-sans); font-size: 0.62em; font-weight: 600;
  vertical-align: super; line-height: 0; margin-left: 1px; padding: 0 2px;
  color: var(--accent); text-decoration: none; border-radius: 4px;
}
.fn:hover { background: var(--accent); color: var(--paper); }

/* estimate highlight */
.est { background: var(--est-bg); color: var(--ink); padding: 0.05em 0.25em; border-radius: 5px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* pull quote */
.pull {
  font-family: var(--font-hand); font-size: var(--text-lg); line-height: 1.4;
  color: var(--ink); border-left: 3px solid var(--accent-warm);
  padding: 0.5rem 0 0.5rem 1.4rem; margin: 2rem 0 0; max-width: 60ch;
}

/* callout / sidebar box */
.callout {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.8rem 0 0;
  max-width: 66ch;
}
.callout .callout-title {
  font-family: var(--font-sans); font-weight: 700; font-size: var(--text-sm);
  color: var(--ink); margin: 0 0 0.6rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.callout p { font-size: var(--text-sm); color: var(--ink-2); margin: 0; max-width: none; }

/* benchmark table */
.bench-wrap { margin: 1.6rem 0 0.8rem; overflow-x: auto; max-width: 66ch; }
.bench { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--text-sm); }
.bench thead th {
  background: #1c1a17; color: #f6f2e6; text-align: left; font-weight: 600;
  padding: 0.55rem 0.7rem;
}
.bench tbody td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule-soft); color: var(--ink); vertical-align: top; }
.bench tbody tr:nth-child(even) td { background: var(--paper-2); }
.bench td:first-child { font-weight: 600; }
.bench-cap { font-family: var(--font-sans); font-size: var(--text-xs); line-height: 1.5; color: var(--ink-3); margin-top: 0.6rem; max-width: 66ch; }

/* ---------- charts ---------- */
.chart { margin: 2rem 0 1.8rem; }
.chart img {
  width: 100%; border-radius: var(--radius); background: var(--img-bg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--rule-soft);
}
.chart figcaption { font-family: var(--font-sans); font-size: var(--text-xs); line-height: 1.5; color: var(--ink-3); margin-top: 0.7rem; max-width: 68ch; }

/* ---------- citations ---------- */
.cites { display: flex; flex-direction: column; gap: 1rem; }
.cites li { display: grid; grid-template-columns: 2rem 1fr; gap: 0.85rem; align-items: start; font-size: var(--text-sm); line-height: 1.5; scroll-margin-top: 86px; }
.cite-n { font-family: var(--font-hand); font-size: var(--text-lg); color: var(--accent-warm); }
.cites strong { font-weight: 700; color: var(--ink); }
.cite-note { display: block; color: var(--ink-2); margin-top: 0.2rem; }
.cites a { font-family: var(--font-sans); font-size: var(--text-xs); word-break: break-word; }
.cites li:target { background: var(--est-bg); border-radius: 8px; padding: 0.5rem; margin: -0.5rem; transition: background 0.4s var(--ease); }

/* ---------- back cover ---------- */
.back { padding: clamp(4rem, 10vw, 8rem) 0 clamp(5rem, 12vw, 9rem); border-top: 1px solid var(--rule-soft); background: var(--paper-2); text-align: center; }
.back-inner { max-width: 620px; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.back-title { font-family: var(--font-hand); font-weight: 400; font-size: var(--text-xl); line-height: 1.3; color: var(--ink); }
.back-ball { margin: clamp(1.8rem, 5vw, 3rem) auto; max-width: 440px; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.back-line { font-family: var(--font-serif); font-weight: 600; font-size: var(--text-base); color: var(--ink); }
.back-meta { font-family: var(--font-hand); font-size: var(--text-sm); color: var(--ink-3); margin-top: 0.4rem; }
.back-pdf { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: clamp(1.8rem, 5vw, 2.6rem); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 600; text-decoration: none; color: var(--accent); padding: 0.6rem 1.1rem; border: 1px solid var(--rule); border-radius: 999px; transition: all 0.2s var(--ease); }
.back-pdf:hover { border-color: var(--accent); background: var(--paper); }

/* ---------- prev/next pager ---------- */
.pager {
  position: fixed; bottom: clamp(1rem, 3vw, 1.6rem); left: 50%; transform: translateX(-50%) translateY(0);
  z-index: 55; display: flex; align-items: center; gap: 0.4rem;
  background: var(--header-bg); backdrop-filter: blur(14px);
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.35rem 0.4rem;
  box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.pager.show { opacity: 1; pointer-events: auto; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; color: var(--ink); transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.pager-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--accent-warm); }
.pager-btn:disabled { color: var(--ink-3); opacity: 0.4; cursor: default; }
.pager-label { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); min-width: 7.5rem; max-width: 11rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 560px) { .pager-label { min-width: 5rem; max-width: 7rem; } }

/* ---------- back to top ---------- */
.to-top {
  position: fixed; bottom: clamp(1rem, 3vw, 1.6rem); right: clamp(1rem, 3vw, 1.6rem); z-index: 55;
  width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); background: var(--header-bg); backdrop-filter: blur(14px);
  border: 1px solid var(--rule); box-shadow: var(--shadow-sm);
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: all 0.3s var(--ease);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { color: var(--accent-warm); }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }
.chart, .section .h2, .section .lead { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.chart.in, .section .h2.in, .section .lead.in { opacity: 1; transform: translateY(0); }
