/* Scene palettes illuminate both the 3D product and its backdrop. */
#cinematic-home .ch-journey [data-slide] {
    --ch-accent: #c5a0ff;
    --ch-secondary-light: #7054e9;
    --ch-art-x: 69%;
    --ch-art-y: 48%;
}

#cinematic-home .ch-journey .ch-slide[data-active] {
    transition: none;
}

#cinematic-home .ch-journey [data-product="tag"],
#cinematic-home .ch-journey [data-product="loyalty"] {
    --ch-accent: #ffc883;
    --ch-secondary-light: #ce7331;
}

#cinematic-home .ch-journey [data-product="store"],
#cinematic-home .ch-journey [data-product="bos"] {
    --ch-accent: #77eadc;
    --ch-secondary-light: #3181da;
}

#cinematic-home .ch-stage-light {
    position: absolute;
    z-index: 1;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at var(--ch-art-x) var(--ch-art-y), color-mix(in srgb, var(--ch-accent) 14%, transparent), transparent 33%),
        radial-gradient(ellipse at 90% 88%, color-mix(in srgb, var(--ch-secondary-light) 18%, transparent), transparent 56%);
}

#cinematic-home .ch-stage-light::after {
    content: "";
    position: absolute;
    inset: -15%;
    background:
        repeating-linear-gradient(90deg, transparent 0 79px, color-mix(in srgb, var(--ch-accent) 7%, transparent) 79px 80px),
        repeating-linear-gradient(0deg, transparent 0 59px, color-mix(in srgb, var(--ch-accent) 7%, transparent) 59px 60px);
    mask-image: radial-gradient(ellipse at var(--ch-art-x) var(--ch-art-y), #000, transparent 42%);
    transform: translateY(calc(var(--ch-scene-progress, 0) * -26px));
}

#cinematic-home .ch-journey .u-scene {
    z-index: 2;
    left: var(--ch-art-x);
    top: var(--ch-art-y);
}

#cinematic-home .ch-journey .u-backdrop {
    background: none;
}

#cinematic-home .ch-journey .u-floor {
    background: radial-gradient(ellipse, color-mix(in srgb, var(--ch-accent) 26%, transparent), transparent 68%);
}

#cinematic-home .ch-journey .u-spark {
    background: var(--ch-accent);
    box-shadow: 0 0 18px 2px color-mix(in srgb, var(--ch-accent) 60%, transparent);
}

#cinematic-home .ch-journey :is(.u-card-face, .u-tag-face, .u-store-screen) {
    border-color: color-mix(in srgb, var(--ch-accent) 64%, #282331);
    box-shadow: inset 0 0 0 6px #ffffff0b, 7px 8px 0 #332a49, 11px 13px 0 #171520,
        0 0 65px color-mix(in srgb, var(--ch-accent) 25%, transparent), 20px 35px 80px #000c;
}

#cinematic-home .ch-journey :is(.u-card-face, .u-tag-face) {
    background: radial-gradient(ellipse at top left, color-mix(in srgb, var(--ch-accent) 31%, #100f19), #12111b 54%, #0b0a10 87%);
}

#cinematic-home .ch-journey .u-store-banner {
    background: radial-gradient(circle at 74% 48%, #267c9d, transparent 58%), linear-gradient(125deg, #142532, #101724);
}

#cinematic-home .ch-journey .u-store-banner :is(span, strong) {
    color: #f5ffff;
}

#cinematic-home .ch-journey .u-lid-border {
    border-color: color-mix(in srgb, var(--ch-accent) 45%, transparent);
}

#cinematic-home .ch-journey .ch-slide .ch-scene-copy {
    position: absolute;
    z-index: 4;
    display: block;
    inset: 50% auto auto 8%;
    width: min(35%, 530px);
    height: auto;
    margin: 0;
    padding: 0;
    background: none;
    color: var(--ch-ink);
    transform: translateY(calc(-47% - var(--ch-scene-progress, 0) * 12px));
    overflow-wrap: anywhere;
}

#cinematic-home .ch-journey .ch-slide .ch-scene-copy h2 {
    font-size: clamp(36px, 5.65vw, 98px);
    font-weight: 750;
    line-height: 1.02;
    letter-spacing: -.058em;
    color: var(--ch-ink);
    text-wrap: balance;
}

