:root {
  --night: #050208;
  --black-plum: #0d0612;
  --deep-plum: #17091f;
  --plum: #2a1238;
  --royal-plum: #4b2368;
  --wine: #68234f;
  --antique-gold: #c99a46;
  --gold-light: #f4d58d;
  --cream: #fff5df;
  --paper: #f2dfbd;
  --ink: #1e1326;
  --muted: rgba(255, 245, 223, .74);
  --line: rgba(244, 213, 141, .24);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body.storybook-home {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 0%, rgba(104, 35, 79, .34), transparent 34rem),
    linear-gradient(180deg, var(--night) 0%, var(--deep-plum) 44%, #100715 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.intro-active {
  height: 100vh;
  overflow: hidden;
}

body.intro-active .story-header,
body.intro-active main,
body.intro-active .storybook-footer {
  visibility: hidden;
}

body.storybook-home img {
  user-select: none;
  -webkit-user-drag: none;
}

.opening-scene {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 44%, rgba(244, 213, 141, .1), transparent 18rem),
    radial-gradient(circle at 24% 18%, rgba(104, 35, 79, .24), transparent 22rem),
    linear-gradient(135deg, #010103 0%, #08030c 45%, #18091f 100%);
  opacity: 1;
  transition: transform 1.1s cubic-bezier(.2, .75, .2, 1), border-radius 1.1s ease;
}

.opening-scene.is-inside-book {
  position: relative;
  min-height: 100vh;
  z-index: 1;
  pointer-events: none;
}

.opening-scene.is-skipped {
  position: relative;
  min-height: 0;
  height: 0;
  visibility: hidden;
  pointer-events: none;
}

.webgl-stage,
#storybookCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#storybookCanvas.butterfly-webgl {
  display: block;
  z-index: 5;
  pointer-events: none;
  touch-action: none;
}

.image-intro-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  background:
    radial-gradient(circle at 54% 40%, rgba(244, 213, 141, .08), transparent 19rem),
    radial-gradient(circle at 38% 28%, rgba(104, 35, 79, .18), transparent 25rem),
    radial-gradient(circle at 84% 64%, rgba(219, 96, 133, .08), transparent 17rem),
    linear-gradient(145deg, #010103 0%, #0a0310 48%, #1b0a22 74%, #020103 100%);
  opacity: 1;
  pointer-events: none;
  transition: opacity .6s ease;
  isolation: isolate;
}

.opening-scene.is-entering-pages .image-intro-stage {
  opacity: 0;
  transform: scale(1.12) translateY(-2vh);
  transition: opacity 2.8s cubic-bezier(.2, .72, .16, 1), transform 2.8s cubic-bezier(.2, .72, .16, 1);
}

.intro-camera {
  position: absolute;
  inset: 0;
  perspective: 1600px;
  transform-style: preserve-3d;
  transform-origin: 47% 55%;
  animation: introCameraPush 22s cubic-bezier(.18, .72, .18, 1) forwards, introHandheld 3.8s ease-in-out infinite;
}

.intro-book-element {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(1240px, 122vw);
  aspect-ratio: 3 / 2;
  transform: translate(-50%, -50%) scale(1.03);
  transform-origin: 52% 58%;
  animation: introBookBreath 5.4s ease-in-out infinite, introBookOpenBeat 11.2s cubic-bezier(.18, .72, .18, 1) forwards;
}

.intro-book-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.08) brightness(.88);
  user-select: none;
  -webkit-user-drag: none;
  animation: introBookImageReveal 22s cubic-bezier(.18, .72, .18, 1) forwards;
}

.intro-book-element::before {
  content: "";
  position: absolute;
  inset: 10% 11% 11% 10%;
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 28% 52%, rgba(0, 0, 0, .16), transparent 28%),
    radial-gradient(ellipse at 76% 78%, rgba(255, 220, 142, .08), transparent 34%);
  opacity: .32;
  filter: blur(5px);
  mix-blend-mode: multiply;
  animation: introLeatherFlex 5.8s ease-in-out infinite;
  pointer-events: none;
}

