/* The home page: one metamorphosis, told as you scroll. Loaded only by index.html.
   Hand-painted plates on white paper. The story starts quiet (ink, bark, a single jade
   chrysalis) and colour seeps in scene by scene through the art, until the golden sky and
   the full-colour butterfly at the end. Text stays in one tone throughout.
   Every scroll effect is a CSS scroll-driven animation; there is no script. Browsers
   without them, and anyone who prefers reduced motion, see each scene finished. */

@property --dot {
  syntax: "<length>";
  inherits: false;
  initial-value: 8px;
}

@property --grow {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 160%;
}

@property --reveal {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 115%;
}

@property --lens {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}

@property --iris {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.home {
  --paper: #ffffff;
  --text: #2b2433;
  --muted: #6b6273;
  --accent: #8a5a83;
  --rule: #ece8e1;
  --shadow: rgba(43, 36, 51, 0.16);
  --ink: #45413c;
  --bark: #6b4f3b;
  --sage-ink: #56634a;
  --jade: #2f6f5d;
  --gold: #b88a2e;
  --monarch: #b4541a;
  --rose: #a8456b;
  --night: #15130f;
  --bg: var(--paper);
  --surface: #f5f2ec;
  --scene-accent: var(--bark);
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .home {
    --paper: #131312;
    --text: #f1ecf3;
    --muted: #a99fb0;
    --accent: #d3a6cb;
    --rule: #2a2a28;
    --shadow: rgba(0, 0, 0, 0.5);
    --ink: #d9d3c8;
    --bark: #d2b291;
    --sage-ink: #b3c19f;
    --jade: #8fd4bd;
    --gold: #e4bd63;
    --monarch: #f3a465;
    --rose: #f09bbd;
    --surface: #1d1d1b;
  }

  /* Night plates. The paintings are on white paper, so in the dark each one is inverted and
     turned back to its own hues: the paper becomes the page (0.925 of white is the page's
     #131312) and the ink turns to chalk. */
  :where(:root:not([data-theme="light"])) .home .plate,
  :where(:root:not([data-theme="light"])) .home .hero-loop,
  :where(:root:not([data-theme="light"])) .home .flyer img {
    filter: invert(0.925) hue-rotate(180deg) saturate(1.1);
  }

  :where(:root:not([data-theme="light"])) .home .plate.strip-grey {
    filter: invert(0.925) hue-rotate(180deg) grayscale(1);
  }

  :where(:root:not([data-theme="light"])) .home .lens {
    background: var(--paper);
  }

  /* On the night plate the wash lightens instead, so the colour sits under the chalk lines. */
  :where(:root:not([data-theme="light"])) .home .lens-wash::after {
    mix-blend-mode: screen;
    opacity: 0.48;
    filter: saturate(1.6);
  }
}

/* The same colours when the header\'s dark mode button picks dark (public/theme.js). */
:where(:root[data-theme="dark"]) .home {
  --paper: #131312;
  --text: #f1ecf3;
  --muted: #a99fb0;
  --accent: #d3a6cb;
  --rule: #2a2a28;
  --shadow: rgba(0, 0, 0, 0.5);
  --ink: #d9d3c8;
  --bark: #d2b291;
  --sage-ink: #b3c19f;
  --jade: #8fd4bd;
  --gold: #e4bd63;
  --monarch: #f3a465;
  --rose: #f09bbd;
  --surface: #1d1d1b;
}

:where(:root[data-theme="dark"]) .home .plate,
:where(:root[data-theme="dark"]) .home .hero-loop,
:where(:root[data-theme="dark"]) .home .flyer img {
  filter: invert(0.925) hue-rotate(180deg) saturate(1.1);
}

:where(:root[data-theme="dark"]) .home .plate.strip-grey {
  filter: invert(0.925) hue-rotate(180deg) grayscale(1);
}

:where(:root[data-theme="dark"]) .home .lens {
  background: var(--paper);
}

:where(:root[data-theme="dark"]) .home .lens-wash::after {
  mix-blend-mode: screen;
  opacity: 0.48;
  filter: saturate(1.6);
}

/* The story runs edge to edge; .wrap keeps text to the site's width and gutter. */
.home .story {
  max-width: none;
  padding: 0;
}

.story .wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Scenes */
.scene {
  position: relative;
  padding-block: clamp(5rem, 14vw, 9rem);
  background: var(--paper);
}

.scene h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  line-height: 1.08;
}

.scene .step-time {
  color: var(--muted);
}

.copy > p,
.columns p,
.beat p,
.wish-card p,
.stage-copy p {
  color: var(--muted);
}

