/* ============================================================
   TickHosting — Home FX layer (landing page only)
   WebGL hero background, entrance choreography, counters and
   micro-interactions. Uses the exact same palette tokens as
   style.css (--bg, --text-main, --text-muted, emerald #10b981).
   ============================================================ */

/* --- Hero canvas layer -------------------------------------- */
.hero-main {
    overflow: hidden;
}

.hero-main > :not(.hero-fx) {
    position: relative;
    z-index: 1;
}

.hero-fx {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.hero-fx canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Key light behind the headline */
.hero-fx::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 45% at 50% 32%, rgba(255, 255, 255, 0.07), transparent 70%);
}

/* Blend the canvas into the page background top & bottom */
.hero-fx::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(5, 5, 7, 0.6), transparent 28%, transparent 62%, var(--bg) 97%);
}

/* Dot-grid retired: too technical for the Apple-like direction */
.hero-fx .hero-grid {
    display: none;
}

/* Film grain */
.hero-fx .hero-grain {
    position: absolute;
    inset: 0;
    opacity: 0.025;
    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)'/%3E%3C/svg%3E");
    background-size: 240px 240px;
}

/* CSS-only fallback when WebGL is unavailable */
.hero-fx.no-webgl {
    background:
        radial-gradient(70% 55% at 30% 20%, rgba(255, 255, 255, 0.04), transparent 60%),
        radial-gradient(55% 45% at 75% 65%, rgba(16, 185, 129, 0.05), transparent 65%);
}

/* --- Hero badge (operational status) ------------------------ */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1px;
    backdrop-filter: blur(8px);
}

.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
    animation: pulse-green 2s infinite;
}

/* --- Hero stats (unboxed, Apple-style big numbers) ----------- */
.hero-stats {
    display: flex;
    align-items: stretch;
    justify-content: center;
    margin-top: 4rem;
}

.hstat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 42px;
    position: relative;
}

.hstat + .hstat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12%;
    bottom: 12%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.hstat-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--text-main);
}

.hstat-num {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff, #b8b8bd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hstat-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.hstat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .hero-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .hstat {
        padding: 14px 10px;
    }

    .hstat + .hstat::before {
        display: none;
    }
}

/* The stats strip makes the hero taller than the old layout:
   bring the scroll indicator back into the flow so it never
   overlaps the stats on shorter viewports. */
.hero-main .scroll-indicator {
    position: static;
    margin-top: 2.6rem;
}

/* --- Primary CTA breathing glow ------------------------------ */
.btn-hero.primary {
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.12);
}

/* --- Hytale marquee: pause on hover -------------------------- */
.hytale-marquee-wrap:hover .hytale-marquee {
    animation-play-state: paused;
}

/* --- Apple-scale typography & breathing room ------------------ */
.hero-main h1 {
    font-size: clamp(3rem, 6.5vw, 5.2rem);
    letter-spacing: -2.5px;
}

.hero-main .main-sub {
    font-size: 1.25rem;
    line-height: 1.5;
}

.section-header {
    padding: 8rem 1rem 2.5rem;
}

.section-header h2 {
    font-size: clamp(2rem, 3.6vw, 3rem);
    font-weight: 700;
    letter-spacing: -1.2px;
    line-height: 1.12;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.section-header .subtitle {
    font-size: 1.15rem;
    margin-top: 4px;
}

/* --- Section eyebrows (quiet, Apple-style) -------------------- */
.section-kicker {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #10b981;
    margin-bottom: 12px;
}

/* --- Plan cards: lift on hover + "Most Popular" pill ---------- */
.pricing-grid.plan-group .card {
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.35s var(--ease-apple);
}

.pricing-grid.plan-group .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px -20px rgba(0, 0, 0, 0.85);
}

.plan-pop {
    display: inline-block;
    margin-left: 10px;
    padding: 3px 11px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: none;
    vertical-align: middle;
}

/* Spec entries read as chips */
.spec-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Upgrade bar: periodic sheen sweep ------------------------ */
.upgrade-bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -15%;
    width: 60px;
    transform: skewX(-20deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    pointer-events: none;
    animation: upgradeSheen 5.5s ease-in-out infinite;
}

