/* Epal motion system v2 — pairs with motion.js. See the attribute docs at the top of motion.js.
   Rules: only transform, opacity and clip-path animate. Hidden-before-reveal states apply only
   under html.js and end visible after 3 s even if JS fails (ep-safe). */
:root {
    --ep-ease-out: cubic-bezier(.22, 1, .36, 1);
    --ep-ease-inout: cubic-bezier(.65, 0, .35, 1);
    --ep-ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --ep-dur-xs: 120ms;
    --ep-dur-s: 240ms;
    --ep-dur-m: 480ms;
    --ep-dur-l: 800ms;
    --ep-stagger: 60ms;
    --ep-rise: 16px;
}
@media (max-width: 767px) { :root { --ep-rise: 8px; } }

/* ---------- Cross-document View Transitions ---------- */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    .ep-header { view-transition-name: ep-header; }
    ::view-transition-old(root) { animation: ep-vt-out var(--ep-dur-s) var(--ep-ease-inout) both; }
    ::view-transition-new(root) { animation: ep-vt-in var(--ep-dur-m) var(--ep-ease-out) both; }
    ::view-transition-group(ep-header) { animation: none; }
}
@keyframes ep-vt-out { to { opacity: 0; } }
@keyframes ep-vt-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Safety net: anything still hidden after 3 s becomes visible ---------- */
@keyframes ep-safe { to { opacity: 1; transform: none; clip-path: none; } }
/* The layout adds .ep-mo in <head>; hidden states apply only under it. motion.js adds .ep-mo-on after a
   successful scan, which cancels the 3 s ep-safe backstop (it covers a motion.js 404). On a JS error it removes .ep-mo. */
html.ep-mo-on [data-reveal]:not(.is-in), html.ep-mo-on [data-stagger]:not(.is-in) > *, html.ep-mo-on [data-split].is-split:not(.is-in) .ep-sw > span { animation: none; }

/* ---------- Reveals ---------- */
.ep-mo [data-reveal]:not(.is-in) {
    opacity: 0;
    transform: translateY(var(--ep-rise));
    animation: ep-safe 1ms 3s forwards;
}
.ep-mo [data-reveal="fade"]:not(.is-in) { transform: none; }
.ep-mo [data-reveal="scale"]:not(.is-in) { transform: scale(.96); }
.ep-mo [data-reveal="blur"]:not(.is-in) { transform: translateY(var(--ep-rise)) scale(.985); filter: blur(10px); }
.ep-mo [data-reveal="left"]:not(.is-in) { transform: translateX(calc(var(--ep-rise) * -2)); }
.ep-mo [data-reveal="right"]:not(.is-in) { transform: translateX(calc(var(--ep-rise) * 2)); }
.ep-mo [data-reveal="blur"] { transition-property: opacity, transform, filter !important; }
.ep-mo [data-reveal="blur"].is-in { filter: none; }
.ep-mo [data-reveal="wipe"]:not(.is-in),
.ep-mo [data-reveal="clip"]:not(.is-in) { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); }
.ep-mo [data-reveal] {
    transition: opacity var(--ep-dur-m) var(--ep-ease-out), transform var(--ep-dur-l) var(--ep-ease-out), clip-path var(--ep-dur-l) var(--ep-ease-inout);
    transition-delay: calc(var(--d, 0ms) + var(--i, 0) * var(--ep-stagger));
}
.ep-mo [data-reveal].is-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }

/* Children of data-stagger (when they carry no data-reveal of their own) */
.ep-mo [data-stagger]:not(.is-in) > * { opacity: 0; transform: translateY(var(--ep-rise)); animation: ep-safe 1ms 3s forwards; }
.ep-mo [data-stagger] > * { transition: opacity var(--ep-dur-m) var(--ep-ease-out), transform var(--ep-dur-l) var(--ep-ease-out); transition-delay: calc(var(--i, 0) * var(--ep-stagger)); }
.ep-mo [data-stagger].is-in > * { opacity: 1; transform: none; }

/* ---------- Split words ---------- */
.ep-sw { display: inline-block; overflow: clip; overflow-clip-margin: .2em; vertical-align: baseline; }
.ep-mo [data-split]:not(.is-split) { opacity: 0; animation: ep-safe 1ms 3s forwards; }
html.ep-mo-on [data-split]:not(.is-split) { animation: none; }
html.ep-lite [data-split]:not(.is-split) { animation: none; opacity: 1; }
[data-count] { font-variant-numeric: tabular-nums; }
.ep-sw > span { display: inline-block; transition: transform var(--ep-dur-l) var(--ep-ease-out); transition-delay: calc(var(--i, 0) * var(--ep-stagger) + 80ms); }
.ep-mo [data-split].is-split:not(.is-in) .ep-sw > span { transform: translateY(130%); animation: ep-safe 1ms 3s forwards; }

