/* ============================================================
   IPL Timeline — styles.css

   Sections:
   1. Reset & Base
   2. Era Theme Variables  (body.era-N class system)
   3. Body & Global Transitions
   4. Layout Shell
   5. Era Title Cards
   6. Season Cards
   7. Year Indicator
   8. Stat Chip Bar
   9. Modal Overlay
  10. Phase 4 — Animations & Parallax
   ============================================================ */


/* ─── 1. Reset & Base ──────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
video {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
}


/* ─── 2. Era Theme Variables ───────────────────────────────── */
/*
   All styling uses these custom properties.
   Swapping body.era-N repaints the whole page.
   Transitions on background-color / color animate the dissolve.
*/

:root {
  /* Default = Era 1 values */
  --color-bg:        #1c0a00;
  --color-accent:    #d97706;
  --color-text:      #fef3c7;
  --color-subtle:    #b45309;
  --color-surface:   rgba(255, 200, 80, 0.06);
  --color-border:    rgba(255, 200, 80, 0.15);
  --font-heading:    'Playfair Display', serif;
  --font-body:       'Source Serif 4', serif;
  --chip-bar-height: 48px;
}

/* Era 1 — The Founding Years (2008–2010)
   Deep brown, amber gold, Playfair Display, Source Serif 4 */
body.era-1 {
  --color-bg:      #1c0a00;
  --color-accent:  #d97706;
  --color-text:    #fef3c7;
  --color-subtle:  #b45309;
  --color-surface: rgba(255, 200, 80, 0.06);
  --color-border:  rgba(255, 200, 80, 0.15);
  --font-heading:  'Playfair Display', serif;
  --font-body:     'Source Serif 4', serif;
}

/* Era 2 — The Classic Era (2011–2013)
   Steel blue, sky blue accent, Barlow Condensed, Segoe UI */
body.era-2 {
  --color-bg:      #1e3a5f;
  --color-accent:  #38bdf8;
  --color-text:    #f4f4f4;
  --color-subtle:  #93b4d4;
  --color-surface: rgba(255, 255, 255, 0.07);
  --color-border:  rgba(255, 255, 255, 0.15);
  --font-heading:  'Barlow Condensed', sans-serif;
  --font-body:     'Segoe UI', sans-serif;
}

/* Era 3 — The Transformative Era (2014–2017)
   Deep navy, DLF gold, Archivo Black, IBM Plex Serif */
body.era-3 {
  --color-bg:      #0a0f2e;
  --color-accent:  #f5c518;
  --color-text:    #e8e8e8;
  --color-subtle:  #8899aa;
  --color-surface: rgba(255, 255, 255, 0.06);
  --color-border:  rgba(255, 255, 255, 0.14);
  --font-heading:  'Archivo Black', sans-serif;
  --font-body:     'IBM Plex Serif', serif;
}

/* Era 4 — The Rivalry Era (2018–2021)
   Dark charcoal, electric purple, Oswald, Barlow */
body.era-4 {
  --color-bg:      #16161e;
  --color-accent:  #a78bfa;
  --color-text:    #e8e4f0;
  --color-subtle:  #7c6fa0;
  --color-surface: rgba(167, 139, 250, 0.07);
  --color-border:  rgba(167, 139, 250, 0.2);
  --font-heading:  'Oswald', sans-serif;
  --font-body:     'Barlow', sans-serif;
}

/* Era 5 — The New Order (2022–2024)
   Off-white, teal, DM Sans throughout */
body.era-5 {
  --color-bg:      #f8f8f6;
  --color-accent:  #0d9488;
  --color-text:    #1e293b;
  --color-subtle:  #64748b;
  --color-surface: rgba(0, 0, 0, 0.04);
  --color-border:  rgba(0, 0, 0, 0.10);
  --font-heading:  'DM Sans', sans-serif;
  --font-body:     'DM Sans', sans-serif;
}

/* Era 6 — The Current Era (2025)
   Cool white, rose accent, DM Sans throughout */
body.era-6 {
  --color-bg:      #f0f4f8;
  --color-accent:  #e11d48;
  --color-text:    #1e2d3d;
  --color-subtle:  #64748b;
  --color-surface: rgba(0, 0, 0, 0.04);
  --color-border:  rgba(0, 0, 0, 0.10);
  --font-heading:  'DM Sans', sans-serif;
  --font-body:     'DM Sans', sans-serif;
}


