/* ---------------------------------------------------------------------------
   /extract: the reading experience.
   Scroll is the reader's hand turning the page. All motion is scrubbed.
--------------------------------------------------------------------------- */

body.extract-body {
  background: #0b0b0d; /* JS animates this across the passage's arc */
}

/* Thin reading-progress hairline, left edge */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: var(--paper);
  opacity: 0.18;
  transform: scaleY(0);
  transform-origin: top;
  pointer-events: none;
  z-index: 5;
}

.reading {
  position: relative;
  z-index: 1;
}

/* Every movement is one beat */
.mv {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18vh 1.5rem;
}

.mv-inner {
  max-width: var(--measure);
  width: 100%;
}

/* Beat types ---------------------------------------------------------------- */

.mv-line .mv-inner {
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  line-height: 1.55;
  text-align: center;
}

.mv-para .mv-inner {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.3125rem);
  line-height: 1.7;
}

.mv-quote { padding: 26vh 1.5rem; }
.mv-quote .mv-inner {
  font-size: clamp(1.625rem, 1.2rem + 2.6vw, 2.625rem);
  line-height: 1.35;
  text-align: center;
  max-width: 22em;
}

.mv-word { min-height: 100svh; padding: 0 1.5rem; }
.mv-word .mv-inner {
  font-size: clamp(2.25rem, 1.5rem + 5vw, 4.5rem);
  font-style: italic;
  text-align: center;
}

/* Dispersion: the marked phrase loosens its letter-spacing while scrolling */
.mv-disperse .mv-inner {
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  text-align: center;
}
.mv-disperse .loose {
  display: inline-block;
  letter-spacing: 0; /* JS scrubs this open */
  white-space: nowrap;
}

/* The circuit: the sentence begins as a closed ring and breaks open */
.mv-circuit {
  min-height: 100svh;
  overflow: hidden;
}
.mv-circuit .mv-inner {
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  line-height: 1.55;
  text-align: center;
}
.mv-circuit .word { display: inline-block; white-space: nowrap; }
.mv-circuit .ch { display: inline-block; white-space: pre; will-change: transform; }

/* The fall: letters break loose and drop toward the right edge */
.mv-fall {
  overflow: hidden; /* falling letters leave the page, not the layout */
}
.mv-fall .mv-inner {
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  line-height: 1.55;
  text-align: center;
}
.mv-fall .word { display: inline-block; white-space: nowrap; }
.mv-fall .ch { display: inline-block; will-change: transform; }

/* Footnote that descends further than expected */
.mv-footnote .mv-inner {
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  text-align: center;
}
.mv-footnote sup {
  font-size: 0.6em;
  color: var(--paper-dim);
  margin-left: 0.1em;
}

/* the recursion echoes: the line repeats below itself, fainter each time */
.mv-footnote { flex-direction: column; }
.mv-footnote .echoes {
  margin-top: 1.4rem;
  width: 100%;
  max-width: var(--measure);
  text-align: center;
}
.mv-footnote .echo {
  display: block;
  font-size: clamp(1.25rem, 1.05rem + 1.2vw, 1.625rem);
  line-height: 1.6;
  transform-origin: 50% 0;
}

.mv-note {
  min-height: 175vh; /* the descent: longer than it should be */
  align-items: flex-end;
  padding-bottom: 30vh;
}
.mv-note .mv-inner {
  max-width: 24em;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--paper-dim);
}
.mv-note .mv-inner::before {
  content: "*";
  display: block;
  color: var(--paper-faint);
  margin-bottom: 0.75rem;
}

/* Breathing space: full-bleed atmosphere panel (swap in a photograph via src) */
.mv-break {
  min-height: 110svh;
  padding: 0;
}
.mv-break .panel {
  position: relative;
  width: 100%;
  min-height: 110svh;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(60, 47, 38, 0.45), transparent 65%),
    radial-gradient(100% 70% at 20% -10%, rgba(28, 30, 38, 0.6), transparent 60%);
  /* dissolve into the page ground at both edges; no hard seams */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
}
.mv-break .panel::after {
  /* film grain: texture on OLED, and dither against gradient banding */
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  pointer-events: none;
}
.mv-break img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The sigil: a thin circle, drawn at the opening, returned inverted */
.mv-sigil { min-height: 90svh; }
.mv-sigil svg {
  width: clamp(72px, 18vw, 110px);
  height: auto;
  display: block;
  margin: 0 auto;
  overflow: visible;
}
.mv-sigil circle,
.mv-sigil line,
.mv-sigil path {
  fill: none;
  stroke: var(--paper-dim);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* Source line + exit */
.mv-colophon {
  flex-direction: column;
  gap: 2.5rem;
  padding-bottom: 22vh;
  text-align: center;
}
.mv-colophon .source {
  font-size: 1.0625rem;
  color: var(--paper-dim);
}
.mv-colophon .exit {
  font-family: var(--grotesque);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
  border-bottom: 1px solid var(--paper-faint);
  padding-bottom: 0.2em;
}
.mv-colophon .exit:hover { color: var(--paper); border-color: var(--accent); }

/* Scroll cue: a small arrow under the opening, gone as reading begins */
.scroll-cue {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
}
.scroll-cue svg {
  width: 14px;
  height: 36px;
  display: block;
}
.scroll-cue path {
  fill: none;
  stroke: var(--paper-dim);
  stroke-width: 1;
}

/* Motion defaults ------------------------------------------------------------ */

/* JS-driven states; without JS or with reduced motion, everything reads statically.
   The eye's lids stay visible from the start (a closed eye is still a line). */
html.has-motion .mv-inner { opacity: 0; }
html.has-motion .mv-sigil .draw,
html.has-motion .mv-sigil .iris { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html.has-motion .mv-inner,
  html.has-motion .mv-sigil .draw,
  html.has-motion .mv-sigil .iris { opacity: 1; }
}

/* --- Phones: tighter breathing so dark stretches stay a pause, not a desert --- */

@media (max-width: 519px) {
  .mv { padding: 12vh 1.5rem; }
  .mv-quote { padding: 18vh 1.5rem; }
  .mv-break,
  .mv-break .panel { min-height: 64svh; }
  /* keep the panels full-bleed: the .mv padding above must not re-inset them */
  .mv-break { padding: 0; }
  /* the descent still overshoots, but a phone's worth, not a desktop's */
  .mv-note { min-height: 115vh; padding-bottom: 24vh; }
}
