/* Wikipedia Summarizer
 *
 * Pure white / pure black, editorial typography, nothing decorative that is not
 * data. Bodoni Moda for display, Spectral for anything that is itself prose,
 * IBM Plex Mono for every label and figure.
 *
 * Both data palettes validated with the six-checks validator against the exact
 * surfaces used here (#ffffff and #000000).
 */

:root {
  color-scheme: light;

  --bg:          #ffffff;
  --bg-2:        #f5f5f5;
  --ink:         #000000;
  --ink-2:       #3d3d3d;
  --ink-3:       #767676;
  --rule:        #e2e2e2;
  --rule-strong: #bdbdbd;
  --accent:      #b3261e;

  /* Categorical slots, fixed order, never cycled. Bright and saturated, but
     hue-adjusted from the obvious blue/green/red/purple set: that combination
     fails CVD separation outright (its red and green measure deltaE 5.0 to
     deuteranopes). Orange-red replaces pure red and the greens are re-stepped
     so every adjacent pair clears the floor. The remaining warn on
     green vs orange-red is why every chart also carries value labels. */
  --series-1:    #c4402c;   /* TextRank */
  --series-2:    #2a72c9;   /* LSA      */
  --series-3:    #c98500;   /* Luhn     */
  --series-4:    #0f9668;   /* MMR      */

  --display: "Bodoni Moda", Didot, "Palatino Linotype", Georgia, serif;
  --body:    "Spectral", "Iowan Old Style", Palatino, Georgia, serif;
  --mono:    "IBM Plex Mono", ui-monospace, Consolas, monospace;
  /* Card titles and descriptions take a UI sans; running prose stays serif. */
  --sans-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --page: 78rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #000000;
    --bg-2:        #131313;
    --ink:         #ffffff;
    --ink-2:       #c9c9c9;
    --ink-3:       #8a8a8a;
    --rule:        #262626;
    --rule-strong: #3f3f3f;
    --accent:      #f0584a;
    --series-1:    #cf5a45;
    --series-2:    #4f8ad8;
    --series-3:    #b58619;
    --series-4:    #2fa070;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #000000;
  --bg-2:        #131313;
  --ink:         #ffffff;
  --ink-2:       #c9c9c9;
  --ink-3:       #8a8a8a;
  --rule:        #262626;
  --rule-strong: #3f3f3f;
  --accent:      #f0584a;
  --series-1:    #cf5a45;
  --series-2:    #4f8ad8;
  --series-3:    #b58619;
  --series-4:    #2fa070;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}

h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: .5px; text-underline-offset: 3px; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 2.5rem; }
::selection { background: var(--ink); color: var(--bg); }

.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;
}

/* ------------------------------------------------------------------ nav -- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  max-width: var(--page); margin: 0 auto; padding: 0 2.5rem;
  height: 3.25rem; display: flex; align-items: center; gap: 1.8rem;
}
.nav-brand {
  font-family: var(--display); font-size: 1rem; font-weight: 500;
  color: var(--ink); text-decoration: none; margin-right: auto;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav a.nav-link {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
  white-space: nowrap; border-bottom: 1px solid transparent; padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.nav a.nav-link:hover { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 46rem) { .nav-link { display: none; } }

.icon-btn {
  border: 1px solid var(--rule-strong); background: none; color: var(--ink-2);
  width: 1.9rem; height: 1.9rem; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: .75rem; flex: none;
  transition: background .2s, color .2s, transform .3s;
}
.icon-btn:hover { background: var(--ink); color: var(--bg); transform: rotate(180deg); }

/* ----------------------------------------------------------------- hero -- */

.hero { padding: 4.5rem 0 3rem; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: .98; letter-spacing: -0.025em; font-weight: 500;
  margin-bottom: 2.5rem; text-wrap: balance;
}

.demo-row {
  display: flex; align-items: baseline; gap: 1rem;
  border-bottom: 1.5px solid var(--ink); padding-bottom: .5rem;
  max-width: 40rem; transition: border-color .25s;
}
.demo-row:focus-within { border-bottom-color: var(--accent); }
.demo-row input {
  flex: 1; min-width: 0; font-family: var(--display);
  font-size: 1.45rem; line-height: 1.3; background: none; border: 0;
  color: var(--ink); padding: 0;
}
.demo-row input::placeholder { color: var(--ink-3); font-style: italic; }
.demo-row input:focus { outline: none; }

