/* ==========================================================================
   Core CMS - Hero Background Engine
   ========================================================================== */

:root {
    --animation-speed-mult: 1;
    --hero-engine-opacity: 1;
    --hero-accent-color: #6366f1;
    --hero-accent-glow: rgba(99, 102, 241, 0.5);
    --hero-accent-soft: rgba(99, 102, 241, 0.15);
}

.hero-engine-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1; /* Placed in front of theme backdrops (-2/-3), but behind theme content (.site-wrapper is z-index: 1) */
    opacity: var(--hero-engine-opacity, 1);
    pointer-events: none; /* By default non-interactive */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    contain: strict;
}

.hero-engine-viewport.fixed-mode {
    position: fixed;
}

.hero-engine-viewport.layer-over-bg {
    background-color: transparent !important;
    background-image: none !important;
}

html[data-theme="dark"] .hero-engine-viewport.layer-over-bg,
html[data-theme="light"] .hero-engine-viewport.layer-over-bg {
    background-color: transparent !important;
    background-image: none !important;
}

/* Base Theme Color Fallbacks */
.hero-engine-viewport.theme-dark {
    background-color: #07070a;
    --ink-primary: #f1f3f9;
    --ink-secondary: rgba(241, 243, 249, 0.65);
    --ink-muted: rgba(241, 243, 249, 0.4);
    --ink-faint: rgba(241, 243, 249, 0.15);
}

.hero-engine-viewport.theme-light {
    background-color: #f8fafc;
    --ink-primary: #0f172a;
    --ink-secondary: rgba(15, 23, 42, 0.7);
    --ink-muted: rgba(15, 23, 42, 0.45);
    --ink-faint: rgba(15, 23, 42, 0.12);
}

/* Dynamic theme overrides to support client-side light/dark mode toggles */
html[data-theme="dark"] .hero-engine-viewport:not(.layer-over-bg) {
    background-color: #07070a !important;
    --ink-primary: #f1f3f9;
    --ink-secondary: rgba(241, 243, 249, 0.65);
    --ink-muted: rgba(241, 243, 249, 0.4);
    --ink-faint: rgba(241, 243, 249, 0.15);
}

html[data-theme="light"] .hero-engine-viewport:not(.layer-over-bg) {
    background-color: #f8fafc !important;
    --ink-primary: #0f172a;
    --ink-secondary: rgba(15, 23, 42, 0.7);
    --ink-muted: rgba(15, 23, 42, 0.45);
    --ink-faint: rgba(15, 23, 42, 0.12);
}

.hero-variant {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.hero-variant.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   VARIANT: MACHINE RIG
   ========================================================================== */

.hero-variant.machine {
    transform: translate3d(0, 0, 0);
    will-change: transform;
    backface-visibility: hidden;
}

.hero-variant.machine svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: translate3d(0, 0, 0);
}

.chr-ring {
    fill: none;
    stroke: var(--ink-primary);
    stroke-dasharray: 3 12;
    transform-origin: 50% 50%;
    vector-effect: non-scaling-stroke;
}

.chr-ring.a {
    opacity: 0.35;
    animation: chr-spin calc(70s / var(--animation-speed-mult)) linear infinite;
}

.chr-ring.b {
    opacity: 0.28;
    animation: chr-spin calc(110s / var(--animation-speed-mult)) linear infinite reverse;
}

.chr-ring.c {
    opacity: 0.22;
    animation: chr-spin calc(160s / var(--animation-speed-mult)) linear infinite;
}

.chr-ring.d {
    opacity: 0.15;
    animation: chr-spin calc(220s / var(--animation-speed-mult)) linear infinite reverse;
}

.chr-solid {
    fill: none;
    stroke: var(--ink-primary);
    opacity: 0.16;
    vector-effect: non-scaling-stroke;
}

.chr-wire {
    stroke: var(--ink-primary);
    opacity: 0.18;
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}

.chr-flow {
    fill: none;
    stroke: var(--hero-accent-color);
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-dasharray: 28 700;
    animation: chr-flow calc(5.2s / var(--animation-speed-mult)) cubic-bezier(0.45, 0, 0.3, 1) infinite;
    will-change: stroke-dashoffset;
}

.chr-dot {
    fill: var(--ink-primary);
    opacity: 0.45;
    animation: chr-blink calc(5s / var(--animation-speed-mult)) ease-in-out infinite;
}

.chr-core {
    fill: var(--hero-accent-color);
}

.chr-halo {
    fill: none;
    stroke: var(--hero-accent-color);
    stroke-width: 1.5px;
    opacity: 0.45;
    transform-box: fill-box;
    transform-origin: center;
    animation: chr-halo calc(5.6s / var(--animation-speed-mult)) ease-out infinite;
    will-change: transform, opacity;
}

.chr-scan {
    fill: none;
    stroke: var(--hero-accent-color);
    stroke-width: 2.2px;
    stroke-linecap: round;
    opacity: 0.85;
    stroke-dasharray: 90 3000;
    transform-origin: 50% 50%;
    animation: chr-spin calc(14s / var(--animation-speed-mult)) linear infinite;
    will-change: transform;
}

@keyframes chr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes chr-flow {
    0% { stroke-dashoffset: 726; }
    72%, 100% { stroke-dashoffset: 0; }
}

@keyframes chr-blink {
    0%, 100% { opacity: 0.18; }
    50% { opacity: 0.75; }
}

@keyframes chr-halo {
    0% { transform: scale(0.5); opacity: 0.6; }
    100% { transform: scale(3.5); opacity: 0; }
}