#cinematic-home .ch-journey .ch-slide .ch-scene-copy p {
    max-width: 34ch;
    margin-top: clamp(9px, 2vw, 24px);
    color: var(--ch-muted);
    font-size: clamp(14px, 1.48vw, 22px);
    line-height: 1.48;
    text-wrap: pretty;
}

#cinematic-home .ch-journey .ch-capability-scene {
    height: 560px;
    transform-style: preserve-3d;
}

#cinematic-home .ch-journey .ch-capability-symbol {
    position: relative;
    background: linear-gradient(146deg, color-mix(in srgb, var(--ch-accent) 38%, #0f1421), #121424 76%);
    color: var(--ch-accent);
    border: 3px solid color-mix(in srgb, var(--ch-accent) 70%, #171c2e);
    box-shadow: inset 0 0 65px color-mix(in srgb, var(--ch-accent) 18%, transparent),
        14px 17px 0 #1c2334, 18px 23px 0 #0b0c16, 28px 52px 95px #000b;
    transform: translate3d(0,-12px,95px) rotateX(-8deg) rotateY(-17deg) rotateZ(-9deg);
}

#cinematic-home .ch-journey .ch-capability-symbol svg {
    filter: drop-shadow(0 4px 19px color-mix(in srgb, var(--ch-accent) 43%, transparent));
}

#cinematic-home .ch-journey .ch-art-orbit {
    position: absolute;
    width: 760px;
    height: 430px;
    border: 2px solid color-mix(in srgb, var(--ch-accent) 55%, transparent);
    border-radius: 50%;
    box-shadow: 0 0 38px color-mix(in srgb, var(--ch-accent) 25%, transparent);
    transform: rotateX(58deg) rotateZ(-17deg) translateZ(-58px);
}

#cinematic-home .ch-journey .ch-art-orbit::after {
    content: "";
    position: absolute;
    inset: 26px;
    border: 2px dashed color-mix(in srgb, var(--ch-accent) 30%, transparent);
    border-radius: inherit;
}

#cinematic-home .ch-journey .ch-art-tile {
    position: absolute;
    width: 165px;
    height: 122px;
    border: 2px solid color-mix(in srgb, var(--ch-accent) 42%, transparent);
    border-radius: 26px;
    background: linear-gradient(150deg, color-mix(in srgb, var(--ch-accent) 37%, #131627), #1a192c);
    box-shadow: 0 24px 50px #000b;
}

#cinematic-home .ch-journey .ch-art-tile::after {
    content: "";
    position: absolute;
    inset: 27% 19%;
    background: repeating-linear-gradient(0deg, transparent 0 12px, var(--ch-accent) 12px 16px);
    opacity: .55;
}

#cinematic-home .ch-journey .ch-art-tile-back {
    transform: translate3d(232px,-132px,-24px) rotateY(-27deg) rotateZ(15deg);
}

#cinematic-home .ch-journey .ch-art-tile-front {
    transform: translate3d(-230px,123px,153px) rotateY(-21deg) rotateZ(-12deg);
}