.intro-book-element::after {
  content: "";
  position: absolute;
  inset: 8.4% 9.6% 10.2% 9.4%;
  border-radius: 30px;
  background:
    radial-gradient(circle at 23% 24%, rgba(255, 235, 181, .14), transparent 10rem),
    radial-gradient(circle at 76% 28%, rgba(255, 225, 151, .11), transparent 8rem),
    repeating-linear-gradient(34deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(112deg, rgba(0, 0, 0, .035) 0 1px, transparent 1px 7px);
  opacity: .34;
  mix-blend-mode: overlay;
  filter: contrast(1.2);
  pointer-events: none;
}

.intro-cover-lift {
  position: absolute;
  inset: 0;
  background: url("../images/storybook-intro-base.png") center / cover no-repeat;
  clip-path: polygon(20% 12%, 86% 10%, 90% 72%, 24% 77%);
  opacity: 0;
  transform-origin: 19% 45%;
  transform: perspective(1300px) rotateY(0deg) rotateX(0deg) translateZ(0);
  filter: saturate(1.1) contrast(1.08) brightness(.96);
  will-change: transform, opacity, filter;
  pointer-events: none;
}

.intro-page-compression {
  position: absolute;
  left: 35.5%;
  right: 1.4%;
  bottom: 5.4%;
  height: 30%;
  background:
    repeating-linear-gradient(0deg, rgba(255, 232, 176, .5) 0 1px, rgba(87, 52, 21, .34) 1px 2px, rgba(246, 204, 115, .18) 2px 4px, transparent 4px 6px),
    linear-gradient(90deg, rgba(0, 0, 0, .44), transparent 12%, rgba(255, 215, 129, .2) 72%, rgba(0, 0, 0, .5));
  clip-path: polygon(0 22%, 99% 4%, 100% 78%, 2% 100%);
  opacity: .34;
  filter: blur(.2px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.intro-page-edge-depth {
  position: absolute;
  left: 37.5%;
  right: 1.8%;
  bottom: 6%;
  height: 28%;
  z-index: 2;
  clip-path: polygon(0 24%, 100% 3%, 99% 84%, 2% 100%);
  background:
    repeating-linear-gradient(0deg, rgba(70, 41, 18, .58) 0 1px, rgba(255, 223, 154, .42) 1px 2px, rgba(102, 66, 30, .34) 2px 3px, transparent 3px 5px),
    linear-gradient(90deg, rgba(38, 19, 10, .7), rgba(255, 223, 149, .18) 45%, rgba(62, 31, 12, .62));
  opacity: .38;
  mix-blend-mode: multiply;
  filter: saturate(1.1) contrast(1.22);
  pointer-events: none;
}

.intro-paper-shadow {
  position: absolute;
  left: 33%;
  right: 3%;
  bottom: 18%;
  height: 18%;
  z-index: 2;
  background:
    linear-gradient(6deg, transparent 0 18%, rgba(34, 16, 8, .32) 42%, transparent 74%),
    radial-gradient(ellipse at 47% 42%, rgba(0, 0, 0, .26), transparent 58%);
  opacity: .22;
  filter: blur(7px);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.intro-spine-flex {
  position: absolute;
  left: 14.6%;
  top: 6%;
  width: 18%;
  height: 84%;
  border-radius: 46% 22% 22% 46%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .34), transparent 34%, rgba(255, 219, 141, .14) 58%, transparent),
    repeating-linear-gradient(0deg, transparent 0 74px, rgba(255, 218, 132, .18) 76px 80px, transparent 82px 152px);
  opacity: .34;
  filter: blur(1.4px);
  mix-blend-mode: overlay;
  transform-origin: 82% 50%;
  pointer-events: none;
}

.intro-reflection-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(102deg, transparent 24%, rgba(255, 224, 151, .18) 40%, transparent 54%);
  opacity: .12;
  transform: translateX(-34%) skewX(-10deg);
  filter: blur(6px);
  mix-blend-mode: screen;
  animation: introReflectionMove 11.2s ease forwards;
  pointer-events: none;
}

.intro-gold-reflection {
  position: absolute;
  left: 27%;
  top: 17%;
  width: 49%;
  height: 28%;
  z-index: 4;
  border-radius: 50%;
  background:
    linear-gradient(104deg, transparent 0 28%, rgba(255, 239, 181, .34) 43%, rgba(255, 181, 60, .2) 50%, transparent 64%),
    radial-gradient(circle at 50% 50%, rgba(255, 222, 133, .18), transparent 58%);
  opacity: .22;
  filter: blur(5px);
  transform: translateX(-22%) skewX(-8deg);
  mix-blend-mode: screen;
  animation: introGoldReflection 8.6s ease-in-out 3s infinite;
  pointer-events: none;
}

.intro-flower-awakening {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.bloom {
  --delay: 7.4s;
  position: absolute;
  width: clamp(72px, 9vw, 128px);
  aspect-ratio: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.28) rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .34));
  mix-blend-mode: screen;
  animation:
    bloomWake 3.1s cubic-bezier(.18, .74, .18, 1) var(--delay) forwards,
    bloomBreeze 5.8s ease-in-out calc(var(--delay) + 2.4s) infinite;
}

.bloom-one {
  --delay: 7.35s;
  --tilt: -12deg;
  left: 22.5%;
  top: 61%;
}

.bloom-two {
  --delay: 8.35s;
  --tilt: 10deg;
  left: 76.5%;
  top: 50.5%;
}

.bloom-three {
  --delay: 9.15s;
  --tilt: -4deg;
  left: 25.5%;
  top: 24%;
  width: clamp(58px, 7vw, 98px);
}

