:root {
    --papyon-spring: cubic-bezier(.16, 1.18, .3, 1);
}

.papyon-page-transition {
    position: fixed;
    z-index: 2500;
    inset: 0;
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
    color: #090909;
}
.papyon-page-transition.is-entering,
.papyon-page-transition.is-leaving {
    visibility: visible;
    pointer-events: auto;
}
.papyon-transition-curtain {
    position: absolute;
    inset: 0;
    background: #dfff00;
    transform: scaleY(0);
    transform-origin: bottom;
}
.papyon-transition-visual {
    position: absolute;
    z-index: 1;
    inset: 0;
    opacity: 0;
    background-position: center;
    background-size: cover;
    filter: saturate(.68) contrast(1.08);
    transform: scale(1.12);
    clip-path: inset(var(--clip-top, 0%) var(--clip-right, 0%) var(--clip-bottom, 0%) var(--clip-left, 0%));
}
.papyon-transition-visual::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, rgba(9,9,9,.92), rgba(9,9,9,.18));
}
.papyon-transition-copy {
    position: absolute;
    z-index: 3;
    right: clamp(22px, 4vw, 72px);
    bottom: clamp(28px, 6vw, 90px);
    left: clamp(22px, 4vw, 72px);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px 28px;
    align-items: end;
    opacity: 0;
    transform: translateY(50px);
}
.papyon-transition-copy span {
    align-self: start;
    padding-top: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .18em;
}
.papyon-transition-copy strong {
    font: clamp(58px, 11vw, 190px)/.78 var(--display, sans-serif);
    letter-spacing: -.075em;
    text-transform: uppercase;
}
.papyon-transition-copy i {
    grid-column: 1 / -1;
    height: 2px;
    background: #090909;
    transform: scaleX(0);
    transform-origin: left;
}
.papyon-page-transition.is-leaving .papyon-transition-curtain {
    animation: papyon-curtain-in .58s cubic-bezier(.7,0,.2,1) forwards;
}
.papyon-page-transition.is-leaving .papyon-transition-visual {
    animation: papyon-visual-in .72s .35s cubic-bezier(.2,.75,.2,1) forwards;
}
.papyon-page-transition.is-leaving .papyon-transition-copy {
    animation: papyon-copy-in .58s .16s var(--papyon-spring) forwards;
}
.papyon-page-transition.is-leaving .papyon-transition-copy i {
    animation: papyon-line-in .65s .3s cubic-bezier(.2,.8,.2,1) forwards;
}
.papyon-page-transition.is-entering {
    background: #dfff00;
    animation: papyon-transition-hide .76s .08s cubic-bezier(.7,0,.2,1) forwards;
}
@keyframes papyon-curtain-in { to { transform: scaleY(1); } }
@keyframes papyon-visual-in { to { opacity: 1; transform: scale(1); clip-path: inset(0); } }
@keyframes papyon-copy-in { to { opacity: 1; transform: translateY(0); } }
@keyframes papyon-line-in { to { transform: scaleX(1); } }
@keyframes papyon-transition-hide {
    0% { clip-path: inset(0); }
    100% { clip-path: inset(0 0 100% 0); visibility: hidden; }
}