/* ---------- Tilt (polaroids) ---------- */
[data-tilt] { transition: transform var(--ep-dur-s) var(--ep-ease-out); transform-style: preserve-3d; }
[data-magnetic] { transition: translate .4s var(--ep-ease-out), transform .35s var(--ep-ease-out), box-shadow .35s var(--ep-ease-out); }
/* Tilt glare: add class nx-glare to a [data-tilt] box (uses ::after; box must be position:relative + overflow:hidden) */
.nx-glare::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0; transition: opacity .3s; background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .22), transparent 60%); }
.nx-glare:hover::after { opacity: 1; }

/* ---------- Sticky stacking cards ---------- */
[data-stack] > * { position: sticky; top: calc(var(--header-h, 72px) + 16px + var(--i, 0) * 12px); }

/* ---------- Hover-reveal image (desktop, fine pointer) ---------- */
.ep-hover-img {
    position: fixed; left: 0; top: 0; z-index: 60; width: 220px; aspect-ratio: 4 / 3; pointer-events: none;
    border-radius: 6px; overflow: hidden; box-shadow: 0 18px 40px rgba(6, 18, 42, .25);
    opacity: 0; transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(-2deg) scale(.92);
    transition: opacity var(--ep-dur-s) var(--ep-ease-out), transform var(--ep-dur-s) var(--ep-ease-out);
}
.ep-hover-img.is-on { opacity: 1; transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(-2deg); }
.ep-hover-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Pause control for moving things ---------- */
.ep-pause {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 13px; padding: 0 14px; cursor: pointer;
}

/* ---------- First-visit ink wipe ---------- */
.ep-inkwipe {
    position: fixed; inset: 0; z-index: 200; background: var(--ink, #06122a); pointer-events: none;
    clip-path: inset(0 0 0 0); animation: ep-inkwipe-out 400ms var(--ep-ease-inout) 120ms forwards;
}
@keyframes ep-inkwipe-out { to { clip-path: inset(0 0 100% 0); } }

/* ---------- Lite mode: short fades only ---------- */
.ep-lite [data-reveal], .ep-lite [data-stagger] > * { transition: opacity 200ms linear !important; transition-delay: 0ms !important; }
.ep-lite [data-reveal]:not(.is-in), .ep-lite [data-stagger]:not(.is-in) > * { transform: none !important; clip-path: none !important; }
.ep-lite [data-parallax] { transform: none !important; }

/* ---------- Reduced motion: nothing hidden, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
    .js [data-reveal], .js [data-stagger] > *, .ep-sw > span, [data-parallax], [data-tilt], [data-magnetic] {
        translate: none !important; filter: none !important;
        opacity: 1 !important; transform: none !important; clip-path: none !important; animation: none !important;
    }
    .ep-inkwipe { display: none; }
}

/* ---------- Scroll-driven parallax (off the main thread where supported) ---------- */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        html:not(.ep-lite) [data-parallax] {
            animation: ep-plx linear both;
            animation-timeline: view();
            animation-range: cover;
        }
    }
}
@keyframes ep-plx {
    from { transform: translate3d(0, calc(var(--plx, 0) * -1px), 0); }
    to { transform: translate3d(0, calc(var(--plx, 0) * 1px), 0); }
}

/* ---------- v4 (white, restrained): 150-300ms ease-out, 8-16px reveals, no blur, no ink wipe, no word-split slide ---------- */
:root { --ep-ease-out: cubic-bezier(.2, .6, .2, 1); --ep-ease-spring: var(--ep-ease-out); --ep-dur-s: 180ms; --ep-dur-m: 260ms; --ep-dur-l: 300ms; --ep-stagger: 40ms; --ep-rise: 12px; }
@media (max-width: 767px) { :root { --ep-rise: 8px; } }
.ep-mo [data-reveal="blur"]:not(.is-in) { filter: none; transform: translateY(var(--ep-rise)); }
.ep-mo [data-reveal="scale"]:not(.is-in) { transform: translateY(var(--ep-rise)); }
.ep-mo [data-reveal="left"]:not(.is-in), .ep-mo [data-reveal="right"]:not(.is-in) { transform: translateY(var(--ep-rise)); }
.ep-mo [data-reveal="wipe"]:not(.is-in), .ep-mo [data-reveal="clip"]:not(.is-in) { opacity: 0; clip-path: none; transform: translateY(var(--ep-rise)); }
.ep-mo [data-split].is-split:not(.is-in) .ep-sw > span { transform: translateY(.35em); opacity: 0; }
.ep-sw > span { transition: transform var(--ep-dur-l) var(--ep-ease-out), opacity var(--ep-dur-l) var(--ep-ease-out); }
.ep-inkwipe { display: none !important; }
