/* ============================================================
   THE MORNING EDITION — front-page layer.
   Tokens come from paper.css; this file only sets the stage.
   ============================================================ */

/* NOTE: no overflow-x:hidden on body — it silently kills position:sticky
   (the learn beat pins with it off; horizontal overflow is prevented at the
   element level instead) */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--red);
  color: var(--paper);
  font-family: var(--grot);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.6em 1em;
}
.skip-link:focus { left: 0; }

/* ---------- nameplate ---------- */
.nameplate {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 0 clamp(16px, 4vw, 48px);
}
.np-row { max-width: 1400px; margin: 0 auto; }
.np-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0 0.35rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.7rem;
}
.np-meta > :last-child { text-align: right; }
.np-mast-name {
  font-family: var(--grot);
  font-weight: 600;
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  letter-spacing: 0.18em;
  color: var(--ink);
  transition: font-size 200ms ease;
}
.np-nav {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.4rem);
  padding: 0.45rem 0;
}
.np-link {
  font-family: var(--grot);
  font-size: 0.72rem;
  font-weight: 540;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  background: none;
  border: none;
  cursor: pointer;
}
.np-link:hover { color: var(--red); }
.np-commissions { color: var(--red); }
.nameplate.condensed .np-meta { padding: 0.3rem 0 0.2rem; }
.nameplate.condensed .np-mast-name { font-size: 0.85rem; }

/* ---------- beat 0: headline ---------- */
.beat-hero {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 5rem) clamp(16px, 4vw, 48px) 0;
}
.headline {
  position: relative;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 10vw, 9.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 1.2rem;
  text-wrap: balance;
}
.hl-g {
  position: relative;
  transition: font-variation-settings 400ms ease, color 400ms ease;
  border-bottom: 2px solid transparent;
}
.hl-g.surprise { border-bottom-color: var(--red); }
.hl-g.oov { opacity: 0.75; }
.hl-g::after {
  content: attr(data-p);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--red);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  white-space: nowrap;
}
.headline.annotated .hl-g[data-p]::after,
.headline .hl-g[data-p]:hover::after { opacity: 1; }
.attn-arcs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.attn-arcs path { stroke: var(--red); fill: none; }

.hl-caption { color: var(--ink-2); margin-bottom: 1rem; max-width: 60ch; }
.hl-edit { margin-bottom: 1.6rem; }
.hl-edit-form { margin-top: 0.8rem; max-width: 34rem; }
.hl-edit-form .label-caps { display: block; margin-bottom: 0.5rem; }
.hl-edit-row { display: flex; gap: 0.6rem; }
.hl-input {
  flex: 1;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: 0.2em 0.1em;
  caret-color: var(--red);
}
.hl-input:focus { border-bottom-color: var(--red); outline: none; }
.hl-input:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.hl-oov-note { color: var(--ink-2); margin-top: 0.5rem; }

.deck {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.5;
  max-width: 46ch;
  color: var(--ink);
  margin-bottom: 1.8rem;
}
.deck em { font-style: italic; color: var(--red); }

.fold-doors {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
.door {
  flex: 1 1 10em;
  font-family: var(--grot);
  font-size: 0.78rem;
  font-weight: 580;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--ink);
  padding: 1rem 1.2rem;
  border-right: 1px solid var(--rule);
  white-space: nowrap;
}
.door:last-child { border-right: none; }
.door:hover { background: rgb(var(--red-rgb) / 0.05); color: var(--red); } /* lighter wash keeps red text ≥ 4.5:1 */
.door-red { color: var(--red); }

/* ---------- beat 1: the wire ---------- */
.wire {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem clamp(16px, 4vw, 48px);
  overflow: hidden;
  white-space: nowrap;
}
.wire-label { color: var(--ink-2); flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.5em; }
.wire-pulse {
  width: 6px; height: 6px;
  background: var(--rule);
  display: inline-block;
}
.wire-pulse.computing { background: var(--red); }
.wire-text { color: var(--ink); overflow: hidden; text-overflow: clip; }