/* ─── 3. Body & Global Transitions ────────────────────────── */

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  overflow-x: hidden;
  /* Smooth era dissolve — fires when body.era-N class changes */
  transition:
    background-color 0.8s ease,
    color 0.6s ease;
}


/* ─── 4. Layout Shell ──────────────────────────────────────── */

#scroll-container {
  width: 100%;
  /* Overflow removed — Lenis drives window scroll instead of a div scroller */
}


/* ─── 5. Era Title Cards ───────────────────────────────────── */

.era-title-card {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 5vw;
  position: relative;
  overflow: hidden;
  --blob-offset: 0px;
}

/* Subtle decorative accent blob in background */
.era-title-card::before {
  content: '';
  position: absolute;
  top: -15%;
  right: -8%;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.05;
  pointer-events: none;
  transition: background-color 0.8s ease;
  transform: translateY(var(--blob-offset));
  will-change: transform;
}

.era-card-inner {
  position: relative;
  z-index: 1;
  max-width: 820px;
}

.era-eyebrow {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
  transition: color 0.6s ease;
}

.era-name {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 1;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  transition: color 0.6s ease;
}

/* Era 1: Playfair Display is wide at large sizes — "The Founding Years" needs room */
body.era-1 .era-name {
  font-size: clamp(2rem, 4.8vw, 4.25rem);
}

/* Era 2: condensed uppercase heading style (Barlow Condensed) */
body.era-2 .era-name {
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* Era 3: Archivo Black is very wide — "A Coming of Age" clips at default size */
body.era-3 .era-name {
  font-size: clamp(2rem, 5.5vw, 5rem);
}

/* Era 4: Oswald tracking + smaller clamp so "Dynastic Domination" fits one line */
body.era-4 .era-name {
  letter-spacing: 0.03em;
  font-size: clamp(2rem, 5vw, 4.5rem);
}

.era-divider {
  width: 56px;
  height: 3px;
  background: var(--color-accent);
  margin-bottom: 1.75rem;
  transition: background-color 0.6s ease;
}

.era-seasons-range {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--color-subtle);
  margin-bottom: 1.25rem;
  transition: color 0.6s ease;
}

.era-intro-text {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.75;
  color: var(--color-text);
  max-width: 56ch;
  opacity: 0.85;
  transition: color 0.6s ease;
}


/* ─── 6. Season Cards ──────────────────────────────────────── */

.season-card {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Reserve space for chip bar (Phase 3) */
  padding-bottom: calc(var(--chip-bar-height) + 1.5rem);
}


/* ── Card Header ── */

.card-header {
  flex: 0 0 auto;
  padding: 2rem 5vw 1rem;
  will-change: transform;
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.12));
}

.card-year {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-accent);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  /* parallax layer — translateY driven by JS scroll position */
  will-change: transform;
  transition: color 0.6s ease;
}

.winner-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  gap: 0.25rem;
}

.winner-label {
  font-family: var(--font-body);
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-subtle);
  transition: color 0.6s ease;
}

.winner-name {
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.01em;
  line-height: 1.15;
  transition: color 0.6s ease;
}

.winner-logo {
  width: auto;
  height: 40px;
  margin-top: 0.35rem;
}

/* MI logo ships ~15% larger than other team logos — scale it down to match */
.winner-logo[src*="mi.png"] {
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}

.card-headline {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  color: var(--color-text);
  max-width: 80%;
  letter-spacing: -0.01em;
  transition: color 0.6s ease;
}

/* Era-specific headline adjustments */
body.era-2 .card-headline {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(1.1rem, 2.4vw, 2rem);
}

body.era-4 .card-headline {
  letter-spacing: 0.04em;
}

body.era-5 .card-headline,
body.era-6 .card-headline {
  font-weight: 500;
  letter-spacing: -0.02em;
}


/* ── Card Body ── */

.card-body {
  flex: 1 1 auto;
  padding: 1.5rem 5vw 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.content-section {
  max-width: 760px;
}

.section-title {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.8rem;
  transition: color 0.6s ease;
}

/* Era 2: use heading font for section labels (Barlow Condensed) */
body.era-2 .section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.7rem;
}

.section-body {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.8;
  color: var(--color-text);
  opacity: 0.85;
  transition: color 0.6s ease, opacity 0.3s ease;
}

.section-body + .section-body {
  margin-top: 1rem;
}

/* Era 4: slightly tighter tracking to match Oswald heading feel */
body.era-4 .section-body {
  letter-spacing: 0.01em;
}


/* ─── 5b. Hero Card ────────────────────────────────────────── */

