/* Layout: one flat field of color; a single reading column; line art alternates
   right / centre / left; the accent marks whatever holds authority in the scene. */
:root {
  --field: #b6c3f4;      /* the page: periwinkle */
  --ink: #14162a;        /* text and line art */
  --ink-soft: #3a4277;   /* captions, metadata */
  --rule: #8492d2;       /* hairlines */
  --accent: #ff5b3a;     /* the one colour: authority */
  --display: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Literata", "Iowan Old Style", Georgia, serif;
  --measure: 34rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --field: #1a1d36; --ink: #e5e8f9; --ink-soft: #a9b1df; --rule: #3c4272; --accent: #ff6e4e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --field: #1a1d36; --ink: #e5e8f9; --ink-soft: #a9b1df; --rule: #3c4272; --accent: #ff6e4e;
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--field);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(19px, 1.05rem + 0.35vw, 21px);
  line-height: 1.68;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 46rem; margin: 0 auto; padding-block: 28px 96px; }
.column { max-width: var(--measure); margin: 0 auto; }

/* ---------- masthead ---------- */
.meta {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
  font-family: var(--display); font-size: 12.5px; font-weight: 500;
  line-height: 1.35; color: var(--ink);
}
.meta span { color: var(--ink-soft); font-weight: 400; display: block; }
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(64px, 19vw, 150px);
  line-height: 0.86; letter-spacing: -0.045em;
  margin: 26px 0 0; text-wrap: balance;
}
.o-dot {
  display: inline-block; width: 0.56em; height: 0.56em;
  margin: 0 0.02em; border-radius: 50%;
  background: var(--accent); vertical-align: -0.02em;
}
.lede-rule { border: 0; border-top: 1px solid var(--rule); margin: 40px 0 36px; }

/* ---------- prose ---------- */
.column > p { margin: 0 0 1.05em; hyphens: auto; }
.column > p em { font-style: italic; }

/* ---------- art ---------- */
figure.art { margin: 2.4em 0 2.6em; display: flex; flex-direction: column; }
figure.art svg { width: 82%; height: auto; overflow: visible; color: var(--ink); }
figure.art.align-right { align-items: flex-end; }
figure.art.align-left { align-items: flex-start; }
figure.art.align-center { align-items: center; }
figure.art.small svg { width: 46%; }
@media (min-width: 760px) {
  figure.art.align-right { margin-right: -6rem; }
  figure.art.align-left { margin-left: -6rem; }
  figure.art svg { width: 72%; }
}
figcaption {
  font-family: var(--display); font-size: 12.5px; color: var(--ink-soft);
  margin-top: 10px; letter-spacing: 0.01em;
}
figure[data-placeholder] figcaption::after { content: " · placeholder art"; opacity: 0.7; }
svg .accent { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
svg [stroke="currentColor"], svg g[stroke] { stroke: currentColor; }

/* ---------- concept note: the explicit layer, outside the world ---------- */
.concept {
  margin: 2.2em 0 2.4em; padding-block: 14px 4px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  font-family: var(--display); font-size: 16px; line-height: 1.55;
}
.concept .eyebrow {
  margin: 0 0 6px; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
}
.concept h3 { margin: 0 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
.concept .term { font-weight: 400; font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.concept .term::before { content: "("; } .concept .term::after { content: ")"; }
.concept p { margin: 0 0 12px; }
.concept strong { font-weight: 500; }

/* ---------- pinned diagram with scrolling steps ---------- */
.scrolly { margin: 2.6em 0; position: relative; }
.scrolly-graphic {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px);
  z-index: 1; background: var(--field);
  display: flex; justify-content: center; padding-block: 8px;
}
.scrolly-graphic svg { width: min(100%, 26rem); max-height: 48vh; height: auto; color: var(--ink); overflow: visible; }
.scrolly-graphic text { font-family: var(--display); font-size: 15px; font-weight: 800; }
.scrolly-graphic text.sub { font-size: 12.5px; font-weight: 400; }
.scrolly-graphic [data-step] { transition: opacity 0.5s ease; }
.scrolly-graphic .accent { transition: opacity 0.5s ease, transform 0.6s cubic-bezier(.3,1.6,.5,1); }
.scrolly.live .scrolly-graphic [data-step].off { opacity: 0.1; }
.scrolly.live .scrolly-graphic .accent.off { opacity: 0; transform: scale(0.2); }
.steps { position: relative; z-index: 0; }
.step { min-height: 62vh; display: flex; align-items: flex-end; padding-bottom: 12vh; }
.step:last-child { min-height: 52vh; padding-bottom: 4vh; }
.step p {
  margin: 0; font-family: var(--display); font-size: 17px; line-height: 1.5;
  border-left: 2px solid var(--ink); padding-left: 14px;
}
.step .num { display: block; font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; margin-bottom: 2px; }
.scrolly.live .step:not(.on) p { opacity: 0.45; }
.step p { transition: opacity 0.4s ease; }

/* ---------- end ---------- */
.end {
  margin-top: 56px; border-top: 1px solid var(--rule); padding-top: 10px;
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
  font-family: var(--display); font-size: 13px; color: var(--ink-soft);
}
.end b { color: var(--ink); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .scrolly-graphic [data-step], .scrolly-graphic .accent, .step p { transition: none; }
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.end a { text-decoration: none; }
.draft-flag {
  display: inline-block; font-family: var(--display); font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid currentColor;
  border-radius: 999px; padding: 1px 8px; vertical-align: middle; color: var(--ink-soft);
}

/* ---------- series index ---------- */
.series-line { font-family: var(--body); font-style: italic; font-size: 1.15em; margin: 22px 0 0; max-width: 24em; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { border-bottom: 1px solid var(--rule); }
.toc a {
  display: grid; grid-template-columns: 3.2rem 1fr; gap: 4px 12px;
  padding-block: 18px; text-decoration: none;
}
.toc .n { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; }
.toc .t { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -0.01em; min-width: 0; }
.toc .d { grid-column: 2; font-family: var(--display); font-size: 13.5px; color: var(--ink-soft); }
.toc a:hover .t { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.15em; }
.empty { font-family: var(--display); color: var(--ink-soft); }
