/* lens-cycle.css — closing scroll beat for jjovan.com.
   Scroll into the lenses: Cohen "crack in everything" writes itself → lens portal
   draws in → handwritten "Thank you" signature → iris zoom → a bespoke "until next
   time…" replay loader runs and returns the visitor to the top (chapter I).

   Ported from lens-cycle-standalone.html. Every generic class is scoped under
   .lens-cycle so it cannot collide with the site's globals; the replay loader is
   renamed .loader→.lens-replay (the real site loader keeps #loader / .loader),
   and the standalone's keyframes loader-* are renamed lcr-* to avoid clashing
   with the real loader's animations. Palette/dynamic CSS vars live on the two
   roots only (no :root pollution). */

.lens-cycle,
.lens-replay {
    --lc-ink: #070708;
    --lc-paper: #f4ead0;
    --lc-paper-soft: rgba(244, 234, 208, 0.78);
    --lc-paper-faint: rgba(244, 234, 208, 0.38);
    --lc-paper-ghost: rgba(244, 234, 208, 0.12);
    --lc-amber: #e9a36f;
    --lc-amber-deep: #d97757;
    --lc-amber-soft: rgba(233, 163, 111, 0.62);

    --lc-font-script: "La Belle Aurore", "Source Serif 4", Georgia, serif;
    --lc-font-serif: "Source Serif 4", Georgia, serif;
    --lc-font-display: "Syne", Arial, sans-serif;
    --lc-font-mono: "JetBrains Mono", Consolas, monospace;

    /* Global scroll progress 0..1 (set by lens-cycle.js on #lensCycle) */
    --p: 0;

    /* Per-act progress */
    --act1: 0;
    --act1-exit: 0;
    --act2: 0;
    --act2-exit: 0;
    --act3: 0;
    --act3-exit: 0;

    /* Crack/light */
    --crack-scale: 0;
    --crack-glow: 0;
    --crack-bloom: 0;

    /* Per-word reveal progress for Cohen quote (12 words) */
    --w1: 0; --w2: 0; --w3: 0; --w4: 0; --w5: 0; --w6: 0;
    --w7: 0; --w8: 0; --w9: 0; --w10: 0; --w11: 0; --w12: 0;

    /* Signature reveal */
    --sig-reveal: 0;
    --sig-underline: 0;

    /* Lens reveal */
    --lens-clip: 50;
    --lens-opacity: 0;
    --lens-blur: 18;
    --lens-flare: 0;
    --lens-scale: 0.72;

    /* Iris zoom at very end */
    --iris-scale: 1;
    --iris-flash: 0;

    /* Chrome */
    --chapter-opacity: 0;
    --attr-opacity: 0;
    --cue-opacity: 0.72;
    --return-opacity: 0;
}

.lens-cycle {
    position: relative;
    min-height: 360vh;
    min-height: 360dvh;
    isolation: isolate;
    overflow: visible;
    color: var(--lc-paper);
    font-family: var(--lc-font-serif);
    background:
        radial-gradient(ellipse 80% 60% at 50% 48%, rgba(233, 163, 111, 0.10), transparent 56%),
        radial-gradient(ellipse 120% 90% at 50% 50%, rgba(244, 234, 208, 0.045), transparent 64%),
        linear-gradient(180deg, #0a0a0c 0%, #07070a 48%, #030305 100%);
}

.lens-cycle::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 50% 50%, transparent 26%, rgba(0, 0, 0, 0.42) 70%, rgba(0, 0, 0, 0.78) 100%);
}

.lens-cycle .stage {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 100vh;
    height: 100dvh;
    min-height: 640px;
    overflow: hidden;
    transform: scale(var(--iris-scale));
    transform-origin: 50% 50%;
    will-change: transform;
}

/* ===========================================
   CHROME — Chapter marker, attribution, cue
   =========================================== */