.hero-card {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 5vw;
  position: relative;
  overflow: hidden;
}

/* Same decorative blob treatment as era title cards */
.hero-card::before {
  content: '';
  position: absolute;
  top: -15%;
  right: -8%;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.06;
  pointer-events: none;
}

/* Second, smaller blob for depth */
.hero-card::after {
  content: '';
  position: absolute;
  bottom: 5%;
  left: -10%;
  width: 30vw;
  height: 30vw;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.03;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: hero-reveal 0.7s ease 0.1s forwards;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(4rem, 13vw, 10.5rem);
  font-weight: 900;
  line-height: 0.95;
  color: var(--color-text);
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: hero-reveal 0.8s ease 0.25s forwards;
}

/* "The IPL" in accent, "Chronicle" in text color */
.hero-title em {
  font-style: normal;
  color: var(--color-accent);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.6vw, 1.15rem);
  line-height: 1.7;
  color: var(--color-text);
  opacity: 0;
  transform: translateY(14px);
  animation: hero-reveal 0.7s ease 0.45s forwards;
}

#about-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 1.75rem;
  padding: 0.35em 0.9em;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: transparent;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  animation: hero-reveal 0.7s ease 0.6s forwards;
  transition: background 0.2s, color 0.2s;
}

#about-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

@keyframes hero-reveal {
  to { opacity: 0.8; transform: translateY(0); }
}

/* Title gets full opacity, not 0.8 */
.hero-title {
  animation: hero-reveal-full 0.8s ease 0.25s forwards;
}

@keyframes hero-reveal-full {
  to { opacity: 1; transform: translateY(0); }
}


/* ─── 6b. Era Jump Navigation ─────────────────────────────── */

#era-nav {
  position: fixed;
  top: 1rem;
  left: 1.25rem;
  z-index: 105;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#era-nav.era-nav-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

#era-nav-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.28em 0.9em;
  border-radius: 100px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.6s ease;
}

#era-nav-toggle:hover,
#era-nav-toggle:focus-visible {
  background: var(--color-surface);
  outline: none;
}

#era-nav-toggle[aria-expanded="true"] {
  background: var(--color-surface);
  border-color: var(--color-accent);
}

.era-nav-chevron {
  font-size: 0.45rem;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

#era-nav-toggle[aria-expanded="true"] .era-nav-chevron {
  transform: rotate(180deg);
}

#era-nav-menu {
  margin-top: 0.4rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: era-nav-open 0.18s ease forwards;
  transition:
    background-color 0.6s ease,
    border-color 0.6s ease;
}

#era-nav-menu[hidden] {
  display: none;
}

@keyframes era-nav-open {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.era-nav-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.6s ease;
}

.era-nav-item:last-child {
  border-bottom: none;
}

.era-nav-item:hover,
.era-nav-item:focus-visible {
  background: var(--color-surface);
  outline: none;
}

.era-nav-item.active {
  background: var(--color-surface);
}

.era-nav-item.active .era-nav-item-name {
  color: var(--color-accent);
}

.era-nav-item-eyebrow {
  font-family: var(--font-body);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.15rem;
  transition: color 0.6s ease;
}

.era-nav-item-name {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  color: var(--color-text);
  transition: color 0.6s ease;
}

.era-nav-item-range {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: var(--color-subtle);
  margin-top: 0.1rem;
  transition: color 0.6s ease;
}


/* ─── 7a. Onboarding Hint ──────────────────────────────────── */

#onboarding-hint {
  position: absolute;
  bottom: calc(var(--chip-bar-height) + 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  cursor: default;
  animation: onboarding-fade-in 0.6s ease 2s both;
}

#onboarding-hint.onboarding-hiding {
  animation: onboarding-fade-out 0.5s ease forwards;
}

.onboarding-text {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.3em 1em;
  border-radius: 100px;
  white-space: nowrap;
  opacity: 0.85;
}

.onboarding-arrow {
  font-size: 1.1rem;
  color: var(--color-accent);
  animation: onboarding-bounce 1.2s ease-in-out infinite;
}

@keyframes onboarding-fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

@keyframes onboarding-fade-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0);   }
  to   { opacity: 0; transform: translateX(-50%) translateY(6px); }
}

@keyframes onboarding-bounce {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(5px); }
}


/* ─── 7. Year Indicator ────────────────────────────────────── */

#year-indicator {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.year-dot {
  /* Visual size stays 6px; touch target extended to 32×32 via ::before */
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-subtle);
  opacity: 0.4;
  cursor: pointer;
  position: relative;
  transition:
    background-color 0.3s ease,
    opacity 0.3s ease,
    transform 0.2s ease;
  flex-shrink: 0;
}

