/* ------------------------------------------------------------------
   Hero
   --hero-p   0 → 1 as the hero scrolls out (set by index.js)
   --tilt-x/y pointer parallax on the device render (set by index.js)
   ------------------------------------------------------------------ */

.hero {
    --hero-p: 0;
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--nav-h) + 3rem) 9% 6rem;
    overflow: hidden;
    background: radial-gradient(
            ellipse 80% 70% at 70% 45%,
            #16171c 0%,
            #0b0b0d 45%,
            #000 80%
        ),
        #000;
    color: #fff;
}

/* fade into the black features section */
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 22vh;
    background: linear-gradient(to bottom, transparent, #000);
    z-index: -1;
    pointer-events: none;
}

/* ---------- background layers ---------- */
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: calc(1 - var(--hero-p) * 0.9);
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(
            rgba(255, 255, 255, 0.045) 1px,
            transparent 1px
        ),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 64px 64px;
    background-position: center;
    -webkit-mask-image: radial-gradient(
        ellipse 60% 55% at 68% 48%,
        #000 10%,
        transparent 72%
    );
    mask-image: radial-gradient(
        ellipse 60% 55% at 68% 48%,
        #000 10%,
        transparent 72%
    );
}

.hero-glow {
    position: absolute;
    top: 48%;
    left: 70%;
    width: 62vmax;
    height: 62vmax;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(185, 195, 235, 0.22) 0%,
        rgba(120, 130, 175, 0.1) 30%,
        transparent 62%
    );
}

.hero-rings,
.hero-sweep {
    position: absolute;
    top: 48%;
    left: 70%;
    width: 78vmin;
    height: 78vmin;
    margin: -39vmin 0 0 -39vmin;
    border-radius: 50%;
}

.hero-rings {
    background: repeating-radial-gradient(
        circle,
        transparent 0 calc(12.5% - 1px),
        rgba(255, 255, 255, 0.07) calc(12.5% - 1px) 12.5%
    );
    -webkit-mask-image: radial-gradient(circle, #000 35%, transparent 71%);
    mask-image: radial-gradient(circle, #000 35%, transparent 71%);
}

/* rotating "LiDAR" sweep */
.hero-sweep {
    background: conic-gradient(
        from 0deg,
        transparent 0deg 290deg,
        rgba(200, 210, 255, 0.02) 300deg,
        rgba(220, 228, 255, 0.16) 358deg,
        transparent 360deg
    );
    -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 71%);
    mask-image: radial-gradient(circle, #000 20%, transparent 71%);
    animation: hero-sweep 7s linear infinite;
    will-change: transform;
}

@keyframes hero-sweep {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- layout ---------- */
.hero-inner {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.6rem;
    max-width: 680px;
    transform: translateY(calc(var(--hero-p) * -60px));
    opacity: calc(1 - var(--hero-p) * 1.4);
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-family: Arkitech;
    font-size: 0.68rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}
.hero-eyebrow::before {
    content: "";
    width: 32px;
    height: 1px;
    background: currentColor;
}

.hero-title {
    font-family: Orenburg;
    font-weight: 400;
    font-size: clamp(2.6rem, 5.4vw, 5.6rem);
    line-height: 1.02;
    letter-spacing: 0.01em;
}
.hero-title span {
    display: block;
    background: linear-gradient(180deg, #fff 30%, #8d8f96 110%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero-lead {
    max-width: 34em;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: clamp(0.95rem, 1.05vw, 1.06rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.62);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 0.4rem;
}

.hero-stats {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 1rem clamp(1.2rem, 2.2vw, 2.4rem);
    width: 100%;
    margin-top: 1.2rem;
    padding-top: 1.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.hero-stats li {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.hero-stats strong {
    font-family: Orenburg;
    font-weight: 400;
    font-size: clamp(1.15rem, 1.6vw, 1.55rem);
    color: #fff;
    white-space: nowrap;
}
.hero-stats small {
    font-size: 0.6em;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.7);
}
.hero-stats span {
    font-family: Arkitech;
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    white-space: nowrap;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.48);
}

/* ---------- device visual ---------- */
.hero-visual {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 2;
    width: 100%;
}

.hero-wordmark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-50% + var(--hero-p) * -80px));
    font-family: Arkitech;
    font-size: clamp(2.4rem, 6.2vw, 7rem);
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.12);
    pointer-events: none;
    user-select: none;
}

.hero-device {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    position: relative;
    z-index: 1;
    width: 108%;
    transform: perspective(1400px) rotateY(var(--tilt-x))
        rotateX(var(--tilt-y))
        translateY(calc(var(--hero-p) * 90px))
        scale(calc(1 - var(--hero-p) * 0.08));
    transition: transform 0.5s var(--ease-out);
    will-change: transform;
}
.hero-device img {
    width: 100%;
    height: auto;
    animation: hero-float 6s ease-in-out infinite;
    will-change: transform;
}

@keyframes hero-float {
    0%,
    100% {
        transform: translateY(0) rotate(-4deg);
    }
    50% {
        transform: translateY(-14px) rotate(-3deg);
    }
}

/* interactive 3D model + LiDAR scan (heroModel.js): a full-hero canvas behind
   the copy. The photo stays as the poster until the first 3D frame is ready. */