.bloom i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32%;
  height: 56%;
  border-radius: 58% 64% 48% 52%;
  background:
    radial-gradient(ellipse at 52% 22%, rgba(255, 232, 246, .34), transparent 22%),
    radial-gradient(ellipse at 45% 72%, rgba(56, 18, 68, .5), transparent 66%),
    linear-gradient(180deg, rgba(193, 94, 174, .42), rgba(112, 42, 119, .34) 52%, rgba(42, 13, 55, .3));
  transform-origin: 50% 92%;
  opacity: .62;
  filter: saturate(1.18) contrast(1.08) blur(.18px);
  animation: petalUnfold 3.1s cubic-bezier(.16, .76, .18, 1) var(--delay) forwards;
}

.bloom i:nth-child(1) { transform: translate(-50%, -72%) scale(.18) rotate(0deg); }
.bloom i:nth-child(2) { transform: translate(-50%, -72%) scale(.18) rotate(40deg); }
.bloom i:nth-child(3) { transform: translate(-50%, -72%) scale(.18) rotate(80deg); }
.bloom i:nth-child(4) { transform: translate(-50%, -72%) scale(.18) rotate(120deg); }
.bloom i:nth-child(5) { transform: translate(-50%, -72%) scale(.18) rotate(160deg); }
.bloom i:nth-child(6) { transform: translate(-50%, -72%) scale(.18) rotate(200deg); }
.bloom i:nth-child(7) { transform: translate(-50%, -72%) scale(.18) rotate(240deg); }
.bloom i:nth-child(8) { transform: translate(-50%, -72%) scale(.18) rotate(280deg); }
.bloom i:nth-child(9) { transform: translate(-50%, -72%) scale(.18) rotate(320deg); }

.bloom i:nth-child(2n) {
  width: 26%;
  height: 49%;
  opacity: .52;
}

.bloom i:nth-child(3n) {
  filter: saturate(1.08) contrast(1.04) blur(.28px);
}

.bloom b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 45% 42%, rgba(255, 235, 170, .9), transparent 28%),
    radial-gradient(circle, rgba(153, 85, 47, .78), rgba(67, 30, 38, .52) 68%, rgba(32, 12, 28, .42));
  transform: translate(-50%, -50%) scale(.2);
  opacity: 0;
  box-shadow: 0 0 18px rgba(255, 212, 119, .32);
  animation: bloomHeart 2.2s ease var(--delay) forwards;
}

.bloom::before,
.bloom::after {
  content: none;
}

.bloom::after {
  transform: rotate(24deg);
  animation-delay: calc(var(--delay) + .28s);
}

.intro-cover-lift::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(0, 0, 0, .18), transparent 34%, rgba(255, 224, 143, .32) 58%, transparent 74%),
    radial-gradient(circle at 55% 46%, rgba(255, 219, 130, .22), transparent 42%);
  opacity: 0;
  mix-blend-mode: screen;
}

.opening-scene.intro-opening .intro-cover-lift {
  animation: introCoverLift 5.1s cubic-bezier(.16, .7, .12, 1) forwards;
}

.opening-scene.intro-opening .intro-cover-lift::after {
  animation: introCoverLiftLight 5.1s ease forwards;
}

.intro-title-glow {
  position: absolute;
  left: 31%;
  top: 24%;
  width: 42%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 218, 135, .24), rgba(255, 184, 68, .08) 38%, transparent 72%);
  filter: blur(12px);
  opacity: .28;
  animation: introTitleGlow 3.8s ease-in-out infinite;
  mix-blend-mode: screen;
}

.intro-cover-light {
  position: absolute;
  left: 38%;
  top: 39%;
  width: 34%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 148, .78), rgba(238, 160, 54, .28) 40%, transparent 72%);
  filter: blur(22px);
  opacity: 0;
  transform: scale(.3);
  mix-blend-mode: screen;
}

.intro-page-glow-leak {
  position: absolute;
  left: 39%;
  top: 45%;
  width: 39%;
  height: 10%;
  z-index: 4;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent, rgba(255, 229, 158, .55), rgba(255, 169, 55, .18), transparent),
    radial-gradient(ellipse, rgba(255, 225, 148, .35), transparent 68%);
  opacity: 0;
  filter: blur(12px);
  transform: scaleX(.25);
  mix-blend-mode: screen;
  animation: introLightLeak 12.8s ease forwards;
  pointer-events: none;
}

.intro-book-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 5%;
  height: 20%;
  border-radius: 50%;
  background: rgba(0, 0, 0, .52);
  filter: blur(34px);
  opacity: .76;
}

.intro-light-rays {
  position: absolute;
  left: 24%;
  right: 10%;
  top: 4%;
  bottom: 0;
  z-index: 2;
  background:
    conic-gradient(from 232deg at 53% 54%, transparent 0 7deg, rgba(255, 229, 158, .28) 11deg, transparent 18deg 27deg, rgba(255, 196, 85, .16) 34deg, transparent 43deg 360deg);
  opacity: 0;
  filter: blur(16px);
  mix-blend-mode: screen;
  transform: scale(.78) rotate(-4deg);
  pointer-events: none;
}