/* 32×32px invisible touch-target centred on the 6px dot */
.year-dot::before {
  content: '';
  position: absolute;
  inset: -13px;
  border-radius: 50%;
}

/* Year label tooltip — real <span> for reliable cross-browser positioning */
.dot-tooltip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.2em 0.55em;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    color 0.6s ease,
    background-color 0.6s ease,
    border-color 0.6s ease;
  /* Keep tooltip above sibling elements */
  z-index: 1;
}

.year-dot:hover .dot-tooltip,
.year-dot:focus-visible .dot-tooltip {
  opacity: 1;
}

.year-dot.active {
  background: var(--color-accent);
  opacity: 1;
  transform: scale(1.5);
}

.year-dot:hover,
.year-dot:focus-visible {
  opacity: 0.75;
  transform: scale(1.3);
  outline: none;
}

.year-dot.active:hover,
.year-dot.active:focus-visible {
  transform: scale(1.6);
}

/* ── Mobile: hide dot rail, show persistent label at top-centre ── */

#mobile-era-label {
  display: none;
  position: fixed;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.22em 0.75em;
  border-radius: 20px;
  z-index: 105;
  white-space: nowrap;
  pointer-events: none;
  transition:
    color 0.6s ease,
    background-color 0.6s ease,
    border-color 0.6s ease;
}

@media (max-width: 768px) {
  #year-indicator { display: none; }
  #mobile-era-label { display: block; }
}

.year-dot-gap {
  height: 10px; /* visual spacing between era groups */
}


/* ─── 8. Stat Chip Bar ─────────────────────────────────────── */

#stat-chip-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--chip-bar-height);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  /* Gradient fade above chip bar so card content blends out cleanly */
  box-shadow: 0 -32px 32px 0 var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0 4vw;
  z-index: 90;
  transition:
    background-color 0.8s ease,
    border-color 0.6s ease,
    transform 0.25s ease;
}

#stat-chip-bar.chip-bar-hidden {
  transform: translateY(100%);
  pointer-events: none;
}

#stat-chip-bar[hidden] {
  display: none;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.stat-chip:hover,
.stat-chip:focus-visible {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
  outline: none;
}

.stat-chip-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.stat-chip.placeholder {
  opacity: 0.45;
  cursor: default;
}

.stat-chip.placeholder:hover,
.stat-chip.placeholder:focus-visible {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

/* Era 2: Barlow Condensed chip labels — uppercase condensed */
body.era-2 .stat-chip {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
}

/* Era 3: Archivo Black era — bold bordered chips */
body.era-3 .stat-chip {
  border-width: 2px;
}

/* Era 4: near-black/purple — sharp edges, subtle glow on hover */
body.era-4 .stat-chip {
  border-radius: 3px;
  letter-spacing: 0.04em;
}

body.era-4 .stat-chip:hover {
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
}


/* ─── 9. Modal Overlay ─────────────────────────────────────── */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#modal-overlay[hidden] {
  display: none;
}

#modal-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  width: 100%;
  max-width: 860px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

body.modal-open {
  overflow: hidden;
}

#modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-subtle);
  font-size: 0.8rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#modal-close:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

#modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--color-text);
  margin-bottom: 0.35rem;
  padding-right: 2.5rem;
}

.modal-about #modal-title {
  color: #d97706;
}

#modal-season-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 1.5rem;
  display: block;
}

#modal-body {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.7;
}

#modal-info-btn {
  position: absolute;
  top: 1.25rem;
  right: 3.25rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--color-subtle);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  line-height: 1;
}

#modal-info-btn:hover,
#modal-info-btn.modal-info-btn-active {
  background: var(--color-surface);
  color: var(--color-text);
}

#modal-info-bubble {
  position: absolute;
  top: 3.5rem;
  right: 1.25rem;
  max-width: 240px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.6em 0.85em;
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  line-height: 1.6;
  color: var(--color-subtle);
  z-index: 10;
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}


/* ── Modal: Stats Table ── */

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.stats-table th {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-subtle);
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.stats-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr:hover td {
  background: var(--color-surface);
}

/* Winner row in points table */
.stats-table tr.table-winner td {
  color: var(--color-accent);
  font-weight: 600;
}

/* Cap badge */
.cap-badge {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
  line-height: 1.6;
}

