/* VRSecLabs: motion layer. Loaded after css/revamp.css on every public page; driven by js/motion.js.
   Palette is untouched: every colour here comes from the existing tokens (--bg-void, --accent, ...).
   Feel: wide gutters, oversized tight display type, word-mask headline reveals, hairlines that draw
   themselves, 40px fade-ups on power3 easing, a header that tucks away while reading, and a curtain
   wipe between pages. Remove the motion.css/motion.js links to fall back to the previous behaviour. */

:root {
    /* GSAP power3.out / power3.inOut, as cubic-beziers */
    --ease-p3out: cubic-bezier(0.215, 0.61, 0.355, 1);
    --ease-p3io: cubic-bezier(0.645, 0.045, 0.355, 1);
    --gutter: clamp(1.25rem, 5.55vw, 6rem);
}

/* ── Wide, fluid gutters instead of a fixed 1280px column ── */
.container {
    max-width: 1760px;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

/* ── Oversized, tight display type ── */
h2 {
    font-size: clamp(2.1rem, 4.6vw, 4.75rem);
    line-height: 1.04;
    letter-spacing: -0.035em;
}

.hx-head {
    max-width: 1100px;
}

.hx-head p {
    max-width: 56ch;
}

/* ── Header tucks away while reading down, returns on scroll up ── */
header {
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.55s var(--ease-p3out);
}

header.is-hidden {
    transform: translateY(-100%);
}

/* ── Links: 1px underline sweeps in from the left ── */
.footer-col ul li a,
.legal-links a,
.hx-mail a {
    position: relative;
    display: inline-block;
}

.footer-col ul li a::after,
.legal-links a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s ease-out;
}

.footer-col ul li a:hover::after,
.legal-links a:hover::after {
    transform: scaleX(1);
}

/* ── Footer wordmark (injected by motion.js) ──
   Sized in container units so the word spans the footer column exactly at any width. */
footer>.container {
    container-type: inline-size;
}