.intro-depth-field {
  position: absolute;
  inset: -4%;
  z-index: 5;
  background:
    radial-gradient(ellipse at 52% 48%, transparent 0 34%, rgba(3, 1, 6, .14) 54%, rgba(3, 1, 6, .58) 100%);
  backdrop-filter: blur(.7px);
  -webkit-backdrop-filter: blur(.7px);
  opacity: .42;
  pointer-events: none;
}

.intro-golden-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, 86vw);
  height: min(360px, 55vh);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 228, 156, .58), rgba(221, 144, 46, .24) 36%, transparent 70%);
  filter: blur(18px);
  opacity: 0;
  transform: translate(-38%, -18%) scale(.3);
  mix-blend-mode: screen;
  pointer-events: none;
}

.opening-scene.intro-opening .intro-page-compression {
  animation: introPageCompression 6.8s ease forwards;
}

.opening-scene.intro-opening .intro-page-edge-depth {
  animation: introPageEdgeOpen 6.8s ease forwards;
}

.opening-scene.intro-opening .intro-paper-shadow {
  animation: introPaperShadow 6.8s ease forwards;
}

.opening-scene.intro-opening .intro-spine-flex {
  animation: introSpineFlex 6.8s cubic-bezier(.2, .7, .2, 1) forwards;
}

.opening-scene.intro-opening .intro-cover-light {
  animation: introCoverLight 6.8s ease forwards;
}

.opening-scene.intro-opening .intro-light-rays {
  animation: introLightRays 6.8s ease forwards;
}

.opening-scene.intro-opening .intro-golden-glow {
  animation: introGlowRise 6.8s ease forwards;
}

.intro-particles,
.intro-particles::before,
.intro-particles::after {
  display: none;
}

.intro-particles::before {
  content: none;
}

.intro-particles::after {
  content: none;
}

.opening-scene.image-load-failed .image-intro-stage {
  background:
    radial-gradient(circle at 50% 46%, rgba(244, 213, 141, .22), transparent 18rem),
    linear-gradient(145deg, #030106, #1a0922);
}

.webgl-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  perspective: 1600px;
  transition: opacity .7s ease;
}

body.webgl-ready .webgl-fallback {
  opacity: 0;
}

.fallback-book-wrap {
  position: relative;
  width: min(760px, 86vw);
  aspect-ratio: 1.42;
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-2deg);
}

.fallback-book-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -10%;
  height: 22%;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  filter: blur(24px);
}

.fallback-petals {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.fallback-petals span {
  position: absolute;
  width: clamp(16px, 3vw, 28px);
  height: clamp(7px, 1.4vw, 12px);
  border-radius: 90% 20% 90% 20%;
  background: linear-gradient(90deg, rgba(240, 223, 186, .72), rgba(111, 49, 95, .64));
  box-shadow: 0 1px 10px rgba(244, 213, 141, .1);
  transform: rotate(var(--petal-rotate, 0deg));
}

.fallback-petals span:nth-child(1) { left: 7%; top: 54%; --petal-rotate: 24deg; }
.fallback-petals span:nth-child(2) { right: 8%; top: 48%; --petal-rotate: -38deg; }
.fallback-petals span:nth-child(3) { left: 20%; bottom: 9%; --petal-rotate: 68deg; }
.fallback-petals span:nth-child(4) { right: 24%; bottom: 5%; --petal-rotate: -12deg; }
.fallback-petals span:nth-child(5) { left: 47%; bottom: -2%; --petal-rotate: 36deg; }

.fallback-book {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.fallback-cover,
.fallback-pages {
  position: absolute;
  inset: 8% 10%;
  border-radius: 18px 28px 28px 18px;
}

.fallback-pages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(87, 58, 26, .2) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, #b99554, #fff0c6 48%, #a77f3a);
  box-shadow:
    inset 0 0 34px rgba(75, 35, 10, .28),
    inset -28px 0 28px rgba(95, 63, 25, .2),
    inset 0 -16px 22px rgba(88, 56, 22, .22),
    0 26px 60px rgba(0, 0, 0, .38);
}

.fallback-page {
  background:
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(83, 49, 23, .09) 21px),
    radial-gradient(circle at 18% 18%, rgba(255,255,255,.36), transparent 14rem);
}

.fallback-page-left {
  transform: rotateY(4deg);
  transform-origin: right center;
}

.fallback-page-right {
  transform: rotateY(-4deg);
  transform-origin: left center;
  border-left: 1px solid rgba(80, 43, 15, .28);
}

