/* Visual Research Paper Explainers & Reading Notes (/notes/ and /notes/<slug>/). */
.portfolio.notes-page .notes-main {
  --nt-panel: var(--space-panel);
  --nt-panel-solid: var(--space-panel-solid);
  --nt-deep: var(--space-deep);
  --nt-bar: var(--space-bar-solid);
  --nt-rule: var(--space-rule);
  --nt-ink: var(--ink);
  --nt-muted: var(--quiet);
  --nt-accent: var(--pantone-peach);
  --nt-red: var(--pantone-coral);
  --nt-gold: var(--pantone-butter);
  --nt-blue: var(--pantone-iris);
  --nt-kicker: var(--pantone-quartz);
  max-width: 1440px;
  padding-top: clamp(1rem, 1.9vw, 1.6rem);
  padding-bottom: 3rem;
}
.notes-shell, .notes-shell *, .note-article, .note-article * { box-sizing: border-box; }
.notes-shell [hidden], .note-article [hidden] { display: none !important; }
.notes-main :is(a, button):focus-visible { outline: 2px solid var(--nt-accent); outline-offset: 4px; }

/* Masthead */
.notes-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .85rem 2.25rem;
  align-items: end;
  padding-bottom: .95rem;
  border-bottom: 1px solid var(--nt-rule);
}
.notes-head > div { min-width: 0; }
.notes-back {
  display: inline-block;
  margin-bottom: .25rem;
  font: 400 .75rem/1.4 var(--mono);
  color: var(--nt-blue);
  text-decoration: none;
}
.notes-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.notes-kicker {
  margin: 0;
  font: italic 400 .84rem/1.45 var(--mono);
  letter-spacing: .02em;
  color: var(--nt-kicker);
}
.notes-head h1 {
  margin: .18rem 0 0;
  font: 400 clamp(2.15rem, 4vw, 3.45rem)/.98 var(--display);
  letter-spacing: -.05em;
  color: var(--nt-ink);
  text-wrap: balance;
}
.notes-head h1 > span { color: var(--nt-accent); }
.notes-lead {
  margin: .42rem 0 0;
  max-width: 70ch;
  font: italic 400 .86rem/1.55 var(--mono);
  color: color-mix(in srgb, var(--nt-ink) 88%, var(--nt-muted));
  text-shadow: 0 1px 12px var(--space-void);
}
/* The essay title, visual and reading action share one link and keyboard stop. */
.notes-shell {max-width:68rem;margin-inline:auto}
.note-entry {border-bottom:1px solid var(--nt-rule)}
.note-entry-link {
  display:grid;grid-template-columns:minmax(0,1.18fr) minmax(0,.82fr);
  align-items:center;gap:clamp(1.5rem,4vw,4.5rem);
  padding:clamp(1.4rem,3.2vw,3.2rem) clamp(1rem,3vw,2.8rem);
  color:var(--nt-ink);background:var(--nt-panel-solid);text-decoration:none;
}
.note-entry-meta {margin:0 0 .85rem;font:400 .77rem/1.4 var(--mono);color:var(--nt-muted)}
.note-entry h2 {margin:0;max-width:21ch;font:400 clamp(1.8rem,3.5vw,3rem)/1.08 var(--display);letter-spacing:-.04em;text-wrap:balance}
.note-entry-summary {margin:.8rem 0 0;max-width:45ch;font:400 .93rem/1.55 var(--mono);color:var(--nt-muted)}
.note-entry-action {display:inline-block;margin-top:1.25rem;color:var(--nt-accent);font:400 .82rem/1.5 var(--mono)}
.note-entry-link:is(:hover,:focus-visible) .note-entry-action {text-decoration:underline;text-underline-offset:4px}
.note-entry-art {background:var(--nt-deep);padding:clamp(.9rem,2.4vw,2rem)}
.note-entry-art svg {display:block;width:100%;height:auto}
.note-entry-art-book {
  background: #000000;
  border: 1px solid rgba(242, 240, 236, 0.14);
  display: grid;
  place-items: center;
  padding: clamp(1.1rem, 2.5vw, 1.85rem);
}
.book-entry-preview {
  width: min(100%, 118px);
}
.note-end {margin-top:2rem}
@media(max-width:650px) {
  .note-entry-link {grid-template-columns:1fr;gap:1.25rem}
  .note-entry-art {grid-row:1}
}