/* Art: every painting fills its frame. */
.story picture {
  width: 100%;
  height: 100%;
}

.plate {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plate-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

/* Every plate fades into the page at its edges, so no painting shows as a box. */
.plate-frame,
.stages-strip {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}

.plate-frame.small {
  max-width: 18rem;
}

.layer {
  position: absolute;
  inset: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.split.narrow {
  grid-template-columns: minmax(0, 3fr) minmax(0, 6fr);
}

/* 1 · Hero: a quiet chrysalis on a branch, seen first through an opening lens. */
.scene-hero {
  --scene-accent: var(--bark);
  display: grid;
  align-items: center;
  min-height: 100svh;
  padding-block: 7rem 4rem;
  overflow: clip;
  isolation: isolate;
}

.hero-art {
  position: absolute;
  inset: 4.75rem 0 0;
  z-index: -1;
}

.hero-art .plate {
  object-position: right top;
}

@media (min-width: 761px) {
  .scene-hero {
    --iris-at: 82% 42%;
  }

  .hero-art {
    left: 40%;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 30%);
    mask-image: linear-gradient(to right, transparent, #000 30%);
  }

  .hero-art .plate {
    object-position: 62% top;
  }
}

.hero-loop {
  position: absolute;
  inset: 0;
  display: none;
}

.hero-copy > * {
  max-width: 34rem;
}

.hero-copy h1 {
  font-size: clamp(2.7rem, 7vw, 4.75rem);
  line-height: 1.02;
}


/* 2 · The caterpillar's loop */
.scene-loops {
  --scene-accent: var(--sage-ink);
}

/* 3 · The worn path: a nerve cell grows into a branch */
.scene-path {
  --scene-accent: var(--ink);
}

.path-art {
  aspect-ratio: 1600 / 868;
}

/* The branch grows outward from the cell body. */
.path-branch {
  -webkit-mask-image: radial-gradient(circle at 50% 46%, #000 var(--grow), transparent calc(var(--grow) + 24%));
  mask-image: radial-gradient(circle at 50% 46%, #000 var(--grow), transparent calc(var(--grow) + 24%));
}

.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem 4rem;
  margin-top: 3rem;
}

/* 4 · Inside the chrysalis: the picture holds still while three beats scroll past. */
.scene-chrysalis {
  --scene-accent: var(--jade);
}

.chrysalis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(2rem, 6vw, 5rem);
}

.chrysalis-art {
  position: sticky;
  top: 2rem;
  display: grid;
  place-items: center;
  background: var(--paper);
}

/* The empty casing (04e, the emerged painting with the butterfly painted out by
   scripts/empty-pod.py) shows only once the butterfly has flown, so it waits hidden. */
.chrysalis-frame .empty {
  opacity: 0;
}

.chrysalis-frame {
  position: relative;
  width: min(100%, 28rem, 60svh);
  aspect-ratio: 1536 / 2150;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 82%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 82%, transparent);
  mask-composite: intersect;
}

.chrysalis-frame .plate {
  object-position: top;
}

.beat {
  max-width: 30rem;
  padding-block: 2rem 4rem;
}

.beat p {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.55;
}

/* 5 · The wish, in either of the app's two voices, between the cloud and the path. */
.scene-wish {
  --scene-accent: var(--rose);
  display: grid;
  place-items: center;
  min-height: max(100svh, 71.4vw);
  z-index: 2;
  isolation: isolate;
}

/* A butterfly from the chrysalis, flying with the scroll. It ends on the top stepping stone,
   which sits at about 51.5% across and 84.5% down the painting, so that's where it rests for
   anyone who sees the page without motion. */
.flyer {
  position: absolute;
  left: 51.5%;
  top: 84.5%;
  z-index: 1;
  width: clamp(54px, 6vw, 84px);
  aspect-ratio: 430 / 320;
  translate: -50% -72%;
  rotate: -8deg;
  pointer-events: none;
}

.flyer img {
  display: block;
  width: 100%;
  height: 100%;
}

/* The hill fades into the page at its foot (and the sky at its top) on an eased curve, so the
   painting never ends in a hard edge. */
.wish-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  transition: filter 0.8s ease;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 7%, #000 80%, rgba(0, 0, 0, 0.9) 85%, rgba(0, 0, 0, 0.62) 90%, rgba(0, 0, 0, 0.28) 95%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 7%, #000 80%, rgba(0, 0, 0, 0.9) 85%, rgba(0, 0, 0, 0.62) 90%, rgba(0, 0, 0, 0.28) 95%, transparent);
}