/* ---------- beat 2: watch it learn ---------- */
.beat-learn { position: relative; }
.learn-sticky {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) clamp(16px, 4vw, 48px);
}
/* the scrub: on capable screens the sentence pins while the scroll travels the run
   (this block must come after the base rule — position would be overridden otherwise) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) and (min-width: 900px) {
  .beat-learn { height: 300vh; }
  .learn-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; }
}
.beat-label { color: var(--red); }
.rule-above { border-top: 1px solid var(--ink); padding-top: 0.6rem; }
.learn-counter {
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" 1;
}
.learn-rail { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; }
/* while the scroll drives the run continuously, per-frame weight updates must not fight the settle transition */
.headline-live .hl-g { transition: none; }
.rail-stop {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0.1em 0;
  cursor: pointer;
}
.rail-stop:hover { color: var(--ink); }
.rail-stop.is-active { color: var(--red); border-bottom-color: var(--red); }
.headline-learn {
  font-size: clamp(2rem, 6.4vw, 6rem);
  margin: 0;
  min-height: 2.2em;
}
.learn-caption { color: var(--ink-2); }
.loss-rail { width: 100%; height: 72px; display: block; }
.loss-rail .axis { stroke: var(--rule); stroke-width: 1; }
.loss-rail .curve { stroke: var(--ink-2); stroke-width: 1; fill: none; }
.loss-rail .mark { fill: var(--red); }
.loss-rail text { font-family: var(--mono); font-size: 9px; fill: var(--ink-2); }

/* ---------- beat 3: columns ---------- */
.beat-columns { max-width: 1400px; margin: 0 auto; padding: clamp(2.5rem, 6vh, 4.5rem) clamp(16px, 4vw, 48px); }
.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: 1.4rem;
}
.col { border-top: 2px solid var(--ink); padding-top: 0.9rem; min-width: 0; }
.col-head { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; line-height: 1.15; margin-bottom: 0.7rem; }
.col p { font-size: 0.98rem; line-height: 24px; }
.col-fig {
  background: var(--plate);
  border: 1px solid var(--rule);
  padding: 0.9rem 1rem;
  margin: 1.1rem 0;
}
.col-fig .label-caps { margin-bottom: 0.5rem; }
.col-specimen { font-style: italic; min-height: 5.5em; font-size: 0.95rem !important; }
.col-fig figcaption { color: var(--ink-2); margin-top: 0.6rem; }
.col-audit { color: var(--red); }
.slug { display: inline-block; margin-top: 0.4rem; color: var(--red); text-decoration: none; border-bottom: 1px solid transparent; font-size: 0.72rem; }
.slug:hover { border-bottom-color: var(--red); }

/* the self-annotating column */
#col-web.annotated {
  background-image: repeating-linear-gradient(
    to bottom,
    rgb(var(--red-rgb) / 0.12) 0,
    rgb(var(--red-rgb) / 0.12) 1px,
    transparent 1px,
    transparent 24px
  );
}
#col-web.annotated .col-head { outline: 1px dashed rgb(var(--red-rgb) / 0.5); outline-offset: 2px; }
#col-web.annotated::after {
  content: "measure 0–100% · leading 24px · Newsreader 600 / body 400 · baseline grid 24px";
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--red);
  margin-top: 0.6rem;
}

/* ---------- beat 4: wire map ---------- */
.beat-map { padding: clamp(2.5rem, 6vh, 4rem) 0 0; border-top: 1px solid var(--rule); }
.beat-map .beat-label { max-width: 1400px; margin: 0 auto 1rem; padding: 0 clamp(16px, 4vw, 48px); }
.wiremap { display: block; width: 100vw; height: 55vh; min-height: 320px; }
.map-datelines {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2.2rem;
  max-width: 1400px;
  margin: 0.8rem auto 0;
  padding: 0 clamp(16px, 4vw, 48px);
  color: var(--ink-2);
}
.map-caption {
  max-width: 1400px;
  margin: 0.6rem auto 0;
  padding: 0 clamp(16px, 4vw, 48px) 2.5rem;
  color: var(--red);
}

/* ---------- beat 5: ledger digest ---------- */
.beat-ledger { max-width: 1400px; margin: 0 auto; padding: clamp(2.5rem, 6vh, 4rem) clamp(16px, 4vw, 48px); }
.beat-ledger .ledger { margin-top: 1.2rem; }

