/*
  Dragon Tamers book pages (r5: two books, each an opening book with its own spread).
  Two families, both self-hosted, both OFL:
    Cinzel        the series face (titles, buttons, the credit).
    Patrick Hand  the hand that writes the back-cover text on the left page. An intentional second
                  family (rule DL-6160): a clear handwritten PRINT face, not cursive, so young readers
                  can read it.
  The book itself lives in book-open.css. The sequence (open, quill, words, eye) and the book swap
  are run by library.js. Base styles are always the FINISHED spread: eye open, glow on, every word
  visible. The in-progress looks apply only under "bk-seq", which only library.js adds.
*/

@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/cinzel-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Patrick Hand";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/patrick-hand-latin.woff2") format("woff2");
}

:root {
  --night: #0b0907;
  --ink: #1a1206;
  --parchment: #f0e6cc;
  --muted: #cbbfa6;
  --quiet: #a99d86;
  --gold: #d4a043;
  --gold-text: #e2b866;
  /* on paper */
  --p-ink: #2a1c0f;
  --p-soft: #54412b;
  --p-gold: #765010;
  --p-rust: #84340f;
  --font: "Cinzel", Georgia, "Times New Roman", serif;
  --hand: "Patrick Hand", "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive;
  /* one board of the book; the spread is twice this.
     Height budget: 114px of page furniture plus the book and the clear space kept under it
     (--leaf-room, 10% of the book's height), hence the divisor 1.499 * 1.1 = 1.649. */
  --page-w: max(min(calc(100vw - 28px), calc((100vh - 114px) / 1.649), 480px), min(280px, calc(100vw - 28px)));
  --page-w: max(min(calc(100vw - 28px), calc((100svh - 114px) / 1.649), 480px), min(280px, calc(100vw - 28px)));
  --leaf-room: calc(var(--page-w) * 0.15);
  --book-w: var(--page-w);
  color-scheme: dark;
}
@media (min-width: 720px) {
  :root {
    --page-w: max(min(calc((100vw - 64px) / 2), calc((100vh - 114px) / 1.649), 740px), 300px);
    --page-w: max(min(calc((100vw - 64px) / 2), calc((100svh - 114px) / 1.649), 740px), 300px);
    --book-w: calc(var(--page-w) * 2);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 60% 55% at 50% 45%, rgba(212, 160, 67, 0.09), transparent 72%),
    radial-gradient(circle at 88% 8%, rgba(123, 184, 200, 0.06), transparent 32%),
    var(--night);
  color: var(--parchment);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

/* Faint grain on the surface: one small static tile, never animated. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .94 0 0 0 0 .82 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--parchment);
  outline-offset: 4px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

main {
  position: relative;
  flex: 1;
  display: grid;
  align-content: center;
  /* bottom: the leaf's clear space (the credit's own 18px top padding makes up the rest) */
  padding: clamp(8px, 2svh, 24px) 0 max(0px, calc(var(--leaf-room) - 10px));
}

.scene {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
}

/* The control row is as wide as the open book; the control sits at its right edge. */
.scene__bar {
  position: relative;
  z-index: 3;            /* always above the book, even while a page swings past */
  width: var(--book-w);
  max-width: calc(100vw - 28px);
  min-height: 32px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.bk-control {
  min-height: 32px;
  min-width: 64px;
  padding: 4px 14px;
  border: 1px solid rgba(226, 184, 102, 0.55);
  border-radius: 999px;
  background: rgba(11, 9, 7, 0.6);
  color: var(--gold-text);
  font: 600 0.8rem/1 var(--font);
  letter-spacing: 0.12em;
  cursor: pointer;
}
.bk-control:hover { background: rgba(226, 184, 102, 0.14); color: var(--parchment); }
.bk-control[hidden] { display: none; }

/* ---- The stage: one book, or two while one slides out and the other slides in ---- */
.stage {
  display: grid;
  width: 100%;
  min-width: 0;
  overflow-x: clip;       /* a book sliding off the side never causes sideways scroll */
}
.slot {
  grid-area: 1 / 1;
  min-width: 0;
}
.slot--out { animation: dt-slide-out 0.55s cubic-bezier(0.55, 0, 0.85, 0.5) both; pointer-events: none; }
.slot--in,
.bk-arrive .slot { animation: dt-slide-in 0.65s 0.12s cubic-bezier(0.15, 0.6, 0.25, 1) both; }
.slot--fade { animation: dt-fade-in 0.2s ease-out both; }
@keyframes dt-slide-out {
  from { transform: none; }
  to   { transform: translateX(calc(-50vw - var(--page-w) * 1.1)); }
}
@keyframes dt-slide-in {
  from { transform: translateX(calc(50vw + var(--page-w) * 1.1)); }
  to   { transform: none; }
}
@keyframes dt-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .slot--out, .slot--in, .bk-arrive .slot { animation: none; }
}