.wish-art .plate {
  object-position: 50% 42%;
}

.wish-card {
  max-width: 36rem;
  margin-inline: auto;
  padding: clamp(2.5rem, 7vw, 4rem);
  text-align: center;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 90%, transparent) 55%, transparent);
}

.voice {
  display: inline-flex;
  margin: 0 0 1.5rem;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--scene-accent) 12%, transparent);
}

.voice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.voice label {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.voice input:checked + label {
  background: var(--paper);
  color: var(--scene-accent);
  box-shadow: 0 1px 3px var(--shadow);
}

.voice input:focus-visible + label {
  outline: 2px solid var(--scene-accent);
  outline-offset: 2px;
}

.voice-copy[data-voice="spiritual"],
.scene-wish:has(#voice-spiritual:checked) .voice-copy[data-voice="science"] {
  display: none;
}

.scene-wish:has(#voice-spiritual:checked) .voice-copy[data-voice="spiritual"] {
  display: block;
}

/* The spiritual voice warms the sky a little. */
.scene-wish:has(#voice-spiritual:checked) .wish-art {
  filter: hue-rotate(-14deg) saturate(1.35);
}

.voice-note {
  margin: 0;
  font-size: 0.85rem;
}

/* 6 · The daily loop: four stages hanging from one branch. Each stage shows its own
   quarter of the picture, so side by side they make the whole branch. */
.scene-stages {
  --scene-accent: var(--monarch);
}

.section-head {
  max-width: 36rem;
}

.stages-strip {
  position: relative;
  aspect-ratio: 1600 / 690;
  margin-top: 3rem;
}

.strip-grey {
  filter: grayscale(1);
  opacity: 0.5;
}

/* Colour runs along the branch from left to right, with a soft, painted edge. */
.strip-colour {
  -webkit-mask-image: linear-gradient(to right, #000 calc(var(--reveal) - 14%), transparent var(--reveal));
  mask-image: linear-gradient(to right, #000 calc(var(--reveal) - 14%), transparent var(--reveal));
}

.stages .stage-art {
  display: none;
}

.stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.stages li {
  margin: 0;
}

.stages li:nth-child(1) { --x: 0%; }
.stages li:nth-child(2) { --x: 33.333%; }
.stages li:nth-child(3) { --x: 66.667%; }
.stages li:nth-child(4) { --x: 100%; }

.stage-art {
  aspect-ratio: 400 / 690;
  overflow: hidden;
}

.stage-art .plate {
  object-position: var(--x) 50%;
}

.stage-copy {
  padding: 1.25rem 1.25rem 0 0;
}

.step-time {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.stage-copy h3 {
  margin: 0 0 0.4rem;
}

.stage-copy p {
  margin: 0;
  font-size: 0.95rem;
}

/* 7 · The image reveal, seen through a lens: outline, then dots, then colour. */
.scene-reveal {
  --scene-accent: var(--accent);
}

.reveal-sticky {
  display: grid;
  grid-template-columns: auto minmax(0, 26rem);
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.lens {
  position: relative;
  width: min(64vmin, 30rem);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 calc(var(--lens) - 9%), transparent var(--lens));
  mask-image: radial-gradient(circle closest-side, #000 calc(var(--lens) - 9%), transparent var(--lens));
}

.lens-layer {
  position: absolute;
  inset: 0;
}

/* Dots of colour that grow until they touch: at 8px they cover the 10px grid. */
.lens-colour {
  -webkit-mask-image: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.8px));
  mask-image: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.8px));
  -webkit-mask-size: 10px 10px;
  mask-size: 10px 10px;
}

/* Stand-in colour until the painting is ready: the drawing washed with sunrise colours. */
.lens-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 226, 150, 0.95) 0 13%, rgba(255, 214, 165, 0.55) 20%, transparent 30%),
    radial-gradient(ellipse 85% 45% at 50% 100%, rgba(150, 184, 126, 0.9), transparent 72%),
    linear-gradient(180deg, #c7d9ef 0%, #d9d2ea 16%, #f2cfd2 30%, #f9dcc4 41%, #f3e3c6 46%, #dbe6c8 53%, #c4d8ab 66%, #b2cc97 100%);
}

.science {
  font-size: 0.92rem;
}

/* 8 · Privacy */
.scene-private {
  --scene-accent: var(--jade);
}

/* 9 · Finale: the butterfly in full colour at last. */
.scene-finale {
  display: grid;
  place-items: center;
  padding-bottom: 0;
  text-align: center;
  overflow: clip;
  isolation: isolate;
}

