/* Follow the trade. Grammar: chaptered editorial (Scrollcraft uniqueness.md 2.2).
   A title page on paper, hard cuts between paper and ink grounds, a running
   folio, a colophon. No pinned scene and no scroll-driven choreography: the
   page scrolls like a printed feature and every record is visible at once. The
   engine is untouched and only fades chapter text in. */

.p-trace { font-size: 1rem; }
html:not(.js) [data-sc-in], html:not(.js) [data-sc-stagger] > * { opacity: 1; transform: none; }
.trace [id] { scroll-margin-top: 3.2rem; }
.p-trace .ftr { margin-top: 0; }
.p-trace .sources { margin-top: 2rem; }

/* ---------------------------------------------------------------- folio -- */
.folio { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1.75rem; height: 2.6rem; padding: 0 var(--gut); margin-top: 1rem;
  background: #14161A; color: #F5F2EB; font-size: var(--t-kick); font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.folio ol { display: flex; gap: 1.5rem; }
.folio a { color: #B9B5AB; text-decoration: none; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.folio a:hover { color: #F5F2EB; }
.folio a[aria-current] { color: #F5F2EB; border-bottom-color: #98A2FF; }
.folio :focus-visible { outline-color: #98A2FF; }

/* ----------------------------------------------------------- title page -- */
.tp { padding: clamp(2rem, 5vw, 4.5rem) 0 clamp(2.5rem, 5vw, 4.5rem); }
.tp__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 2rem clamp(2rem, 5vw, 5rem); align-items: end; }
.tp h1 { margin-top: 0.9rem; font-size: clamp(3rem, 1.5rem + 6.4vw, 6.6rem); line-height: 0.88; max-width: 9ch; }
.tp .deck { margin-top: 1.4rem; }
.tp__note { margin-top: 1.25rem; font-size: var(--t-sm); color: var(--sc-ink-soft); }
.tp__note .tag { margin-right: 0.4rem; }

/* -------------------------------------------------------------- chapters -- */
.ch { padding: clamp(3rem, 6vw, 5.5rem) 0; }
.ch--paper { border-top: 4px solid var(--sc-ink); }
.ch__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: 2.5rem clamp(2rem, 6vw, 6rem); align-items: start; }
.ch__grid--calc { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); }
.ch__text h2, .split__top h2, .colophon h2 { font-size: clamp(2rem, 1.3rem + 3vw, 3.6rem); line-height: 0.95; max-width: 16ch; }
.ch__text > .read { margin-top: 1.1rem; max-width: 36rem; font-size: 1.2rem; line-height: 1.4; }
.ch__text > .fact__m { margin-top: 0.5rem; }
.commit, .gaps { margin-top: 1.75rem; border-top: 2px solid var(--sc-ink); max-width: 40rem; }
.commit li, .gaps li { padding: 0.8rem 0; border-bottom: 1px solid var(--rule-soft); }
.gaps li { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; align-items: baseline; }
.avail { margin-top: 1.25rem; max-width: 40rem; }
.doc { border-top: 4px solid var(--sc-ink); padding-top: 0.7rem; font-size: var(--t-sm); }
.doc__t { font-family: var(--sc-font-display); font-stretch: 75%; font-weight: 800; font-size: 1.5rem; line-height: 1; margin: 0.5rem 0 0.9rem; }
.doc dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid var(--rule-soft); }
.doc dt { color: var(--sc-ink-soft); } .doc dd { text-align: right; font-weight: 650; }
.doc__n { margin: 0.9rem 0 0.5rem; padding-top: 0.8rem; border-top: 2px solid var(--sc-ink); font-family: var(--font-read); font-style: italic; font-size: 1.2rem; line-height: 1.3; }

.inter { min-height: 20rem; display: grid; place-items: center; padding: 3rem var(--gut); }
.inter__line { font-family: var(--sc-font-display); font-stretch: 75%; font-weight: 800; font-size: clamp(2.6rem, 1rem + 7vw, 7rem); line-height: 0.9; text-align: center; }

.formula { margin-top: 1.5rem; padding: 0.9rem 0; border-block: 1px solid var(--rule-soft); font-size: 0.9375rem; font-weight: 600; line-height: 2.3; max-width: 36rem; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; line-height: 1.3; text-align: center; margin: 0 0.2rem; }
.frac span + span { border-top: 1.5px solid var(--sc-ink); }
.gates { margin-top: 1.5rem; max-width: 36rem; border-top: 2px solid var(--sc-ink); }
.gates > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule-soft); font-size: var(--t-md); }
.gates dt { color: var(--sc-ink-soft); } .gates dd { font-weight: 650; text-align: right; }
.gates__n { margin-top: 0.6rem; font-size: var(--t-sm); font-weight: 650; color: var(--unknown); }
.calc { border-top: 4px solid var(--sc-ink); padding-top: 0.7rem; }
.calc__k { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.calc__in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 1rem 0 1.1rem; }
.calc__in label { display: grid; gap: 0.3rem; font-size: var(--t-xs); font-weight: 600; color: var(--sc-ink-soft); }
.calc__in input { width: 100%; height: 2.6rem; background: var(--sc-surface); border-color: var(--rule-soft); color: var(--sc-ink); font-size: 1rem; font-weight: 650; }
.calc__err { margin-bottom: 0.8rem; color: var(--stop); font-size: var(--t-sm); font-weight: 600; }
.calc__out { margin-top: 0.6rem; padding-top: 0.8rem; border-top: 2px solid var(--sc-ink); }
.calc__res { font-family: var(--sc-font-display); font-stretch: 75%; font-weight: 800; font-size: clamp(3rem, 2rem + 3.4vw, 5rem); line-height: 0.9; color: var(--sc-accent); }
.calc__sum { margin-top: 0.4rem; font-size: var(--t-sm); color: var(--sc-ink-soft); }
.calc__note { font-size: var(--t-sm); }
.calc__small { margin-top: 0.8rem; font-size: var(--t-xs); color: var(--sc-ink-soft); }

