/* ============================================================
   landing.css — "Vital Signs" scroll experience for index.html
   ------------------------------------------------------------
   Loaded ONLY by index.html. Every rule is scoped to
   body.landing-page (or lfx-* classes that exist only there),
   per the global-CSS gotcha: styles.css is shared site-wide.

   JS-dependent hidden states are gated behind html.lfx-on
   (added by landing-fx.js at parse time) so the page remains
   fully visible if JS fails or is disabled.

   Reduced motion: the global kill-switch in styles.css already
   collapses all animations/transitions; landing-fx.js also
   skips its rAF loops, so nothing here needs extra guards.
   ============================================================ */

/* ------------------------------------------------------------
   1. Aurora atmosphere — fixed, behind everything.
   Three blurred brand-blue blobs drift on slow keyframe loops;
   JS adds scroll parallax (--lfx-sp) and a gradual hue rotation
   (--lfx-hue) so the page atmosphere evolves blue → cyan →
   indigo on the way down. Grain overlay keeps it filmic.
   ------------------------------------------------------------ */
.landing-page {
    --lfx-hue: 0;
    --lfx-sp: 0;
}

.landing-page .lfx-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    filter: hue-rotate(calc(var(--lfx-hue) * 1deg));
    transform: translate3d(0, calc(var(--lfx-sp) * 1px), 0);
}

.landing-page .lfx-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    will-change: transform;
}

.landing-page .lfx-blob-1 {
    width: 55vw;
    height: 55vw;
    top: -18vw;
    left: -12vw;
    background: radial-gradient(circle at 35% 35%, rgba(29, 78, 216, 0.55), rgba(29, 78, 216, 0) 65%);
    animation: lfxDrift1 34s ease-in-out infinite alternate;
}

.landing-page .lfx-blob-2 {
    width: 44vw;
    height: 44vw;
    top: 28vh;
    right: -16vw;
    background: radial-gradient(circle at 60% 40%, rgba(34, 211, 238, 0.34), rgba(34, 211, 238, 0) 65%);
    animation: lfxDrift2 41s ease-in-out infinite alternate;
}

.landing-page .lfx-blob-3 {
    width: 50vw;
    height: 50vw;
    bottom: -22vw;
    left: 22vw;
    background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.4), rgba(59, 130, 246, 0) 65%);
    animation: lfxDrift3 47s ease-in-out infinite alternate;
}

@keyframes lfxDrift1 {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(9vw, 7vh, 0) scale(1.18); }
}

@keyframes lfxDrift2 {
    from { transform: translate3d(0, 0, 0) scale(1.1); }
    to   { transform: translate3d(-8vw, -9vh, 0) scale(0.92); }
}

@keyframes lfxDrift3 {
    from { transform: translate3d(0, 0, 0) scale(0.95); }
    to   { transform: translate3d(-10vw, -6vh, 0) scale(1.15); }
}

/* Film grain: inline SVG turbulence, no network request */
.landing-page .lfx-grain {
    position: absolute;
    inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
    opacity: 0.05;
    mix-blend-mode: overlay;
}

/* Light theme: softer, pastel atmosphere */
[data-theme="light"].landing-page .lfx-blob { opacity: 0.3; }
[data-theme="light"].landing-page .lfx-grain { opacity: 0.03; }

/* Content rides above the aurora */
.landing-page .main,
.landing-page .footer {
    position: relative;
    z-index: 1;
}

/* Let the aurora glow through the solid section panels (glass feel).
   color-mix has broad support; solid fallback declared first. */
.landing-page .features,
.landing-page .how-it-works {
    background: var(--bg-secondary);
    background: color-mix(in srgb, var(--bg-secondary) 76%, transparent);
}

.landing-page .footer {
    background: var(--bg-primary);
    background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
}

/* ------------------------------------------------------------
   2. Scroll progress comet — fixed top bar above the banner.
   JS drives --lfx-p (0..1); the glowing tip reads as telemetry.
   ------------------------------------------------------------ */
.landing-page .lfx-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1100;
    pointer-events: none;
}

.landing-page .lfx-progress-bar {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #1d4ed8, #3b82f6 55%, #22d3ee);
    transform: scaleX(var(--lfx-p, 0));
    transform-origin: left center;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.55);
}

