/* ============================================================================
   ISL — shared styles
   Used by index.html (landing), team.html, player.html. Each page also has
   page-specific CSS inline. Tokens, reset, nav, ticker, table, badges,
   reveals, footer live here.
   ============================================================================ */

:root {
  /* Tell the browser to render native UI controls (date picker, scrollbars,
     calendar icon) in dark mode. Without this, <input type="date"> shows a
     dark calendar icon on our dark background and is invisible. */
  color-scheme: dark;

  --bg:           oklch(0.155 0.012 35);
  --bg-raised:    oklch(0.20 0.014 35);
  --bg-deeper:    oklch(0.12 0.010 35);
  /* Borders lifted so card edges and separators are visible against the
     three background tiers above. */
  --line:         oklch(0.36 0.016 38);
  --line-soft:    oklch(0.30 0.012 38);
  /* Ink tiers tuned for WCAG AA on the darkest background tier. Older eyes
     lose contrast sensitivity first; the previous ink-3 (≈4:1) and ink-faint
     (≈2:1) failed AA outright. New targets: ink-2 ≈9:1 (AAA), ink-3 ≈5.7:1
     (AA), ink-faint ≈4.6:1 (AA). Same hue family, just brighter. */
  --ink:          oklch(0.97 0.010 70);
  --ink-2:        oklch(0.78 0.012 55);
  --ink-3:        oklch(0.68 0.012 50);
  --ink-faint:    oklch(0.64 0.012 45);

  --ember:        oklch(0.74 0.190 50);
  --ember-hi:     oklch(0.86 0.170 65);
  --ember-deep:   oklch(0.45 0.150 42);
  --ember-tint:   oklch(0.74 0.190 50 / 0.10);

  --ct:           oklch(0.66 0.140 235);
  --hel:          oklch(0.78 0.160 75);

  --live:         oklch(0.68 0.22 22);
  --win:          oklch(0.78 0.140 145);
  --loss:         oklch(0.62 0.150 25);

  --max:          1440px;
  --gutter:       clamp(20px, 4vw, 56px);

  --surface-base:   oklch(0.155 0.012 35);
  --surface-recess: oklch(0.128 0.010 35);

  --t-display: "Big Shoulders Display", "Arial Narrow", system-ui, sans-serif;
  --t-body:    "Sora", system-ui, -apple-system, sans-serif;
  --t-mono:    "Azeret Mono", ui-monospace, "SFMono-Regular", monospace;

  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-out-expo:  cubic-bezier(0.19, 1, 0.22, 1);
}

/* Respect OS-level "Increase Contrast" preference. Common with older users
   who set it system-wide; we lift the same tokens a second time so labels
   and separators get a further boost without changing the default look. */
@media (prefers-contrast: more) {
  :root {
    --ink-2:     oklch(0.86 0.012 55);
    --ink-3:     oklch(0.78 0.012 50);
    --ink-faint: oklch(0.70 0.012 45);
    --line:      oklch(0.50 0.016 38);
    --line-soft: oklch(0.42 0.012 38);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--t-body);
  /* Bumped from 16px / 1.55 — older audience leans on slightly larger body
     with more breathing room. Everything that uses em / rem cascades from
     here, so the lift propagates through most of the site automatically. */
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;

  background-image:
    radial-gradient(ellipse 70% 50% at 10% 0%,  oklch(0.26 0.06 50  / 0.55), transparent 70%),
    radial-gradient(ellipse 55% 40% at 95% 20%, oklch(0.22 0.07 30  / 0.50), transparent 70%),
    radial-gradient(ellipse 70% 30% at 50% 100%, oklch(0.22 0.05 240 / 0.18), transparent 70%);
}

::selection { background: var(--ember); color: var(--bg-deeper); }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.10;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ── nav ─────────────────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  background: oklch(0.155 0.012 35 / 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.wordmark {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--t-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.wordmark .mark {
  width: 26px; height: 26px;
  border: 1.5px solid var(--ember);
  display: grid; place-items: center; color: var(--ember);
  font-family: var(--t-mono); font-size: 11px; font-weight: 600;
}
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 500;
  position: relative;
  transition: color 200ms var(--ease-out-quart);
}
.nav-links a:hover { color: var(--ember); }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -8px;
  height: 1px; background: var(--ember);
  transition: right 360ms var(--ease-out-expo);
}
.nav-links a:hover::after { right: 0; }
.nav-signin {
  font-family: var(--t-display);
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 9px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  transition: all 220ms var(--ease-out-quart);
}
.nav-signin:hover { border-color: var(--ember); color: var(--ember); }

@media (max-width: 720px) { .nav-links { display: none; } }

/* ── live ticker ─────────────────────────────────────────────────────── */