.cap-orange {
  background: rgba(234, 88, 12, 0.18);
  color: #ea580c;
}

.cap-purple {
  background: rgba(124, 58, 237, 0.18);
  color: #7c3aed;
}


/* ── Modal: Knockout Results ── */

.knockout-bracket {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.knockout-round-label {
  font-family: var(--font-heading);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-subtle);
  margin-bottom: 0.25rem;
}

.knockout-match {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
}

.knockout-match.final-match {
  border-color: var(--color-accent);
}

.knockout-teams {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.3rem;
}

.knockout-winner-name {
  color: var(--color-accent);
}

.knockout-margin {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-subtle);
}

.knockout-venue {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-subtle);
  margin-top: 0.2rem;
  opacity: 0.75;
}


/* ── Modal: Close Matches ── */

.close-matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.close-match-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
}

.close-match-teams {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.close-match-meta {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-subtle);
  opacity: 0.75;
  margin-bottom: 0.3rem;
}

.close-match-result {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-subtle);
}

.scorecard-link {
  color: var(--color-accent);
  text-decoration: none;
  margin-left: 0.4rem;
}

.scorecard-link:hover {
  text-decoration: underline;
}


/* ── Modal: Two-column stat layout (batters + bowlers) ── */

.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.stats-col-title {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.stats-two-col .stats-table tbody td:nth-child(2),
.stats-two-col .stats-table tbody td:nth-child(2) span {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stats-two-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}


/* ── Modal: Author-fill list items ── */

.author-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.author-list-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
}

.author-list-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}

.author-list-team {
  font-size: 0.72rem;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

.author-list-stat {
  font-size: 0.82rem;
  color: var(--color-subtle);
}

.author-list-detail {
  font-size: 0.8rem;
  color: var(--color-text);
  opacity: 0.8;
  margin-top: 0.35rem;
  line-height: 1.55;
}

.close-match-result {
  font-size: 0.82rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.close-match-link {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.close-match-link:hover {
  border-bottom-color: var(--color-accent);
}


/* ── Modal: Placeholder state ── */

.placeholder-message {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-subtle);
}

.placeholder-message p {
  font-size: 0.85rem;
  line-height: 1.6;
}

.placeholder-message strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  opacity: 0.5;
}


/* ── Era-specific modal overrides ── */

/* Era 1 (brown/amber/Playfair): warm serif modal, amber top accent */
#modal-panel.scorecard-era1 {
  border-top: 3px solid var(--color-accent);
}

#modal-panel.scorecard-era1 .stats-table th {
  font-family: 'Source Serif 4', serif;
  letter-spacing: 0.08em;
}

/* Era 2 (steel blue/red/Barlow Condensed): uppercase condensed headers, sharp corners */
#modal-panel.scorecard-era2 {
  border-radius: 4px;
  border-top: 3px solid var(--color-accent);
}

#modal-panel.scorecard-era2 .stats-table th {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
}

#modal-panel.scorecard-era2 .knockout-match {
  border-radius: 3px;
}

/* Era 3 (navy/gold/Archivo Black): bold gold borders */
#modal-panel.scorecard-era3 {
  border-left: 4px solid var(--color-accent);
  border-radius: 0 8px 8px 0;
}

#modal-panel.scorecard-era3 .stats-table th {
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.6rem;
}

/* Era 4 (charcoal/purple/Oswald): sharp edges, soft glow */
#modal-panel.scorecard-era4 {
  border-radius: 3px;
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.08);
}

#modal-panel.scorecard-era4 .stats-table th {
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.12em;
}

#modal-panel.scorecard-era4 .stats-table tbody tr:hover td {
  background: rgba(167, 139, 250, 0.07);
}

#modal-panel.scorecard-era4 .knockout-match.final-match {
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.2);
}

/* Era 5 (light/teal/DM Sans): clean minimal */
#modal-panel.scorecard-era5 {
  border-top: 2px solid var(--color-accent);
  border-radius: 8px;
}

/* Era 6 (cool white/rose/DM Sans): same clean structure, rose top line */
#modal-panel.scorecard-era6 {
  border-top: 2px solid var(--color-accent);
  border-radius: 8px;
}


/* ─── 10. Phase 4 — Animations & Parallax ─────────────────── */

/*
  B — Content reveal on card entry.

  Elements inside .season-card and .era-title-card start in their
  "hidden" state (opacity 0, translated down slightly). When JS adds
  .card-entered to the card, each child animates to its natural position
  with a staggered delay via --reveal-delay custom property.

  Era title cards use the same mechanism with .era-entered.
*/