.landing-page .lfx-progress-dot {
    position: absolute;
    top: 50%;
    left: calc(var(--lfx-p, 0) * 100%);
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: #7dd3fc;
    box-shadow: 0 0 10px 3px rgba(56, 189, 248, 0.8);
    opacity: var(--lfx-po, 0);
    transition: opacity 0.3s ease;
}

/* ------------------------------------------------------------
   3. Hero — word-by-word title rise, staggered supporting cast,
   particle canvas behind, telemetry-style dashboard preview.
   ------------------------------------------------------------ */
.landing-page .hero {
    position: relative;
    overflow: hidden;
}

.landing-page .lfx-hero-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.landing-page .hero .container {
    position: relative;
    z-index: 1;
}

/* Container fade is replaced by per-element choreography */
.landing-page .hero-content { animation: none; }

/* Word reveal (spans injected by JS; without JS the title simply shows) */
.landing-page .lfx-w {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.9em) rotate(3deg);
    animation: lfxWord 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 75ms + 0.12s);
    transform-origin: 0 100%;
}

@keyframes lfxWord {
    to { opacity: 1; transform: translateY(0) rotate(0); }
}

.landing-page .hero-subtitle,
.landing-page .hero-actions,
.landing-page .hero-microcopy,
.landing-page .hero-trust {
    animation: lfxRise 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-page .hero-subtitle  { animation-delay: 0.5s; }
.landing-page .hero-actions   { animation-delay: 0.66s; }
.landing-page .hero-microcopy { animation-delay: 0.8s; }
.landing-page .hero-trust     { animation-delay: 0.94s; }

@keyframes lfxRise {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Primary CTA: breathing glow ring + periodic sheen sweep */
.landing-page .hero-actions .btn-primary {
    position: relative;
    overflow: hidden;
    animation: lfxBreath 3.4s ease-in-out 1.8s infinite;
}

@keyframes lfxBreath {
    0%, 100% { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3), 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50%      { box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5), 0 0 0 12px rgba(59, 130, 246, 0); }
}

.landing-page .hero-actions .btn-primary::after,
.landing-page .lfx-dock-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -130%;
    width: 55%;
    height: 100%;
    transform: skewX(-22deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: lfxSheen 4.6s ease-in-out 2.4s infinite;
    pointer-events: none;
}

@keyframes lfxSheen {
    0%   { left: -130%; }
    16%  { left: 160%; }
    100% { left: 160%; }
}

/* Dashboard preview: 3D tilt stage (JS drives the transform) */
.landing-page .hero-visual {
    perspective: 1100px;
    animation: fadeInUp 1s ease-out 0.3s both, lfxBob 9s ease-in-out 2.4s infinite;
}

@keyframes lfxBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}

.landing-page .dashboard-preview {
    transform-style: preserve-3d;
    will-change: transform;
    border-color: rgba(96, 165, 250, 0.28);
    box-shadow:
        0 20px 40px var(--shadow),
        0 0 60px rgba(59, 130, 246, 0.12);
}

[data-theme="light"].landing-page .dashboard-preview {
    border-color: rgba(59, 130, 246, 0.25);
}

/* Telemetry numerals shouldn't jiggle while counting up */
.landing-page .progress-text {
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   4. EKG dividers — heartbeat traces that draw on scroll.
   JS sets stroke-dashoffset + positions the leading dot.
   ------------------------------------------------------------ */
.landing-page .lfx-ekg {
    position: relative;
    z-index: 1;
    height: 90px;
    /* pulled up into the padding of the section above, so the trace
       runs close beneath its text */
    margin: -52px 0 -10px;
    pointer-events: none;
    /* faint monitor graph paper */
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
    mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
}

.landing-page .lfx-ekg svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Base geometry path: invisible — it exists only as the measuring track
   for the pulse (getPointAtLength). The monitor is dark at rest; only a
   fired pulse lights it up. */
.landing-page .lfx-ekg-path {
    fill: none;
    opacity: 0;
}

/* Pulse trace: cloned by JS and stroked with a head-tracking gradient —
   brightly glowing leading edge, tail aging out over ~1s behind it.
   No stroke color here: the JS-built gradient attribute must apply. */
.landing-page .lfx-ekg-pulse {
    stroke-width: 2.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    opacity: 0;
    filter: drop-shadow(0 0 3px rgba(186, 230, 253, 1))
            drop-shadow(0 0 10px rgba(96, 165, 250, 0.95))
            drop-shadow(0 0 26px rgba(59, 130, 246, 0.7));
}

.landing-page .lfx-ekg-dot {
    fill: #bae6fd;
    filter: drop-shadow(0 0 6px rgba(186, 230, 253, 1))
            drop-shadow(0 0 18px rgba(96, 165, 250, 0.95));
    opacity: 0;
}

[data-theme="light"].landing-page .lfx-ekg-pulse {
    filter: drop-shadow(0 0 3px rgba(59, 130, 246, 0.8))
            drop-shadow(0 0 12px rgba(59, 130, 246, 0.5));
}

[data-theme="light"].landing-page .lfx-ekg-dot {
    fill: #2563eb;
    filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.8));
}

