/*
 * Styles for "Is the modern NBA really worse?". Dash loads every file in assets/.
 * Design plan: docs/design_plan.md. Gold always means the 1980s and cobalt always
 * means the 2020s; nothing else on the page uses those two colors.
 */

:root {
  --ink: #16202e;
  --muted: #5b6575;
  --paper: #ffffff;
  --wash: #eef1f5;
  --rule: #e6e9ee;
  --between: #b9c0cb;
  --gold: #e2a010;
  --gold-text: #8a5d00;
  --cobalt: #1f4fd8;

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Libre Franklin", Helvetica, Arial, sans-serif;

  --measure: 68ch;
  --bar-height: 84px;

  /* Dash 4 component theme: sliders, dropdowns and radio buttons in ink. */
  --Dash-Fill-Interactive-Strong: #16202e;
  --Dash-Text-Primary: #16202e;
  --Dash-Text-Strong: #16202e;
  --Dash-Text-Weak: #5b6575;
  --Dash-Font-Family: "Libre Franklin", Helvetica, Arial, sans-serif;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cobalt); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }

h1, h2, h3 { margin: 0; color: var(--ink); }
h2 { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1.05; letter-spacing: 0.005em; }
h3 { font-family: var(--body); font-weight: 700; font-size: 1.15rem; line-height: 1.35; margin-top: 2.25rem; }
p, ul, ol { max-width: var(--measure); }

.lead { font-size: 1.2rem; line-height: 1.55; }

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------ duotone photos */
/* A black-and-white photo blended over its era color. */
.duo { margin: 0; }
.duo__frame { position: relative; overflow: hidden; background: var(--between); }
.duo--80 .duo__frame { background: var(--gold); }
.duo--20 .duo__frame { background: var(--cobalt); }
.duo__frame img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.15) brightness(1.05);
  mix-blend-mode: multiply;
}
.duo--20 .duo__frame img { mix-blend-mode: luminosity; filter: grayscale(1) contrast(1.2) brightness(1.1); }
.duo figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.duo--small { width: 100%; max-width: 220px; justify-self: end; }
.duo--small .duo__frame { aspect-ratio: 4 / 5; }

/* ------------------------------------------------------------ hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  min-height: min(88vh, 760px);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.hero .duo--hero { height: 100%; display: flex; flex-direction: column; }
.hero .duo--hero .duo__frame { flex: 1; min-height: 420px; }
.hero .duo--hero figcaption {
  font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1;
  margin: 0; padding: 14px 20px 18px;
}
.hero .duo--80 figcaption { color: var(--gold-text); }
.hero .duo--20 figcaption { color: var(--cobalt); text-align: right; }
.hero .duo--80 .duo__frame img { object-position: 60% 20%; }
.hero .duo--20 .duo__frame img { object-position: 50% 15%; }

.hero__copy { padding: 56px 40px 64px; align-self: center; }
.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.2rem, 7.2vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.005em;
}
.hero__dek { font-size: 1.25rem; line-height: 1.5; margin: 22px 0 0; color: var(--ink); }
.hero__key { margin: 18px 0 0; color: var(--muted); font-size: 1rem; }
.key-80, .key-20 { font-weight: 700; padding-bottom: 1px; }
.key-80 { color: var(--gold-text); box-shadow: inset 0 -4px 0 var(--gold); }
.key-20 { color: var(--cobalt); box-shadow: inset 0 -4px 0 rgba(31, 79, 216, 0.35); }

/* The one load moment: the two eras slide in to meet the headline. Movement only,
   no fading, so the hero is still readable if the animation never runs. */
@keyframes from-left { from { transform: translateX(-10%); } to { transform: none; } }
@keyframes from-right { from { transform: translateX(10%); } to { transform: none; } }
.hero .duo--80 { animation: from-left 800ms cubic-bezier(.2, .7, .2, 1); }
.hero .duo--20 { animation: from-right 800ms cubic-bezier(.2, .7, .2, 1); }

