/* The Degrees That Went Quiet - three acts: paper / dark / paper.
   Paper tokens match sachindew27.github.io (swisoft); dark tokens from the
   validated design-engineering sheet (canvas #0f1115, CVD pair #4c8dff/#d95926). */

:root {
  --paper: #faf7f2; --ink: #26241f; --ink-soft: #6f6a5c;
  --p-accent: #4f7267; --hairline: #dbd2c0; --panel: #f2ecdf;

  --bg: #0f1115; --bg-1: #15181e; --bg-2: #1b1f27;
  --line: #22262f; --line-2: #2c313c;
  --tx: #eceff4; --tx-2: #a9b2c3; --tx-3: #7c8698;
  --ac: #4c8dff; --ac-tx: #8ab4ff; --hot: #ff7b52; --orange: #d95926;

  --font: "Avenir Next", Avenir, "Helvetica Neue", Seravek, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --dur: 140ms; --ease: cubic-bezier(.2, .7, .3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html:focus-within { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip;
}
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
.act-paper :focus-visible { outline-color: var(--p-accent); }

.col { max-width: 720px; margin-inline: auto; padding-inline: 24px; }
.act { padding-block: 72px; }
.act-paper { background: var(--paper); color: var(--ink); }
.act-dark { background: var(--bg); color: var(--tx); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

h1 {
  font-size: clamp(40px, 7vw, 66px);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  margin-block: 14px 18px;
}
h2 {
  font-size: clamp(24px, 4vw, 31px);
  font-weight: 700; line-height: 1.2; letter-spacing: -0.01em;
  margin-block: 6px 18px; max-width: 24ch;
}
h3 { font-size: 20px; font-weight: 700; margin-block: 40px 12px; }
p { max-width: 62ch; margin-block: 0 14px; }

.kicker {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--p-accent); max-width: none;
}
.act-dark .kicker { color: var(--ac-tx); }
.dek { font-size: 20px; line-height: 1.45; color: var(--ink-soft); max-width: 48ch; }

/* ------------------------------ hero ------------------------------ */
.hero { padding-block: 72px 0; }
.hero-official { display: flex; align-items: center; gap: 16px; margin-block: 34px 44px; }
#hero-spark { width: 190px; height: 44px; color: var(--ink); flex: none; }
.spark-label { font-size: 14px; color: var(--ink-soft); margin: 0; }

.hero-dark { background: var(--bg); color: var(--tx); position: relative; margin-top: 8px; }
#hero-strip { display: block; width: 100%; height: 130px; }
.hero-dark-copy { padding-block: 26px 34px; }
.giant {
  font-size: clamp(58px, 11vw, 108px);
  font-weight: 600; line-height: 1; letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.giant-sub { font-size: 19px; color: var(--tx-2); max-width: 52ch; }
.giant-sub .num { font-size: 15px; color: var(--tx-3); }
.anchor {
  font-size: 15px; color: var(--tx-2); max-width: 62ch;
  border-left: 2px solid var(--line-2); padding-left: 14px; margin-top: 18px;
}
.anchor strong { color: var(--tx); }
.scroll-cue { color: var(--tx-3); font-size: 22px; margin-top: 22px; }

/* ------------------------------ seams ------------------------------ */
.seam { height: 8px; background: linear-gradient(var(--paper), var(--bg)); }
.seam-close { background: linear-gradient(var(--bg), var(--paper)); }

/* ------------------------------ figures ------------------------------ */
figure { margin-block: 26px 30px; }
figure svg { width: 100%; height: auto; display: block; }
figcaption {
  font-size: 13px; color: var(--ink-soft);
  margin-top: 10px; max-width: 66ch;
}
.act-dark figcaption { color: var(--tx-3); }
.src { color: inherit; }
.footnote { font-size: 14px; color: var(--ink-soft); }
.act-dark .footnote { color: var(--tx-3); }
.callout {
  border-left: 3px solid var(--orange);
  padding-left: 16px; font-size: 18px; max-width: 56ch;
}

/* chart text */
svg text { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.act-paper .chart-grid { stroke: var(--hairline); }

/* ------------------------------ depth (technical) ------------------------------ */
details.depth { margin-block: 18px 6px; max-width: 66ch; }
details.depth summary {
  display: inline-block; cursor: pointer;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ac-tx); list-style: none;
}
details.depth summary::-webkit-details-marker { display: none; }
details.depth summary::before { content: "+ "; }
details.depth[open] summary::before { content: "\2212  "; }
.act-paper details.depth summary { color: var(--p-accent); }
details.depth[open] {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.act-paper details.depth[open] { background: var(--panel); border-color: var(--hairline); }
details.depth table {
  border-collapse: collapse; width: 100%; margin-top: 10px; font-size: 13.5px;
}
details.depth th, details.depth td { padding: 5px 10px 5px 0; text-align: right; }
details.depth th:first-child, details.depth td:first-child { text-align: left; }
details.depth th {
  font-weight: 600; border-bottom: 1px solid var(--line-2);
  font-family: var(--font);
}
.act-paper details.depth th { border-color: var(--hairline); }
details.depth td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
details.depth td:first-child { font-family: var(--font); }

/* ------------------------------ scrolly (field of lights) ------------------------------ */
.scrolly { position: relative; padding-block: 0; }
.graphic {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
#field-canvas { display: block; width: 100%; height: 100%; }
#field-labels { position: absolute; inset: 0; pointer-events: none; }
#field-labels .flabel {
  position: absolute;
  font-family: var(--mono); font-size: 11px;
  color: var(--tx-2); white-space: nowrap;
  transform: translateY(-50%);
  background: rgba(15, 17, 21, 0.72);
  padding: 2px 7px; border-radius: 4px;
}
.steps { position: relative; z-index: 2; pointer-events: none; }
.step {
  min-height: 88vh; min-height: 88svh;
  display: flex; align-items: center;
}
.step p {
  pointer-events: auto;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; max-width: 44ch;
  margin-left: max(24px, calc((100vw - 720px) / 2));
  font-size: 17px;
  backdrop-filter: blur(2px);
}
.step .num { color: var(--tx); font-weight: 600; }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .step p { background: rgba(15, 17, 21, 0.88); }
}

/* ------------------------------ toggle ------------------------------ */
.toggle-row { display: flex; gap: 8px; margin-block: 14px 4px; }
.tbtn {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--tx-2); background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 16px; cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tbtn.on { color: var(--tx); border-color: var(--ac); background: var(--bg-2); }
.tbtn.on::before { content: "\2713  "; }
.tbtn:hover { color: var(--tx); }

/* ------------------------------ lookup ------------------------------ */
.lookup-box { max-width: 560px; }
#lookup-card { max-width: none; }
#lookup-input {
  width: 100%; font: inherit; font-size: 16px;
  color: var(--tx); background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: 10px;
  padding: 12px 16px;
}
#lookup-input::placeholder { color: var(--tx-3); }
#lookup-results { margin-top: 6px; }
#lookup-results button {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 15px; color: var(--tx-2);
  background: none; border: none; border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
}
#lookup-results button:hover, #lookup-results button:focus-visible {
  background: var(--bg-2); color: var(--tx);
}
#lookup-results .st { color: var(--tx-3); font-size: 13px; }
#lookup-card {
  margin-top: 22px; border: 1px solid var(--line-2);
  border-radius: 12px; padding: 18px 20px;
  background: var(--bg-1);
}
#lookup-card:empty { display: none; }
#lookup-card h4 { font-size: 18px; margin-bottom: 2px; }
#lookup-card .st { color: var(--tx-3); font-size: 13px; margin-bottom: 12px; }
#lookup-card .big { font-size: 30px; font-weight: 600; }
#lookup-card .cmp { font-size: 14px; color: var(--tx-2); margin-top: 8px; max-width: 46ch; }
#lookup-card .gonenote { font-size: 15px; color: var(--tx-2); max-width: 46ch; }
.lookup-note { font-size: 13px; color: var(--tx-3); margin-top: 10px; }