/* ------------------------------------------------------------
   5. Scroll reveals — hidden ONLY when JS announced itself
   via html.lfx-on, so no-JS users see everything.
   ------------------------------------------------------------ */
.lfx-on .landing-page [data-lfx-reveal] {
    opacity: 0;
    transform: translateY(34px) scale(0.985);
    transition:
        opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--lfx-d, 0) * 90ms);
}

.lfx-on .landing-page [data-lfx-reveal="left"]  { transform: translateX(-40px); }
.lfx-on .landing-page [data-lfx-reveal="right"] { transform: translateX(40px); }

.lfx-on .landing-page .lfx-in[data-lfx-reveal],
.lfx-on .landing-page .lfx-in[data-lfx-reveal="left"],
.lfx-on .landing-page .lfx-in[data-lfx-reveal="right"] {
    opacity: 1;
    transform: none;
}

/* ------------------------------------------------------------
   6. Section titles — scroll-linked shimmer sweep.
   JS drives --lfx-sw (0..1); default 0 renders plain text color.
   ------------------------------------------------------------ */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .lfx-on .landing-page .section-title {
        /* The glyphs are ALWAYS painted by this solid fill, so the title
           stays legible even when the clipped-gradient shimmer below fails
           to paint — forced-colors/high-contrast mode, disabled GPU
           compositing (corporate policy / VDI), or extensions that strip
           background-images. The gradient carries only the moving highlight
           band over a transparent base; at rest it adds nothing and the
           title reads as plain --text-primary. */
        -webkit-text-fill-color: var(--text-primary);
        background-image: linear-gradient(100deg,
            transparent 0%, transparent 38%,
            #60a5fa 46%, #93c5fd 50%, #22d3ee 54%,
            transparent 62%, transparent 100%);
        background-size: 300% 100%;
        background-position: calc((1 - var(--lfx-sw, 0)) * 100%) 0;
        -webkit-background-clip: text;
        background-clip: text;
    }

    /* deeper sweep hues for light backgrounds */
    .lfx-on [data-theme="light"].landing-page .section-title {
        background-image: linear-gradient(100deg,
            transparent 0%, transparent 38%,
            #2563eb 46%, #3b82f6 50%, #0891b2 54%,
            transparent 62%, transparent 100%);
    }
}

/* Forced colors / high contrast: drop the decorative shimmer entirely and
   let the system paint the heading with a guaranteed-legible color. */
@media (forced-colors: active) {
    .lfx-on .landing-page .section-title {
        background: none;
        -webkit-text-fill-color: currentColor;
    }
}

/* ------------------------------------------------------------
   7. Feature cards — cursor spotlight + JS micro-tilt.
   (script.js's generic hover/reveal handlers are disabled on
   this page via the window.__lfx guard.)
   ------------------------------------------------------------ */