/* ---- The book (sizes and colours; the mechanics are in book-open.css) ---- */
.bk {
  --bk-page-w: var(--page-w);
  --bk-ratio: 1.499;            /* the Book 1 cover is 1000 x 1499 */
  --bk-board: #141d18;
  --bk-board-hi: #223029;
  --bk-paper: #efe4c8;
  --bk-paper-edge: #cdbd98;
  cursor: default;
}
/* Book 2, Nightstorm: night-sky boards, as on its cover. */
.bk--b2 {
  --bk-board: #12122a;
  --bk-board-hi: #232448;
}
.bk-seq .bk__book { cursor: pointer; }

/* ---- Left page: the eye, then the back-cover text in a child-readable hand ---- */
.bk__art {
  container-type: inline-size;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 5% 7.5%;
}
.eye {
  /* The slit pupil's centre, measured from the artwork (the centroid of the slit's solid ink,
     qa/make_two_book_assets_r5.py), as a share of the image box. Every light is anchored here,
     inside the same box as the image, so it stays on the pupil at every size and during every move. */
  --pupil-x: 35.11%;
  --pupil-y: 49.3%;
  /* The eye's opening (the lid line), traced from the artwork, as a share of the image box. */
  --eye-open: polygon(19.8% 60.3%, 20.9% 56.8%, 22.9% 52.4%, 25.2% 48.1%, 27.1% 44.7%, 28.5% 42.6%, 29.8% 41.2%, 31.0% 40.2%, 32.3% 39.4%, 33.7% 38.6%, 35.1% 38.1%, 36.7% 37.8%, 38.3% 37.7%, 40.2% 37.8%, 42.2% 38.1%, 44.2% 38.7%, 46.1% 39.4%, 47.9% 40.3%, 49.7% 41.5%, 51.3% 42.8%, 52.6% 44.0%, 53.4% 45.2%, 53.9% 46.3%, 54.2% 47.5%, 54.3% 49.0%, 54.3% 50.8%, 54.1% 52.8%, 53.6% 55.0%, 53.0% 57.5%, 52.0% 60.4%, 50.9% 63.7%, 49.4% 66.9%, 47.8% 69.5%, 45.9% 71.4%, 43.7% 72.8%, 41.4% 73.8%, 39.2% 74.4%, 37.0% 74.6%, 34.8% 74.4%, 32.6% 73.8%, 30.6% 73.0%, 28.6% 71.9%, 26.8% 70.5%, 25.1% 69.0%, 23.7% 67.4%, 22.2% 65.9%, 20.8% 64.5%, 19.9% 62.7%);
  position: relative;
  isolation: isolate;
  width: 86%;
  aspect-ratio: 1200 / 732;
}
/* Nightstorm's eye looks the other way: the same drawing, mirrored (lights and lids mirror with it). */
.bk--b2 .eye { transform: scaleX(-1); }
.eye picture,
.eye img {
  display: block;
  width: 100%;
  height: 100%;
}
.eye picture { position: relative; z-index: 1; }

/*
  The eye's glow: dark purple, for Nightstorm. Layers, bottom to top:
    .eye__iris  a deep violet haze UNDER the drawing, centred on the pupil.
    picture     the ink drawing.
    .eye__glow  violet light OVER the drawing, masked by the drawing itself, so only the ink takes
                the colour; its hottest point is the pupil's centre.
    .eye__glint a faint light that drifts across the eye's opening; the middle of its path is the pupil.
    .eye__fx    the lids and the membrane (a canvas; empty at rest; the eye wakes last).
  Colours: core #3b0a5c to #6a1b9a, hottest point #9b4dff.
*/
.eye__iris,
.eye__glow {
  position: absolute;
  pointer-events: none;
}
.eye__iris {
  z-index: 0;
  left: var(--pupil-x);
  top: var(--pupil-y);
  width: 42%;
  height: 56%;
  border-radius: 50%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%,
    rgba(59, 10, 92, 0.8) 0%,
    rgba(74, 16, 120, 0.64) 34%,
    rgba(59, 10, 92, 0.36) 60%,
    rgba(59, 10, 92, 0) 78%);
  transform: translate(-50%, -50%) rotate(-8deg);
  opacity: 0.88;
}
/* Without mask support: a small violet light on the slit only. */
.eye__glow {
  z-index: 2;
  left: var(--pupil-x);
  top: var(--pupil-y);
  width: 6%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, #9b4dff 0%, #6a1b9a 40%, rgba(59, 10, 92, 0.6) 70%, rgba(59, 10, 92, 0) 100%);
  transform: translate(-50%, -50%) rotate(-12deg);
  opacity: 0.94;
}
@supports ((mask-image: url("")) or (-webkit-mask-image: url(""))) {
  .eye__glow {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    background: radial-gradient(ellipse 20% 34% at 35.11% 49.3%,
      #9b4dff 0%,
      #7a2bd0 4%,
      #6a1b9a 10%,
      #4a0f74 20%,
      #3b0a5c 32%,
      rgba(59, 10, 92, 0.85) 62%,
      rgba(59, 10, 92, 0) 100%);
    -webkit-mask: url("img/eye-ink-720.webp") center / 100% 100% no-repeat;
    mask: url("img/eye-ink-720.webp") center / 100% 100% no-repeat;
    transform: none;
  }
}