.fallback-cover {
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .35rem;
  padding: clamp(22px, 5vw, 54px);
  text-align: center;
  color: var(--gold-light);
  transform-origin: left center;
  transform: rotateY(0deg) translateZ(14px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .08), transparent 10%, rgba(0, 0, 0, .2) 92%),
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .09), transparent 11rem),
    repeating-linear-gradient(32deg, rgba(255,255,255,.028) 0 2px, rgba(0,0,0,.028) 3px 5px),
    linear-gradient(135deg, #2a1014, #5c241f 45%, #1a090f);
  border: 1px solid rgba(244, 213, 141, .35);
  box-shadow:
    inset 10px 0 18px rgba(255, 255, 255, .08),
    inset -24px 0 36px rgba(0, 0, 0, .28),
    inset 0 0 0 8px rgba(28, 8, 12, .36),
    0 28px 60px rgba(0, 0, 0, .45);
}

.fallback-cover::before {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid rgba(244, 213, 141, .52);
  border-radius: 16px 24px 24px 16px;
  box-shadow: inset 0 0 0 7px rgba(0, 0, 0, .08);
}

.fallback-cover::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgba(244, 213, 141, .22);
  border-radius: 14px 22px 22px 14px;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, .18),
    0 0 18px rgba(244, 213, 141, .07);
}

.fallback-emblem {
  position: relative;
  z-index: 1;
  width: clamp(46px, 9vw, 72px);
  height: clamp(36px, 7vw, 54px);
  margin-bottom: .45rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .48));
}

.fallback-emblem::before,
.fallback-emblem::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/monarch-cover-realistic.png") center / contain no-repeat;
}

.fallback-emblem::before {
  opacity: .92;
}

.fallback-emblem::after {
  display: none;
}

.fallback-butterflies {
  position: absolute;
  inset: -12% -8%;
  z-index: 4;
  pointer-events: none;
  transform-style: preserve-3d;
}

.fallback-butterflies span {
  position: absolute;
  width: clamp(48px, 7vw, 74px);
  aspect-ratio: 206 / 197;
  opacity: 0;
  background: url("../images/monarch-cover-realistic.png") center / contain no-repeat;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .32)) saturate(1.05) contrast(1.04);
  animation: fallbackButterflyLand 6.2s cubic-bezier(.2, .8, .18, 1) forwards;
}

.fallback-butterflies span::before,
.fallback-butterflies span::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 62%;
  background: url("../images/monarch-cover-left-wing.png") center / contain no-repeat;
  animation: fallbackWing .42s ease-in-out infinite alternate;
}

.fallback-butterflies span::before {
  transform-origin: right center;
}

.fallback-butterflies span::after {
  left: auto;
  right: 0;
  background-image: url("../images/monarch-cover-right-wing.png");
  transform-origin: left center;
}

.fallback-butterflies span:nth-child(1) { left: -2%; top: 20%; --land-x: 270%; --land-y: 165%; animation-delay: .25s; }
.fallback-butterflies span:nth-child(2) { right: -2%; top: 10%; --land-x: -270%; --land-y: 210%; animation-delay: .72s; }
.fallback-butterflies span:nth-child(3) { left: 25%; top: -8%; --land-x: 80%; --land-y: 260%; animation-delay: 1.05s; }
.fallback-butterflies span:nth-child(4) { right: 18%; bottom: -5%; --land-x: -150%; --land-y: -180%; animation-delay: 1.28s; }

.opening-scene.fallback-opening-pages .fallback-butterflies span {
  animation: fallbackButterflyLift 3.8s ease-in forwards;
}

.fallback-cover span,
.fallback-cover strong,
.fallback-cover small {
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .46);
}

.fallback-cover span {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.4rem, 9vw, 5.6rem);
  line-height: .82;
}

.fallback-cover strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3.1rem, 11vw, 7rem);
  line-height: .8;
}