.fx-wordmark {
    display: block;
    margin: clamp(1.5rem, 4vw, 3.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
    font-family: var(--font-header);
    font-size: 13.4vw;
    font-size: 17.3cqw;
    font-weight: 600;
    line-height: 0.82;
    letter-spacing: -0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(var(--ink-rgb, 244, 245, 247), 0.07);
    user-select: none;
    pointer-events: none;
    overflow: hidden;
}

.fx-wordmark i {
    font-style: normal;
    color: var(--accent);
    opacity: 0.9;
}

/* ── Section index: "002 / 008 ──────── Label" (injected by motion.js) ── */
.fx-index {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: clamp(2rem, 4.5vw, 4rem);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.fx-index b {
    font-weight: 500;
    color: var(--text-primary);
}

.fx-index-rule {
    position: relative;
    flex: 1;
    height: 1px;
    background: var(--border-strong);
}

.fx-index-rule::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}

/* ── Animated states: only when motion is welcome ── */
@media (prefers-reduced-motion: no-preference) {

    /* Word-mask headline reveal: each word rises out of its own clip box */
    .fx-w {
        display: inline-block;
        overflow: hidden;
        vertical-align: top;
        padding: 0.08em 0 0.14em;
        margin: -0.08em 0 -0.14em;
    }

    .fx-w>span {
        display: inline-block;
        transform: translate3d(0, 108%, 0);
        transition: transform 0.95s var(--ease-p3out);
        transition-delay: calc(var(--wi, 0) * 0.055s);
        will-change: transform;
    }

    .fx-words.is-in .fx-w>span {
        transform: none;
    }

    /* Generic 40px fade-up. motion.js strips these classes once the reveal ends,
       so hover transitions on the element are never slowed by the delay. */
    .fx {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
        transition: opacity 0.8s var(--ease-p3out) var(--d, 0s), transform 0.95s var(--ease-p3out) var(--d, 0s);
    }

    .fx.is-in {
        opacity: 1;
        transform: none;
    }

    /* Hairlines draw left to right */
    .fx-index-rule::after {
        transition: transform 1.4s var(--ease-p3io) 0.15s;
    }

    .fx-index.is-in .fx-index-rule::after {
        transform: scaleX(1);
    }

    .fx-index>span,
    .fx-index>b {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
        transition: opacity 0.6s var(--ease-p3out) 0.1s, transform 0.6s var(--ease-p3out) 0.1s;
    }

    .fx-index.is-in>span,
    .fx-index.is-in>b {
        opacity: 1;
        transform: none;
    }

    /* Wordmark: letters rise one after another */
    .fx-wordmark .fx-c {
        display: inline-block;
        transform: translate3d(0, 105%, 0);
        transition: transform 1.2s var(--ease-p3out);
        transition-delay: calc(var(--ci, 0) * 0.045s);
    }

    .fx-wordmark.is-in .fx-c {
        transform: none;
    }

    /* Page entrance on inner pages (home runs its own hero sequence). Opacity only:
       a transform on body would break the fixed header. */
    html:not(:has(.hx-hero)) body {
        animation: fx-page-in 0.6s ease-out backwards;
    }

    /* Curtain wipe between pages */
    .fx-wipe {
        position: fixed;
        inset: 0;
        z-index: 3000;
        pointer-events: none;
        background: var(--bg-void);
        border-top: 1px solid var(--accent);
        transform: translate3d(0, 101%, 0);
        transition: transform 0.5s var(--ease-p3io);
    }

    html.fx-leaving .fx-wipe {
        pointer-events: auto;
        transform: none;
    }

    /* Intro curtain: first home visit of a session (markup at the top of index.html body).
       Pure CSS, so it can never get stuck. Sequence: letters rise, rule draws, full form fades up,
       then the whole curtain lifts away. */
    html.fx-intro .fx-curtain {
        position: fixed;
        inset: 0;
        z-index: 3500;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        padding: 0 1.5rem;
        text-align: center;
        background: var(--bg-void);
        pointer-events: none;
        animation: fx-intro-out 0.7s var(--ease-p3io) 1.3s both;
    }

    .fx-curtain-mark {
        display: block;
        overflow: hidden;
        padding: 0.08em 0.04em 0.14em;
        font-family: var(--font-header);
        font-size: clamp(2.4rem, 9.5vw, 7.5rem);
        font-weight: 600;
        line-height: 0.95;
        letter-spacing: -0.045em;
        white-space: nowrap;
        color: var(--text-primary);
    }

    .fx-curtain-mark .c {
        display: inline-block;
        transform: translate3d(0, 112%, 0);
        animation: fx-intro-rise 0.7s var(--ease-p3out) calc(0.1s + var(--ci, 0) * 0.035s) forwards;
    }

    .fx-curtain-mark i {
        font-style: normal;
        color: var(--accent);
    }

    .fx-curtain-rule {
        display: block;
        width: min(300px, 55vw);
        height: 1px;
        background: var(--accent);
        transform-origin: left;
        animation: fx-intro-line 0.65s var(--ease-p3io) 0.3s both;
    }

    .fx-curtain-sub {
        max-width: 28em;
        font-family: var(--font-mono);
        font-size: clamp(0.62rem, 1.5vw, 0.85rem);
        font-weight: 500;
        line-height: 1.7;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        text-wrap: balance;
        color: var(--text-secondary);
        opacity: 0;
        transform: translate3d(0, 10px, 0);
        animation: fx-intro-fade 0.6s var(--ease-p3out) 0.5s forwards;
    }
}

/* Only ever shown by html.fx-intro (set in the index.html head, never under reduced motion) */
.fx-curtain {
    display: none;
}

@keyframes fx-page-in {
    from {
        opacity: 0;
    }
}

@keyframes fx-intro-line {
    from {
        transform: scaleX(0);
    }
}

@keyframes fx-intro-out {
    to {
        transform: translate3d(0, -101%, 0);
        visibility: hidden;
    }
}

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

@keyframes fx-intro-fade {
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    header,
    .fx-w>span,
    .fx {
        transition: none;
    }

    .fx-index-rule::after {
        transform: scaleX(1);
    }
}

@media (max-width: 760px) {
    .fx-wordmark {
        font-size: 14.2vw;
        font-size: 17.3cqw;
    }

    .fx-index-label {
        display: none;
    }
}