/* The glint: one small light, clipped to the eye's opening. Only transform and opacity move. */
.eye__glint {
  position: absolute;
  z-index: 3;
  inset: 0;
  clip-path: var(--eye-open);
  pointer-events: none;
}
.eye__glint::before {
  content: "";
  position: absolute;
  left: calc(var(--pupil-x) - 5.5%);
  top: calc(var(--pupil-y) - 26%);
  width: 11%;
  height: 52%;
  background: linear-gradient(to right, rgba(155, 77, 255, 0) 0%, rgba(190, 150, 255, 0.55) 50%, rgba(155, 77, 255, 0) 100%);
  transform: translateX(-240%) rotate(16deg);
  opacity: 0;
}

/* The lids and the membrane (r6): one small canvas over the eye's opening, drawn by library.js from
   sheets made out of the drawing's own ink. It is empty unless the sequence runs or the membrane
   flicks across. library.js places it over the opening. */
.eye__fx {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

/* The back-cover text. Real text from the start; the quill only reveals it. */
.backtext {
  position: relative;
  width: 100%;
  margin-top: 3.2cqi;
  font-family: var(--hand);
  color: var(--p-ink);
}
.backtext p { margin: 0; }
.backtext__lead {
  margin-bottom: 0.3em !important;
  font-size: clamp(16px, 6.4cqi, 44px);
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: balance;
  color: var(--p-rust);
}
.backtext__body {
  font-size: clamp(12.5px, 4.9cqi, 32px);
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-align: left;
  hyphens: none;
}
/* The quill: decoration only, moved by library.js (transform and opacity). */
.quill {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(46px, 19cqi, 132px);
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
  transform-origin: 0 100%;
  transition: opacity 0.35s ease;
  will-change: transform;
}
.q-on .quill { opacity: 1; }
.bk:not(.bk-seq) .quill { transition: none; }   /* Skip: gone at once */

/* Right page: the words. Sizes follow the page width (container query units) with readable floors. */
.bk__words {
  display: grid;
  align-items: center;
  padding: calc(var(--page-w) * 0.07) calc(var(--page-w) * 0.075);
  color: var(--p-ink);
  text-align: center;
}
.bk__words:focus { outline: none; }

.words {
  display: grid;
  justify-items: center;
  gap: clamp(6px, 2.6cqi, 22px);
}

.kicker {
  margin: 0;
  font-weight: 600;
  font-size: clamp(12px, 3.3cqi, 22px);
  letter-spacing: 0.18em;
  padding-left: 0.18em;           /* optical centring against the trailing tracking */
  color: var(--p-gold);
}

h1 {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 0.12em;
  font-weight: 700;
  font-size: clamp(28px, 12cqi, 92px);
  line-height: 1.02;
  letter-spacing: 0.06em;
  padding-left: 0.06em;
  color: var(--p-ink);
}
h1:focus { outline: none; }
.h1__book {
  font-size: 0.56em;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding-left: 0.12em;
  color: var(--p-soft);
}

.byline {
  margin: 0;
  font-weight: 600;
  font-size: clamp(13px, 3.8cqi, 26px);
  letter-spacing: 0.14em;
  padding-left: 0.14em;
  color: var(--p-gold);
}

.ornament {
  width: 46cqi;
  height: auto;
  aspect-ratio: 320 / 34;
  color: var(--p-gold);
  opacity: 0.85;
}
.ornament path { fill: none; stroke: currentColor; stroke-width: 1.6; }

.keep { white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 0.3em;
  padding: 0.75em 1.1em;
  white-space: nowrap;
  border: 1px solid #8a5f17;
  border-radius: 4px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(13px, 3.5cqi, 22px);
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(118, 80, 16, 0.25);
  transition: background-color 160ms ease, transform 160ms ease;
}
.btn:hover { background: #e2b866; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.bk__words :focus-visible { outline-color: var(--p-ink); }

/* The link to the other book, and the link to the author's home page. Blocks of text, so a long
   label wraps as words between its two halves on narrow pages. */
.swap-link,
.home-link {
  display: inline-block;
  min-height: 24px;
  padding: 2px 4px;
  font-weight: 600;
  font-size: clamp(12px, 3.2cqi, 20px);
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--p-soft);
  text-decoration: underline;
  text-decoration-color: rgba(118, 80, 16, 0.6);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.swap-link:hover,
.home-link:hover { color: var(--p-ink); }
.swap-link { color: var(--p-ink); }
.swap-link cite { font-style: normal; }

/* The series line: plain words under the link to the other book, in the hand that wrote the back-cover text.
   Not a link. The two titles are plain, as the other book's title is in the link above. */
.series-note {
  margin: -0.2em 0;                /* the links above and below carry their own air */
  max-width: 100cqi;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(14px, 4.3cqi, 26px);
  line-height: 1.18;
  letter-spacing: 0.01em;
  color: var(--p-ink);
  text-wrap: balance;
}
.series-note cite { font-style: normal; }

@container (max-width: 270px) {
  .btn { padding: 0.75em 0.7em; font-size: 12px; letter-spacing: 0.04em; }
  .swap-link, .home-link { letter-spacing: 0.02em; }
  .series-note { font-size: 13px; letter-spacing: 0; }
}

/* Phones: one tall page holds the eye, then the written text, then the words. */
@media (max-width: 719.98px) {
  .bk__art { align-content: start; padding: 7% 8% 0; }
  .eye { width: 66%; }
  .backtext { margin-top: 4cqi; }
  .backtext__lead { font-size: clamp(19px, 7.4cqi, 30px); }
  .backtext__body { font-size: clamp(15.5px, 5.6cqi, 22px); line-height: 1.34; }
  .bk__words { align-items: start; padding-top: calc(var(--page-w) * 0.07); padding-bottom: calc(var(--page-w) * 0.08); }
  .words { gap: clamp(6px, 2.4cqi, 14px); }
  h1 { font-size: clamp(26px, 10.4cqi, 60px); }
  .ornament { width: 40cqi; }
}

/* ---- Designer credit ---- */
.credit {
  position: relative;
  z-index: 3;            /* above the book; main's bottom padding (--leaf-room) keeps turning leaves clear of it */
  padding: 18px 20px 14px;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
.credit p { margin: 0; }
.credit a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 3px;
  color: var(--gold-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.credit a:hover { color: var(--parchment); }

/* ---- Pause animations: a small-print button beside the credit (library.js shows it). Pressed, it reads
        "Play animations", and everything on the page that keeps moving stands still. Its unseen margin makes
        it easy to hit; on a narrow window it takes a line of its own, clear of the credit's link. ---- */
.pause-ctl {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0 0 0 1.2em;
  padding: 2px 3px;
  border: 0;
  background: none;
  color: var(--gold-text);
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}
.pause-ctl[hidden] { display: none; }
.pause-ctl::after { content: ""; position: absolute; inset: -10px 0; }
.pause-ctl:hover { color: var(--parchment); }
@media (max-width: 599.98px) {
  .pause-ctl { display: flex; margin: 20px auto 0; }
  .pause-ctl[hidden] { display: none; }
}
/* Paused: the eye's glow holds where it is (the scripts hold everything else). */
.dt-paused .eye__iris,
.dt-paused .eye__glow,
.dt-paused .eye__glint::before { animation-play-state: paused; }

/* ---- The eye's life. Only opacity and transform move, on small layers. ----
   Finished state: the purple breathes slowly (4.4 s a cycle); a glint crosses every third breath.
   Under reduced motion the glow is still and there is no glint. */
@media (prefers-reduced-motion: no-preference) {
  .eye__iris { animation: dt-breathe-iris 4.4s ease-in-out infinite; }
  .eye__glow { animation: dt-breathe-glow 4.4s ease-in-out infinite; }
  .eye__glint::before { animation: dt-glint 13.2s 6.6s linear infinite; }
}
@keyframes dt-wake-iris {
  0%   { opacity: 0;    transform: translate(-50%, -50%) rotate(-8deg) scale(0.6); }
  60%  { opacity: 1;    transform: translate(-50%, -50%) rotate(-8deg) scale(1.1); }
  100% { opacity: 0.72; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
}
@keyframes dt-wake-glow {
  0%   { opacity: 0; }
  60%  { opacity: 1; }
  100% { opacity: 0.8; }
}
@keyframes dt-breathe-iris {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  50%      { opacity: 1;    transform: translate(-50%, -50%) rotate(-8deg) scale(1.07); }
}
@keyframes dt-breathe-glow {
  0%, 100% { opacity: 0.8; }
  50%      { opacity: 1; }
}
@keyframes dt-glint {
  0%   { opacity: 0; transform: translateX(-240%) rotate(16deg); }
  2%   { opacity: 1; }
  12%  { opacity: 1; }
  14%  { opacity: 0; transform: translateX(240%) rotate(16deg); }
  100% { opacity: 0; transform: translateX(240%) rotate(16deg); }
}
@media (prefers-reduced-motion: reduce) {
  .eye__iris, .eye__glow { animation: none; }
  .eye__glint { display: none; }
}

/* =====================  The sequence (bk-seq; library.js)  =====================
   Order: the book opens -> the eye is CLOSED -> the quill writes the back-cover text (q-on, then
   q-done) -> the right page draws in (w-on) -> the eye wakes, then its glow comes up (e-on).
   When it ends, or on Skip, every class is removed and the base styles above show. */

/* 1. The eye is shut (library.js draws the lids or the membrane) and dark until its turn. */
.bk-seq:not(.e-on) .eye__iris,
.bk-seq:not(.e-on) .eye__glow { opacity: 0; animation: none; }
.bk-seq .eye__glint::before { animation: none; }

/* 2. The text is unwritten until the quill reaches it. The written part is painted by the CSS
      Custom Highlight API (no change to the text itself); the newest letters are still wet. */
.bk-seq:not(.q-done) .backtext p { color: transparent; }
::highlight(dt-ink) { color: #2a1c0f; }
.backtext__lead::highlight(dt-ink) { color: #84340f; }
::highlight(dt-wet) { color: rgba(42, 28, 15, 0.5); }
.backtext__lead::highlight(dt-wet) { color: rgba(132, 52, 15, 0.5); }
/* Browsers without the Highlight API: the text fades in while the quill waits. */
.bk-seq.q-fade:not(.q-done) .backtext p { color: inherit; animation: dt-fade-in 1.2s ease-out both; }
.bk-seq.q-fade:not(.q-done) .backtext__lead { color: var(--p-rust); }

/* 3. The right page is blank until the text is written, then each line is drawn in. */
.bk-seq:not(.w-on) .words > * { opacity: 0; }
.bk-seq.w-on .words > * { animation: dt-draw 0.6s cubic-bezier(0.3, 0.5, 0.3, 1) both; }
.bk-seq.w-on .words > :nth-child(2) { animation-delay: 0.12s; }
.bk-seq.w-on .words > :nth-child(3) { animation-delay: 0.24s; }
.bk-seq.w-on .words > :nth-child(4) { animation-delay: 0.36s; }
.bk-seq.w-on .words > :nth-child(5) { animation-delay: 0.48s; }
.bk-seq.w-on .words > :nth-child(6) { animation-delay: 0.6s; }
.bk-seq.w-on .words > :nth-child(7) { animation-delay: 0.72s; }
.bk-seq.w-on .words > :nth-child(8) { animation-delay: 0.84s; }
@keyframes dt-draw {
  from { opacity: 0; clip-path: inset(-14px 100% -14px -14px); }
  to   { opacity: 1; clip-path: inset(-14px -14px -14px -14px); }
}

/* 4. The eye wakes (library.js moves the lids or the membrane), then the purple wakes on the pupil.
      --eye-glow-at is when the glow starts, set by library.js for the eye variant in use.
      The wake ends exactly where the breathing starts, so the hand-over cannot be seen. */
.bk-seq.e-on .eye__iris { animation: dt-wake-iris 1.3s var(--eye-glow-at, 2.1s) ease-in-out both; }
.bk-seq.e-on .eye__glow { animation: dt-wake-glow 1.3s var(--eye-glow-at, 2.1s) ease-in-out both; }

@media (prefers-reduced-motion: reduce) {
  .eye__fx { display: none; }
  .bk-seq .backtext p { color: inherit !important; animation: none !important; }
  .bk-seq .backtext__lead { color: var(--p-rust) !important; }
  .bk-seq .words > * { opacity: 1 !important; animation: none !important; }
  .bk-seq .eye__iris, .bk-seq .eye__glow { opacity: 0.88 !important; animation: none !important; }
}