.lens-cycle .chapter {
    position: absolute;
    top: clamp(1.5rem, 4vh, 3.2rem);
    left: clamp(1.5rem, 4vw, 3.5rem);
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: var(--lc-paper-faint);
    font-family: var(--lc-font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: var(--chapter-opacity);
    pointer-events: none;
    line-height: 1;
}

.lens-cycle .chapter-roman {
    color: var(--lc-paper-soft);
    font-family: var(--lc-font-serif);
    font-size: 0.95rem;
    font-style: italic;
    letter-spacing: 0.16em;
    text-transform: none;
}

.lens-cycle .chapter-coord {
    color: var(--lc-paper-faint);
    font-variant-numeric: tabular-nums;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: none;
}

.lens-cycle .chapter-meta {
    color: var(--lc-amber-soft);
    font-size: 0.58rem;
    letter-spacing: 0.3em;
}

.lens-cycle .attribution {
    position: absolute;
    right: clamp(1.5rem, 4vw, 3.5rem);
    bottom: clamp(2rem, 5vh, 4rem);
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    color: var(--lc-paper-faint);
    font-family: var(--lc-font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    opacity: var(--attr-opacity);
    line-height: 1;
    pointer-events: none;
}

.lens-cycle .attribution-rule {
    display: block;
    width: 3rem;
    height: 1px;
    background: var(--lc-amber-soft);
    opacity: 0.55;
}

.lens-cycle .attribution-name {
    color: var(--lc-paper-soft);
    font-family: var(--lc-font-serif);
    font-size: 0.86rem;
    font-style: italic;
    letter-spacing: 0.14em;
    text-transform: none;
}

.lens-cycle .attribution-album {
    color: var(--lc-paper-ghost);
    font-size: 0.54rem;
    letter-spacing: 0.32em;
}

.lens-cycle .scroll-cue {
    position: fixed;
    left: 50%;
    bottom: clamp(2.4rem, 5vh, 4rem);
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    transform: translateX(-50%);
    color: var(--lc-paper-faint);
    font-family: var(--lc-font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: var(--cue-opacity);
    pointer-events: none;
}

.lens-cycle .scroll-cue-rule {
    position: relative;
    display: block;
    width: clamp(5rem, 11vw, 9rem);
    height: 1px;
    background: rgba(244, 234, 208, 0.10);
    overflow: hidden;
}

.lens-cycle .scroll-cue-rule::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--lc-amber-deep) 50%, transparent);
    transform: translateX(calc(-100% + var(--p) * 200%));
    transition: transform 80ms linear;
}

/* ===========================================
   ACT I — Crack of light + Cohen quote
   =========================================== */

.lens-cycle .act-quote {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: clamp(4rem, 10vh, 8rem) clamp(1.5rem, 5vw, 5rem);
    opacity: calc(1 - var(--act1-exit));
    transform: translateY(calc(var(--act1-exit) * -160px)) scale(calc(1 - var(--act1-exit) * 0.04));
    will-change: transform, opacity;
}

.lens-cycle .crack {
    position: absolute;
    left: 50%;
    top: 8%;
    bottom: 8%;
    width: 2px;
    transform: translateX(-50%) scaleY(var(--crack-scale));
    transform-origin: 50% 50%;
    background:
        linear-gradient(180deg,
            transparent 0%,
            rgba(233, 163, 111, 0.0) 6%,
            rgba(233, 163, 111, 0.85) 24%,
            rgba(244, 234, 208, 0.95) 50%,
            rgba(233, 163, 111, 0.85) 76%,
            rgba(233, 163, 111, 0.0) 94%,
            transparent 100%);
    opacity: var(--crack-glow);
    pointer-events: none;
    will-change: transform, opacity;
}

.lens-cycle .crack::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38vw;
    height: 38vw;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(233, 163, 111, 0.32), rgba(217, 119, 87, 0.08) 28%, transparent 62%);
    filter: blur(46px);
    opacity: var(--crack-bloom);
    pointer-events: none;
}

.lens-cycle .crack::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 78vw;
    height: 64vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, rgba(244, 234, 208, 0.10), transparent 56%);
    filter: blur(72px);
    opacity: calc(var(--crack-bloom) * 0.6);
    pointer-events: none;
}

.lens-cycle .quote {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2rem, 6vh, 4.5rem);
    max-width: min(96vw, 1240px);
    margin: 0 auto;
    text-align: center;
}

.lens-cycle .quote-line {
    margin: 0;
    line-height: 0.96;
    color: var(--lc-paper);
    font-family: var(--lc-font-script);
    font-weight: 400;
    letter-spacing: 0;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 0 32px rgba(233, 163, 111, 0.10);
}

.lens-cycle .quote-line--a {
    font-size: clamp(2.4rem, 7vw, 6rem);
    transform: rotate(-1.5deg) translateY(-0.4em);
    white-space: nowrap;
}

.lens-cycle .quote-line--b {
    font-size: clamp(2.5rem, 7.4vw, 6.2rem);
    color: var(--lc-amber);
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 0 18px rgba(233, 163, 111, 0.32);
    transform: rotate(1deg) translateY(0.1em);
    white-space: nowrap;
}