/* ---------- the exhibits ---------- */
.beat-exhibits { max-width: 1400px; margin: 0 auto; padding: clamp(2.5rem, 6vh, 4rem) clamp(16px, 4vw, 48px); }
.section-lede { font-style: italic; color: var(--ink-2); margin: 0.8rem 0 1.4rem; max-width: 52ch; }
.exhibit-doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 2.5vw, 2rem); }
.exhibit-door {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--ink);
  padding: 1.2rem 1.3rem 1.4rem;
  background: var(--plate);
  transition: border-color 160ms ease;
}
.exhibit-door:hover { border-color: var(--red); border-top-color: var(--red); }
.exhibit-door:hover .ex-name, .exhibit-door:hover .ex-go { color: var(--red); }
.ex-num { color: var(--red); font-size: 0.7rem; }
.ex-name { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.ex-desc { font-size: 0.93rem; line-height: 22px; color: var(--ink-2); }
.ex-go { margin-top: auto; color: var(--ink-2); }
@media (max-width: 1000px) { .exhibit-doors { grid-template-columns: 1fr; } }

/* ---------- beat 6: the fold ---------- */
.fold-band {
  /* the paper flips to its own night edition for the footer — in both themes */
  --paper: #131110;
  --plate: #1c1915;
  --ink: #e7e1d3;
  --ink-2: #9a9280;
  --rule: #2e2a24;
  --red: #e2543c;
  --red-rgb: 226 84 60;
  --red-wash: rgba(226, 84, 60, 0.1);
  background: var(--paper);
  color: var(--ink);
  border-top: 1px solid #000;
  padding: clamp(3rem, 8vh, 6rem) clamp(16px, 4vw, 48px) 1.5rem;
}
.fold-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
}
.fold-head {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 6.5vw, 6.5rem);
  line-height: 0.98;
  margin-bottom: 1.6rem;
}
.rates-table { border-collapse: collapse; width: 100%; }
.rates-table th, .rates-table td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 1rem 0.55rem 0;
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 22px;
}
.rates-table th { color: var(--red); width: 7.5em; font-weight: 500; }
.fold-more { display: inline-block; margin-top: 1.1rem; color: var(--red); }

.fold-right .label-caps { color: var(--red); margin-bottom: 1rem; }
.write-form { display: flex; flex-direction: column; gap: 0.4rem; }
.write-form label { color: var(--ink-2); margin-top: 0.6rem; }
.wf-input {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-2);
  padding: 0.35em 0.1em;
  caret-color: var(--red);
  resize: vertical;
}
.wf-msg { border: 1px solid var(--rule); padding: 0.6em; line-height: 1.5; }
.wf-input:focus { border-color: var(--red); outline: none; }
.wf-input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.wf-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-top: 1rem; }
.key-btn-night { color: var(--ink); background: var(--paper); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.key-btn-night:hover { color: var(--red); border-color: var(--red); box-shadow: 2px 2px 0 var(--red); }
.wf-mail { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.wf-mail:hover { color: var(--red); border-color: var(--red); }
.wf-norm { color: var(--ink-2); margin-top: 1rem; }

.signage {
  font-family: var(--grot);
  font-weight: 640;
  font-size: clamp(3rem, 12.5vw, 12rem);
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  color: var(--ink);
  opacity: 0.14;
  margin: clamp(2rem, 6vh, 4rem) 0 0.5rem;
  user-select: none;
  white-space: nowrap;
}
.foot { text-align: center; color: var(--ink-2); padding-bottom: 1.2rem; }
.foot a { color: var(--red); }
.foot kbd {
  font-family: var(--mono);
  border: 1px solid var(--rule);
  padding: 0 0.35em;
}

/* ---------- mobile pill ---------- */
.mobile-pill {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 60;
  font-family: var(--grot);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: var(--red);
  padding: 0.7em 1.5em;
  box-shadow: 2px 2px 0 var(--ink);
}
@media (min-width: 900px) { .mobile-pill { display: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .columns { grid-template-columns: 1fr; }
  .fold-inner { grid-template-columns: 1fr; }
  .np-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .np-nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 700px) {
  .np-meta { grid-template-columns: auto 1fr; }
  .np-meta > #edition-no { display: none; }
  .wire-label .wire-tag-long { display: none; }
  .headline { font-size: clamp(2.6rem, 12vw, 4rem); }
  .map-datelines { flex-direction: column; }
  /* the nav wraps instead of hiding its tail — the edition switch must be reachable */
  .np-nav { flex-wrap: wrap; overflow: visible; row-gap: 0.15rem; }
  .signage { font-size: 11vw; letter-spacing: 0.02em; }
}

/* ---------- motion discipline ---------- */
@media (prefers-reduced-motion: reduce) {
  .hl-g { transition: none; }
  .wire-pulse { transition: none; }
  .wire { display: none; } /* a ticker that will never tick should not render */
}
.hl-tools { margin-bottom: 0.9rem; }

/* ---------- print ---------- */
@media print {
  .wire, .mobile-pill, .hl-edit, .hl-tools, .np-nav, .attn-arcs,
  .learn-rail, #learn-caption, .col-fig-self, .print-hide,
  .write-form label, .write-form .wf-input,
  .hl-caption.js-only { display: none !important; }
  /* the static caption reads correctly on paper — surface it even with JS on */
  :root.js .no-js-only.hl-caption { display: block !important; }
  .fold-band { --paper: #ffffff; --ink: #111; --ink-2: #444; --rule: #bbb; --red: #b02a18; border-top: 2px solid #111; }
  .beat-learn { height: auto; }
  .signage { opacity: 0.25; }
}