.rhythm-story.rhythm-cinema {
    position: relative;
    left: 0;
    width: 100vw;
    height: 500svh;
    min-height: 3400px;
    margin: 120px 0 0 calc(50% - 50vw);
    overflow: visible;
    background: #090909;
}
.rhythm-cinema-stage {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100svh;
    min-height: 650px;
    overflow: hidden;
    isolation: isolate;
}
.rhythm-cinema-visuals,
.rhythm-cinema-layer,
.rhythm-cinema-layer img,
.rhythm-cinema-wash {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.rhythm-cinema-layer {
    margin: 0;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity .85s ease, transform 1.2s cubic-bezier(.2,.75,.2,1);
}
.rhythm-cinema-layer.is-active {
    opacity: 1;
    transform: scale(1);
}
.rhythm-cinema-layer img {
    object-fit: cover;
    object-position: center 38%;
    filter: saturate(.72) contrast(1.12);
}
.rhythm-cinema-layer:nth-child(2) img { object-position: center 32%; }
.rhythm-cinema-layer:nth-child(3) img { object-position: center 44%; }
.rhythm-cinema-wash {
    z-index: 1;
    background:
        radial-gradient(circle at 62% 45%, rgba(223,255,0,.11), transparent 28%),
        linear-gradient(90deg, #090909 0 24%, rgba(9,9,9,.74) 40%, rgba(9,9,9,.08) 72%),
        linear-gradient(0deg, rgba(9,9,9,.9), transparent 55%);
    transition: background .8s ease;
}
.rhythm-cinema .rhythm-story-intro {
    position: absolute;
    z-index: 4;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: min(31vw, 520px);
    flex-direction: column;
    justify-content: center;
    padding: 7vw var(--pad);
    pointer-events: none;
    background: none;
}
.rhythm-cinema-chapters {
    position: absolute;
    z-index: 4;
    right: var(--pad);
    bottom: 10vh;
    width: min(650px, 48vw);
    min-height: 280px;
}
.rhythm-cinema-chapter {
    position: absolute;
    inset: auto 0 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(48px);
    transition: visibility .55s, opacity .55s ease, transform .75s var(--papyon-spring);
}
.rhythm-cinema-chapter.is-active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
.rhythm-cinema-chapter > span {
    display: block;
    margin-bottom: 22px;
    color: #dfff00;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .18em;
}
.rhythm-cinema-chapter > p {
    margin: 0 0 12px;
    color: rgba(255,255,255,.7);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.rhythm-cinema-chapter h3 {
    margin: 0;
    font: clamp(52px, 7vw, 118px)/.82 var(--display);
    letter-spacing: -.075em;
    text-transform: uppercase;
}
.rhythm-cinema-chapter h3 em {
    color: #dfff00;
    font: italic 700 .82em/1 var(--serif);
    text-transform: none;
}
.rhythm-cinema-chapter a {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    gap: 28px;
    margin-top: 28px;
    padding: 0 18px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 100px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.rhythm-cinema-chapter a b { color: #dfff00; font-size: 16px; }
.rhythm-cinema-finale { width: min(760px, 70vw); }
.rhythm-cinema-finale h3 { font-size: clamp(62px, 9vw, 148px); }
.rhythm-cinema .rhythm-progress {
    z-index: 6;
    bottom: 28px;
}

[data-haptic].is-pressed,
a[data-dance].is-pressed,
.mobile-action-grid > *.is-pressed,
.contact-sheet-grid > *.is-pressed {
    transform: scale(.965);
}

@media (max-width: 760px) {
    .papyon-transition-copy {
        bottom: calc(92px + env(safe-area-inset-bottom));
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .papyon-transition-copy span { padding: 0; }
    .papyon-transition-copy strong { font-size: clamp(54px, 18vw, 82px); }
    .rhythm-story.rhythm-cinema {
        height: 470svh;
        min-height: 3000px;
        margin-top: 80px;
        overflow: visible;
        background: #090909;
    }
    .rhythm-cinema-stage { min-height: 620px; }
    .rhythm-cinema-layer img { object-position: 58% center; }
    .rhythm-cinema-layer:nth-child(2) img { object-position: 56% 38%; }
    .rhythm-cinema-layer:nth-child(3) img { object-position: 62% center; }
    .rhythm-cinema-wash {
        background:
            linear-gradient(0deg, #090909 0 18%, rgba(9,9,9,.76) 42%, rgba(9,9,9,.05) 72%),
            linear-gradient(90deg, rgba(9,9,9,.72), rgba(9,9,9,.02));
    }
    .rhythm-cinema .rhythm-story-intro {
        top: 88px;
        right: 20px;
        bottom: auto;
        left: 20px;
        width: auto;
        min-height: 0;
        padding: 0;
    }
    .rhythm-cinema .rhythm-story-intro p { display: none; }
    .rhythm-cinema .rhythm-story-intro h2 {
        margin: 0;
        font-size: clamp(46px, 13vw, 64px);
    }
    .rhythm-cinema .rhythm-story-intro > span { margin-top: 10px; }
    .rhythm-cinema-chapters {
        right: 20px;
        bottom: 72px;
        left: 20px;
        width: auto;
        min-height: 245px;
    }
    .rhythm-cinema-chapter h3 { font-size: clamp(45px, 14vw, 68px); }
    .rhythm-cinema-chapter a { min-height: 46px; margin-top: 20px; }
    .rhythm-cinema-finale { width: auto; }
    .rhythm-cinema .rhythm-progress { right: 20px; bottom: 30px; left: 20px; }
    .contact-sheet {
        transform: translateY(108%) scale(.98);
        transition: transform .58s var(--papyon-spring), opacity .3s, visibility .58s;
        will-change: transform;
    }
    body.contact-open .contact-sheet { transform: translateY(0) scale(1); }
    .contact-sheet.is-dragging { transition: none; }
    .mobile-action-grid > [data-pwa-install]:not([hidden]) { display: grid; grid-column: 1 / -1; min-height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
    .papyon-page-transition { display: none !important; }
    .rhythm-cinema-layer,
    .rhythm-cinema-chapter { transition: none !important; }
}