.flight {
  width: min(52vw, 17rem);
  margin: 0 auto 1.5rem;
}

.flight-float {
  position: relative;
  aspect-ratio: 700 / 760;
}

.flight-float img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.flight-butterfly {
  filter: drop-shadow(0 18px 28px rgba(110, 50, 140, 0.3));
}

.scene-finale h2 {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
}

/* The page's call to action, at its end: join the waitlist (the App Store badge once the app
   is live). */
.finale-actions {
  display: flex;
  justify-content: center;
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
}

/* Sources */
.sources {
  margin: 0;
  padding: 1.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.sources summary {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.sources ul {
  margin: 1rem 0;
}

/* Phones */
@media (max-width: 760px) {
  .scene-hero {
    align-items: end;
  }

  .hero-art {
    inset: 3.5rem 0 0;
  }

  .hero-loop {
    display: block;
  }

  .scene-hero {
    --iris-at: 57% 12%;
  }

  .split,
  .split.narrow,
  .columns,
  .chrysalis-grid,
  .reveal-sticky {
    grid-template-columns: minmax(0, 1fr);
  }

  .columns {
    margin-top: 2rem;
  }

  .stages-strip {
    display: none;
  }

  .stages .stage-art {
    display: block;
  }

  .stages {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .stages li {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    align-items: center;
    gap: 1.25rem;
  }

  .stage-copy {
    padding: 0;
  }

  .reveal-sticky {
    justify-items: center;
    gap: 1.75rem;
  }

  .lens {
    width: min(78vw, 44svh);
  }
}

/* Motion: only where motion is welcome, and scroll effects only where they exist. */
@media (prefers-reduced-motion: reduce) {
  .hero-loop {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* The lens opens on the hero when the page loads. */
  .scene-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: radial-gradient(circle at var(--iris-at, 72% 30%), transparent var(--iris), var(--night) calc(var(--iris) + 10vmax));
    animation: iris 2.6s cubic-bezier(0.45, 0, 0.2, 1) 0.2s both;
  }

  .hero-copy {
    animation: rise 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) 1.1s both;
  }

  .flight-float {
    animation: float 6s ease-in-out infinite;
  }

  @supports (animation-timeline: view()) {
    .hero-art {
      animation: drift linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    .enter {
      animation: enter linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 35%;
    }

    /* The worn path: the plate holds still while the nerve cell grows into a branch, from the
       cell body out, so the leaves at the tips come last. */
    .scene-path {
      height: 175svh;
      padding: 0;
      view-timeline: --path;
    }

    .scene-path > .wrap {
      position: sticky;
      top: 0;
      display: grid;
      align-content: center;
      min-height: 100svh;
      padding-block: calc(var(--bar) + 1rem) 2rem;
    }

    .path-art {
      width: min(100%, 110svh);
      margin-inline: auto;
      animation: settle linear both;
      animation-timeline: --path;
      animation-range: contain 0% contain 70%;
    }

    .path-branch {
      animation: grow linear both;
      animation-timeline: --path;
      animation-range: contain 6% contain 70%;
    }

    .scene-path .copy {
      animation: appear linear both;
      animation-timeline: --path;
      animation-range: contain 50% contain 78%;
    }

    /* Chrysalis: three tall beats; the picture changes as they pass. */
    .scene-chrysalis {
      view-timeline: --chrysalis;
    }

    .chrysalis-art {
      top: 0;
      height: 100svh;
    }

    .chrysalis-frame {
      width: min(100%, 28rem, 60svh);
    }

    .beat {
      display: grid;
      align-content: center;
      min-height: 72svh;
      padding: 0;
      animation: beat linear both;
      animation-timeline: view();
    }

    .chrysalis-frame .wings,
    .chrysalis-frame .emerged {
      animation: appear linear both;
      animation-timeline: --chrysalis;
    }

    .chrysalis-frame .wings {
      animation-range: contain 34% contain 52%;
    }

    .chrysalis-frame .emerged {
      animation-range: contain 62% contain 82%;
    }

    /* As the scene leaves, the butterfly takes off (the flyer in the next scene) and the pod
       is left empty. */
    .chrysalis-frame .empty {
      opacity: 1;
      animation: appear linear both;
      animation-timeline: --chrysalis;
      animation-range: exit 0% exit 8%;
    }

    /* Daily loop: colour runs along the branch, and each stage's words arrive as it fills. */
    .scene-stages {
      view-timeline: --stages;
    }

    .strip-colour {
      animation: reveal linear both;
      animation-timeline: --stages;
      animation-range: cover 22% cover 58%;
    }

    .stages li {
      animation: stage linear both;
      animation-timeline: --stages;
    }

    .stages li:nth-child(1) { animation-range: cover 22% cover 31%; }
    .stages li:nth-child(2) { animation-range: cover 31% cover 40%; }
    .stages li:nth-child(3) { animation-range: cover 40% cover 49%; }
    .stages li:nth-child(4) { animation-range: cover 49% cover 58%; }

    /* Reveal: a tall scene with the lens held still while you scroll through it. */
    .scene-reveal {
      height: 185svh;
      padding: 0;
      view-timeline: --reveal;
    }

    .reveal-sticky {
      position: sticky;
      top: 0;
      height: 100svh;
    }

    .lens {
      animation: lens-open linear both;
      animation-timeline: --reveal;
      animation-range: contain 0% contain 24%;
    }

    /* The butterfly flies with the scroll: out of the chrysalis scene above, a loop over the
       sky, and down onto the stone. Its wings beat as you scroll and rest open when it lands. */
    .scene-wish {
      view-timeline: --wish;
    }

    .flyer {
      animation: fly linear both;
      animation-timeline: --wish;
      animation-range: entry 0% cover 48%;
    }

    .flyer img {
      animation: flap linear both;
      animation-timeline: --wish;
      animation-range: entry 0% cover 48%;
    }

    .lens-colour {
      animation: dots linear both;
      animation-timeline: --reveal;
      animation-range: contain 28% contain 84%;
    }

    /* Finale: the three dots arrive one by one, then the butterfly takes its colour. */
    .flight-dots {
      animation: dots-in linear both;
      animation-timeline: view();
      animation-range: entry 30% cover 40%;
    }

    .flight-butterfly {
      animation: emerge linear both;
      animation-timeline: view();
      animation-range: cover 25% cover 50%;
    }

    @media (max-width: 760px) {
      .chrysalis-art {
        z-index: 1;
        height: 54svh;
        padding-top: 1rem;
      }

      .chrysalis-frame {
        width: auto;
        height: 50svh;
      }

      .beat {
        align-content: start;
        min-height: 62svh;
        padding-top: 1.5rem;
      }

      .stages li:nth-child(n) {
        animation-timeline: view();
        animation-range: entry 20% cover 45%;
      }
    }
  }
}

@keyframes iris {
  from { --iris: 3vmax; }
  75% { opacity: 1; }
  to { --iris: 150vmax; opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(1.5rem); }
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(0, -10px) rotate(-2deg); }
}

@keyframes drift {
  to { transform: translateY(12%) scale(1.05); }
}

@keyframes enter {
  from { opacity: 0; transform: translateY(2.5rem); filter: saturate(0.15); }
}

@keyframes grow {
  from { --grow: 0%; }
}

@keyframes appear {
  from { opacity: 0; }
}

@keyframes beat {
  0% { opacity: 0.15; }
  35%, 65% { opacity: 1; }
  100% { opacity: 0.15; }
}

@keyframes stage {
  from { opacity: 0.15; }
}

@keyframes reveal {
  from { --reveal: 0%; }
}

@keyframes settle {
  from { transform: scale(0.94); }
}

@keyframes lens-open {
  from { --lens: 16%; }
}

@keyframes fly {
  0% { top: -44%; left: 22%; rotate: -24deg; scale: 1.2; opacity: 0; }
  7% { opacity: 1; }
  32% { top: -6%; left: 66%; rotate: 18deg; scale: 1.15; }
  58% { top: 28%; left: 80%; rotate: -12deg; }
  82% { top: 64%; left: 38%; rotate: 12deg; scale: 1.05; }
  100% { top: 84.5%; left: 51.5%; rotate: -8deg; scale: 1; opacity: 1; }
}

@keyframes flap {
  0%, 9%, 18%, 27%, 36%, 45%, 54%, 63%, 72%, 81%, 92%, 100% { scale: 1 1; }
  4.5%, 13.5%, 22.5%, 31.5%, 40.5%, 49.5%, 58.5%, 67.5%, 76.5%, 86% { scale: 0.22 1; }
}

@keyframes dots {
  0% { --dot: 0px; }
  45% { --dot: 2px; }
  100% { --dot: 8px; }
}

@keyframes dots-in {
  from { clip-path: inset(0 100% 0 0); }
}

@keyframes emerge {
  from {
    opacity: 0;
    transform: translate(-18%, 22%) scale(0.5) rotate(-8deg);
    filter: grayscale(1) drop-shadow(0 18px 28px rgba(110, 50, 140, 0));
  }

  60% {
    opacity: 1;
  }
}