/* Explainer article layout (3-zone Distill / Tufte visual grid) */
.note-paper-card {
  margin: 0;
  padding: .85rem 1.05rem;
  border: 1px solid var(--nt-rule);
  background: var(--nt-panel);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 var(--space-sheen);
  display: grid;
  gap: .38rem;
  min-width: min(100%, 290px);
  max-width: 390px;
  font: 400 .72rem/1.45 var(--mono);
}
.note-paper-card > div { display: grid; grid-template-columns: 5.8rem minmax(0, 1fr); gap: .6rem; }
.note-paper-card dt { color: var(--nt-muted); font-style: italic; }
.note-paper-card dd { margin: 0; color: var(--nt-ink); }
.note-paper-card a { color: var(--nt-accent); text-decoration: underline; text-underline-offset: 4px; }

.note-abstract {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .5rem 1.25rem;
  align-items: baseline;
  margin-top: 1.15rem;
  padding: .9rem 1.15rem;
  border: 1px solid var(--nt-rule);
  border-left: 3px solid var(--nt-accent);
  background: var(--nt-panel);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 var(--space-sheen);
}
.note-abstract-tag {
  font: 400 .66rem/1.4 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--nt-accent);
}
.note-abstract p { margin: 0; font: italic 400 .84rem/1.65 var(--mono); color: var(--nt-ink); }

.note-layout {
  display: grid;
  grid-template-columns: 195px minmax(0, 1fr);
  gap: 1.5rem 2.25rem;
  margin-top: 1.75rem;
  align-items: start;
}
.note-toc {
  position: sticky;
  top: 1.25rem;
  padding: .9rem 1rem;
  border: 1px solid var(--nt-rule);
  background: var(--nt-panel);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 var(--space-sheen);
  font: 400 .72rem/1.55 var(--mono);
}
.note-toc-title {
  margin: 0 0 .55rem;
  font-size: .64rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--nt-kicker);
}
.note-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.note-toc a { color: var(--nt-muted); text-decoration: none; display: block; }
.note-toc a:hover { color: var(--nt-ink); }
.note-toc a span { color: var(--nt-gold); margin-right: .35rem; }

.note-stream { display: grid; gap: 1.5rem; }
.note-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 1rem 1.75rem;
  align-items: start;
}
.note-prose {
  padding: 1.35rem 1.55rem;
  border: 1px solid var(--nt-rule);
  background: var(--nt-panel);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 var(--space-sheen);
}
.note-prose h2 {
  margin: 0 0 .8rem;
  font: 400 clamp(1.35rem, 2.2vw, 1.8rem)/1.18 var(--display);
  letter-spacing: -.03em;
  color: var(--nt-ink);
}
.note-prose h2 > span {
  font: 400 .78rem/1 var(--mono);
  color: var(--nt-gold);
  margin-right: .45rem;
  vertical-align: .15em;
}
.note-prose p {
  margin: 0 0 .9rem;
  max-width: 66ch;
  font: 400 .9rem/1.75 var(--mono);
  color: var(--nt-muted);
}
.note-prose p:last-child { margin-bottom: 0; }

/* Full-width Visual Figure Frame inside explainers */
.note-figure {
  margin: 1.15rem 0;
  border: 1px solid var(--nt-rule);
  background: var(--nt-deep);
}
.note-figure-bar {
  padding: .48rem .85rem;
  border-bottom: 1px solid var(--nt-rule);
  background: var(--nt-bar);
  font: 400 .68rem/1.3 var(--mono);
  letter-spacing: .04em;
  color: var(--nt-gold);
}
.note-figure-stage { padding: 1rem; }
.note-fig-svg { display: block; width: 100%; height: auto; }
.nf-box { fill: var(--nt-panel-solid); stroke: var(--nt-rule); stroke-width: 1.5; }
.nf-box.is-focus { stroke: var(--nt-accent); }
.nf-title { fill: var(--nt-ink); font: 400 13px var(--mono); }
.nf-sub { fill: var(--nt-muted); font: italic 400 11px var(--mono); }
.nf-arrow { stroke: var(--nt-blue); stroke-width: 1.75; }
.nf-arrow-head { fill: var(--nt-blue); }
.note-figure figcaption {
  padding: .65rem .9rem;
  border-top: 1px solid var(--nt-rule);
  font: italic 400 .76rem/1.55 var(--mono);
  color: var(--nt-muted);
}

