/*
 * Motion. Restrained on purpose: one signature moment per page, a different
 * gesture for each kind of section, and most things simply arriving quietly.
 *
 *   Hero           the headline comes into focus, then its text and buttons;
 *                  scrolling away lifts and fades it a little
 *   Statement      the About statement's words sharpen as it scrolls through
 *                  the screen (after the BYQ "Scroll Blur Reveal" gem)
 *   Stats          the figures count up once
 *   Photo rows     the "engineered" photos settle from a slight zoom
 *   Everything else  headings and product rows fade in, nothing more
 *
 * assets/js/motion.js drives it. html.motion-ok (set in <head>, inc/motion.php)
 * holds back the first screen until the script runs, so it never flashes
 * finished and then hides. Reduced motion, or no script: a static page.
 */

:root {
    --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Held back until motion.js takes over. */
.motion-ok:not(.motion-ready) :is(.hero-heading, .hero-desc, .hero-buttons) {
    opacity: 0;
}

/* ---- Hero --------------------------------------------------------------- */

[data-motion="hero"] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 1.2s var(--motion-ease) var(--d, 0s), transform 1.4s var(--motion-ease) var(--d, 0s), filter 1.4s var(--motion-ease) var(--d, 0s);
}

[data-motion="hero"].hero-heading {
    filter: blur(10px);
}

[data-motion="hero"].is-in {
    opacity: 1;
    transform: none;
    filter: none;
}

/* Lift-and-fade while scrolling away, written by motion.js. */
.hero-main[data-motion-scroll] {
    transform: translateY(var(--lift, 0px));
    opacity: var(--fade, 1);
    will-change: transform, opacity;
}

/* ---- Quiet arrivals ----------------------------------------------------- */

[data-motion="fade"] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 1.1s var(--motion-ease) var(--d, 0s), transform 1.1s var(--motion-ease) var(--d, 0s);
}

[data-motion="fade"].is-in {
    opacity: 1;
    transform: none;
}

/* ---- Statement ---------------------------------------------------------- */

.motion-sharpen {
    /* --p (0..1) is written per word by motion.js as the statement scrolls. */
    opacity: calc(0.14 + 0.86 * var(--p, 0));
    filter: blur(calc((1 - var(--p, 0)) * 6px));
    transition: opacity 0.25s linear, filter 0.25s linear;
}

/* ---- Photo settle ------------------------------------------------------- */

/* "scale", not "transform", so the cards' hover zoom is left alone. */
[data-motion="settle"] img {
    scale: 1.08;
    opacity: 0;
    transition: transform 0.4s ease, scale 1.8s var(--motion-ease) var(--d, 0s), opacity 1s ease var(--d, 0s);
}

[data-motion="settle"].is-in img {
    scale: 1;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    [data-motion],
    [data-motion] img,
    .motion-sharpen,
    .hero-main[data-motion-scroll] {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        scale: none !important;
        transition: none !important;
    }
}