.hero-model {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateY(calc(var(--hero-p) * 60px));
    transition: opacity 0.9s var(--ease-out);
    pointer-events: none;
}
.hero.has-model .hero-model {
    opacity: 1;
}
.hero-visual.has-model .hero-device,
.hero-visual.has-model .hero-floor,
.hero-visual.has-model .hero-wordmark {
    opacity: 0;
    transition: opacity 0.9s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .hero.has-model {
        cursor: grab;
    }
    .hero.has-model.is-dragging {
        cursor: grabbing;
    }
    .hero.has-model :is(a, button) {
        cursor: pointer;
    }
}

/* the radar backdrop (rings, sweep, grid) belongs to the photo; hide it, and stop
   its animation, while the live 3D scan is running */
.hero.has-model .hero-rings,
.hero.has-model .hero-sweep,
.hero.has-model .hero-grid {
    opacity: 0;
    animation: none;
    transition: opacity 0.9s var(--ease-out);
}

/* "Ctrl + scroll to zoom" hint, shown briefly on a plain wheel over the scene */
.hero-zoom-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    transform: translate(-50%, -50%) scale(0.96);
    padding: 0.85rem 1.3rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(8, 8, 10, 0.78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out), visibility 0s 0.25s;
}
.hero-zoom-hint.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out), visibility 0s;
}
.hero-zoom-hint kbd {
    display: inline-block;
    min-width: 1.9em;
    margin: 0 0.15em;
    padding: 0.12em 0.45em;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom-width: 2px;
    font: inherit;
    font-weight: 600;
    text-align: center;
}
@media (hover: none), (pointer: coarse) {
    .hero-zoom-hint {
        display: none;
    }
}

/* readability scrim behind the copy while the scan fills the hero */
.hero-inner {
    position: relative;
    z-index: 1;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.78) 0%,
        rgba(0, 0, 0, 0.55) 34%,
        rgba(0, 0, 0, 0) 58%
    );
    opacity: 0;
    transition: opacity 1.2s var(--ease-out);
}
.hero.has-scan::before {
    opacity: 1;
}
@media (max-width: 880px) {
    .hero::before {
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0) 24%,
            rgba(0, 0, 0, 0.72) 38%,
            rgba(0, 0, 0, 0.82) 100%
        );
    }
}

/* let our two-finger pinch zoom the scene instead of the page; one finger scrolls */
.hero.has-scan {
    touch-action: pan-y;
}

/* soft contact shadow that breathes with the float */
.hero-floor {
    position: absolute;
    left: 50%;
    bottom: 9%;
    width: 55%;
    height: 9%;
    margin-left: -27.5%;
    border-radius: 50%;
    background: radial-gradient(
        closest-side,
        rgba(170, 180, 230, 0.2),
        transparent
    );
    animation: hero-floor 6s ease-in-out infinite;
}

@keyframes hero-floor {
    0%,
    100% {
        transform: scaleX(1);
        opacity: 1;
    }
    50% {
        transform: scaleX(0.86);
        opacity: 0.7;
    }
}

/* ---------- entrance (starts once the loader is gone) ---------- */
.hero-in {
    opacity: 0;
    animation: hero-in 1s var(--ease-out) both;
    animation-delay: calc(var(--d, 0) * 110ms + 100ms);
    animation-play-state: paused;
}
.is-ready .hero-in {
    animation-play-state: running;
}

@keyframes hero-in {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .hero {
        padding-left: 5%;
        padding-right: 5%;
    }
    .hero-stats {
        grid-template-columns: repeat(2, auto);
    }
    .hero-eyebrow {
        font-size: 0.58rem;
        letter-spacing: 0.16em;
    }
}

@media (max-width: 880px) {
    .hero {
        padding: calc(var(--nav-h) + 1.5rem) 6% 5.5rem;
        justify-content: flex-start;
        background: radial-gradient(
                ellipse 110% 60% at 50% 62%,
                #16171c 0%,
                #0b0b0d 45%,
                #000 80%
            ),
            #000;
    }
    .hero-inner {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .hero-copy {
        align-items: center;
        text-align: center;
        margin: 0 auto;
        gap: 1.2rem;
    }
    .hero-eyebrow {
        font-size: 0.56rem;
        letter-spacing: 0.14em;
    }
    .hero-wordmark {
        font-size: 13vw;
    }
    .hero-eyebrow::before {
        display: none;
    }
    .hero-title {
        font-size: clamp(2.3rem, 11vw, 3.4rem);
    }
    .hero-actions {
        justify-content: center;
    }
    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        gap: 1.2rem 1rem;
        margin-top: 0.6rem;
        padding-top: 1.2rem;
    }
    .hero-stats li {
        align-items: center;
    }
    .hero-visual {
        order: -1;
        max-width: 520px;
        margin: 0 auto -1rem;
    }
    .hero-glow,
    .hero-rings,
    .hero-sweep {
        top: 24%;
        left: 50%;
    }
    .hero-grid {
        -webkit-mask-image: radial-gradient(
            ellipse 80% 40% at 50% 24%,
            #000 10%,
            transparent 72%
        );
        mask-image: radial-gradient(
            ellipse 80% 40% at 50% 24%,
            #000 10%,
            transparent 72%
        );
    }
    .hero-device {
        width: 100%;
    }

}

@media (max-width: 380px) {
    .hero-actions .btn-2 {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-sweep,
    .hero-device img,
    .hero-floor {
        animation: none;
    }
    .hero-in {
        animation: none;
        opacity: 1;
    }
    .hero-device {
        transition: none;
    }
}