.fallback-cover small {
  margin-top: 1rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.fallback-book-glow {
  position: absolute;
  left: 50%;
  top: 14%;
  z-index: 2;
  width: 26px;
  height: 72%;
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scaleY(.2);
  background: linear-gradient(180deg, transparent, rgba(255, 224, 147, .96), transparent);
  filter: blur(18px);
}

.opening-scene.fallback-opening-pages .fallback-cover {
  animation: fallbackCoverOpen 4.5s cubic-bezier(.18, .78, .18, 1) forwards;
}

.opening-scene.fallback-opening-pages .fallback-book-glow {
  animation: fallbackGlow 4.5s ease forwards;
}

.opening-caption {
  position: absolute;
  left: clamp(18px, 5vw, 70px);
  bottom: clamp(24px, 7vw, 82px);
  z-index: 2;
  max-width: 420px;
  pointer-events: none;
  text-shadow: 0 10px 32px rgba(0, 0, 0, .58);
  opacity: 0;
  transition: opacity .8s ease, transform .8s ease;
}

.opening-scene.is-entering-pages .opening-caption,
.opening-scene.fallback-opening-pages .opening-caption {
  opacity: 0;
}

.opening-caption p {
  margin: 0;
  color: var(--gold-light);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  font-weight: 700;
  line-height: .78;
}

.opening-caption span {
  display: block;
  margin-top: 16px;
  color: rgba(255, 245, 223, .74);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.chapter-reveal-copy {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(860px, calc(100% - 36px));
  text-align: center;
  transform: translate(-50%, -38%) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.4s cubic-bezier(.2, .72, .16, 1), transform 2.4s cubic-bezier(.2, .72, .16, 1);
  text-shadow: 0 20px 55px rgba(0, 0, 0, .5);
}

.opening-scene.is-entering-pages .chapter-reveal-copy {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.chapter-reveal-copy h2 {
  margin: 0;
  color: var(--gold-light);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3.2rem, 10vw, 8rem);
  line-height: .82;
}

.chapter-reveal-copy span {
  display: block;
  margin-top: 18px;
  color: rgba(255, 245, 223, .78);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.skip-opening {
  position: absolute;
  right: clamp(18px, 4vw, 42px);
  bottom: clamp(18px, 4vw, 42px);
  z-index: 3;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(244, 213, 141, .48);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(5, 2, 8, .62);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
  font: 800 .86rem Inter, sans-serif;
  cursor: pointer;
}

.opening-scene.is-entering-pages .skip-opening,
.opening-scene.is-inside-book .skip-opening {
  opacity: 0;
  pointer-events: none;
}

.story-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(18px, 6vw, 84px);
  background: rgba(5, 2, 8, .76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.story-brand {
  display: grid;
  gap: 1px;
  color: var(--gold-light);
  text-decoration: none;
}

.story-brand span {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 700;
  line-height: .9;
}

.story-brand small {
  color: rgba(255, 245, 223, .62);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.story-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}

.story-nav a {
  position: relative;
  color: rgba(255, 245, 223, .78);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-decoration: none;
  text-shadow: 0 0 18px rgba(201, 154, 70, .08);
  transition: color .22s ease, text-shadow .22s ease;
}

.story-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--antique-gold), transparent);
  opacity: 0;
  transition: left .28s ease, right .28s ease, opacity .28s ease;
}

.story-nav a:hover,
.story-nav a:focus-visible {
  color: var(--gold-light);
  text-shadow: 0 0 18px rgba(244, 213, 141, .34);
  outline: 0;
}

.story-nav a:hover::after,
.story-nav a:focus-visible::after {
  left: 8%;
  right: 8%;
  opacity: 1;
}

.story-nav .nav-order {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid rgba(244, 213, 141, .46);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(244, 213, 141, .08);
  box-shadow: inset 0 0 18px rgba(244, 213, 141, .08);
}

.story-menu-button {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(244, 213, 141, .32);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
}

.story-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 999px;
  background: var(--gold-light);
}

@media (max-width: 840px) {
  .story-menu-button { display: block; }

  .story-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 18px;
    right: 18px;
    display: none;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(13, 6, 18, .96);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
  }

  .story-nav.is-open { display: grid; }

  .story-nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .opening-caption {
    right: 18px;
    bottom: 86px;
  }

  .opening-caption span {
    font-size: .72rem;
    letter-spacing: .08em;
  }
}

@keyframes fallbackCoverOpen {
  0% {
    transform: rotateY(0deg) translateZ(14px);
  }
  55% {
    transform: rotateY(-82deg) translateZ(14px);
  }
  100% {
    transform: rotateY(-145deg) translateZ(14px);
  }
}

@keyframes fallbackGlow {
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleY(.2);
  }
  58% {
    opacity: .8;
    transform: translateX(-50%) scaleY(1.25);
  }
  100% {
    opacity: .95;
    transform: translateX(-50%) scaleY(1.45);
  }
}

@keyframes fallbackButterflyLand {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 90px) rotateZ(-18deg) scale(.72);
  }
  24% {
    opacity: .95;
  }
  78%, 100% {
    opacity: .92;
    transform: translate3d(var(--land-x), var(--land-y), 42px) rotateZ(10deg) scale(.82);
  }
}

@keyframes fallbackButterflyLift {
  0% {
    opacity: .92;
    transform: translate3d(var(--land-x), var(--land-y), 42px) rotateZ(10deg) scale(.82);
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--land-x) * .72), -220%, 120px) rotateZ(-20deg) scale(.76);
  }
}

@keyframes fallbackWing {
  from {
    transform: rotateY(18deg);
  }
  to {
    transform: rotateY(58deg);
  }
}

@keyframes introCameraPush {
  0% {
    transform: translate3d(-1.8vw, .75vh, 0) scale(.965) rotateZ(.2deg);
  }
  22% {
    transform: translate3d(-1vw, .35vh, 0) scale(.99) rotateZ(.12deg);
  }
  48% {
    transform: translate3d(.18vw, -.12vh, 0) scale(1.05) rotateZ(-.05deg);
  }
  74% {
    transform: translate3d(-.18vw, -.9vh, 0) scale(1.105) rotateZ(-.13deg);
  }
  100% {
    transform: translate3d(.26vw, -2.8vh, 0) scale(1.18) rotateZ(.05deg);
  }
}