/* Equation / Theorem block */
.note-equation {
  margin: 1.1rem 0 0;
  padding: .9rem 1.05rem;
  border: 1px solid var(--nt-rule);
  border-left: 2px solid var(--nt-blue);
  background: var(--nt-deep);
}
.note-equation code {
  display: block;
  font: 400 .95rem/1.5 var(--mono);
  color: var(--nt-ink);
  overflow-x: auto;
}
.note-equation p {
  margin: .45rem 0 0 !important;
  font: italic 400 .75rem/1.55 var(--mono) !important;
  color: var(--nt-muted);
}

/* Tufte-style cursive Victor Mono margin note */
.note-margin {
  padding: .85rem .95rem;
  border: 1px solid var(--nt-rule);
  border-top: 2px solid var(--nt-kicker);
  background: var(--nt-panel);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 var(--space-sheen);
  font: italic 400 .75rem/1.6 var(--mono);
  color: var(--nt-muted);
}
.note-margin-num {
  display: inline-block;
  margin-bottom: .25rem;
  font-style: normal;
  font-size: .64rem;
  color: var(--nt-kicker);
}
.note-margin p { margin: 0; }

@media (max-width: 1120px) {
  .note-layout { grid-template-columns: 1fr; }
  .note-toc { position: static; }
  .note-section { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .notes-head { grid-template-columns: 1fr; }
  .note-abstract { grid-template-columns: 1fr; }
}

/* Figure-led speed-race note */
[data-note="speed-arms-race"] .note-section {display:block}
[data-note="speed-arms-race"] .note-margin {margin:.65rem 0 0;max-width:78ch}
[data-note="speed-arms-race"] .note-figure-stage {display:block;padding:0}
[data-note="speed-arms-race"] .note-prose {min-width:0}
[data-note="speed-arms-race"] .note-stream {min-width:0}
.speed-plate,.clock-panels,.gain-panels {padding:clamp(.9rem,3vw,2.3rem);color:var(--nt-ink);font:400 .85rem/1.45 var(--mono);font-variant-numeric:tabular-nums}
.fee-key {display:flex;flex-wrap:wrap;gap:.5rem 1.35rem;margin-bottom:1.3rem}
.fee-key span {display:inline-flex;gap:.4rem;align-items:center}
.fee-key i {display:inline-block;width:.95rem;height:.95rem}
.seg-0 {background:var(--nt-blue)}
.seg-1 {background:var(--nt-accent)}
.seg-2 {background:repeating-linear-gradient(125deg,transparent 0 3px,var(--nt-gold) 3px 4px),var(--nt-deep);outline:1px solid var(--nt-gold);outline-offset:-1px}
.fee-row + .fee-row {margin-top:1rem}
.fee-row strong,.gain-panel > strong,.clock-panel > strong {display:block;margin-bottom:.45rem;font-weight:500}
.fee-bar {display:flex;height:2.6rem}
.fee-seg {display:grid;place-items:center;color:var(--nt-deep);font-weight:700;border-right:1px solid var(--nt-deep)}
.fee-seg.seg-2 b {color:var(--nt-ink);background:var(--nt-deep);padding:0 .18em}
.clock-panels {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:.85rem}
.clock-panel {min-width:0;border:1px solid var(--nt-rule);padding:.8rem;background:var(--nt-panel-solid)}
.clock-panel svg {width:100%;display:block;height:auto;overflow:visible}
.clock-axis,.clock-boundary {fill:none;stroke:var(--nt-muted);stroke-width:1}
.clock-boundary {stroke-dasharray:3 3}
.clock-panel svg text {fill:var(--nt-muted);font:13px monospace}
.clock-panel .bid-a {color:var(--nt-blue)}
.clock-panel .bid-b {color:var(--nt-accent)}
.clock-panel g path {stroke:currentColor}
.clock-panel g circle,.clock-panel g text {fill:currentColor}
.clock-panel g text {text-anchor:middle}
.clock-result {border-top:1px solid var(--nt-rule);padding-top:.55rem}
.gain-panel + .gain-panel {border-top:1px solid var(--nt-rule);margin-top:1rem;padding-top:1.2rem}
.gain-plot {--label:6.5rem;position:relative;padding-top:2.5rem}
.gain-row {display:grid;grid-template-columns:var(--label) 1fr;align-items:center;min-height:2.8rem}
.gain-track {position:relative;height:1px;background:var(--nt-rule)}
.gain-track b {position:absolute;bottom:.45rem;left:var(--at);transform:translateX(-50%);font-weight:500}
.gain-track::after {content:'';position:absolute;left:var(--at);top:0;transform:translate(-50%,-50%);width:.7rem;height:.7rem;border-radius:50%;background:var(--nt-blue)}
.gain-fee {position:absolute;inset:0 0 1.4rem var(--label);pointer-events:none}
.gain-fee::before {content:'';position:absolute;left:var(--fee);inset-block:1.55rem 0;border-left:1px dashed var(--nt-gold)}
.gain-fee span {position:absolute;left:var(--fee);transform:translateX(-50%);white-space:nowrap;color:var(--nt-gold)}
.gain-ticks {display:flex;justify-content:space-between;margin-left:var(--label);color:var(--nt-muted);font-size:.75rem}
@media (max-width:600px) {
  [data-note="speed-arms-race"] .note-prose {padding:1rem .75rem}
  .gain-plot {--label:5.6rem}
  .speed-plate,.clock-panels,.gain-panels {font-size:.77rem}
}

.note-companion {margin:0;font:400 .85rem/1.5 var(--mono)}
.note-companion a {color:var(--nt-accent);text-underline-offset:.25em}

/* Let the first observation follow the question directly. */
[data-note="speed-arms-race"] .note-article-head {grid-template-columns:minmax(0,1fr)}
[data-note="speed-arms-race"] h1 {max-width:22ch}
[data-note="speed-arms-race"] .notes-lead {
  max-width:67ch;margin-top:1rem;
  font:400 clamp(1rem,1.6vw,1.15rem)/1.55 var(--display);text-shadow:none;
}
[data-note="speed-arms-race"] .note-paper-card {max-width:65ch}
[data-note="speed-arms-race"] .note-prose p {color:var(--nt-ink)}
.note-figure-source {display:block;margin-top:.45rem;color:var(--nt-blue);text-underline-offset:.2em}
.duration-plate {padding:clamp(1rem,3vw,2.3rem);font:400 .83rem/1.4 var(--mono);color:var(--nt-ink)}
.duration-label {display:flex;justify-content:space-between;align-items:baseline;margin-bottom:.3rem}
.duration-label strong {font:400 clamp(1.6rem,3vw,2.7rem)/1.1 var(--display);font-variant-numeric:tabular-nums}
.duration-label small {font:400 .75rem var(--mono)}
.duration-row + .duration-row {margin-top:1.25rem}
.duration-ruler {
  height:1.6rem;border-bottom:1px solid var(--nt-rule);
  background:repeating-linear-gradient(to right,var(--nt-rule) 0 1px,transparent 1px 10%);
}
.duration-ruler i {display:block;height:100%;background:var(--nt-blue);border-right:2px solid var(--nt-ink)}
.duration-row:nth-child(2) i {background:var(--nt-accent)}
.duration-ticks {display:grid;grid-template-columns:1fr auto 1fr;margin-top:.35rem;color:var(--nt-muted)}
.duration-ticks span:last-child {justify-self:end}
@media(max-width:780px) {
  [data-note="speed-arms-race"] .note-toc {display:none}
}

.clock-panel g .clock-earlier {text-anchor:end}
.clock-panel g .clock-later {text-anchor:start}
.batch-share {
  margin:0 clamp(.9rem,3vw,2.3rem) clamp(.9rem,3vw,2.3rem);
  color:var(--nt-ink);font:400 .84rem/1.5 var(--mono);
}
.batch-share > strong {font-weight:500}
.batch-phase {display:grid;grid-template-columns:1fr var(--split);margin:.6rem 0 .45rem}
.batch-phase b {display:grid;place-items:center;min-height:2rem;background:var(--nt-accent);color:var(--nt-deep)}
.batch-phase b + b {background:var(--nt-blue);border-left:2px solid var(--nt-deep)}
.batch-key {display:flex;justify-content:space-between;gap:.3rem 1rem;flex-wrap:wrap}
.batch-key b {font-weight:500}
