/* Motion layer: page transitions, scroll reveals, cursor light, tilt and the
   3D hero canvases. Everything here is decoration; with reduced motion the
   page renders exactly as site.css + pages.css describe. */

/* Cross-page transitions (Chromium, Safari 18+). The nav and the active tab
   pill keep their identity, so the pill glides to the new tab while the
   page content dissolves underneath. */
@view-transition {
    navigation: auto;
}

.nav {
    view-transition-name: site-nav;
}

.tab-pill {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 122, 69, 0.9), rgba(168, 85, 247, 0.9));
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
    view-transition-name: tab-pill;
}

.page-tabs a {
    position: relative;
    isolation: isolate;
}

.page-tabs a[aria-current="page"].has-pill {
    background: none;
}

::view-transition-old(root) {
    animation: fx-page-out 320ms cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
    animation: fx-page-in 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

::view-transition-group(tab-pill) {
    animation-duration: 520ms;
    animation-timing-function: cubic-bezier(0.34, 1.3, 0.5, 1);
}

@keyframes fx-page-out {
    to { opacity: 0; transform: translateY(-14px) scale(0.985); filter: blur(6px); }
}

@keyframes fx-page-in {
    from { opacity: 0; transform: translateY(22px) scale(1.01); filter: blur(8px); }
}

/* Scroll progress */
.fx-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: 2px;
    transform-origin: 0 50%;
    transform: scaleX(var(--fx-progress, 0));
    background: linear-gradient(90deg, var(--orange), #a855f7, var(--cyan));
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.7);
    pointer-events: none;
}

/* Soft light that follows the cursor across the whole page */
.fx-glow {
    position: fixed;
    left: 0;
    top: 0;
    z-index: -1;
    width: 620px;
    height: 620px;
    margin: -310px 0 0 -310px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.16), rgba(255, 122, 69, 0.05) 40%, transparent 68%);
    pointer-events: none;
    transform: translate3d(var(--gx, -999px), var(--gy, -999px), 0);
    will-change: transform;
}

/* Scroll reveals. `translate` composes with any transform a card already
   has (the media cards are rotated), so nothing gets flattened. */
.fx-ready [data-reveal] {
    opacity: 0;
    translate: 0 26px;
    filter: blur(6px);
    transition:
        opacity 900ms cubic-bezier(0.16, 1, 0.3, 1),
        translate 900ms cubic-bezier(0.16, 1, 0.3, 1),
        filter 900ms cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--d, 0ms);
}

.fx-ready [data-reveal].is-in {
    opacity: 1;
    translate: 0 0;
    filter: none;
}

/* Headline words rise out of a mask */
.fx-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
}

.fx-word > span {
    display: inline-block;
    transform: translateY(105%);
    animation: fx-rise 1100ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--d, 0ms);
}

@keyframes fx-rise {
    to { transform: none; }
}

/* Cursor spotlight + border light on cards */
.fx-spot-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
    background:
        radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(167, 139, 250, 0.13), transparent 45%);
}

.fx-spot-layer::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 122, 69, 0.85), rgba(167, 139, 250, 0.5) 40%, transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* The card is its own stacking context, so a z-index of -1 paints the light
   above the card's background but beneath all of its content. */
.fx-spot {
    isolation: isolate;
}

.fx-spot > .fx-spot-layer {
    z-index: -1;
}

.fx-spot:hover > .fx-spot-layer {
    opacity: 1;
}

/* 3D tilt */
[data-tilt] {
    transform-style: preserve-3d;
    transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

[data-tilt].is-tilting {
    transition: transform 120ms linear;
}

.product-shot[data-tilt] .phone {
    transform: translateZ(60px);
}

.product-shot[data-tilt] .browser {
    transform: translateZ(0);
}

[data-tilt] .fx-sheen {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms ease;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.14) var(--sheen, 50%), transparent 70%);
    mix-blend-mode: soft-light;
}

[data-tilt].is-tilting .fx-sheen {
    opacity: 1;
}

/* Magnetic buttons */
.btn.fx-magnet {
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1), background 180ms ease, border-color 180ms ease;
}

.btn.fx-magnet.is-pulled {
    transition: transform 140ms linear, background 180ms ease, border-color 180ms ease;
}

/* Primary buttons get a light sweep */
.btn-primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
    transform: translateX(-120%);
    animation: fx-sweep 4.2s cubic-bezier(0.6, 0, 0.2, 1) infinite 1.4s;
}

@keyframes fx-sweep {
    0%, 55% { transform: translateX(-120%); }
    85%, 100% { transform: translateX(120%); }
}

/* 3D hero canvases */
.hero,
.page-hero {
    position: relative;
    isolation: isolate;
}

.fx-3d {
    position: absolute;
    z-index: -1;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1600ms ease;
}

.fx-3d.is-live {
    opacity: var(--fx-3d-opacity, 1);
}

.fx-3d canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.fx-3d[data-shape="sphere"] {
    top: -90px;
    bottom: -40px;
    -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
    mask-image: linear-gradient(180deg, #000 70%, transparent);
}

.fx-3d[data-shape="helix"],
.fx-3d[data-shape="wave"] {
    top: -90px;
    bottom: -60px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 88%, transparent);
    mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 88%, transparent);
}

.fx-3d[data-shape="orbit"] {
    top: -90px;
    bottom: 0;
    -webkit-mask-image: radial-gradient(ellipse 45% 100% at 82% 50%, #000 50%, transparent 90%);
    mask-image: radial-gradient(ellipse 45% 100% at 82% 50%, #000 50%, transparent 90%);
}

/* Kicker text decodes when it scrolls in */
.fx-decode {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .fx-3d {
        --fx-3d-opacity: 0.55;
    }

    .fx-glow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root),
    ::view-transition-group(tab-pill) {
        animation: none;
    }

    .btn-primary::after {
        animation: none;
    }
}

/* 3D scenes placed in a closing booking section */
.contact,
.cta-band-3d {
    position: relative;
    isolation: isolate;
}

.fx-3d[data-place="cta"] {
    top: -40px;
    bottom: -40px;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%, #000 85%, transparent);
    mask-image: linear-gradient(180deg, transparent, #000 35%, #000 85%, transparent);
}

.cta-band-3d {
    overflow: hidden;
}

.cta-band-3d .fx-3d[data-place="cta"] {
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    transform: none;
}

/* The page background's circuit lines fight the 3D scenes. Behind every
   scene, a soft veil of the page colour quiets them so only one thing moves. */
.page-hero:has(.fx-3d)::before,
.contact:has(.fx-3d)::before {
    content: "";
    position: absolute;
    z-index: -2;
    top: -90px;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    pointer-events: none;
    background: radial-gradient(ellipse 50% 75% at 78% 45%, rgba(4, 3, 11, 0.94), rgba(4, 3, 11, 0.6) 55%, transparent 80%);
}

.contact:has(.fx-3d)::before {
    top: 0;
    background: radial-gradient(ellipse 70% 70% at 50% 85%, rgba(4, 3, 11, 0.95), rgba(4, 3, 11, 0.6) 55%, transparent 85%);
}