/* ------------------------------------------------------------ control bar */
.control-bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.control-bar__inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 28px 6px;
  display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 10px 28px; align-items: center;
}
.control-bar label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }

.era-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.era-button {
  font: 600 0.9rem/1 var(--body); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--between); border-radius: 3px;
  padding: 8px 11px; cursor: pointer;
}
.era-button:hover { border-color: var(--ink); }
.era-button.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.era-key { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.era-key__ramp {
  width: 96px; height: 10px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--between), var(--cobalt));
}

/* Range slider (Dash 4): selected range and handles in ink, year boxes kept plain. */
.control-bar__slider .dash-slider-track { background: var(--rule); }
.control-bar__slider .dash-slider-thumb { background: var(--paper); border: 3px solid var(--ink); box-shadow: none; }
.control-bar__slider .dash-range-slider-input {
  font: 600 0.9rem var(--body); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--between); border-radius: 3px; width: 4.2em; text-align: center;
}

/* ------------------------------------------------------------ page layout */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 48px;
}

.rail { position: relative; }
.rail ol {
  position: sticky; top: calc(var(--bar-height) + 32px);
  list-style: none; margin: 48px 0 0; padding: 0;
  border-left: 2px solid var(--rule);
}
.rail__link {
  display: block; padding: 6px 0 6px 14px; margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; white-space: pre;
}
.rail__link:hover { color: var(--ink); }
.rail__link.is-current { color: var(--ink); font-weight: 700; border-left-color: var(--ink); }

.main { min-width: 0; padding-bottom: 80px; }

.section { padding: 72px 0 24px; scroll-margin-top: calc(var(--bar-height) + 8px); }
.section + .section { border-top: 1px solid var(--rule); }
.section > p, .section > ul { margin: 16px 0 0; }

/* ------------------------------------------------------------ summary */
.summary h2 { margin-bottom: 18px; }
.fold { max-width: var(--measure); border-top: 1px solid var(--rule); margin-top: 18px; }
.fold:last-child { border-bottom: 1px solid var(--rule); }
.fold summary {
  cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; font-family: var(--display); font-size: 1.6rem; line-height: 1; color: var(--muted); }
.fold[open] summary::after { content: "\2212"; }
.fold > p, .fold > ul { margin: 0 0 16px; }

/* ------------------------------------------------------------ claims */
.claim__head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 220px; gap: 8px 28px; align-items: start;
}
.claim__number {
  font-family: var(--display); font-weight: 900; font-size: 5.5rem; line-height: 0.8;
  color: var(--ink); min-width: 0.6em;
}
.claim__quote { display: block; font-size: clamp(2.2rem, 3.6vw, 3.1rem); line-height: 1.02; }
.claim__setup { margin: 16px 0 0; }
.claim__visual { justify-self: end; width: 100%; max-width: 220px; }
.court { display: block; width: 100%; height: auto; }

/* The 1980s against the 2020s, set like a box score. */
.box-score { width: 100%; max-width: 760px; border-collapse: collapse; margin: 36px 0 12px; }
.box-score th, .box-score td { padding: 10px 0; border-bottom: 1px solid var(--rule); text-align: left; }
.box-score thead th { font-size: 0.9rem; font-weight: 700; border-bottom: 2px solid var(--ink); padding-top: 0; }
.box-score tbody th { font-weight: 500; color: var(--ink); padding-right: 24px; width: 56%; }
.box-score td, .box-score thead th.era-80, .box-score thead th.era-20 { width: 22%; text-align: right; }
.box-score td { font-family: var(--display); font-weight: 800; font-size: 2.3rem; line-height: 1; }
.box-score .era-80 { color: var(--gold-text); }
.box-score .era-20 { color: var(--cobalt); }
.box-score thead .era-80 { box-shadow: inset 0 -4px 0 var(--gold); }
.box-score thead .era-20 { box-shadow: inset 0 -4px 0 var(--cobalt); }

.chart { margin: 28px 0 0; overflow: hidden; }
.caption { font-size: 0.95rem; color: var(--muted); margin: 28px 0 -12px; }