@media (max-width: 767px) and (orientation: portrait) {
    #cinematic-home .ch-journey [data-slide] {
        --ch-art-x: 50%;
        --ch-art-y: clamp(22%, calc(43% - var(--ch-consent-offset, 0px) / 2), 43%);
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy {
        inset: auto 6% clamp(66px, calc(var(--ch-consent-offset, 0px) + 15px), 48%) 6%;
        width: auto;
        transform: translateY(calc(8px - var(--ch-scene-progress, 0) * 8px));
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy h2 {
        font-size: clamp(31px, 9.8vw, 60px);
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy p {
        max-width: min(86%, 38ch);
        font-size: clamp(14px, 3.9vw, 18px);
    }
}

@media (max-height: 540px) and (orientation: landscape) {
    #cinematic-home .ch-journey [data-slide] {
        --ch-art-y: clamp(30%, calc(48% - var(--ch-consent-offset, 0px) / 2), 48%);
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy {
        top: clamp(30%, calc(50% - var(--ch-consent-offset, 0px) / 2), 50%);
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy h2 {
        font-size: clamp(27px, 4.5vw, 50px);
    }

    #cinematic-home .ch-journey .ch-slide .ch-scene-copy p {
        font-size: clamp(13px, 1.85vw, 17px);
    }
}

/* The seam stays attached to each panel while the page scrolls past it. */
#cinematic-home .ch-journey[data-ready] .ch-slide {
    --ch-scene-entry: 0;
    --ch-scene-exit: 0;
    --ch-seam-glow: 0;
    mask-image: linear-gradient(180deg, transparent, #000 9%, #000 92%, transparent);
}

#cinematic-home .ch-journey[data-ready] .ch-stage-light {
    overflow: hidden;
    transform: translateY(calc(var(--ch-scene-entry) * -7svh + var(--ch-scene-exit) * 9svh));
}

#cinematic-home .ch-journey[data-ready] .ch-slide + .ch-slide::before {
    content: '';
    position: absolute;
    z-index: 1;
    inset: 0 0 auto;
    height: min(28svh, 220px);
    pointer-events: none;
    opacity: calc(.46 + .54 * var(--ch-seam-glow));
    background:
        radial-gradient(ellipse at var(--ch-art-x) 4%, color-mix(in srgb, var(--ch-accent) 44%, transparent), transparent 58%),
        linear-gradient(180deg, color-mix(in srgb, var(--ch-accent) 13%, transparent), transparent 56%);
    mask-image: linear-gradient(180deg, #000, #000 21%, transparent);
}

#cinematic-home .ch-journey[data-ready] .ch-slide + .ch-slide .ch-stage-light::before {
    content: '';
    position: absolute;
    left: var(--ch-art-x);
    top: 0;
    width: min(74vw, 920px);
    aspect-ratio: 3.1;
    border: 1px solid color-mix(in srgb, var(--ch-accent) 55%, transparent);
    border-radius: 50%;
    box-shadow: inset 0 0 32px color-mix(in srgb, var(--ch-accent) 17%, transparent),
        0 0 42px color-mix(in srgb, var(--ch-accent) 25%, transparent);
    transform: translate3d(-50%, calc(-46% + var(--ch-seam-glow) * 15svh), 0)
        perspective(860px) rotateX(61deg) scale(calc(.74 + .26 * var(--ch-seam-glow)));
    opacity: var(--ch-seam-glow);
}

#cinematic-home .ch-journey[data-ready] .ch-slide .u-scene {
    transform: translate(-50%, -50%) perspective(1150px)
        translate3d(0, calc(var(--ch-scene-entry) * -41svh + var(--ch-scene-exit) * 16svh),
            calc(var(--ch-scene-entry) * -260px + var(--ch-scene-exit) * -160px))
        rotateX(calc(var(--ch-scene-entry) * 36deg + var(--ch-scene-exit) * -24deg))
        scale(var(--unbox-scale, 1));
    opacity: calc(1 - var(--ch-scene-entry) * .28 - var(--ch-scene-exit) * .26);
}

#cinematic-home .ch-journey[data-ready] .ch-scene-copy {
    translate: 0 calc(var(--ch-scene-entry) * -3.4svh + var(--ch-scene-exit) * 5svh);
}

@media (prefers-reduced-motion: no-preference) {
    #cinematic-home #ch-features .ch-tool-grid {
        perspective: 1150px;
    }

    #cinematic-home #ch-features :is(.ch-section-heading, .ch-tool) {
        transform: none;
        opacity: 1;
        transition: transform 650ms cubic-bezier(.18,.78,.22,1), opacity 420ms ease, border-color 260ms ease, box-shadow 300ms ease;
        transition-delay: var(--ch-feature-delay, 0ms);
    }

    #cinematic-home #ch-features .ch-section-heading[data-feature-pending] {
        transform: translateY(26px) scale(.985);
        opacity: .72;
    }

    #cinematic-home #ch-features .ch-tool {
        --ch-card-tilt: -5deg;
        background: radial-gradient(ellipse at 16% 0%, #a98dff16, transparent 66%),
            linear-gradient(148deg, color-mix(in srgb, var(--ln-home-background) 91%, var(--ch-ink)),
                color-mix(in srgb, var(--ln-home-background) 97%, var(--ch-ink)) 75%);
        transform-origin: center bottom;
        transform-style: preserve-3d;
    }

    #cinematic-home #ch-features .ch-tool:nth-child(even) {
        --ch-card-tilt: 5deg;
    }

    #cinematic-home #ch-features .ch-tool[data-feature-pending]:not(:focus-visible) {
        transform: translate3d(0, 46px, -90px) rotateX(19deg) rotateY(var(--ch-card-tilt));
        opacity: .52;
    }

    #cinematic-home #ch-features .ch-tool:focus-visible {
        transition-delay: 0ms;
    }

    #cinematic-home #ch-features .ch-tool::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 1;
        border-radius: inherit;
        background: linear-gradient(128deg, transparent 30%, #d2bdff20 48%, transparent 69%);
        transform: translateX(-110%);
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
    #cinematic-home #ch-features .ch-tool:hover {
        transform: translate3d(0, -6px, 26px) rotateX(5deg) rotateY(calc(var(--ch-card-tilt) / 2));
        box-shadow: 0 18px 32px #06050db0;
        transition-delay: 0ms;
    }

    #cinematic-home #ch-features .ch-tool:hover::after {
        transform: translateX(110%);
        transition: transform 650ms cubic-bezier(.2,.66,.28,1);
    }
}