.btn {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; cursor: pointer; white-space: nowrap;
  background: none; border: 0; color: var(--ink); padding: .3rem 0;
  position: relative; flex: none;
}
.btn::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .3s;
}
.btn:hover::after { transform: scaleX(1); }
.btn:disabled { color: var(--ink-3); cursor: progress; }

.suggests {
  margin: 1rem 0 0; font-family: var(--mono); font-size: .7rem;
  color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
}
.suggests button {
  font: inherit; background: none; cursor: pointer; color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 2rem; padding: .22rem .75rem;
  transition: color .2s, background .2s, border-color .2s;
}
.suggests button:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.notice {
  font-family: var(--mono); font-size: .78rem; color: var(--ink-2);
  margin: 1.5rem 0 0; border-left: 2px solid var(--accent); padding: .6rem .9rem;
  background: var(--bg-2);
}
.spinner {
  width: .75rem; height: .75rem; border: 1.5px solid var(--rule-strong);
  border-top-color: var(--accent); border-radius: 50%; display: inline-block;
  vertical-align: -1px; margin-right: .5rem; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- sections -- */

section { padding: 3.5rem 0; border-top: 1px solid var(--rule); }
/* The nav is sticky, so anchor jumps must clear it or the heading lands under. */
section[id], .figure { scroll-margin-top: 4.5rem; }

.article-title {
  font-family: var(--display); font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.05; letter-spacing: -0.02em; font-weight: 500;
}
.article-meta {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-3);
  letter-spacing: .04em; margin: .6rem 0 2.5rem;
}
.section-title {
  font-family: var(--display); font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em; font-weight: 500; margin-bottom: 2.5rem;
}

/* ---------------------------------------------------------------- cards -- */

.cards { display: grid; gap: 0 3rem; }
@media (min-width: 58rem) { .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cards > .card { min-width: 0; }

.card {
  border-top: 1px solid var(--rule); padding: 1.4rem 0 1.8rem;
  display: flex; flex-direction: column;
}
.card.reference {
  grid-column: 1 / -1; border-top: 2px solid var(--ink);
  background: var(--bg-2); padding: 1.5rem 1.8rem 1.6rem; margin-bottom: 2rem;
}
.card > header {
  display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
  margin-bottom: .9rem;
}
.card .dot {
  width: .5rem; height: .5rem; border-radius: 50%; flex: none;
  transform: translateY(-1px);
}
.card .tag {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 500;
}
.card .meta {
  margin-left: auto; font-family: var(--mono); font-size: .64rem;
  color: var(--ink-3); letter-spacing: .03em;
}
.summary-text { font-size: 1rem; line-height: 1.68; flex: 1; }

.sumstats {
  display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: .4rem 0 0;
  padding-top: .8rem; border-top: 1px solid var(--rule);
}
.sumstats div { display: flex; align-items: baseline; gap: .35rem; }
.sumstats dt {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3);
}
.sumstats dd {
  margin: 0; font-family: var(--mono); font-size: .8rem; font-weight: 500;
  color: var(--ink); font-variant-numeric: tabular-nums;
}

.cardscores {
  display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-top: .6rem;
  padding-top: .7rem; border-top: 1px solid var(--rule);
}
.cardscores span { display: flex; align-items: baseline; gap: .35rem; }
.cardscores i {
  font-style: normal; font-family: var(--mono); font-size: .6rem;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.cardscores b {
  font-family: var(--mono); font-size: .84rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cardscores .reach { margin-left: auto; }
.cardscores .reach b { color: var(--accent); }

/* -------------------------------------------------------------- figures -- */

/* Charts live in a two-column card grid: eyebrow, title, one-line description,
   then the chart. Each card is a self-contained unit rather than one item in a
   run of stacked rules.

   minmax(0, 1fr), not 1fr: a grid track sizes to min-content by default, so a
   wide chart inside would refuse to shrink and push the page sideways. */
.chart-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 62rem) {
  .chart-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.chart-grid > .figure.wide { grid-column: 1 / -1; }

.figure {
  min-width: 0; margin: 0;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 14px;
  padding: 1.5rem 1.6rem 1.4rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  transition: box-shadow .2s;
  display: flex; flex-direction: column;
}
.figure:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, .07); }
:root[data-theme="dark"] .figure,
:root:not([data-theme="light"]) .figure { box-shadow: none; }