.lens-cycle .word {
    display: inline-block;
    margin: 0 0.18em;
    opacity: var(--word-r);
    transform: translateY(calc((1 - var(--word-r)) * 0.32em)) rotate(calc((1 - var(--word-r)) * 0.6deg));
    -webkit-mask-image: linear-gradient(90deg, #000 0 calc(var(--word-r) * 100%), transparent calc(var(--word-r) * 100% + 0.6em));
    mask-image: linear-gradient(90deg, #000 0 calc(var(--word-r) * 100%), transparent calc(var(--word-r) * 100% + 0.6em));
    will-change: transform, opacity, mask-image;
}

.lens-cycle .quote-line--a .word:nth-child(1) { --word-r: var(--w1); }
.lens-cycle .quote-line--a .word:nth-child(2) { --word-r: var(--w2); }
.lens-cycle .quote-line--a .word:nth-child(3) { --word-r: var(--w3); }
.lens-cycle .quote-line--a .word:nth-child(4) { --word-r: var(--w4); }
.lens-cycle .quote-line--a .word:nth-child(5) { --word-r: var(--w5); }
.lens-cycle .quote-line--a .word:nth-child(6) { --word-r: var(--w6); }

.lens-cycle .quote-line--b .word:nth-child(1) { --word-r: var(--w7); }
.lens-cycle .quote-line--b .word:nth-child(2) { --word-r: var(--w8); }
.lens-cycle .quote-line--b .word:nth-child(3) { --word-r: var(--w9); }
.lens-cycle .quote-line--b .word:nth-child(4) { --word-r: var(--w10); }
.lens-cycle .quote-line--b .word:nth-child(5) { --word-r: var(--w11); }
.lens-cycle .quote-line--b .word:nth-child(6) { --word-r: var(--w12); }

/* ===========================================
   ACT II — Lens portal (glasses draw-in)
   =========================================== */

.lens-cycle .act-lens {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    opacity: var(--lens-opacity);
    transform: scale(var(--lens-scale));
    transform-origin: 50% 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.lens-cycle .lens-frame {
    position: relative;
    width: min(86vw, 1120px);
    aspect-ratio: 2730 / 1536;
    min-width: 420px;
}

.lens-cycle .lens-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter:
        drop-shadow(0 0 18px rgba(233, 163, 111, 0.32))
        drop-shadow(0 0 56px rgba(244, 234, 208, 0.08))
        blur(calc(var(--lens-blur) * 1px))
        saturate(0.88)
        contrast(1.12);
    mix-blend-mode: lighten;
    clip-path: inset(0 calc(var(--lens-clip) * 1%) 0 calc(var(--lens-clip) * 1%));
    user-select: none;
    will-change: clip-path, filter;
}

.lens-cycle .lens-aura {
    position: absolute;
    left: 50%;
    top: 52%;
    width: 56%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(233, 163, 111, 0.26), rgba(233, 163, 111, 0.04) 38%, transparent 68%);
    filter: blur(34px);
    opacity: calc(var(--act2) * 0.85);
    pointer-events: none;
}

.lens-cycle .lens-flare {
    position: absolute;
    left: -8%;
    top: 50%;
    width: 116%;
    height: 1px;
    transform: translateY(-50%) scaleX(calc(var(--lens-flare) * 1));
    transform-origin: 50% 50%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(244, 234, 208, 0.0) 8%,
        rgba(244, 234, 208, 0.92) 50%,
        rgba(244, 234, 208, 0.0) 92%,
        transparent 100%);
    box-shadow:
        0 0 18px rgba(244, 234, 208, 0.55),
        0 0 48px rgba(233, 163, 111, 0.35);
    opacity: calc(var(--lens-flare) * (1 - var(--act2-exit) * 0.6));
    pointer-events: none;
}

/* ===========================================
   ACT III — Handwritten signature thank you
   =========================================== */

.lens-cycle .act-signature {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: clamp(4rem, 10vh, 7rem) clamp(1.5rem, 5vw, 5rem);
    opacity: calc(var(--act3) * (1 - var(--act3-exit)));
    transform: translateY(calc((1 - var(--act3)) * 60px + var(--act3-exit) * -40px));
    pointer-events: none;
    will-change: transform, opacity;
}

.lens-cycle .signature {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    max-width: min(94vw, 1200px);
    text-align: center;
}

