/* ==========================================================================
   The Build Journal · Research Supplement
   Broadsheet layout: nameplate, the fold, sections, columns, back matter.
   Interactive pieces live in press-ui.css.
   ========================================================================== */

:root {
  --paper: #f5f2ea;
  --paper-2: #ebe6da;
  --paper-3: #ddd6c6;
  --sheet: #f8f6f0;
  --desk: #2b2925;
  --ink: #141414;
  --ink-2: #3a3936;
  --grey: #77746c;
  --hair: #cfc9bb;
  --hair-2: #a9a395;
  --spot: #d9301c;
  --spot-2: #9c1f10;
  --spot-wash: rgba(217, 48, 28, 0.1);
  --good: #23784a;
  --bad: #c0281b;
  --warn: #b77b00;
  --f-flag: "UnifrakturMaguntia", "Old English Text MT", serif;
  --f-head: "Noto Serif Display", "Times New Roman", serif;
  --f-body: "Source Serif 4", Georgia, serif;
  --f-sans: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif;
  --f-code: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --measure: 37.5rem;
  --wide: 62rem;
  --text: 1.16rem;
  --lh: 1.6;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

.ed-dfs    { --spot: #d9301c; --spot-2: #9c1f10; --spot-wash: rgba(217, 48, 28, 0.1); }
.ed-ballot { --spot: #1f45d6; --spot-2: #132a8a; --spot-wash: rgba(31, 69, 214, 0.09); }
.ed-risk   { --spot: #e06c00; --spot-2: #964600; --spot-wash: rgba(224, 108, 0, 0.11); }
.ed-or     { --spot: #c4127c; --spot-2: #820a52; --spot-wash: rgba(196, 18, 124, 0.09); }

[data-theme="night"] {
  --paper: #121110; --paper-2: #1b1a18; --paper-3: #26241f; --sheet: #191816; --desk: #070707;
  --ink: #ece8df; --ink-2: #c9c4b8; --grey: #959084; --hair: #36332d; --hair-2: #57534a;
  color-scheme: dark;
}
[data-theme="night"] .ed-dfs, [data-theme="night"].ed-dfs { --spot: #ff6146; --spot-2: #ff9a86; --spot-wash: rgba(255, 97, 70, 0.14); }
[data-theme="night"] .ed-ballot, [data-theme="night"].ed-ballot { --spot: #7894ff; --spot-2: #aebdff; --spot-wash: rgba(120, 148, 255, 0.14); }
[data-theme="night"] .ed-risk, [data-theme="night"].ed-risk { --spot: #ff9a3d; --spot-2: #ffc285; --spot-wash: rgba(255, 154, 61, 0.14); }
[data-theme="night"] .ed-or, [data-theme="night"].ed-or { --spot: #f05bb0; --spot-2: #ff9fd3; --spot-wash: rgba(240, 91, 176, 0.14); }
[data-size="s"] { --text: 1.05rem; }
[data-size="l"] { --text: 1.3rem; --measure: 40rem; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4rem; background: var(--paper); overflow-x: clip; }
body {
  margin: 0; min-width: 320px; overflow-x: clip;
  color: var(--ink); background: var(--paper);
  font-family: var(--f-body); font-size: var(--text); line-height: var(--lh);
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--spot); text-decoration-thickness: 1.5px; text-underline-offset: 0.17em; }
a:hover { color: var(--spot-2); }
::selection { background: var(--spot); color: #fff; }
:focus-visible { outline: 2px solid var(--spot); outline-offset: 3px; }
button { font: inherit; color: inherit; }
.skip { position: absolute; left: 1rem; top: -5rem; z-index: 100; padding: 0.6rem 1rem; background: var(--ink); color: var(--paper); font: 600 0.85rem var(--f-sans); text-decoration: none; }
.skip:focus { top: 1rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* --------------------------------------------------------------------------
   Running head
   -------------------------------------------------------------------------- */
.runhead {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: 3.1rem;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 0 var(--gutter); background: var(--paper); border-bottom: 1px solid var(--ink);
  transform: translateY(-101%); transition: transform 0.45s var(--ease);
}
.runhead.is-on { transform: none; }
.runhead-flag { font: 400 1.35rem/1 var(--f-flag); text-decoration: none; white-space: nowrap; }
.runhead-sec { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 0.82rem/1.2 var(--f-sans); color: var(--ink-2); }
.runhead-sec b { color: var(--spot); margin-right: 0.45rem; }
.runhead-tools { display: flex; gap: 0.25rem; }
.tool {
  min-height: 2.2rem; padding: 0 0.75rem; border: 0; background: none; cursor: pointer;
  font: 600 0.8rem/1 var(--f-sans); letter-spacing: 0.01em; border-radius: 4px;
}
.tool:hover { background: var(--paper-2); }
.progress { position: absolute; left: 0; bottom: -2px; height: 3px; width: 100%; background: var(--spot); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
@media (max-width: 640px) { .runhead-sec { display: none; } .runhead { grid-template-columns: 1fr auto; } }

/* --------------------------------------------------------------------------
   The front page: a broadsheet that arrives folded
   -------------------------------------------------------------------------- */
.desk {
  position: relative; padding: clamp(0.6rem, 3vw, 2.4rem) clamp(0.5rem, 3vw, 2.4rem) clamp(2rem, 6vw, 5rem);
  background: radial-gradient(120% 80% at 50% 0%, #3b3833 0%, var(--desk) 70%);
  perspective: 2400px; perspective-origin: 50% 30%;
}
[data-theme="night"] .desk { background: radial-gradient(120% 80% at 50% 0%, #1b1a17 0%, var(--desk) 70%); }
.sheet {
  position: relative; max-width: 76rem; margin: 0 auto; color: #141414;
  --sheet-ink: #141414; --sheet-grey: #6d6a62; --sheet-hair: #cdc7b8;
  transform-style: preserve-3d;
}
.sheet-half { position: relative; background: #f8f6f0; padding: 0 clamp(1rem, 3.4vw, 3rem); }
.sheet-half::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(rgba(0,0,0,.05) 0.5px, transparent 0.6px), radial-gradient(rgba(0,0,0,.035) 0.5px, transparent 0.6px);
  background-size: 5px 5px, 9px 9px; background-position: 0 0, 2px 3px;
}
.sheet-top { padding-top: clamp(0.8rem, 2.4vw, 1.6rem); padding-bottom: clamp(1.2rem, 3vw, 2rem); box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); z-index: 2; }
.sheet-fold { position: relative; transform-origin: 50% 0; transform-style: preserve-3d; z-index: 1; }
.sheet-bottom { padding-top: clamp(1rem, 2.6vw, 1.8rem); padding-bottom: clamp(1.4rem, 3vw, 2.4rem); backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.sheet-back { position: absolute; inset: 0; background: #e6e1d5; transform: rotateX(180deg); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.sheet-crease { position: absolute; left: 0; right: 0; top: 0; height: 2.4rem; pointer-events: none; z-index: 3; background: linear-gradient(rgba(0,0,0,var(--crease, 0.1)), transparent); }
.fold-hint {
  position: absolute; left: 50%; top: 100%; margin-top: 0.9rem; transform: translateX(-50%); z-index: 4;
  font: 600 0.74rem/1 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; color: #e9e4d8; opacity: var(--hint, 0); white-space: nowrap; pointer-events: none;
}
.fold-hint::after { content: ""; display: block; width: 1px; height: 1.6rem; margin: 0.5rem auto 0; background: currentColor; animation: hint 1.6s var(--ease) infinite; transform-origin: top; }
@keyframes hint { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.nameplate { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(0.6rem, 2vw, 1.6rem); padding-bottom: 0.5rem; }
.flag { margin: 0; font: 400 clamp(2.3rem, 8.2vw, 6.4rem)/1.08 var(--f-flag); text-align: center; letter-spacing: 0.01em; white-space: nowrap; color: var(--sheet-ink); }
.flag-over { display: block; margin-bottom: 0.1rem; text-align: center; font: italic 500 clamp(0.75rem, 1.4vw, 0.95rem)/1.3 var(--f-head); color: var(--sheet-grey); }
.ear { border: 1px solid var(--sheet-ink); padding: 0.55rem 0.7rem 0.6rem; font: 500 0.72rem/1.35 var(--f-sans); color: var(--sheet-ink); max-width: 12.5rem; }
.ear-r { justify-self: end; text-align: right; }
.ear b { display: block; font: 800 0.66rem/1.2 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.25rem; }
.ear .big { display: block; padding: 0.05rem 0; font: 800 1.3rem/1.2 var(--f-sans); font-variant-numeric: tabular-nums; color: var(--spot); }
@media (max-width: 760px) { .nameplate { grid-template-columns: 1fr; } .ear { display: none; } }

.dateline {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.3rem 1.2rem; padding: 0.42rem 0;
  border-top: 3px solid var(--sheet-ink); border-bottom: 1px solid var(--sheet-ink);
  font: 600 0.75rem/1.35 var(--f-sans); color: var(--sheet-ink); margin-top: 0.2rem;
}
.dateline span:nth-child(2) { font-style: italic; font-weight: 500; }
.banner-kicker { margin: clamp(1rem, 2.6vw, 1.7rem) 0 0.45rem; font: 700 0.88rem/1.35 var(--f-sans); color: var(--spot); }
.banner {
  margin: 0; padding: 0.04em 0; font: 900 clamp(3.2rem, 11.2vw, 9.6rem)/0.95 var(--f-head); font-stretch: 68%;
  letter-spacing: -0.012em; color: var(--sheet-ink); text-wrap: balance;
}
.banner-deck { max-width: 52rem; margin: 0.9rem 0 0; font: italic 400 clamp(1.25rem, 2.7vw, 1.95rem)/1.28 var(--f-head); font-stretch: 85%; color: #2e2d2a; text-wrap: balance; }
.byline-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.4rem; margin-top: 1.1rem; padding-top: 0.6rem; border-top: 1px solid var(--sheet-hair); font: 500 0.84rem/1.45 var(--f-sans); color: var(--sheet-grey); }
.byline-row strong { color: var(--sheet-ink); font-weight: 700; }

/* Below the fold: broadsheet columns */
.front-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 2rem; }
.front-cols > * { min-width: 0; }
.front-story { columns: 2 15rem; column-gap: 2rem; column-rule: 1px solid var(--sheet-hair); font-size: 1.02rem; line-height: 1.55; color: #1d1c1a; }
.front-story p { margin: 0 0 0.8rem; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.front-story h3 { column-span: all; margin: 0 0 0.8rem; font: 800 clamp(1.6rem, 3vw, 2.3rem)/1.05 var(--f-head); font-stretch: 75%; color: #141414; }
.front-story .jump { font: italic 600 0.85rem var(--f-sans); color: var(--spot); text-decoration: none; }
.front-rail { border-left: 1px solid var(--sheet-hair); padding-left: 1.6rem; }
.front-rail h4 { margin: 0 0 0.6rem; padding-bottom: 0.4rem; border-bottom: 3px solid #141414; font: 800 0.8rem/1.2 var(--f-sans); letter-spacing: 0.06em; text-transform: uppercase; color: #141414; }
.inside { list-style: none; margin: 0 0 1.4rem; padding: 0; }
.inside li { border-bottom: 1px solid var(--sheet-hair); }
.inside a { display: grid; grid-template-columns: 1.8rem 1fr; gap: 0.4rem; padding: 0.45rem 0; text-decoration: none; font: 600 0.88rem/1.35 var(--f-sans); color: #141414; }
.inside a span { color: var(--spot); font-weight: 800; font-variant-numeric: tabular-nums; }
.inside a:hover { color: var(--spot); }
@media (max-width: 820px) { .front-cols { grid-template-columns: 1fr; } .front-rail { border-left: 0; padding-left: 0; border-top: 3px solid #141414; padding-top: 1rem; margin-top: 0.6rem; } }
@media (max-width: 560px) { .front-story { columns: 1; } .front-story p { text-align: left; } }

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */
.paper { position: relative; padding: 0 0 4rem; }
.col { width: min(100% - 2 * var(--gutter), var(--measure)); margin: 0 auto; position: relative; }
.col > p { margin: 0 0 1.1em; }
.col > p.lead { font-size: 1.14em; line-height: 1.55; }
.col h3 { margin: 2.2em 0 0.5em; font: 800 1.6em/1.1 var(--f-head); font-stretch: 78%; }
.col h4 { margin: 1.6em 0 0.4em; font: 700 0.95em/1.3 var(--f-sans); }
.col ul, .col ol { margin: 0 0 1.1em; padding-left: 1.25em; }
.col li { margin-bottom: 0.4em; }
.col li::marker { color: var(--spot); font-family: var(--f-sans); font-weight: 700; }
.col blockquote { margin: 1.8em 0; padding-left: 1.1em; border-left: 3px solid var(--ink); font-style: italic; }
.col blockquote cite { display: block; margin-top: 0.4em; font: normal 600 0.8rem/1.35 var(--f-sans); color: var(--grey); }
.breakout { width: min(100vw - 2 * var(--gutter), var(--wide)); margin-left: 50%; transform: translateX(-50%); }

.dropcap::first-letter {
  float: left; margin: 0.06em 0.08em 0 0; padding: 0.02em 0 0;
  font: 800 4.3em/0.84 var(--f-head); font-stretch: 70%; color: var(--spot);
}

/* Section openers */
.sec { padding: clamp(3.4rem, 9vw, 6.5rem) 0 0.5rem; }
.sec-head { width: min(100% - 2 * var(--gutter), var(--wide)); margin: 0 auto clamp(1.6rem, 4vw, 2.6rem); text-align: center; }
.sec-label { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0 0 0.9rem; font: 700 0.82rem/1.2 var(--f-sans); letter-spacing: 0.04em; text-transform: uppercase; }
.sec-label b { display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; padding: 0 0.4rem; background: var(--spot); color: #fff; font-weight: 800; font-variant-numeric: tabular-nums; }
.sec-head h2 { margin: 0 auto; max-width: 18ch; padding: 0.04em 0; font: 900 clamp(2.3rem, 6.4vw, 4.6rem)/1.02 var(--f-head); font-stretch: 70%; letter-spacing: -0.01em; text-wrap: balance; }
.sec-deck { max-width: 36rem; margin: 0.8rem auto 0; font: italic 400 clamp(1.1rem, 2.2vw, 1.35rem)/1.38 var(--f-head); font-stretch: 88%; color: var(--ink-2); text-wrap: balance; }
.sec-rule { display: block; width: 3.2rem; height: 3px; margin: 1.2rem auto 0; background: var(--ink); }

/* Margin notes */
.note {
  float: right; clear: right; width: 14.5rem; margin: 0.3rem -17.5rem 1rem 1.5rem;
  padding-top: 0.55rem; border-top: 3px solid var(--ink); font: 400 0.86rem/1.48 var(--f-sans); color: var(--ink-2);
}
.note b, .note strong { color: var(--ink); }
.note .note-k { display: block; margin-bottom: 0.25rem; font: 800 0.72rem/1.25 var(--f-sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--spot); }
.note .note-n { display: block; margin: 0.1rem 0 0.25rem; padding: 0.04em 0; font: 900 2.5rem/1.1 var(--f-head); font-stretch: 70%; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 1180px) {
  .note { float: none; width: auto; margin: 1.4em 0; padding: 0.8rem 0 0.4rem; border-bottom: 1px solid var(--hair); }
}

/* Pull quote */
.pull {
  margin: 2.2em 0; padding: 0.9em 0 1em; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  font: italic 500 clamp(1.55rem, 3.6vw, 2.3rem)/1.2 var(--f-head); font-stretch: 82%; text-align: center; text-wrap: balance;
}
.pull::before, .pull::after { content: ""; display: block; width: 2.4rem; height: 3px; margin: 0 auto 0.7em; background: var(--spot); }
.pull::after { margin: 0.7em auto 0; }

/* Facts row */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 1.8em 0 2em; border-top: 3px solid var(--ink); }
.fact { padding: 0.8rem 0.9rem 0.9rem 0; border-bottom: 1px solid var(--hair); }
.fact + .fact { padding-left: 0.9rem; border-left: 1px solid var(--hair); }
.fact b { display: block; padding: 0.04em 0; font: 900 clamp(2rem, 4.6vw, 2.8rem)/1.1 var(--f-head); font-stretch: 70%; color: var(--spot); font-variant-numeric: tabular-nums; }
.fact span { display: block; margin-top: 0.3rem; font: 400 0.84rem/1.42 var(--f-sans); color: var(--ink-2); }

/* Equations */
.eq { display: flex; align-items: center; gap: 1rem; margin: 1.4em 0; padding: 0.7rem 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.eq .eq-body { flex: 1 1 auto; min-width: max-content; text-align: center; padding: 0.2rem 0; }
.eq .eq-n { flex: 0 0 auto; font: 500 0.85rem/1.2 var(--f-sans); color: var(--grey); font-variant-numeric: tabular-nums; }
.eq .katex-display { margin: 0; }
.tex { white-space: nowrap; }

/* Tables */
.tablewrap { margin: 1.6em 0 2em; overflow-x: auto; border-top: 3px solid var(--ink); }
table.news { width: 100%; min-width: 36rem; border-collapse: collapse; font: 400 0.88rem/1.45 var(--f-sans); }
.news th { text-align: left; padding: 0.6rem 0.7rem 0.5rem 0; font-weight: 800; font-size: 0.78rem; border-bottom: 1px solid var(--ink); vertical-align: bottom; }
.news td { padding: 0.65rem 0.7rem 0.65rem 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.news td:first-child { font-weight: 700; }

/* --------------------------------------------------------------------------
   Back matter
   -------------------------------------------------------------------------- */
.back { margin-top: 3rem; padding-top: 0.4rem; border-top: 3px solid var(--ink); }
.back h3 { margin-top: 1.8em; }
.refs { margin: 0.6rem 0 2rem; padding-left: 2.2rem; font: 400 0.9rem/1.5 var(--f-body); }
.refs li { padding: 0.35rem 0; scroll-margin-top: 6rem; }
.refs li::marker { color: var(--spot); font: 700 0.82rem var(--f-sans); }
.refs li.is-flash { animation: flash 2s var(--ease); }
@keyframes flash { 0%, 35% { background: var(--spot-wash); } 100% { background: transparent; } }
.refs a { overflow-wrap: anywhere; }
.credits { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 2rem; margin: 0.6rem 0 2rem; font: 400 0.9rem/1.5 var(--f-body); }
.credits div { padding: 0.8rem 0; border-top: 1px solid var(--hair); }
.credits h4 { margin: 0 0 0.35rem; font: 800 0.86rem/1.25 var(--f-sans); }
.citebox pre { margin: 0 0 0.6rem; padding: 0.8rem 0.9rem; background: var(--paper-2); font: 500 0.78rem/1.55 var(--f-code); white-space: pre-wrap; overflow-wrap: anywhere; }
.more-papers { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1.6rem; margin-top: 0.6rem; border-top: 3px solid var(--ink); }
.more-papers a { display: block; padding: 0.9rem 0 1rem; border-bottom: 1px solid var(--hair); text-decoration: none; }
.more-papers small { display: block; font: 800 0.74rem/1.2 var(--f-sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--c); }
.more-papers b { display: block; margin: 0.35rem 0 0.25rem; font: 800 1.45rem/1.1 var(--f-head); font-stretch: 75%; }
.more-papers span { font: 400 0.88rem/1.42 var(--f-sans); color: var(--ink-2); }
.more-papers a:hover b { color: var(--c); }

.colophon { margin-top: 2rem; padding: 2.4rem var(--gutter) 3rem; background: var(--ink); color: var(--paper); font: 400 0.86rem/1.6 var(--f-sans); }
[data-theme="night"] .colophon { background: #000; color: var(--ink); }
.colophon-in { max-width: var(--wide); margin: 0 auto; display: grid; gap: 1.6rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
.colophon .flag-sm { font: 400 2rem/1.1 var(--f-flag); margin: 0 0 0.6rem; }
.colophon a { color: inherit; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin-bottom: 0.3rem; }
.colophon p { margin: 0 0 0.5rem; opacity: 0.75; }
@media (max-width: 760px) { .colophon-in { grid-template-columns: 1fr; } }

/* Motion: kept to what carries meaning */
.js .sec-head { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.9s var(--ease); }
.js .sec-head.is-in { opacity: 1; transform: none; }
.calm *, .calm *::before, .calm *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; transition-delay: 0ms !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; } }
@media print {
  .runhead, .controls, .tool, .overlay, .fold-hint { display: none !important; }
  .desk { background: none; padding: 0; } .sheet-fold { transform: none !important; }
  .note { float: none; width: auto; margin: 0.6em 0; }
}