/* ── Season card reveal ── */

.season-card .card-year,
.season-card .winner-badge,
.season-card .card-headline,
.season-card .content-section {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease,
    color 0.6s ease;
}

.season-card.card-entered .card-year {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0ms;
  /* translateY will be overridden by parallax after entry */
}

.season-card.card-entered .winner-badge {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 30ms;
}

.season-card.card-entered .card-headline {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 70ms;
}

.season-card.card-entered .content-section:nth-child(1) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 120ms;
}

/* ── Era title card reveal ── */

.era-title-card .era-eyebrow,
.era-title-card .era-divider,
.era-title-card .era-seasons-range,
.era-title-card .era-intro-text {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

/* .era-name reveal is handled per-character by Splitting.js (see below) */

.era-title-card.era-entered .era-eyebrow {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0ms;
}

.era-title-card.era-entered .era-divider {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 160ms;
}

.era-title-card.era-entered .era-seasons-range {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 200ms;
}

.era-title-card.era-entered .era-intro-text {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 260ms;
}

/*
  A — Parallax depth.

  GSAP ScrollTrigger now drives translateY on .card-year, .card-header,
  and the --blob-offset CSS variable on .era-title-card via scrubbed
  ScrollTrigger instances. No CSS transitions on transform needed here —
  GSAP handles timing. will-change: transform is kept for GPU compositing.
*/

/* ── Exit states (bidirectional reveal) ── */

.season-card.card-exited .card-year,
.season-card.card-exited .winner-badge,
.season-card.card-exited .card-headline,
.season-card.card-exited .content-section {
  opacity: 0;
  transform: translateY(-14px); /* exits upward — card scrolled above viewport */
}

.era-title-card.era-exited .era-eyebrow,
.era-title-card.era-exited .era-divider,
.era-title-card.era-exited .era-seasons-range,
.era-title-card.era-exited .era-intro-text {
  opacity: 0;
  transform: translateY(-12px);
}

/* ── Splitting.js — per-character era name reveal ── */

/* Each character starts hidden and slightly below its resting position */
.era-name .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
  /* Base 80ms offset to fire after eyebrow; each char staggers by 28ms */
  transition-delay: calc(var(--char-index) * 28ms + 80ms);
}

/* On card entry, chars cascade into place */
.era-title-card.era-entered .era-name .char {
  opacity: 1;
  transform: translateY(0);
}

/* On card exit, chars collapse upward quickly (shorter stagger) */
.era-title-card.era-exited .era-name .char {
  opacity: 0;
  transform: translateY(-10px);
  transition-delay: calc(var(--char-index) * 10ms);
}

/* ── Scroll progress bar ── */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 110;
  background: transparent;
  /* Pointer events on so tick hover works; fill/ticks are non-interactive */
}

#scroll-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  pointer-events: none;
  transition: background-color 0.6s ease;
}

/* Era boundary tick marks */
.progress-tick {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--color-bg);
  opacity: 0.6;
  pointer-events: none;
  transform: translateX(-50%);
  transition: background-color 0.6s ease;
}

/* Hover tooltip on progress bar */
#progress-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.2em 0.6em;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.1s ease,
    color 0.6s ease,
    background-color 0.6s ease,
    border-color 0.6s ease;
  z-index: 1;
}

#scroll-progress:hover #progress-tooltip {
  opacity: 1;
}


/* ─── Season of Their Life ──────────────────────────────────── */

.sotl-root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sotl-toggle {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.sotl-tab {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35em 1em;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-subtle);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sotl-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}

.sotl-panel-hidden {
  display: none;
}

.sotl-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
}

.sotl-card + .sotl-card {
  margin-top: 0.6rem;
}

.sotl-card-player {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}

.sotl-card-team {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-subtle);
  opacity: 0.7;
  margin-bottom: 0.4rem;
}

.sotl-card-stats {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-subtle);
}

.sotl-card-note {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-accent);
  opacity: 0.85;
  margin-top: 0.35rem;
  font-style: italic;
}

.sotl-section + .sotl-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}


/* ─── End-of-scroll toast ──────────────────────────────────── */

#end-toast {
  position: fixed;
  bottom: calc(var(--chip-bar-height) + 1.2rem);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: 0.45em 1.2em;
  font-family: var(--font-body);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--color-text);
  white-space: nowrap;
  z-index: 120;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    background-color 0.6s ease,
    border-color 0.6s ease,
    color 0.6s ease;
}

#end-toast.end-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
