/*
 * Premium interactive hero — homepage only.
 * Loaded/initialized only when the hero markup (#hero.hero-premium) is present,
 * so it never affects other pages or the admin panel.
 */

.hero-premium {
    --hp-glow-x: 50%;
    --hp-glow-y: 40%;
    isolation: isolate;
}

/* Slow ambient color drift behind the mesh blobs — always on, very low amplitude */
.hp-aurora {
    position: absolute;
    inset: -10%;
    z-index: 0;
    background: conic-gradient(from 0deg at 30% 40%, rgba(67, 144, 187, 0.16), rgba(230, 81, 0, 0.08), rgba(1, 87, 155, 0.14), rgba(67, 144, 187, 0.16));
    filter: blur(90px);
    animation: hpAuroraDrift 22s ease-in-out infinite alternate;
    opacity: 0.8;
}
@keyframes hpAuroraDrift {
    0%   { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(18deg) scale(1.12); }
}

/* ---------- Mesh gradient background ---------- */
.hp-mesh {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}
.hp-mesh__blob {
    position: absolute;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.5;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

/* Cursor-follow spotlight glow */
.hp-spotlight {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(600px circle at var(--hp-glow-x) var(--hp-glow-y), rgba(67, 144, 187, 0.16), transparent 60%);
    transition: opacity 0.4s ease;
}

/* Subtle grain/noise overlay for a premium, non-flat surface */
.hp-noise {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Ambient particle canvas */
.hp-particles {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* ---------- Content layer ---------- */
.hp-content {
    position: relative;
    z-index: 10;
}

.hp-label {
    opacity: 0;
}
.hp-label__dot {
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: #ff8a50;
    box-shadow: 0 0 0 0 rgba(255, 138, 80, 0.6);
    animation: hpPulse 2.2s ease-out infinite;
}
@keyframes hpPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 138, 80, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 138, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 138, 80, 0); }
}

/* SplitType line/char wrappers */
.hp-headline .line {
    overflow: hidden;
    display: block;
}
.hp-headline .char {
    display: inline-block;
    will-change: transform, opacity;
}
.hp-headline {
    position: relative;
    background: linear-gradient(100deg, #ffffff 40%, #a6cceb 60%, #ffffff 80%);
    background-size: 220% auto;
    background-position: 0 0;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 26px rgba(67, 144, 187, 0.28));
}
.hp-headline.hp-gradient-sweep {
    animation: hpGradientSweep 3.5s ease-in-out 1.4s 1 forwards;
}
@keyframes hpGradientSweep {
    to { background-position: -160% 0; }
}

.hp-desc, .hp-points, .hp-badges {
    opacity: 0;
}

/* ---------- Buttons: magnetic, glow, animated border, arrow slide ---------- */
.hp-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    will-change: transform;
    opacity: 0;
}
.hp-btn__arrow {
    display: inline-flex;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.hp-btn:hover .hp-btn__arrow,
.hp-btn:focus-visible .hp-btn__arrow {
    transform: translateX(5px);
}
.hp-btn-primary {
    background: linear-gradient(135deg, #e65100, #ff8a50);
    box-shadow: 0 12px 30px -10px rgba(230, 81, 0, 0.55);
}
.hp-btn-primary::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    pointer-events: none;
}
.hp-btn-secondary {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.hp-btn-secondary::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, rgba(67, 144, 187, 0.9), rgba(67, 144, 187, 0), rgba(67, 144, 187, 0.9));
    background-size: 250% 250%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: hpBorderFlow 4s linear infinite;
    pointer-events: none;
}
@keyframes hpBorderFlow {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ---------- Glass stat cards with tilt ---------- */
.hp-stat {
    opacity: 0;
    transform-style: preserve-3d;
    will-change: transform;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 0 rgba(67, 144, 187, 0);
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}
.hp-stat:hover {
    border-color: rgba(67, 144, 187, 0.5);
    box-shadow: 0 14px 34px -14px rgba(67, 144, 187, 0.45);
}
.hp-stat__value {
    font-variant-numeric: tabular-nums;
}

/* ---------- Right-side visual stage ----------
 * Position (absolute/inset/right/width) is set via Tailwind utility classes in the
 * markup so it can size against the hero (a much larger, full-bleed layer, not a
 * boxed grid column) — deliberately not set here to avoid a specificity fight with
 * those utilities. */
.hp-stage {
    opacity: 0;
    mask-image: linear-gradient(to right, transparent 0%, black 14%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 14%);
}
.hp-stage__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.hp-stage__fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hp-stage__fallback svg {
    width: 100%;
    height: 100%;
    max-width: 720px;
}
.hp-stage__glow {
    position: absolute;
    inset: 10%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(67, 144, 187, 0.35), transparent 70%);
    filter: blur(40px);
    z-index: -1;
    animation: hpGlowPulse 6s ease-in-out infinite;
}
@keyframes hpGlowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.08); }
}