@keyframes upgradeSheen {
    0%, 55% {
        left: -15%;
    }

    85%, 100% {
        left: 115%;
    }
}

/* --- How-it-works: oversized mono step numbers ---------------- */
#how-it-works .faq-grid {
    counter-reset: step;
}

#how-it-works .faq-item {
    counter-increment: step;
    position: relative;
    overflow: hidden;
}

#how-it-works .faq-item::before {
    content: counter(step);
    position: absolute;
    top: 12px;
    right: 22px;
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

/* --- FAQ / step cards: lift on hover -------------------------- */
.faq-item {
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.35s var(--ease-apple);
}

.faq-item:hover {
    transform: translateY(-2px);
    background: var(--surface-highlight);
}

/* --- Ambient aurora behind the deeper sections ---------------- */
.features-section,
.map-section {
    position: relative;
}

.features-section::before,
.map-section::before {
    content: "";
    position: absolute;
    inset: -12% -18%;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(38% 30% at 18% 25%, rgba(16, 185, 129, 0.06), transparent 70%),
        radial-gradient(30% 26% at 82% 70%, rgba(255, 255, 255, 0.04), transparent 70%);
    animation: auroraDrift 26s ease-in-out infinite alternate;
}

.map-section::before {
    animation-duration: 34s;
    animation-direction: alternate-reverse;
}

@keyframes auroraDrift {
    from {
        transform: translate3d(-3%, -2%, 0) scale(1);
    }

    to {
        transform: translate3d(3%, 2%, 0) scale(1.1);
    }
}

/* --- Feature card icon micro-interaction --------------------- */
.f-icon {
    transition: transform 0.4s var(--ease-apple), background 0.4s ease;
}

.feature-card:hover .f-icon {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.09);
}

/* --- Navbar: stronger surface once scrolled ------------------ */
.navbar {
    transition: background 0.4s ease, border-color 0.4s ease;
}

.navbar.fx-scrolled {
    background: rgba(5, 5, 7, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   Motion (gated: only when JS is ready AND the user has not
   requested reduced motion — content is fully visible otherwise)
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {

    /* Hero entrance choreography */
    @keyframes fxRise {
        from {
            opacity: 0;
            transform: translateY(26px);
            filter: blur(8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
            filter: blur(0);
        }
    }

    body.fx-ready .hero-badge          { animation: fxRise 0.9s var(--ease-apple) 0.10s both; }
    body.fx-ready .hero-main h1        { animation: fxRise 1.0s var(--ease-apple) 0.22s both; }
    body.fx-ready .hero-main .main-sub { animation: fxRise 1.0s var(--ease-apple) 0.38s both; }
    body.fx-ready .hero-btns           { animation: fxRise 1.0s var(--ease-apple) 0.52s both; }
    body.fx-ready .hero-trust          { animation: fxRise 1.0s var(--ease-apple) 0.66s both; }
    body.fx-ready .hero-stats          { animation: fxRise 1.0s var(--ease-apple) 0.80s both; }

    body.fx-ready .scroll-indicator {
        animation:
            fxRise 1s var(--ease-apple) 1.15s both,
            bobbing 2.5s ease-in-out 2.2s infinite;
    }

    body.fx-ready .btn-hero.primary {
        animation: ctaBreathe 4.5s ease-in-out 1.8s infinite;
    }

    @keyframes ctaBreathe {
        0%, 100% { box-shadow: 0 0 14px rgba(255, 255, 255, 0.10); }
        50%      { box-shadow: 0 0 30px rgba(255, 255, 255, 0.28); }
    }

    /* Scroll-triggered staggered reveals (class applied by JS) */
    body.fx-ready .fx-reveal {
        opacity: 0;
        transform: translateY(28px);
        transition: opacity 0.9s var(--ease-apple), transform 0.9s var(--ease-apple);
        will-change: opacity, transform;
    }

    body.fx-ready .fx-reveal.fx-in {
        opacity: 1;
        transform: translateY(0);
    }
}