.landing-page .feature-card {
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.landing-page .feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
        rgba(59, 130, 246, 0.14), transparent 65%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.landing-page .feature-card:hover::after { opacity: 1; }

/* while the cursor is steering the tilt, track it tightly;
   on leave the class drops and the 0.5s spring returns the card */
.landing-page .feature-card.lfx-tilting {
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.1s linear;
}

.landing-page .feature-card:hover {
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow:
        0 14px 34px var(--shadow),
        0 0 30px rgba(59, 130, 246, 0.12);
}

/* ------------------------------------------------------------
   8. CTA — rotating conic border ring + intensified glow.
   ------------------------------------------------------------ */
.landing-page .cta-content {
    background: var(--bg-secondary);
    background: color-mix(in srgb, var(--bg-secondary) 86%, transparent);
}

.landing-page .lfx-cta-ring {
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 1.5px;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    overflow: hidden;
    pointer-events: none;
}

.landing-page .lfx-cta-ring::before {
    content: '';
    position: absolute;
    inset: -150%;
    background: conic-gradient(
        transparent 0deg 240deg,
        rgba(59, 130, 246, 0.1) 260deg,
        rgba(96, 165, 250, 0.95) 300deg,
        rgba(34, 211, 238, 0.9) 322deg,
        transparent 345deg);
    animation: lfxSpin 7s linear infinite;
}

@keyframes lfxSpin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   9. Conversion dock — glassy pill that slides in after hero.
   Hidden state uses visibility so it can't trap focus.
   ------------------------------------------------------------ */
.landing-page .lfx-dock {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    z-index: 950;
    transform: translate(-50%, calc(100% + 2rem));
    visibility: hidden;
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.55s;
}

.landing-page .lfx-dock.lfx-dock-show {
    transform: translate(-50%, 0);
    visibility: visible;
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s;
}

.landing-page .lfx-dock-inner {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.6rem 0.6rem 0.6rem 1.1rem;
    border-radius: 999px;
    background: rgba(15, 15, 15, 0.74);
    border: 1px solid rgba(96, 165, 250, 0.3);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.45),
        0 0 28px rgba(59, 130, 246, 0.14);
}

[data-theme="light"].landing-page .lfx-dock-inner {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.18),
        0 0 28px rgba(59, 130, 246, 0.12);
}

.landing-page .lfx-dock-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.landing-page .lfx-dock-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    white-space: nowrap;
}

.landing-page .lfx-dock-text strong {
    font-size: 0.86rem;
    color: var(--text-primary);
}

.landing-page .lfx-dock-text span {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.landing-page .lfx-dock-btn {
    position: relative;
    overflow: hidden;
    padding: 0.65rem 1.4rem;
    font-size: 0.92rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Lift the floating feedback button clear of the dock */
.landing-page.lfx-dock-visible .feedback-btn-container {
    bottom: calc(2rem + 66px);
}

/* ------------------------------------------------------------
   10. Responsive
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    .landing-page .lfx-ekg {
        height: 64px;
        margin: -34px 0 -8px;
    }

    .landing-page .lfx-dock {
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        transform: translate(0, calc(100% + 3rem));
    }

    .landing-page .lfx-dock.lfx-dock-show {
        transform: translate(0, 0);
    }

    .landing-page .lfx-dock-inner {
        justify-content: space-between;
        border-radius: 1rem;
    }

    .landing-page .lfx-dock-logo { display: none; }

    .landing-page.lfx-dock-visible .feedback-btn-container {
        bottom: calc(1rem + 78px);
    }

    /* blur is expensive on weak GPUs; lighten the load */
    .landing-page .lfx-blob { filter: blur(60px); }
}

/* ------------------------------------------------------------
   11. Login page (body.landing-page.login-page)
   Shares the aurora + EKG system; adds glassy card treatment,
   an ambient heartbeat strip under the card, and CTA energy
   on the submit button. Index-only selectors above simply
   don't match anything here.
   ------------------------------------------------------------ */
.login-page .login-main {
    position: relative;
    z-index: 1;
    flex-direction: column;
}

/* NOTE: no backdrop-filter here — the forgot-password modal is a
   position:fixed descendant, and a backdrop-filter ancestor would
   re-anchor it to this box instead of the viewport. The aurora blobs
   are pre-blurred, so translucency alone reads as glass. */
.login-page .login-container {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
    border-color: rgba(96, 165, 250, 0.24);
    box-shadow:
        0 20px 50px var(--shadow),
        0 0 60px rgba(59, 130, 246, 0.1);
}

[data-theme="light"].login-page .login-container {
    border-color: rgba(59, 130, 246, 0.22);
}

/* ambient heartbeat strip below the card (auto-fires every ~3s) */
.login-page .lfx-ekg-login {
    width: 100%;
    margin: 1.25rem 0 -1rem;
}

/* submit button: breathing glow + periodic sheen (same as hero CTA) */
.login-page .submit-btn {
    position: relative;
    overflow: hidden;
    animation: lfxBreath 3.4s ease-in-out 1.2s infinite;
}

.login-page .submit-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -130%;
    width: 55%;
    height: 100%;
    transform: skewX(-22deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: lfxSheen 4.6s ease-in-out 2.4s infinite;
    pointer-events: none;
}
