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

:root {
    --animation-speed-mult: 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: -3; /* Placed behind theme content */
    pointer-events: none; /* By default non-interactive */
}

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

.hero-engine-viewport.layer-over-bg {
    background-color: transparent !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);
}

.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 {
    /* Radial Center Aperture Mask - punches out central space for title legibility */
    -webkit-mask-image: radial-gradient(ellipse 42% 34% at 50% 46%, transparent 35%, #000 100%);
    mask-image: radial-gradient(ellipse 42% 34% at 50% 46%, transparent 35%, #000 100%);
}

.hero-variant.machine svg {
    width: 100%;
    height: 100%;
    display: block;
}

.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: 1.8px;
    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;
    filter: drop-shadow(0 0 6px var(--hero-accent-glow));
}

.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);
    filter: drop-shadow(0 0 10px var(--hero-accent-glow));
}

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

.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;
    filter: drop-shadow(0 0 12px var(--hero-accent-color));
}

@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);
    filter: drop-shadow(0 0 8px var(--hero-accent-glow));
}

@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;
}

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

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

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

.orbital-ring.ring-3 {
    width: 880px;
    height: 880px;
    opacity: 0.18;
    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.1) 60%, transparent 100%);
    filter: blur(24px);
    animation: corePulse calc(4s / var(--animation-speed-mult)) ease-in-out infinite alternate;
}

@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;
}

.cyber-plane {
    width: 100%;
    height: 100%;
    transform: rotateX(82deg);
    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% { background-position: 0 0; }
    100% { background-position: 0 50px; }
}

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

.aurora-container {
    position: absolute;
    inset: 0;
    filter: blur(60px);
    opacity: 0.6;
    overflow: hidden;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    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), rgba(139, 92, 246, 0.4));
}

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

.aurora-blob.blob-3 {
    top: 40%;
    right: 40%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #10b981, var(--hero-accent-soft));
    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;
}