/* ------------------------------------------- two lanes and the seam -- */
.split { padding: clamp(2rem, 4vw, 3.5rem) 0 clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--rule-soft); }
.split__top { padding-bottom: 1.75rem; }
.lane__k { margin-bottom: 0.9rem; }
.rec .slip { max-width: 17rem; }
.rec__c { margin-top: 0.8rem; font-size: 1rem; line-height: 1.38; max-width: 22rem; }
.rec .fact__m { margin-top: 0.35rem; }
.thread { position: relative; margin: 0.5rem 0 0.5rem 1.25rem; padding: 1rem 0 1rem 1.25rem; }
.thread__line { position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px dotted var(--sc-ink); }
.seam { margin: 2.25rem 0 0; padding: 1.25rem 0 0; border-top: 2px dashed var(--sc-accent); }
.seam__q { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); line-height: 0.98; max-width: 12ch; color: var(--sc-accent); }
.lane--broker { margin-top: 1.5rem; }
.scn { margin: 1.5rem 0 0; padding: 0; border: 0; min-width: 0; max-width: 24rem; }
/* The legend is not floated: a floated full-width legend squeezes the first
   label to zero width and its text spills past a 390px viewport. */
.scn legend { display: block; width: 100%; padding: 0.8rem 0 0; margin-bottom: 0.5rem; border-top: 2px solid var(--sc-ink); }
.scn__opts { display: flex; flex-wrap: wrap; gap: 0 1.25rem; font-size: var(--t-sm); font-weight: 600; }
.scn label { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.2rem; cursor: pointer; }
.tl { margin-top: 0.6rem; overflow: visible; }
.tl__no { display: none; }
.split[data-outcome="none"] .tl__ok, .split[data-outcome="skip"] .tl__ok { display: none; }
.split[data-outcome="none"] .tl__no { display: inline; }
.scn__out { margin-top: 0.3rem; font-size: var(--t-sm); font-weight: 600; color: var(--sc-accent); }
.split[data-outcome="none"] [data-v="fillStatus"], .split[data-outcome="skip"] [data-v="fillStatus"] { color: #A8261C; }
.facility { border-top: 1px solid var(--rule-soft); padding: 2.25rem 0 3rem; }
.facility__in { display: grid; grid-template-columns: minmax(0, 0.45fr) minmax(0, 1fr); gap: 1rem 3rem; align-items: start; }
.facility h3 { font-size: 1.9rem; line-height: 1; }
.facility .read { margin-top: 1rem; max-width: 40rem; }
.facility .fact__m { margin-top: 0.5rem; }

/* ------------------------------------------------- closing paper chapter -- */
.openq { border-top: 4px solid var(--sc-accent); padding-top: 0.7rem; }
.openq h3 { font-size: 1.9rem; line-height: 1; margin: 0.5rem 0 0.7rem; }
.openq p + p { margin-top: 0.8rem; }
.colophon { margin-top: clamp(2.5rem, 6vw, 4.5rem); padding-top: 0.8rem; border-top: 4px solid var(--sc-ink); }
.colophon .checks { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 1.5rem; }
.colophon__go { margin-top: 2rem; font-size: 1.2rem; }

/* -------------------------------------------- wide screens: side by side -- */
@media (min-width: 1000px) {
  .lanes { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.55fr) minmax(0, 1fr); gap: 0 2rem; align-items: start; }
  .lane__row { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem minmax(0, 1fr); gap: 0 1rem; }
  .thread--mf { margin: 0; padding: 2.1rem 0 0; text-align: center; }
  .thread--mf .thread__line { left: 0; right: 0; top: 1.5rem; bottom: auto; border-left: 0; border-top: 2px dotted var(--sc-ink); }
  .seam { margin: 0; padding: 0 0 0 1.5rem; border-top: 0; border-left: 2px dashed var(--sc-accent); align-self: stretch; display: flex; align-items: center; }
  .lane--broker { margin-top: 0; }
}

/* --------------------------------------------------------------- mobile -- */
@media (max-width: 900px) {
  .folio { gap: 1.1rem; } .folio ol { gap: 1.1rem; }
  .tp__grid, .ch__grid, .ch__grid--calc, .facility__in { grid-template-columns: minmax(0, 1fr); }
  .tp__grid { align-items: start; }
  .inter { min-height: 13rem; }
  .calc__in { grid-template-columns: minmax(0, 1fr); }
  .colophon .checks { grid-template-columns: minmax(0, 1fr); }
}