/* Rocket illustration (SVG fallback): hover bob, flame flicker, twinkling stars, rising smoke */
@keyframes hpRocketHover {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-10px) rotate(0.6deg); }
}
.hp-flame {
    animation: hpFlameFlicker 0.18s ease-in-out infinite alternate;
    transform-origin: 250px 336px;
}
@keyframes hpFlameFlicker {
    0%   { transform: scaleY(0.88) scaleX(0.96); }
    100% { transform: scaleY(1.08) scaleX(1.03); }
}
.hp-star {
    animation: hpStarTwinkle 2.6s ease-in-out infinite;
}
@keyframes hpStarTwinkle {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.9; }
}
.hp-smoke-puff {
    animation: hpSmokePuff 2.6s ease-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}
@keyframes hpSmokePuff {
    0%   { transform: translateY(0) scale(0.5); opacity: 0.45; }
    100% { transform: translateY(34px) scale(1.6); opacity: 0; }
}

/* Floating glass badge chips around the stage */
.hp-chip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 26px -12px rgba(2, 6, 23, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
    opacity: 0;
    white-space: nowrap;
    z-index: 5;
}
.hp-chip i {
    color: #4390bb;
    font-size: 0.9rem;
}
.hp-chip--float {
    animation: hpChipFloat 6s ease-in-out infinite;
}
.hp-chip--1 { top: 6%; right: 4%; }
.hp-chip--2 { bottom: 14%; left: 2%; animation-duration: 7.2s; animation-delay: -2s; }
.hp-chip--3 { top: 46%; right: 2%; animation-duration: 5.4s; animation-delay: -3.4s; }
.hp-chip--4 { top: 18%; left: 3%; animation-duration: 6.6s; animation-delay: -1.2s; }
.hp-chip--5 { bottom: 5%; right: 20%; animation-duration: 7.8s; animation-delay: -0.6s; }
.hp-chip--6 { top: 66%; left: 9%; animation-duration: 5.8s; animation-delay: -2.8s; }
.hp-chip--7 { top: 1%; left: 34%; animation-duration: 6.2s; animation-delay: -4s; }
@keyframes hpChipFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* Scroll cue */
.hp-scroll-cue {
    opacity: 0;
}
.hp-scroll-cue__line {
    width: 1px;
    height: 28px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.7), transparent);
    animation: hpScrollCue 1.8s ease-in-out infinite;
}
@keyframes hpScrollCue {
    0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
    40%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
    60%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ---------- Mobile: simplify for performance ---------- */
@media (max-width: 1023px) {
    .hp-stage__canvas { display: none; }
    .hp-mesh__blob { filter: blur(45px); }
}
@media (max-width: 639px) {
    .hp-particles { display: none; }
}

/*
 * Respect reduced motion: show the final layout immediately, with no entrance
 * slides, cursor-follow parallax, 3D rotation or directional scroll-cue motion.
 * Small ambient loops (dot pulse, glow breathing, aurora drift, chip/node bob)
 * are low-amplitude and non-directional, so they stay on to keep the hero from
 * feeling inert — WCAG's reduced-motion guidance targets large/parallax motion,
 * not subtle in-place decoration.
 */
@media (prefers-reduced-motion: reduce) {
    .hp-label, .hp-desc, .hp-points, .hp-badges, .hp-btn, .hp-stat, .hp-stage {
        opacity: 1 !important;
        transform: none !important;
    }
    .hp-chip { opacity: 1 !important; }
    .hp-scroll-cue { opacity: 1 !important; }
    .hp-headline .char { opacity: 1 !important; transform: none !important; }
    .hp-headline.hp-gradient-sweep,
    .hp-scroll-cue__line {
        animation: none !important;
    }
}