.lens-cycle .signature-mark {
    display: block;
    color: var(--lc-amber-soft);
    font-family: var(--lc-font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    opacity: calc(min(1, var(--act3) * 2.4) * 0.7);
}

.lens-cycle .signature-line {
    margin: 0;
    color: var(--lc-paper);
    font-family: var(--lc-font-script);
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 8.4rem);
    line-height: 0.94;
    letter-spacing: 0;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 0 32px rgba(244, 234, 208, 0.10);
    clip-path: inset(-0.2em calc((1 - var(--sig-reveal)) * 100%) -0.2em -0.05em);
    will-change: clip-path;
}

.lens-cycle .signature-line--two {
    color: var(--lc-amber);
    transform: rotate(-0.8deg);
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 0 28px rgba(233, 163, 111, 0.42);
}

.lens-cycle .signature-flourish {
    display: block;
    margin-top: 0.4rem;
    width: clamp(8rem, 28vw, 22rem);
    height: 22px;
    opacity: var(--sig-underline);
}

.lens-cycle .signature-flourish path {
    fill: none;
    stroke: var(--lc-amber-deep);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 600;
    stroke-dashoffset: calc(600 - var(--sig-underline) * 600);
}

.lens-cycle .signature-return {
    margin: 1.4rem 0 0;
    color: var(--lc-paper-faint);
    font-family: var(--lc-font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.32em;
    line-height: 2;
    text-transform: uppercase;
    opacity: var(--return-opacity);
}

.lens-cycle .signature-return em {
    font-style: normal;
    color: var(--lc-amber-soft);
}

/* ===========================================
   Iris flash at the very end
   =========================================== */

.lens-cycle .iris-flash {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(255, 252, 245, 0.92) 0%,
        rgba(233, 163, 111, 0.32) 38%,
        transparent 72%);
    opacity: var(--iris-flash);
    mix-blend-mode: screen;
}

/* ===========================================
   REPLAY loader — "until next time…" → return to I
   (renamed from the standalone .loader so it never
   collides with the real site loader)
   =========================================== */

.lens-replay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    overflow: hidden;
    color: var(--lc-paper);
    background: var(--lc-ink);
    clip-path: inset(0 0 0 0);
    pointer-events: none;
}

html.lens-replay-active .lens-replay {
    display: block;
    pointer-events: auto;
}

.lens-replay::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.28;
    background:
        radial-gradient(ellipse at 50% 43%, rgba(217, 119, 87, 0.12), transparent 42%),
        radial-gradient(ellipse at 50% 50%, rgba(244, 234, 208, 0.08), transparent 56%);
}

.lens-replay-grain,
.lens-replay-vignette,
.lens-replay-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.lens-replay-grain {
    z-index: 5;
    opacity: 0;
    background:
        repeating-radial-gradient(circle at 30% 30%, rgba(244, 234, 208, 0.22) 0 1px, transparent 1px 4px);
    background-size: 110px 110px;
    mix-blend-mode: overlay;
}

.lens-replay-vignette {
    z-index: 6;
    opacity: 0;
    background: radial-gradient(ellipse at 50% 45%, transparent 24%, rgba(0, 0, 0, 0.22) 48%, rgba(0, 0, 0, 0.78) 100%);
}

.lens-replay-flash {
    z-index: 14;
    opacity: 0;
    background: radial-gradient(ellipse, rgba(255, 252, 245, 0.92) 0%, rgba(90, 85, 80, 0.44) 50%, transparent 100%);
}

.lens-replay-letterbox {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 18;
    height: 7vh;
    background: #080808;
    pointer-events: none;
}

.lens-replay-letterbox--top { top: 0; }
.lens-replay-letterbox--bot { bottom: 0; }

.lens-replay-glasses {
    position: absolute;
    left: 50%;
    top: 48%;
    z-index: 4;
    width: min(92vw, 980px);
    height: auto;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.38);
    filter: drop-shadow(0 0 10px rgba(233, 163, 111, 0.32)) drop-shadow(0 0 36px rgba(233, 163, 111, 0.10)) blur(2px);
    pointer-events: none;
    user-select: none;
}

.lens-replay-script {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 9;
    opacity: 0;
    transform: translate(-50%, -50%);
    color: rgba(244, 234, 208, 0.92);
    font-family: var(--lc-font-script);
    font-size: clamp(2.4rem, 7vw, 5.8rem);
    font-weight: 400;
    line-height: 0.95;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 28px rgba(233, 163, 111, 0.24);
}