@keyframes introHandheld {
  0%, 100% {
    filter: blur(0);
  }
  35% {
    filter: blur(.18px);
  }
  70% {
    filter: blur(0);
  }
}

@keyframes introBookBreath {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1.035) rotateZ(0deg) skewX(0deg);
  }
  50% {
    transform: translate(-50%, calc(-50% - .28vh)) scale(1.041) rotateZ(-.08deg) skewX(.12deg);
  }
}

@keyframes introBookOpenBeat {
  0%, 26% {
    filter: saturate(.94) contrast(1.05) brightness(.18) blur(.7px);
  }
  48% {
    filter: saturate(1.04) contrast(1.06) brightness(.64) blur(0);
  }
  70% {
    filter: saturate(1.14) contrast(1.08) brightness(.98);
  }
  100% {
    filter: saturate(1.18) contrast(1.06) brightness(1.12);
  }
}

@keyframes introBookImageReveal {
  0% {
    opacity: 0;
    filter: saturate(.88) contrast(1.08) brightness(.04) blur(1.8px);
  }
  8% {
    opacity: .015;
    filter: saturate(.9) contrast(1.08) brightness(.07) blur(1.4px);
  }
  17% {
    opacity: .16;
    filter: saturate(.94) contrast(1.1) brightness(.13) blur(1px);
  }
  29% {
    opacity: .68;
    filter: saturate(1.02) contrast(1.08) brightness(.4) blur(.35px);
  }
  42% {
    opacity: 1;
    filter: saturate(1.1) contrast(1.06) brightness(.76) blur(0);
  }
  100% {
    opacity: 1;
    filter: saturate(1.12) contrast(1.06) brightness(1);
  }
}

@keyframes introGlowRise {
  0%, 48% {
    opacity: 0;
    transform: translate(-38%, -18%) scale(.3);
  }
  70% {
    opacity: .48;
    transform: translate(-38%, -18%) scale(.95);
  }
  100% {
    opacity: .78;
    transform: translate(-38%, -18%) scale(1.62);
  }
}

@keyframes introLightLeak {
  0%, 30% {
    opacity: 0;
    transform: scaleX(.18) translateY(0);
  }
  52% {
    opacity: .24;
    transform: scaleX(.52) translateY(-1px);
  }
  78% {
    opacity: .48;
    transform: scaleX(.86) translateY(-2px);
  }
  100% {
    opacity: .62;
    transform: scaleX(1) translateY(-3px);
  }
}

@keyframes introDustFloat {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, -92px, 0);
  }
}

@keyframes introTitleGlow {
  0%, 100% {
    opacity: .18;
    transform: scale(.94);
  }
  50% {
    opacity: .46;
    transform: scale(1.06);
  }
}

@keyframes introCoverLight {
  0%, 50% {
    opacity: 0;
    transform: scale(.3);
  }
  72% {
    opacity: .68;
    transform: scale(1);
  }
  100% {
    opacity: .92;
    transform: scale(1.65);
  }
}

@keyframes introCoverLift {
  0% {
    opacity: .96;
    transform: perspective(1300px) rotateY(0deg) rotateX(0deg) translate3d(0, 0, 0) scale(1);
    filter: saturate(1.1) contrast(1.08) brightness(.96);
  }
  14% {
    opacity: .98;
    transform: perspective(1300px) rotateY(-1.8deg) rotateX(.4deg) translate3d(-.25vw, -.08vh, 4px) scale(1.002);
    filter: saturate(1.1) contrast(1.08) brightness(.97);
  }
  26% {
    opacity: .98;
    transform: perspective(1300px) rotateY(.8deg) rotateX(-.2deg) translate3d(.05vw, .05vh, 2px) scale(1);
    filter: saturate(1.1) contrast(1.08) brightness(.96);
  }
  48% {
    opacity: .96;
    transform: perspective(1300px) rotateY(-18deg) rotateX(2deg) translate3d(-1.8vw, -.8vh, 18px) scale(1.015);
    filter: saturate(1.1) contrast(1.08) brightness(1);
  }
  80% {
    opacity: .78;
    transform: perspective(1300px) rotateY(-52deg) rotateX(5deg) translate3d(-8vw, -2.4vh, 58px) scale(1.04);
    filter: saturate(1.08) contrast(1.03) brightness(1.08);
  }
  100% {
    opacity: 0;
    transform: perspective(1300px) rotateY(-72deg) rotateX(7deg) translate3d(-14vw, -3.6vh, 90px) scale(1.06);
    filter: saturate(1.08) contrast(1.02) brightness(1.16);
  }
}

@keyframes introLeatherFlex {
  0%, 100% {
    transform: scale(1) skewX(0deg);
    opacity: .26;
  }
  45% {
    transform: scale(1.012, .996) skewX(.28deg);
    opacity: .38;
  }
}