/* ------------------------------ traps ------------------------------ */
.trap { margin-block: 26px; max-width: 66ch; }
.trap h3 { margin-block: 0 8px; display: flex; align-items: baseline; gap: 12px; }
.trap-n {
  flex: none; font-size: 13px; font-weight: 600;
  color: var(--p-accent); border: 1px solid var(--hairline);
  border-radius: 999px; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(-2px);
}

/* ------------------------------ data / footer ------------------------------ */
.downloads { list-style: none; margin-block: 8px 16px; }
.downloads li { margin-block: 6px; font-size: 15.5px; }
a { color: var(--p-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.act-dark a { color: var(--ac-tx); }
.site-footer { border-top: 1px solid var(--hairline); padding-block: 34px 56px; }
.site-footer .src { font-size: 13px; }

/* ------------------------------ motion ------------------------------ */
.drawable .draw-line { stroke-dasharray: 1600; stroke-dashoffset: 1600; }
.drawable.drawn .draw-line {
  animation: draw 900ms var(--ease) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.grow-bar { transform-box: fill-box; transform-origin: 0 50%; }
.grown .grow-bar { animation: growx 420ms var(--ease) backwards; animation-delay: calc(var(--i) * 30ms); }
@keyframes growx { from { transform: scaleX(0); } }
.grow-up { transform-origin: 50% 100%; }
.grow-down { transform-origin: 50% 0%; }
.grown .grow-up, .grown .grow-down {
  animation: growy 420ms var(--ease) backwards; animation-delay: calc(var(--i) * 30ms);
}
@keyframes growy { from { transform: scaleY(0); } }

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  .drawable .draw-line { stroke-dasharray: none; stroke-dashoffset: 0; }
  .drawable.drawn .draw-line, .grown .grow-bar { animation: none; }
}

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 900px) {
  .act { padding-block: 52px; }
  .step p { margin-inline: 18px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding-block: 48px 0; }
  .hero-official { flex-direction: column; align-items: flex-start; gap: 6px; }
  .giant-sub { font-size: 17px; }
  .step { min-height: 80vh; min-height: 80svh; }
}

@media print {
  .graphic, .lookup-box { display: none; }
  .act-dark { background: #fff; color: #000; }
  .act-dark svg text { fill: #000 !important; }
  .act-dark figcaption, .act-dark .footnote { color: #333; }
}

/* ------------------------------ hero call to action ------------------------------ */
.hero-cta { margin-top: 18px; font-size: 17px; }
.hero-cta a {
  font-weight: 600; border-bottom: 2px solid var(--p-accent);
  padding-bottom: 1px; text-decoration: none;
}
.hero-cta a:hover { text-decoration: none; background: var(--panel); }
.hero-cta a::after { content: " \2192"; }

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

/* ------------------------------ lookup listbox ------------------------------ */
#lookup-listbox { list-style: none; margin: 6px 0 0; padding: 0; }
#lookup-listbox li {
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 15px; color: var(--tx-2);
}
#lookup-listbox li.on, #lookup-listbox li:hover { background: var(--bg-2); color: var(--tx); }
#lookup-listbox .st { color: var(--tx-3); font-size: 13px; }

/* ------------------------------ the school view ------------------------------ */
#lookup-card { padding: 22px 24px; }
#lookup-card .kicker { margin-bottom: 6px; }
.school-name { font-size: clamp(21px, 3.4vw, 27px); margin-bottom: 14px; max-width: 22ch; }
#lookup-card p { font-size: 16px; }
.churn { color: var(--tx-2); }
.churn strong, .cmp strong { color: var(--tx); }
#lookup-card h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ac-tx); margin-block: 26px 12px;
}
ul.prog { list-style: none; margin: 0; padding: 0; }
ul.prog li {
  border-top: 1px solid var(--line); padding-block: 14px;
}
ul.prog li:first-child { border-top: none; }
.pname { display: block; font-size: 16.5px; font-weight: 600; color: var(--tx); }
.pmeta {
  display: block; font-family: var(--mono); font-size: 12px;
  color: var(--tx-3); margin-top: 3px;
}
.pfact { display: block; font-size: 14.5px; color: var(--tx-2); margin-top: 7px; max-width: 60ch; }
.pfact strong { color: var(--tx); font-family: var(--mono); }
.pflag, .prisk {
  display: block; font-size: 13.5px; color: var(--tx-3);
  margin-top: 5px; max-width: 60ch;
}
.pflag { border-left: 2px solid var(--line-2); padding-left: 10px; }
details.excl summary { color: var(--tx-3); }
details.excl[open] { margin-top: 14px; }
.excl-list li { border-top-color: var(--line); padding-block: 10px; }
.excl-list .pname { font-size: 15px; font-weight: 500; }
.school-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.school-actions .tbtn { text-decoration: none; display: inline-block; }
#cite-out:empty { display: none; }

.statelist { list-style: none; columns: 2; column-gap: 32px; margin-block: 6px 22px; }
.statelist li { break-inside: avoid; font-size: 14.5px; margin-block: 3px; }
@media (max-width: 640px) { .statelist { columns: 1; } }