.lens-replay-chapter {
    position: absolute;
    top: calc(7vh + 2.2rem);
    left: calc(2.5vw + 1.2rem);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    opacity: 0;
    pointer-events: none;
    line-height: 1;
}

.lens-replay-chapter-roman {
    color: rgba(244, 234, 208, 0.55);
    font-family: var(--lc-font-serif);
    font-size: clamp(0.85rem, 1.05vw, 1rem);
    font-style: italic;
    letter-spacing: 0.18em;
}

.lens-replay-chapter-coord {
    color: rgba(244, 234, 208, 0.72);
    font-family: var(--lc-font-mono);
    font-size: clamp(0.78rem, 0.92vw, 0.88rem);
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.lens-replay-chapter-meta {
    color: rgba(233, 163, 111, 0.6);
    font-family: var(--lc-font-mono);
    font-size: clamp(0.6rem, 0.72vw, 0.7rem);
    letter-spacing: 0.26em;
    text-transform: uppercase;
    white-space: nowrap;
}

.lens-replay-label {
    position: absolute;
    left: 50%;
    bottom: calc(7vh + 2.4rem);
    z-index: 30;
    width: min(86vw, 720px);
    opacity: 0;
    transform: translateX(-50%);
    color: rgba(244, 234, 208, 0.78);
    font-family: var(--lc-font-serif);
    font-size: clamp(0.95rem, 1.25vw, 1.15rem);
    letter-spacing: 0.04em;
    text-align: center;
    pointer-events: none;
}

.lens-replay-label-narrative {
    display: block;
    margin-inline: auto;
    max-width: 42ch;
    color: rgba(244, 234, 208, 0.94);
    font-size: clamp(1.3rem, 1.85vw, 1.7rem);
    font-style: italic;
    line-height: 1.32;
}

.lens-replay-label-sig {
    display: block;
    margin-top: 0.95rem;
    color: rgba(244, 234, 208, 0.42);
    font-family: var(--lc-font-mono);
    font-size: clamp(0.54rem, 0.68vw, 0.64rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
}

.lens-replay-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(7vh - 1px);
    z-index: 30;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    background: rgba(244, 234, 208, 0.06);
    pointer-events: none;
}

.lens-replay-progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: rgba(244, 234, 208, 0.58);
}

.lens-replay-percent {
    position: absolute;
    right: calc(2.5vw + 1.2rem);
    bottom: calc(7vh + 2.1rem);
    z-index: 30;
    opacity: 0;
    color: rgba(244, 234, 208, 0.48);
    font-family: var(--lc-font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    pointer-events: none;
}

html.lens-replay-active .lens-replay { animation: lcr-shell-out 3.16s cubic-bezier(0.76, 0, 0.24, 1) forwards; }
html.lens-replay-active .lens-replay-grain { animation: lcr-grain-in 2.2s ease forwards; }
html.lens-replay-active .lens-replay-vignette { animation: lcr-vignette-in 2.2s ease forwards; }
html.lens-replay-active .lens-replay-glasses { animation: lcr-glasses-enter 2.25s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
html.lens-replay-active .lens-replay-script { animation: lcr-script-in 1.7s 0.38s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
html.lens-replay-active .lens-replay-chapter,
html.lens-replay-active .lens-replay-label,
html.lens-replay-active .lens-replay-progress,
html.lens-replay-active .lens-replay-percent { animation: lcr-copy-in 2.55s ease forwards; }
html.lens-replay-active .lens-replay-progress-bar { animation: lcr-progress-fill 2.2s 0.25s ease-in-out forwards; }
html.lens-replay-active .lens-replay-letterbox { animation: lcr-letterbox-out 0.55s 2.46s cubic-bezier(0.76, 0, 0.24, 1) forwards; }
html.lens-replay-active .lens-replay-flash { animation: lcr-flash 0.44s 2.03s ease-out forwards; }

@keyframes lcr-shell-out { 0%, 82% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 0 100% 0); } }
@keyframes lcr-grain-in { 0% { opacity: 0.04; } 35%, 100% { opacity: 0.18; } }
@keyframes lcr-vignette-in { 0% { opacity: 0; } 35%, 100% { opacity: 0.72; } }

@keyframes lcr-script-in {
    0% { opacity: 0; transform: translate(-50%, -42%) rotate(-1deg); clip-path: inset(0 100% 0 0); }
    22%, 82% { opacity: 1; transform: translate(-50%, -50%) rotate(0deg); clip-path: inset(0 0% 0 0); }
    100% { opacity: 0; transform: translate(-50%, -56%) rotate(0.4deg); clip-path: inset(0 0% 0 0); }
}

@keyframes lcr-glasses-enter {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.38);
        filter: drop-shadow(0 0 10px rgba(233, 163, 111, 0.32)) drop-shadow(0 0 36px rgba(233, 163, 111, 0.10)) blur(2px);
    }
    32% {
        opacity: 0.52;
        transform: translate(-50%, -50%) scale(0.92);
        filter: drop-shadow(0 0 12px rgba(233, 163, 111, 0.42)) drop-shadow(0 0 48px rgba(233, 163, 111, 0.14)) blur(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(7.2);
        filter: drop-shadow(0 0 24px rgba(233, 163, 111, 0.58)) drop-shadow(0 0 88px rgba(244, 234, 208, 0.18)) blur(16px);
    }
}