@keyframes introPageCompression {
  0%, 48% {
    opacity: .32;
    transform: translate3d(0, 0, 0) scaleY(1);
  }
  58% {
    opacity: .48;
    transform: translate3d(-.42vw, .28vh, 0) scaleY(.9);
  }
  78% {
    opacity: .38;
    transform: translate3d(-1.1vw, -.28vh, 0) scaleY(1.04);
  }
  100% {
    opacity: .28;
    transform: translate3d(-2vw, -.6vh, 0) scaleY(1.08);
  }
}

@keyframes introPageEdgeOpen {
  0%, 48% {
    opacity: .38;
    transform: translate3d(0, 0, 0) skewX(0deg);
  }
  66% {
    opacity: .5;
    transform: translate3d(-.7vw, .15vh, 0) skewX(-1.2deg);
  }
  100% {
    opacity: .3;
    transform: translate3d(-1.7vw, -.5vh, 0) skewX(-2deg);
  }
}

@keyframes introPaperShadow {
  0%, 46% {
    opacity: .16;
    transform: translate3d(0, 0, 0) scaleX(.86);
  }
  68% {
    opacity: .36;
    transform: translate3d(-.8vw, -.2vh, 0) scaleX(1.08);
  }
  100% {
    opacity: .24;
    transform: translate3d(-1.2vw, -.5vh, 0) scaleX(1.18);
  }
}

@keyframes introSpineFlex {
  0%, 48% {
    transform: rotateY(0deg) scaleX(1);
    opacity: .28;
  }
  62% {
    transform: rotateY(-3deg) scaleX(1.035);
    opacity: .42;
  }
  100% {
    transform: rotateY(-7deg) scaleX(1.06);
    opacity: .25;
  }
}

@keyframes introReflectionMove {
  0% {
    opacity: .08;
    transform: translateX(-44%) skewX(-10deg);
  }
  54% {
    opacity: .18;
    transform: translateX(6%) skewX(-10deg);
  }
  100% {
    opacity: .26;
    transform: translateX(28%) skewX(-10deg);
  }
}

@keyframes introGoldReflection {
  0%, 100% {
    opacity: .1;
    transform: translateX(-30%) skewX(-8deg);
  }
  44% {
    opacity: .32;
    transform: translateX(8%) skewX(-8deg);
  }
  62% {
    opacity: .18;
    transform: translateX(28%) skewX(-8deg);
  }
}

@keyframes introLightRays {
  0%, 50% {
    opacity: 0;
    transform: scale(.72) rotate(-4deg);
  }
  70% {
    opacity: .34;
    transform: scale(1.02) rotate(-2deg);
  }
  100% {
    opacity: .58;
    transform: scale(1.25) rotate(1deg);
  }
}

@keyframes bloomWake {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.34) rotate(var(--tilt, 0deg));
  }
  32% {
    opacity: .62;
  }
  100% {
    opacity: .88;
    transform: translate(-50%, -50%) scale(1) rotate(var(--tilt, 0deg));
  }
}

@keyframes petalUnfold {
  0% {
    transform: translate(-50%, -72%) scale(.18) rotate(var(--petal-rotate, 0deg)) rotateX(68deg);
  }
  64% {
    transform: translate(-50%, -72%) scale(.96) rotate(var(--petal-rotate, 0deg)) rotateX(14deg);
  }
  100% {
    transform: translate(-50%, -72%) scale(1) rotate(var(--petal-rotate, 0deg)) rotateX(0deg);
  }
}

.bloom i:nth-child(1) { --petal-rotate: 0deg; }
.bloom i:nth-child(2) { --petal-rotate: 40deg; }
.bloom i:nth-child(3) { --petal-rotate: 80deg; }
.bloom i:nth-child(4) { --petal-rotate: 120deg; }
.bloom i:nth-child(5) { --petal-rotate: 160deg; }
.bloom i:nth-child(6) { --petal-rotate: 200deg; }
.bloom i:nth-child(7) { --petal-rotate: 240deg; }
.bloom i:nth-child(8) { --petal-rotate: 280deg; }
.bloom i:nth-child(9) { --petal-rotate: 320deg; }

@keyframes bloomHeart {
  0%, 22% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.2);
  }
  100% {
    opacity: .95;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes bloomSparkles {
  0%, 16% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(.7);
  }
  42% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -28px, 0) scale(1.24);
  }
}

@keyframes bloomBreeze {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1) rotate(var(--tilt, 0deg));
  }
  50% {
    transform: translate(calc(-50% + 4px), calc(-50% - 3px)) scale(1.018) rotate(calc(var(--tilt, 0deg) + 2deg));
  }
}

@keyframes introCoverLiftLight {
  0%, 32% {
    opacity: 0;
  }
  66% {
    opacity: .42;
  }
  100% {
    opacity: .2;
  }
}
