/* ════════════════════════════════════════════════════════════════════════ */
/* OmniSentient — Marketing Animation System (R1 — shared foundation)        */
/*                                                                           */
/* Design tokens + 7 reusable interactive primitives shared across every     */
/* marketing page. Pure CSS + vanilla JS — no framework, no library.         */
/* GPU-only transforms. Respects prefers-reduced-motion globally.            */
/* ════════════════════════════════════════════════════════════════════════ */

:root {
    /* Easing curves — same rhythm everywhere */
    --m-ease:        cubic-bezier(0.16, 1, 0.3, 1);
    --m-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --m-ease-in:     cubic-bezier(0.7, 0, 0.84, 0);

    /* Durations */
    --m-fast:  150ms;
    --m-base:  300ms;
    --m-slow:  600ms;
    --m-pulse: 2400ms;

    /* Signature colors — reuse the existing brand palette */
    --m-violet: #c4b5fd;
    --m-cyan:   #67e8f9;
    --m-glow-violet: rgba(124, 58, 237, 0.18);
    --m-glow-cyan:   rgba(6, 182, 212, 0.14);
}

/* ────────────────────────────────────────────────────────────── */
/* (A) Cursor-glow blob — page-level soft gradient follower       */
/* ────────────────────────────────────────────────────────────── */
.fx-cursor-glow {
    position: fixed;
    top: 0; left: 0;
    width: 520px; height: 520px;
    margin-left: -260px; margin-top: -260px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        var(--m-glow-violet) 0%,
        var(--m-glow-cyan) 35%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: opacity 600ms var(--m-ease);
    mix-blend-mode: screen;
    filter: blur(8px);
    will-change: transform, opacity;
}
.fx-cursor-glow.is-active { opacity: 1; }
.fx-cursor-glow.is-boost  { opacity: 1.4; }

/* ────────────────────────────────────────────────────────────── */
/* (B) Magnetic CTA — JS sets transform; we only declare polish    */
/* ────────────────────────────────────────────────────────────── */
[data-fx-magnetic] {
    will-change: transform;
    transition: transform 320ms var(--m-ease);
    position: relative;
}
[data-fx-magnetic].is-snapped {
    transition: transform 80ms var(--m-ease);
}
/* Optional scanline sweep — opt in with data-fx-sweep on the same el */
[data-fx-magnetic][data-fx-sweep] {
    overflow: hidden;  /* clip the sweep pseudo to the element's bounds */
}
[data-fx-magnetic][data-fx-sweep]::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        110deg,
        transparent 30%,
        rgba(196, 181, 253, 0.22) 50%,
        transparent 70%
    );
    transform: translateX(-110%);
    transition: transform 720ms var(--m-ease);
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 1;
}
[data-fx-magnetic][data-fx-sweep]:hover::after {
    transform: translateX(110%);
}

/* ────────────────────────────────────────────────────────────── */
/* (C) Tilt card — JS computes rotateX/rotateY, we set perspective */
/* ────────────────────────────────────────────────────────────── */
[data-fx-tilt] {
    transform-style: preserve-3d;
    transition: transform 480ms var(--m-ease);
    will-change: transform;
}
[data-fx-tilt].is-tilting {
    transition: transform 80ms linear;
}
[data-fx-tilt] > * {
    transform: translateZ(0);
}

/* ────────────────────────────────────────────────────────────── */
/* (D) Streaming log tail — terminal-feel rolling log              */
/* ────────────────────────────────────────────────────────────── */
.fx-log-tail {
    position: relative;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(203, 213, 225, 0.86);
    background: linear-gradient(180deg, rgba(8, 14, 30, 0.72), rgba(20, 14, 38, 0.62));
    border: 1px solid rgba(196, 181, 253, 0.14);
    border-radius: 12px;
    padding: 14px 18px;
    overflow: hidden;
    max-height: 220px;
    mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 100%);
}
.fx-log-tail::before {
    content: '';
    position: absolute;
    top: 8px; right: 12px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
    animation: fxLogPulse var(--m-pulse) ease-in-out infinite;
}
.fx-log-tail-line {
    display: block;
    opacity: 0;
    transform: translateY(-6px);
    animation: fxLogIn 360ms var(--m-ease) forwards;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fx-log-tail-line .ts   { color: rgba(148, 163, 184, 0.62); margin-right: 8px; }
.fx-log-tail-line .lv-i { color: #67e8f9; }
.fx-log-tail-line .lv-w { color: #f59e0b; }
.fx-log-tail-line .lv-e { color: #ef4444; }
.fx-log-tail-line .lv-s { color: #22c55e; }
.fx-log-tail-line .kv   { color: var(--m-violet); }
@keyframes fxLogIn  { to { opacity: 1; transform: translateY(0); } }
@keyframes fxLogPulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: 0.4; transform: scale(0.8); }
}

/* ────────────────────────────────────────────────────────────── */
/* (E) Scroll-pinned reveal — sticky scene with progress staging   */
/* ────────────────────────────────────────────────────────────── */
[data-fx-pin] {
    position: relative;
}
[data-fx-pin] > .fx-pin-track {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
[data-fx-pin-stage] {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 420ms var(--m-ease);
    pointer-events: none;
}
[data-fx-pin-stage].is-active {
    opacity: 1;
    pointer-events: auto;
}

/* ────────────────────────────────────────────────────────────── */
/* (F) Number counter — JS handles tweening                        */
/* ────────────────────────────────────────────────────────────── */
[data-fx-counter] {
    font-variant-numeric: tabular-nums;
    will-change: contents;
}

/* ────────────────────────────────────────────────────────────── */
/* (G) Kinetic eyebrow — letter-by-letter reveal                   */
/* ────────────────────────────────────────────────────────────── */
[data-fx-kinetic] {
    display: inline-block;
}
[data-fx-kinetic] .fx-kchar {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.45em);
    transition: opacity 480ms var(--m-ease), transform 480ms var(--m-ease);
}
[data-fx-kinetic] .fx-kchar.fx-kspace {
    width: 0.32em;
}
[data-fx-kinetic].is-visible .fx-kchar {
    opacity: 1;
    transform: translateY(0);
}

/* ────────────────────────────────────────────────────────────── */
/* Magnetic + tilt: hide on touch / coarse pointer                  */
/* ────────────────────────────────────────────────────────────── */
@media (hover: none), (pointer: coarse) {
    .fx-cursor-glow { display: none; }
    [data-fx-magnetic],
    [data-fx-tilt] {
        transform: none !important;
    }
}

/* ────────────────────────────────────────────────────────────── */
/* Reduced motion — disable everything that moves                   */
/* ────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .fx-cursor-glow { display: none; }
    [data-fx-magnetic],
    [data-fx-tilt],
    .fx-log-tail-line,
    [data-fx-kinetic] .fx-kchar {
        transform: none !important;
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
    }
    .fx-log-tail::before { animation: none; }
}