@keyframes lcr-copy-in { 0% { opacity: 0; } 16%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lcr-progress-fill { to { transform: scaleX(1); } }
@keyframes lcr-letterbox-out { to { height: 0; } }
@keyframes lcr-flash { 0%, 100% { opacity: 0; } 42% { opacity: 0.55; } }

/* Lock page scroll while the replay loader covers the screen. */
html.lens-replay-active,
html.lens-replay-active body {
    overflow: hidden;
}

@media (max-width: 768px) {
    .lens-cycle {
        min-height: 300vh;
        min-height: 300dvh;
    }

    .lens-cycle .stage {
        min-height: 100dvh;
    }

    .lens-cycle .chapter {
        top: 1.1rem;
        left: 1.1rem;
        font-size: 0.52rem;
    }

    .lens-cycle .chapter-roman { font-size: 0.82rem; }
    .lens-cycle .chapter-coord { font-size: 0.58rem; }

    .lens-cycle .attribution {
        right: 1.1rem;
        bottom: 1.6rem;
        font-size: 0.5rem;
        letter-spacing: 0.22em;
    }

    .lens-cycle .attribution-name { font-size: 0.74rem; }
    .lens-cycle .attribution-album { font-size: 0.46rem; }
    .lens-cycle .attribution-rule { width: 2rem; }

    .lens-cycle .quote {
        gap: 1.6rem;
        max-width: 96vw;
    }

    .lens-cycle .quote-line--a {
        font-size: clamp(2.1rem, 11vw, 3.6rem);
        transform: rotate(-1deg);
    }

    .lens-cycle .quote-line--b {
        font-size: clamp(2.6rem, 14vw, 4.4rem);
        transform: rotate(0.7deg);
    }

    .lens-cycle .word {
        margin: 0 0.14em;
    }

    .lens-cycle .signature-line {
        font-size: clamp(2.4rem, 14vw, 4.6rem);
    }

    .lens-cycle .signature-return {
        font-size: 0.54rem;
        letter-spacing: 0.22em;
        max-width: 28ch;
        line-height: 1.8;
    }

    .lens-cycle .scroll-cue {
        bottom: 1.6rem;
        gap: 0.7rem;
        font-size: 0.46rem;
        letter-spacing: 0.22em;
    }

    .lens-cycle .scroll-cue-rule {
        width: 4.2rem;
    }

    .lens-cycle .lens-frame {
        width: 142vw;
        min-width: 0;
    }

    .lens-replay-glasses {
        width: 132vw;
    }

    .lens-replay-script {
        font-size: clamp(2rem, 12vw, 3.4rem);
        white-space: normal;
        max-width: 88vw;
    }

    .lens-replay-label {
        bottom: calc(5vh + 4.4rem);
    }

    .lens-replay-label-narrative {
        max-width: 22ch;
        font-size: clamp(1rem, 3.4vw, 1.2rem);
    }

    .lens-replay-label-sig {
        font-size: 0.5rem;
        letter-spacing: 0.26em;
    }

    .lens-replay-chapter {
        top: calc(5vh + 1.6rem);
        left: 1.2rem;
    }

    .lens-replay-percent {
        right: 1.2rem;
        bottom: calc(5vh + 1.6rem);
    }

    .lens-replay-progress { bottom: calc(5vh - 1px); }
    .lens-replay-letterbox { height: 5vh; }
}

@media (prefers-reduced-motion: reduce) {
    .lens-cycle *,
    .lens-cycle *::before,
    .lens-cycle *::after,
    .lens-replay *,
    .lens-replay *::before,
    .lens-replay *::after,
    html.lens-replay-active .lens-replay {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
