/* Scroll reveals: content stays visible when JavaScript or motion is disabled. */
@media (prefers-reduced-motion: no-preference) {
    .scroll-reveal {
        opacity: 1;
        transform: none;
        transition:
            opacity 700ms cubic-bezier(.2, .65, .25, 1),
            transform 850ms cubic-bezier(.2, .65, .25, 1);
        transition-delay: var(--reveal-delay, 0ms);
    }

    .scroll-reveal.reveal-pending {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }

    .about-visual.reveal-pending,
    .contact-photo.reveal-pending {
        transform: translate3d(0, 34px, 0) scale(.975);
    }

    .scroll-reveal:focus-within {
        opacity: 1;
        transform: none;
        transition: none;
    }

    /* The photograph, copy and glass photo link sit at different depths. */
    .hero.parallax-ready {
        perspective: 1400px;
        perspective-origin: 50% 45%;
        --hero-x: 0;
        --hero-y: 0;
        --hero-scroll: 0;
    }

    .parallax-ready .hero-image {
        inset: -6%;
        width: 112%;
        height: 112%;
        transform:
            translate3d(
                calc(var(--hero-x) * -16px),
                calc(var(--hero-y) * -10px + var(--hero-scroll) * 28px),
                0
            )
            rotateX(calc(var(--hero-y) * 2deg))
            rotateY(calc(var(--hero-x) * -2.8deg))
            scale(1.015);
        backface-visibility: hidden;
    }

    .parallax-ready .hero-content {
        transform: translate3d(
            calc(var(--hero-x) * 8px),
            calc(var(--hero-y) * 5px - var(--hero-scroll) * 12px),
            22px
        );
    }

    .parallax-ready .hero-gallery {
        transform: translate3d(
            calc(var(--hero-x) * 17px),
            calc(var(--hero-y) * 11px - var(--hero-scroll) * 20px),
            44px
        );
    }

    .parallax-moving .hero-image,
    .parallax-moving .hero-content,
    .parallax-moving .hero-gallery {
        will-change: transform;
    }
}

@media (max-width: 800px) and (prefers-reduced-motion: no-preference) {
    .parallax-ready .hero-image {
        inset: -3%;
        width: 106%;
        height: 106%;
    }

    .parallax-ready .hero-content {
        transform: translate3d(0, calc(var(--hero-scroll) * -5px), 0);
    }

    .parallax-ready .hero-gallery {
        transform: translate3d(0, calc(var(--hero-scroll) * -9px), 0);
    }

    .scroll-reveal.reveal-pending {
        transform: translate3d(0, 20px, 0);
    }
}

/* Immediate fallback, including a preference changed while the page is open. */
@media (prefers-reduced-motion: reduce), print {
    .scroll-reveal,
    .scroll-reveal.reveal-pending,
    .parallax-ready .hero-content,
    .parallax-ready .hero-gallery {
        opacity: 1;
        transform: none;
        transition: none;
        will-change: auto;
    }

    .parallax-ready .hero-image {
        inset: 0;
        width: 100%;
        height: 100%;
        transform: none;
        will-change: auto;
    }
}
