/* ==========================================================================
   DESIGN TOKENS — change the whole look here
   ========================================================================== */
:root {
  --paper: #fbfbf8;
  --ink: #16161a;
  --ink-soft: #6b6b70;
  --blue: #2b45ee;
  --blue-mid: #93a9f4;
  --blue-pale: #dfe6fc;
  --blue-tint: #f0f3fe;
  --hairline: #c9c9c2;

  --mono: "Departure Mono", "SF Mono", Menlo, monospace;
  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;

  --page-width: 1200px;
  --prose-width: 640px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: var(--page-width); margin: 0 auto; padding: 0 32px 120px; }

/* ================= MASTHEAD ================= */
.masthead { padding: 44px 0 24px; }
.masthead .title {
  font-family: var(--mono);
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.02;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  max-width: 1000px;
}
.masthead .byline {
  margin-top: 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft);
}
.divider {
  height: 10px;
  background-image:
    repeating-linear-gradient(90deg, var(--hairline) 0 3px, transparent 3px 9px, var(--hairline) 9px 12px, transparent 12px 26px),
    repeating-linear-gradient(90deg, transparent 0 5px, var(--hairline) 5px 8px, transparent 8px 19px);
  background-size: 100% 3px, 100% 3px;
  background-position: 0 1px, 0 6px;
  background-repeat: repeat-x;
  margin: 26px 0 56px;
}

/* ================= LAYOUT ================= */
.prose { max-width: var(--prose-width); margin: 0 auto; }
.prose p { margin-bottom: 26px; text-align: justify; hyphens: auto; }
.prose .dropcap::first-letter {
  float: left; font-size: 72px; line-height: 0.83;
  padding: 6px 10px 0 0; font-weight: 500;
}
.prose a { color: var(--ink); text-decoration-color: var(--blue); text-underline-offset: 3px; }
.prose a:hover { color: var(--blue); }
.prose strong { font-weight: 600; }
.prose ol { margin: 0 0 26px 24px; }
.prose ol li { margin-bottom: 26px; text-align: justify; hyphens: auto; }

.sectionhead {
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 34px);
  color: var(--blue);
  text-transform: uppercase; letter-spacing: 0.02em;
  margin: 80px auto 36px; max-width: var(--prose-width);
}
.rule { border: 0; border-top: 1px dotted var(--hairline); margin: 64px auto; max-width: 860px; }

/* ================= FIGURES ================= */
figure.fig { position: relative; margin: 48px auto; padding: 0 34px; max-width: 900px; }
figure.fig.wide { max-width: 980px; }
figure.fig.framed { border: 1px dotted var(--hairline); padding: 28px 34px; }

.fig .edge {
  position: absolute; top: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--ink-soft); text-transform: uppercase;
  writing-mode: vertical-rl; white-space: nowrap;
}
.fig .edge.left { left: 8px; transform: rotate(180deg); }
.fig .edge.right { right: 8px; }

.fig svg { width: 100%; height: auto; display: block; }

figcaption {
  font-family: var(--mono); font-size: 11px; line-height: 1.7; letter-spacing: 0.02em;
  color: var(--ink-soft); margin-top: 16px; max-width: 640px;
}
figcaption .no { color: var(--blue); }
figcaption a { color: inherit; }

/* diagram text inside SVGs */
.d-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; fill: var(--blue); }
.d-sub   { font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em; fill: var(--ink-soft); }
.d-tiny  { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; fill: var(--ink-soft); }
.d-ink   { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; fill: var(--ink); }

/* ================= MOVEMENT ================= */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .in-view .reveal { opacity: 1; transform: none; transition: opacity 0.6s ease, transform 0.6s ease; }
.js .in-view .reveal:nth-child(1) { transition-delay: 0.05s; }
.js .in-view .reveal:nth-child(2) { transition-delay: 0.15s; }
.js .in-view .reveal:nth-child(3) { transition-delay: 0.25s; }
.js .in-view .reveal:nth-child(4) { transition-delay: 0.35s; }
.js .in-view .reveal:nth-child(5) { transition-delay: 0.45s; }
.js .in-view .reveal:nth-child(6) { transition-delay: 0.55s; }

.js .bar-fill { width: 0; }
.js .in-view .bar-fill { width: var(--w); transition: width 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s; }

.js .draw { stroke-dasharray: 1200; stroke-dashoffset: 1200; }
.js .in-view .draw { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s ease 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .bar-fill, .js .draw { opacity: 1; transform: none; width: var(--w); stroke-dashoffset: 0; transition: none; }
}

/* ================= BAR CHARTS (gap, mixes) ================= */
.bars { font-family: var(--mono); }
.bars .row { margin: 20px 0; }
.bars .row-label {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 7px;
}
.bars .row-label .val { color: var(--blue); text-align: right; }
.bars .track { height: 24px; border: 1.5px solid var(--blue); position: relative; }
.bars .bar-fill { height: 100%; background: var(--blue); }
.bars .bar-fill.hatched { background: repeating-linear-gradient(-45deg, var(--blue) 0 4px, transparent 4px 9px); }
.bars .ghost { position: absolute; top: 0; bottom: 0; border-right: 2px dashed var(--blue); opacity: 0.6; }
.bars .axis { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--ink-soft); margin-top: 8px; }
.bars .note { font-size: 11px; color: var(--ink-soft); line-height: 1.7; margin-top: 14px; }
.bars .note b { color: var(--blue); font-weight: 400; }

/* ================= VIDEO EMBED ================= */
.video-fig { position: relative; margin: 48px auto; padding: 0 34px; max-width: 900px; }
.video-fig .frame { border: 1px solid var(--ink); box-shadow: 4px 4px 0 rgba(22,22,26,0.9); aspect-ratio: 16/9; }
.video-fig iframe { width: 100%; height: 100%; display: block; border: 0; }

/* ================= FOOTER ================= */
.protonote {
  max-width: 900px; margin: 90px auto 0; padding-top: 16px; border-top: 1px dotted var(--hairline);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
