/* flow.css — the scroll pages (/companions, /equussecure). Loads after
   styles.css and doc.css. The headlines dissolve (js/doc.js); one hairline runs
   down the page, inked as far as the reader has come; one section per screen. */

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(80px, 14vh, 140px) clamp(20px, 5vw, 60px) clamp(48px, 9vh, 90px);
}
.hero-inner { width: min(1000px, 90vw); }
.flow-page h1.dtext { font-size: clamp(40px, 6.4vw, 88px); white-space: pre-line; }

.hero-note {
  margin: clamp(24px, 3.6vh, 38px) auto 0;
  max-width: 44ch;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: balance;
}

@keyframes rise {
  from { opacity: 0; filter: blur(6px); transform: translateY(8px); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}
/* the headline assembles from dust and the lines follow; the default delays
   are a fallback so the copy appears even if the script never runs */
.hero-note { animation: rise 1.3s var(--ease-out-expo) 3s both; }
.is-ready .hero-note { animation-delay: 1.05s; }

/* ---------- The spine ---------- */

.run { position: relative; }

.spine {
  position: absolute;
  top: 0;
  bottom: 0;
  /* the left edge of the content measure: min(1120px, 90vw), centred */
  left: max(5vw, calc(50% - 560px));
  width: 1px;
}
/* the track: the whole run, waiting */
.spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--faint);
}
/* the ink: drawn as far as the reader has come */
.spine-ink {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: top;
  transform: scaleY(var(--p, 0));
  will-change: transform;
}
/* the ember at the leading edge */
.spine-ember {
  position: absolute;
  left: 50%;
  top: calc(var(--p, 0) * 100%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
  will-change: top;
}

/* ---------- Sections ---------- */

.sec {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(80px, 14vh, 140px) 0 clamp(48px, 9vh, 90px);
}

.sec .wrap {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: clamp(26px, 5vw, 76px);
  align-items: start;
}

.sec-rail { padding-top: 0.5em; }
.sec-rail .num {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sec-body { min-width: 0; }

.flow-page .sec-body h2.dtext {
  font-size: clamp(30px, 3.6vw, 50px);
  letter-spacing: -0.014em;
  color: var(--ink);
  max-width: 20ch;
}
.sec-body p {
  margin-top: 1em;
  font-family: var(--serif);
  font-size: clamp(17px, 1.25vw, 20px);
  line-height: 1.55;
  color: color-mix(in oklch, var(--ink) 84%, var(--bg));
  max-width: 44ch;
  text-wrap: pretty;
}
.sec-body h2 + p { margin-top: clamp(20px, 3vh, 30px); }
.sec-body .plain { margin-top: clamp(22px, 3.2vh, 32px); max-width: 52ch; }
.sec-body .plain li { font-size: clamp(16px, 1.15vw, 18px); }

/* ---------- Closer ---------- */

.closer {
  min-height: 46svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(60px, 10vh, 110px) 0 clamp(50px, 9vh, 90px);
}
.closer .wrap { text-align: center; }
.closer .colophon {
  font-family: var(--grot);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- One section per scroll ----------
   Guarded: a viewport too short to hold a section would trap its content, and
   snapping is scroll hijacking for anyone who has asked for less motion. */

@media (min-height: 640px) and (prefers-reduced-motion: no-preference) {
  html {
    scroll-snap-type: y mandatory;
    scroll-padding-top: 0;
  }
  .hero, .sec {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
  .closer { scroll-snap-align: end; }
}

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .sec .wrap { grid-template-columns: 1fr; gap: 12px; padding-left: 28px; }
  .sec { padding: clamp(64px, 11vh, 110px) 0 clamp(40px, 7vh, 70px); }
  .sec-rail { padding-top: 0; }
  .flow-page .sec-body h2.dtext, .sec-body p { max-width: none; }
  .hero { padding-top: clamp(96px, 18vh, 150px); }
  .doc-masthead { position: absolute; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero-note { animation: none !important; }
  .spine-ink { transform: none; }   /* the line is simply there */
  .spine-ember { display: none; }
}

/* ---------- Print ---------- */

@media print {
  .hero { padding: 40px 0 32px; }
  .hero-note { animation: none !important; }
  .spine { display: none; }
  .sec { padding: 26px 0; break-inside: avoid; }
}