/* ==========================================================================
   VARIANT: KINETIC MESH
   ========================================================================== */

#hero-mesh-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mesh-line {
    stroke: var(--ink-faint);
    stroke-width: 1px;
}

.mesh-accent-line {
    stroke: var(--hero-accent-color);
    stroke-width: 1.5px;
    opacity: 0.25;
    stroke-dasharray: 8 16;
    animation: meshDash calc(12s / var(--animation-speed-mult)) linear infinite;
}

.mesh-dot {
    fill: var(--ink-muted);
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mesh-dot-active {
    fill: var(--hero-accent-color);
}

@keyframes meshDash {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -400; }
}

/* ==========================================================================
   VARIANT: QUANTUM ORBITAL REACTOR
   ========================================================================== */

.orbital-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    transform: translate3d(0, 0, 0);
    contain: strict;
}

.orbital-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px dashed var(--ink-muted);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
}

.orbital-ring.ring-1 {
    width: 450px;
    height: 450px;
    border-color: var(--hero-accent-color);
    opacity: 0.55;
    animation: orbitRotate1 calc(24s / var(--animation-speed-mult)) linear infinite;
}

.orbital-ring.ring-2 {
    width: 650px;
    height: 650px;
    opacity: 0.35;
    animation: orbitRotate2 calc(38s / var(--animation-speed-mult)) linear infinite reverse;
}

.orbital-ring.ring-3 {
    width: 880px;
    height: 880px;
    opacity: 0.22;
    animation: orbitRotate3 calc(55s / var(--animation-speed-mult)) linear infinite;
}

.orbital-core-glow {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--hero-accent-color) 0%, rgba(99, 102, 241, 0.25) 40%, rgba(99, 102, 241, 0.05) 65%, transparent 75%);
    animation: corePulse calc(4s / var(--animation-speed-mult)) ease-in-out infinite alternate;
    will-change: transform, opacity;
}

@keyframes orbitRotate1 {
    0% { transform: rotateX(65deg) rotateY(-20deg) rotateZ(0deg); }
    100% { transform: rotateX(65deg) rotateY(-20deg) rotateZ(360deg); }
}

@keyframes orbitRotate2 {
    0% { transform: rotateX(45deg) rotateY(35deg) rotateZ(0deg); }
    100% { transform: rotateX(45deg) rotateY(35deg) rotateZ(360deg); }
}

@keyframes orbitRotate3 {
    0% { transform: rotateX(75deg) rotateY(10deg) rotateZ(0deg); }
    100% { transform: rotateX(75deg) rotateY(10deg) rotateZ(360deg); }
}

@keyframes corePulse {
    0% { transform: scale(0.85); opacity: 0.5; }
    100% { transform: scale(1.25); opacity: 0.9; }
}

/* ==========================================================================
   VARIANT: CYBERPUNK PERSPECTIVE SYNTHWAVE GRID
   ========================================================================== */

.cyber-grid-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, var(--hero-accent-soft), transparent 70%);
}

.cyber-horizon {
    position: absolute;
    top: 45%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--hero-accent-color), transparent);
    box-shadow: 0 0 20px var(--hero-accent-color);
}

.cyber-sun {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ec4899 0%, var(--hero-accent-color) 80%, transparent 100%);
    filter: blur(2px);
    opacity: 0.4;
    mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}

.cyber-floor {
    position: absolute;
    top: 45%;
    left: -50%;
    width: 200%;
    height: 100%;
    perspective: 450px;
    overflow: hidden;
}

.cyber-plane {
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    height: calc(100% + 50px);
    transform-origin: 50% 0%;
    transform: rotateX(82deg) translate3d(0, 0, 0);
    will-change: transform;
    background-image: 
        linear-gradient(to right, rgba(99, 102, 241, 0.25) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(99, 102, 241, 0.25) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove calc(3s / var(--animation-speed-mult)) linear infinite;
}

@keyframes gridMove {
    0% { transform: rotateX(82deg) translate3d(0, 0, 0); }
    100% { transform: rotateX(82deg) translate3d(0, 50px, 0); }
}

/* ==========================================================================
   VARIANT: HOLOGRAPHIC FLUID AURORA MESH
   ========================================================================== */

.aurora-container {
    position: absolute;
    inset: 0;
    opacity: 0.75;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    contain: strict;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    animation: blobFloat calc(18s / var(--animation-speed-mult)) ease-in-out infinite alternate;
}

.aurora-blob.blob-1 {
    top: 20%;
    left: 30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--hero-accent-color) 0%, rgba(139, 92, 246, 0.45) 30%, rgba(139, 92, 246, 0.12) 55%, transparent 70%);
}

.aurora-blob.blob-2 {
    bottom: 10%;
    right: 25%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #3b82f6 0%, rgba(236, 72, 153, 0.35) 32%, rgba(236, 72, 153, 0.08) 58%, transparent 72%);
    animation-delay: -6s;
}

.aurora-blob.blob-3 {
    top: 40%;
    right: 40%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #10b981 0%, var(--hero-accent-soft) 35%, rgba(16, 185, 129, 0.05) 60%, transparent 70%);
    animation-delay: -12s;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(80px, -60px) scale(1.15); }
    100% { transform: translate(-60px, 50px) scale(0.9); }
}

/* ==========================================================================
   VARIANT: WAVEFORMS (FREQUENCY OSCILLATOR)
   ========================================================================== */

.hero-variant.waveforms {
    background: transparent;
}

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