@media (prefers-reduced-motion: no-preference) {
    #cinematic-home [data-motion-visible] {
        --ch-idle-state: running;
    }

    #cinematic-home .ch-journey .ch-slide .u-scene :is(.u-product-float, .u-box-lid, .u-box-base,
        .ch-capability-symbol, .ch-art-orbit, .ch-art-tile),
    #cinematic-home #ch-features .ch-tool .ch-feature-visual > :is(img, .ch-feature-icon) {
        animation: ch-object-drift var(--ch-drift-time, 12s) ease-in-out infinite;
        animation-play-state: var(--ch-idle-state, paused) !important;
    }

    #cinematic-home .ch-journey .ch-slide .u-scene :is(.u-box-lid, .ch-art-tile-front) {
        --ch-drift-time: 14s;
        --ch-drift-y: -17px;
        --ch-drift-z: 18px;
    }

    #cinematic-home .ch-journey .ch-slide .u-scene :is(.u-box-base, .ch-art-orbit) {
        --ch-drift-time: 16s;
        --ch-drift-y: 15px;
        --ch-drift-z: -18px;
    }

    #cinematic-home .ch-journey .ch-slide .u-scene .ch-art-tile-back {
        --ch-drift-time: 13s;
        --ch-drift-y: 26px;
        --ch-drift-z: -22px;
    }

    #cinematic-home .ch-journey .ch-slide .u-scene .u-spark {
        animation-duration: calc(12s + var(--i) * .24s);
        animation-play-state: var(--ch-idle-state, paused) !important;
    }

    #cinematic-home .ch-journey[data-ready] .ch-slide::after {
        content: '';
        display: block;
        position: absolute;
        z-index: 1;
        inset: 0;
        pointer-events: none;
        animation: none;
        background: radial-gradient(ellipse at var(--ch-art-x) calc(10% + 80% * var(--ch-motion-pass, 0)),
            color-mix(in srgb, var(--ch-accent) 23%, transparent), transparent 24%);
        opacity: calc(var(--ch-motion-glow, 0) * .74);
        transform: scaleX(calc(.73 + .27 * var(--ch-motion-pass, 0)));
    }

    #cinematic-home .ch-journey[data-ready] .u-floor {
        translate: 0 calc(32px - var(--ch-motion-pass, 0) * 64px) calc(var(--ch-motion-glow, 0) * -140px);
    }

    #cinematic-home #ch-features .ch-tool .ch-feature-visual {
        --ch-drift-y: -7px;
        --ch-drift-z: 7px;
        --ch-drift-tilt: 4deg;
        --ch-drift-time: 12s;
        --ch-depth-distance: max(var(--ch-card-scroll-depth, 0), calc(-1 * var(--ch-card-scroll-depth, 0)));
        transform: perspective(680px) rotateX(calc(var(--ch-card-scroll-depth, 0) * 9deg))
            translate3d(0, calc(var(--ch-card-scroll-depth, 0) * -4px), calc(14px - var(--ch-depth-distance) * 14px));
    }
}

@keyframes ch-object-drift {
    0%, 100% { translate: 0 0 0; rotate: x 0deg; }
    27% { translate: 0 calc(var(--ch-drift-y, -29px) * .75) var(--ch-drift-z, 36px); rotate: x var(--ch-drift-tilt, 7deg); }
    51% { translate: 0 var(--ch-drift-y, -29px) calc(var(--ch-drift-z, 36px) * .35); rotate: x calc(var(--ch-drift-tilt, 7deg) * .42); }
    76% { translate: 0 calc(var(--ch-drift-y, -29px) * -.38) calc(var(--ch-drift-z, 36px) * -.6); rotate: x calc(var(--ch-drift-tilt, 7deg) * -.64); }
}