.fig-num {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  margin: 0 0 .35rem;
}
.fig-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .35rem; }
.fig-title {
  font-family: var(--sans-ui); font-size: 1.14rem; font-weight: 650;
  letter-spacing: -0.015em; color: var(--ink); text-transform: none;
  line-height: 1.25;
}
.fig-desc {
  font-family: var(--sans-ui); font-size: .84rem; color: var(--ink-3);
  line-height: 1.55; margin: 0 0 1.5rem; max-width: 68ch;
}
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-bottom: 1.2rem; }
.legend .item {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-2);
}
.legend .swatch { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
.legend .swatch.ceiling {
  width: .9rem; height: 0; border-top: 1.5px dashed var(--ink); border-radius: 0;
}

.chart-scroll { overflow-x: auto; max-width: 100%; }
svg.chart { display: block; width: 100%; min-width: 0; height: auto; }
svg.chart text { font-family: var(--mono); fill: var(--ink-3); }
svg.chart .val { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
svg.chart .val.lead { fill: var(--ink); font-weight: 500; }
svg.chart .grid { stroke: var(--rule); stroke-width: 1; }
svg.chart .axis { stroke: var(--ink); stroke-width: 1; }
svg.chart .grouplabel { fill: var(--ink); font-weight: 500; letter-spacing: .06em; }
svg.chart [tabindex] { transition: opacity .2s; }
svg.chart [tabindex]:hover, svg.chart [tabindex]:focus-visible { opacity: .75; outline: none; }

.viz-tip {
  position: fixed; z-index: 200; pointer-events: none; opacity: 0;
  transition: opacity .12s; background: var(--ink); color: var(--bg);
  padding: .5rem .7rem; font-family: var(--mono); font-size: .68rem;
  line-height: 1.5; max-width: 16rem;
}
.viz-tip b { font-weight: 500; }

/* --------------------------------------------------------------- tables -- */

/* max-width:100% is required: without it the grid/flex parent sizes to the
   table's min-width and the page scrolls horizontally instead of the box. */
.table-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 3.5rem; }
table { border-collapse: collapse; width: 100%; min-width: 46rem; }
caption {
  text-align: left; font-family: var(--mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  padding-bottom: .9rem; caption-side: top;
  /* The caption inherits the table's min-width and would widen the scroll box;
     pinning it to the viewport keeps the horizontal scroll on the table alone. */
  width: 0; min-width: 100%;
}
th, td { padding: .7rem .9rem; text-align: right; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
thead th {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 400;
  border-bottom: 1px solid var(--ink); white-space: nowrap;
}
tbody td {
  font-family: var(--mono); font-size: .8rem; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
tbody tr:hover { background: var(--bg-2); }
tbody td.best { color: var(--ink); font-weight: 500; }
tbody tr.ceiling-row td { border-bottom: 1px solid var(--ink); color: var(--ink); }
td .method {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--mono); font-size: .8rem; color: var(--ink);
}
td .method .dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
td .method .dot.ceiling { border: 1.5px dashed var(--ink); background: none; }

/* --------------------------------------------------------------- footer -- */

footer {
  padding: 2.5rem 0 4rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: .66rem; color: var(--ink-3);
}
footer .wrap { display: flex; flex-wrap: wrap; gap: .8rem 2rem; justify-content: space-between; }

@media (max-width: 44rem) {
  .wrap, .nav-inner { padding: 0 1.3rem; }
  .hero { padding: 3rem 0 2rem; }
  section { padding: 2.5rem 0; }
  .card.reference { padding: 1.2rem 1.2rem 1.1rem; }
}