.inline-control { max-width: 640px; margin: 28px 0 0; }
.inline-control > label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.inline-control .dash-radioitems-inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 22px; }

/* The verdict closes each claim: set in ink, carried by its words. */
.verdict { margin: 40px 0 0; padding: 22px 0 0; border-top: 6px solid var(--ink); max-width: 820px; }
.verdict__text {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(1.8rem, 2.6vw, 2.3rem); line-height: 1.05;
}
.verdict ul { margin: 18px 0 0; padding-left: 1.1em; }
.verdict li { margin-bottom: 10px; }
.verdict li::marker { color: var(--between); }

/* ------------------------------------------------------------ conclusion */
.conclusion h2 { font-size: clamp(3rem, 6vw, 4.8rem); }
.conclusion .lead { margin-top: 14px; }
.scoreboard { width: 100%; border-collapse: collapse; margin: 36px 0 8px; }
.scoreboard th {
  text-align: left; font-size: 0.9rem; font-weight: 700; color: var(--ink);
  padding: 0 12px 10px 0; border-bottom: 2px solid var(--ink);
}
.scoreboard td { padding: 16px 12px 16px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.score__number a {
  font-family: var(--display); font-weight: 900; font-size: 2rem; line-height: 1;
  color: var(--ink); text-decoration: none;
}
.score__number a:hover { color: var(--cobalt); }
.score__claim { font-weight: 600; width: 30%; }
.score__verdict { font-family: var(--display); font-weight: 800; font-size: 1.35rem; line-height: 1.1; width: 20%; }
.score__evidence { color: var(--muted); font-size: 0.95rem; }

.conclusion__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.conclusion__grid p { margin-top: 10px; }


/* ------------------------------------------------------------ explore */
.explore__head { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; align-items: start; }
.explore__head p { margin: 16px 0 0; }
.explore .dash-dropdown, .explore #radar-picker { margin-top: 24px; }
.explore .dash-spreadsheet-container { margin-top: 12px; }

/* ------------------------------------------------------------ next steps */
.actions { list-style: none; padding: 0; margin: 28px 0 0; max-width: 820px; }
.action { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.action:first-child { border-top: 2px solid var(--ink); }
.action__number { font-family: var(--display); font-weight: 900; font-size: 2.6rem; line-height: 0.9; }
.action h3 { margin: 0 0 6px; }
.action p { margin: 0; color: var(--muted); }

/* ------------------------------------------------------------ sources */
.sources { font-size: 0.92rem; color: var(--muted); }
.sources h2 { font-size: 1.8rem; }
.credits { padding-left: 1.1em; margin-top: 12px; }
.credits li { margin-bottom: 6px; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail { display: none; }
  .control-bar__inner { grid-template-columns: 1fr; padding: 8px 18px 4px; }
  .era-key { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr 1fr; min-height: 0; }
  .hero__copy { grid-column: 1 / -1; grid-row: 1; padding: 36px 18px 24px; }
  .hero .duo--hero .duo__frame { min-height: 260px; }
  .hero .duo--hero figcaption { font-size: 1.2rem; padding: 10px 12px 14px; }
  .layout { padding: 0 18px; }
  .control-bar { position: static; }
  .claim__head { grid-template-columns: minmax(0, 1fr); }
  .claim__number { font-size: 4rem; }
  .claim__visual { justify-self: start; max-width: 160px; }
  .box-score td { font-size: 1.7rem; }
  .box-score tbody th { width: auto; }
  .scoreboard thead { display: none; }
  .scoreboard tr { display: grid; grid-template-columns: 40px 1fr; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .scoreboard td { border: 0; padding: 2px 0; width: auto; }
  .scoreboard td.score__number { grid-row: span 3; }
  .conclusion__grid, .explore__head { grid-template-columns: minmax(0, 1fr); }
  .explore__head .duo--small { justify-self: start; max-width: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero .duo--80, .hero .duo--20 { animation: none; }
}