.ticker {
  background: var(--bg-deeper);
  border-bottom: 1px solid var(--line-soft);
  height: 38px;
  display: flex; align-items: stretch;
  overflow: hidden; position: relative; z-index: 4;
}
.ticker-tag {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: var(--live);
  color: var(--ink);
  font-family: var(--t-display);
  font-weight: 900;
  letter-spacing: 0.16em;
  font-size: 13px;
  text-transform: uppercase;
  flex-shrink: 0; position: relative; z-index: 2;
}
.ticker-tag .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink);
  animation: pulse 1.2s infinite;
}
.ticker-track { flex: 1; display: flex; overflow: hidden; position: relative; }
.ticker-track::after {
  content: "";
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  background: linear-gradient(90deg, transparent, var(--bg-deeper));
  pointer-events: none; z-index: 2;
}
.ticker-marquee {
  display: flex; white-space: nowrap;
  animation: marquee 75s linear infinite;
  will-change: transform;
}
.ticker-marquee > span {
  display: inline-flex; align-items: center;
  gap: clamp(10px, 1.2vw, 16px);
  padding: 0 clamp(20px, 2.5vw, 36px);
  height: 100%;
  border-right: 1px solid var(--line);
  font-family: var(--t-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.ticker-marquee .t-team {
  font-family: var(--t-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--ember);
}
.ticker-marquee .t-score {
  font-family: var(--t-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  padding: 0 4px;
  display: inline-flex; align-items: center;
}
.ticker-marquee .t-score .s { color: var(--ink-2); }
.ticker-marquee .t-score .s.is-win { color: var(--win); }
.ticker-marquee .t-dash { color: var(--ink-faint); margin: 0 6px; font-weight: 500; }
.ticker-marquee .t-meta { color: var(--ink-2); font-size: 11px; letter-spacing: 0.08em; }
.ticker-marquee .t-meta .map { color: var(--ember-hi); }
.ticker-marquee .t-meta .t-dot { color: var(--ink-faint); margin: 0 2px; }
.ticker-marquee .t-label {
  font-family: var(--t-display);
  font-weight: 800;
  color: var(--ember);
  letter-spacing: 0.16em;
  font-size: 12px;
  margin-right: 4px;
}
.ticker-sep { display: none; }
.ticker:hover .ticker-marquee { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.82); } }

/* ── shared section frame ───────────────────────────────────────────── */

/* Sections sit on alternating full-bleed bands so the page reads as distinct
   chapters instead of one continuous scroll. The .section box stays
   constrained to var(--max); a ::before extends a colored band to viewport
   edges behind it. */
.section {
  position: relative;
  isolation: isolate;
  padding: clamp(64px, 8vw, 130px) var(--gutter);
  max-width: var(--max); margin: 0 auto;
}
.section::before {
  content: "";
  position: absolute;
  inset: 0;
  /* extend the band to the viewport edges, regardless of how much gutter the
     section's parent left around it */
  margin-left:  calc((100% - 100vw) / 2);
  margin-right: calc((100% - 100vw) / 2);
  background: var(--surface-base);
  z-index: -1;
}
.section--recess::before { background: var(--surface-recess); }

/* Small roman-numeral broadcast bug, anchored to the section's top-right. */
.section-tag {
  position: absolute;
  top: clamp(20px, 2.5vw, 36px);
  right: var(--gutter);
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
.section-tag .num {
  font-family: var(--t-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-right: 6px;
  color: var(--ember);
}
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; margin-bottom: clamp(32px, 4vw, 56px); flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--t-display);
  font-weight: 900;
  font-size: clamp(48px, 6vw, 110px);
  line-height: 0.88;
  letter-spacing: -0.022em;
  text-transform: uppercase;
}
.section-head h2 em { font-style: normal; color: var(--ember); }
.section-head .stamp {
  font-family: var(--t-mono);
  font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.16em; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.section-head .stamp .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--win);
  box-shadow: 0 0 10px oklch(0.78 0.140 145 / 0.7);
}

/* small back-to-landing link used in nested pages */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 200ms var(--ease-out-quart);
}
.back-link:hover { color: var(--ember); }

/* ── data table ─────────────────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--t-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.table thead th {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-align: right;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table thead th:first-child,
.table thead th.left { text-align: left; }
.table tbody td {
  padding: 16px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  transition: background 200ms var(--ease-out-quart);
  white-space: nowrap;
}
.table tbody td:first-child,
.table tbody td.left { text-align: left; }
.table tbody tr:hover td { background: oklch(0.21 0.014 35 / 0.6); }
.table tbody tr.link-row { cursor: pointer; }
.table tbody tr.link-row:hover td { background: oklch(0.22 0.020 38 / 0.7); }

.rank {
  font-family: var(--t-display);
  font-weight: 800;
  font-size: 22px; width: 56px;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}
.rank.top { color: var(--ember); }
.team-cell { display: flex; align-items: center; gap: 14px; }
.team-cell .chip { width: 10px; height: 28px; flex-shrink: 0; }
.team-cell .name {
  font-family: var(--t-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--ink);
}
.team-cell .tag {
  font-family: var(--t-mono);
  font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em;
}
.team-cell a { color: inherit; transition: color 200ms var(--ease-out-quart); }
.team-cell a:hover { color: var(--ember); }

.num-big {
  font-family: var(--t-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.delta-pos { color: var(--win); }
.delta-neg { color: var(--loss); }
.pts {
  font-family: var(--t-display);
  font-weight: 900;
  font-size: 26px;
  color: var(--ember);
  letter-spacing: -0.01em;
}
@media (max-width: 760px) {
  .table thead th.opt, .table tbody td.opt { display: none; }
  .rank { width: 36px; font-size: 18px; }
  .team-cell .name { font-size: 14px; }
}

/* ── team badge + player avatar ─────────────────────────────────────── */

.team-badge {
  display: inline-grid;
  place-items: center;
  background: var(--c, var(--ink-faint));
  color: var(--fg, var(--ink));
  border: 1px solid color-mix(in oklch, var(--c, var(--ink-faint)), oklch(0 0 0) 32%);
  font-family: var(--t-display);
  font-weight: 900;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1;
  flex-shrink: 0;
  font-feature-settings: "ss01";
}
.team-badge-sm { width: 34px;  height: 34px;  font-size: 12px;  letter-spacing: 0; }
.team-badge-md { width: 48px;  height: 48px;  font-size: 16px;  letter-spacing: -0.005em; }
.team-badge-lg { width: 96px;  height: 96px;  font-size: 28px;  letter-spacing: -0.02em;  border-width: 2px; }
.team-badge-xl { width: 144px; height: 144px; font-size: 44px;  letter-spacing: -0.03em;  border-width: 2px; }

.team-badge.has-logo { padding: 0; overflow: hidden; }
.team-badge-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.player-avatar {
  display: block;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.player-avatar-sm { width: 38px;  height: 38px; }
.player-avatar-md { width: 72px;  height: 72px; }
.player-avatar-lg { width: 112px; height: 112px; border-width: 2px; }
.player-avatar-xl { width: clamp(180px, 22vw, 260px); height: clamp(220px, 26vw, 320px); border-width: 2px; }

.portrait-skel {
  background: linear-gradient(135deg, var(--line-soft), var(--line));
  border: 1px solid var(--line);
  display: inline-block;
}
.portrait-skel.team-lg     { width: 96px;  height: 96px;  border-width: 2px; }
.portrait-skel.player-lg   { width: 112px; height: 112px; border-width: 2px; }

/* ── footer ──────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  padding: clamp(48px, 5vw, 80px) var(--gutter) 40px;
  max-width: var(--max); margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
}
.foot-mark {
  font-family: var(--t-display);
  font-weight: 900;
  font-size: clamp(48px, 6vw, 92px);
  line-height: 0.88;
  letter-spacing: -0.022em;
  text-transform: uppercase;
}
.foot-mark em { color: var(--ember); font-style: normal; }
.foot-mark .seal {
  display: inline-block;
  font-family: var(--t-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  margin-top: 16px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}
.foot-col h4 {
  font-family: var(--t-mono);
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 16px;
}
.foot-col ul { list-style: none; display: grid; gap: 8px; }
.foot-col li a { color: var(--ink-2); font-size: 14px; transition: color 200ms; }
.foot-col li a:hover { color: var(--ember); }
.foot-bar {
  border-top: 1px solid var(--line-soft);
  padding: 18px var(--gutter);
  max-width: var(--max); margin: 0 auto;
  font-family: var(--t-mono);
  font-size: 11px;
  color: var(--ink-faint);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  letter-spacing: 0.08em;
}
@media (max-width: 820px) { .foot { grid-template-columns: 1fr; gap: 32px; } }

/* ── loading & error states ──────────────────────────────────────────── */

.skel {
  display: inline-block;
  background: linear-gradient(90deg, var(--line-soft) 0%, var(--line) 50%, var(--line-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 2px;
  height: 1em;
  vertical-align: middle;
  color: transparent;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.error-note {
  font-family: var(--t-mono);
  font-size: 12px;
  color: var(--loss);
  letter-spacing: 0.08em;
  padding: 12px;
  border: 1px solid var(--loss);
  margin: 12px 0;
}

/* ── scroll reveals (IntersectionObserver-driven) ───────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 720ms var(--ease-out-expo),
              transform 720ms var(--ease-out-expo);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }

/* ── entrance animations on dynamic content ─────────────────────────── */

@keyframes card-enter {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes row-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes portrait-fade {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
/* Shared hero-entrance primitives. Elements set their own initial opacity:0
   + transform, then animate to the `to` state. */
@keyframes rise    { to { opacity: 1; transform: translateY(0); } }
@keyframes stretch { to { transform: scaleX(1); } }

.table tbody tr {
  animation: row-enter 480ms var(--ease-out-quart) backwards;
  animation-delay: calc(var(--row-i, 0) * 70ms);
}
.player-avatar { animation: portrait-fade 500ms var(--ease-out-quart) backwards; }
.team-badge    { animation: portrait-fade 420ms var(--ease-out-quart) backwards; }

/* ── reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ticker-marquee { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .table tbody tr, .player-avatar, .team-badge { animation: none; }
}
