/* =========================================
   SAPR Design System — Shared Styles
   ========================================= */

:root {
    --accent-primary: #00e599;
    --accent-primary-rgb: 0, 229, 153;
    --accent-glow: #00ffaa;
    --accent-glow-rgb: 0, 255, 170;
    --accent-secondary: #06b6d4;
    --accent-secondary-rgb: 6, 182, 212;
}

/* --- Dot Grid Background --- */
.dot-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 100%);
}

/* --- Noise Texture Overlay --- */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}

/* --- Mouse-Tracking Card Borders --- */
.glow-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 0.3s ease;
}
.glow-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(
        from var(--card-angle, 0deg) at var(--card-x, 50%) var(--card-y, 50%),
        rgba(var(--accent-primary-rgb), 0.5),
        transparent 60%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.glow-card:hover::before {
    opacity: 1;
}
.glow-card:hover {
    background: rgba(255,255,255,0.08);
}
/* Inner content wrapper for glow cards */
.glow-card-inner {
    position: relative;
    z-index: 1;
}

/* --- Scroll-Triggered Fade Animations --- */
.fade-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.stagger-children > .fade-up:nth-child(1) { transition-delay: 0ms; }
.stagger-children > .fade-up:nth-child(2) { transition-delay: 80ms; }
.stagger-children > .fade-up:nth-child(3) { transition-delay: 160ms; }
.stagger-children > .fade-up:nth-child(4) { transition-delay: 240ms; }
.stagger-children > .fade-up:nth-child(5) { transition-delay: 320ms; }
.stagger-children > .fade-up:nth-child(6) { transition-delay: 400ms; }

/* --- Animated Counter --- */
.counter-value {
    font-variant-numeric: tabular-nums;
}

/* --- Glowing Orb Accent --- */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.18;
    pointer-events: none;
    background: var(--orb-color, var(--accent-primary));
}
.glow-orb-primary { --orb-color: var(--accent-primary); }
.glow-orb-secondary { --orb-color: var(--accent-secondary); }
.glow-orb-glow { --orb-color: var(--accent-glow); }

/* Keep legacy for backward compatibility, but point them to variables */
.glow-orb-green { --orb-color: var(--accent-primary); }
.glow-orb-teal { --orb-color: var(--accent-secondary); }
.glow-orb-blue { --orb-color: #3b82f6; } /* Default blue */
.glow-orb-amber { --orb-color: #f59e0b; } /* Default amber */

/* =========================================
   SVG ILLUSTRATION ANIMATIONS
   ========================================= */

/* --- Hero Pipeline: particles flowing along path --- */
@keyframes flowParticle {
    0% { offset-distance: 0%; opacity: 0; }
    5% { opacity: 1; }
    90% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}
.pipeline-particle {
    offset-rotate: 0deg;
    animation: flowParticle 3s ease-in-out infinite;
}
.pipeline-particle:nth-child(2) { animation-delay: 0.6s; }
.pipeline-particle:nth-child(3) { animation-delay: 1.2s; }
.pipeline-particle:nth-child(4) { animation-delay: 1.8s; }
.pipeline-particle:nth-child(5) { animation-delay: 2.4s; }

/* --- Hero SVG 3D Improvements --- */
.hero-svg-3d {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-svg-3d:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-5deg);
}

/* Hex core pulse */
@keyframes hexPulse {
    0%, 100% { stroke-opacity: 0.06; transform: scale(1); }
    50% { stroke-opacity: 0.15; transform: scale(1.03); }
}
.hex-pulse-outer {
    transform-origin: center;
    animation: hexPulse 4s ease-in-out infinite;
}

/* Hex corner nodes pulse */
@keyframes hexCornerPulse {
    0%, 100% { opacity: 0.4; r: 3; }
    50% { opacity: 0.8; r: 4; }
}
.hex-corner-node {
    animation: hexCornerPulse 3s ease-in-out infinite;
}

/* Core float */
@keyframes coreFloat {
    0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); }
    50% { transform: translateY(-5px) scale(1.05); filter: brightness(1.2); }
}
.core-node-3d {
    animation: coreFloat 4s ease-in-out infinite;
    transform-origin: center;
}

/* Group levitate */
@keyframes levitate {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.input-nodes-group {
    animation: levitate 5s ease-in-out infinite;
}
.output-hex-group {
    animation: levitate 5s ease-in-out infinite 0.5s;
}

/* Floating data nodes */
@keyframes nodeFloat {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(3px, -4px); }
    66% { transform: translate(-2px, 2px); }
}
.node-float-1 { animation: nodeFloat 3s ease-in-out infinite; }
.node-float-2 { animation: nodeFloat 4s ease-in-out infinite; }
.node-float-3 { animation: nodeFloat 3.5s ease-in-out infinite; }

/* Particle glow */
.particle-3d {
    filter: drop-shadow(0 0 5px var(--accent-glow));
}

/* Pipeline node pulse */
@keyframes nodePulse {
    0%, 100% { r: 4; opacity: 0.6; }
    50% { r: 6; opacity: 1; }
}
.pipeline-node {
    animation: nodePulse 2s ease-in-out infinite;
}
.pipeline-node:nth-child(2) { animation-delay: 0.5s; }
.pipeline-node:nth-child(3) { animation-delay: 1s; }

/* --- Card Icons --- */

/* Scan line sweep */
@keyframes scanSweep {
    0% { transform: translateY(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(36px); opacity: 0; }
}
.scan-line {
    animation: scanSweep 2.5s ease-in-out infinite;
}

/* Row highlight (follows scan) */
@keyframes rowHighlight {
    0%, 20% { opacity: 0.15; }
    30%, 100% { opacity: 0.6; }
}
.scan-row:nth-child(1) { animation: rowHighlight 2.5s ease infinite; }
.scan-row:nth-child(2) { animation: rowHighlight 2.5s ease 0.5s infinite; }
.scan-row:nth-child(3) { animation: rowHighlight 2.5s ease 1s infinite; }
.scan-row:nth-child(4) { animation: rowHighlight 2.5s ease 1.5s infinite; }

/* Flowing dot between pipeline nodes */
@keyframes dotFlow {
    0% { cx: 6; }
    33% { cx: 22; }
    66% { cx: 38; }
    100% { cx: 6; }
}
.flow-dot {
    animation: dotFlow 2s ease-in-out infinite;
}

/* Node glow */
@keyframes nodeGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
.glow-node:nth-child(1) { animation: nodeGlow 2s ease infinite; }
.glow-node:nth-child(2) { animation: nodeGlow 2s ease 0.66s infinite; }
.glow-node:nth-child(3) { animation: nodeGlow 2s ease 1.33s infinite; }

/* Matching lines draw */
@keyframes drawLine {
    0% { stroke-dashoffset: 30; opacity: 0; }
    50% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}
.match-line {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: drawLine 1.5s ease forwards;
}
.match-line:nth-child(2) { animation-delay: 0.4s; }
.match-line:nth-child(3) { animation-delay: 0.8s; }

/* Matching dots pulse */
@keyframes matchPulse {
    0% { r: 2.5; }
    50% { r: 3.5; }
    100% { r: 2.5; }
}
.match-dot {
    animation: matchPulse 2s ease infinite;
}

/* --- Stat Pulse Ring --- */
@keyframes pulseRing {
    0% { r: 10; opacity: 0.4; stroke-width: 2; }
    100% { r: 40; opacity: 0; stroke-width: 0.5; }
}
.stat-ring {
    animation: pulseRing 2.5s ease-out infinite;
}

/* --- Case Study: Transcript — documents aligning --- */
@keyframes docAlign {
    0% { transform: rotate(var(--start-rot)) translate(var(--start-x), var(--start-y)); opacity: 0.4; }
    100% { transform: rotate(0deg) translate(0, 0); opacity: 1; }
}
.align-doc {
    animation: docAlign 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.align-doc:nth-child(1) { --start-rot: -12deg; --start-x: -8px; --start-y: 4px; animation-delay: 0.1s; }
.align-doc:nth-child(2) { --start-rot: 8deg; --start-x: 5px; --start-y: -6px; animation-delay: 0.3s; }
.align-doc:nth-child(3) { --start-rot: -5deg; --start-x: -3px; --start-y: 8px; animation-delay: 0.5s; }
.align-doc:nth-child(4) { --start-rot: 15deg; --start-x: 6px; --start-y: -4px; animation-delay: 0.7s; }

/* Grid rows fade in */
@keyframes gridRowIn {
    0% { width: 0; opacity: 0; }
    100% { width: 100%; opacity: 1; }
}
.grid-row {
    animation: gridRowIn 0.6s ease forwards;
}
.grid-row:nth-child(1) { animation-delay: 1.2s; }
.grid-row:nth-child(2) { animation-delay: 1.4s; }
.grid-row:nth-child(3) { animation-delay: 1.6s; }
.grid-row:nth-child(4) { animation-delay: 1.8s; }

/* --- Case Study: Financial — number extraction --- */
@keyframes extractFloat {
    0% { opacity: 0; transform: translate(0, 0); }
    30% { opacity: 1; }
    100% { opacity: 1; transform: translate(var(--float-x), var(--float-y)); }
}
.extract-num {
    animation: extractFloat 1.5s ease forwards;
    opacity: 0;
}
.extract-num:nth-child(1) { --float-x: 60px; --float-y: -20px; animation-delay: 0.5s; }
.extract-num:nth-child(2) { --float-x: 65px; --float-y: 0px; animation-delay: 0.8s; }
.extract-num:nth-child(3) { --float-x: 55px; --float-y: 20px; animation-delay: 1.1s; }
.extract-num:nth-child(4) { --float-x: 70px; --float-y: 40px; animation-delay: 1.4s; }

@keyframes scanPDF {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(50px); }
}
.pdf-scan-line {
    animation: scanPDF 3s ease-in-out infinite;
}

/* --- Case Study: Skills — network clustering --- */
@keyframes clusterMove {
    0% { transform: translate(var(--scatter-x), var(--scatter-y)); }
    100% { transform: translate(0, 0); }
}
.cluster-node {
    animation: clusterMove 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes edgeDraw {
    0% { stroke-dashoffset: 50; opacity: 0; }
    50% { opacity: 0.6; }
    100% { stroke-dashoffset: 0; opacity: 0.6; }
}
.cluster-edge {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: edgeDraw 1s ease forwards;
}

/* --- Case Study: Insurance — document sorting --- */
@keyframes sortSlide {
    0% { transform: translate(0, 0) rotate(var(--start-rot)); opacity: 0.5; }
    100% { transform: translate(var(--sort-x), var(--sort-y)) rotate(0deg); opacity: 1; }
}
.sort-doc {
    animation: sortSlide 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes labelFadeIn {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.sort-label {
    opacity: 0;
    animation: labelFadeIn 0.5s ease forwards;
}

/* =========================================
   NEON-INSPIRED EMISSIVE EFFECTS
   ========================================= */

/* --- Emissive Light Streaks (neon.tech style) --- */
.hero-emissive-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.hero-streak {
    position: absolute;
    bottom: 0;
    width: 120px;
    height: 130%;
    filter: blur(80px);
    opacity: 0.5;
    will-change: transform;
    animation: streakPulse 8s ease-in-out infinite alternate;
}

.hero-streak--1 {
    left: 10%;
    background: linear-gradient(180deg, transparent 0%, var(--accent-primary) 30%, var(--accent-glow) 50%, transparent 100%);
}
.hero-streak--2 {
    left: 30%;
    background: linear-gradient(180deg, transparent 0%, var(--accent-secondary) 30%, var(--accent-primary) 50%, transparent 100%);
    opacity: 0.35;
    width: 100px;
}
.hero-streak--3 {
    right: 20%;
    background: linear-gradient(180deg, transparent 0%, var(--accent-primary) 20%, var(--accent-secondary) 50%, transparent 100%);
    opacity: 0.3;
    width: 90px;
}
.hero-streak--4 {
    right: 5%;
    background: linear-gradient(180deg, transparent 0%, var(--accent-secondary) 30%, var(--accent-glow) 50%, transparent 100%);
    opacity: 0.2;
    width: 80px;
}
.hero-streak--5 {
    left: 55%;
    background: linear-gradient(180deg, transparent 10%, var(--accent-primary) 40%, var(--accent-glow) 60%, transparent 100%);
    opacity: 0.15;
    width: 70px;
}

@keyframes streakPulse {
    0% { transform: translateY(5%) scaleX(1); opacity: var(--streak-opacity, 0.4); }
    50% { transform: translateY(-3%) scaleX(1.15); opacity: calc(var(--streak-opacity, 0.4) * 1.4); }
    100% { transform: translateY(5%) scaleX(1); opacity: var(--streak-opacity, 0.4); }
}

/* --- Animated Gradient Overlay --- */
.animated-gradient-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse 80% 50% at 50% 50%, rgba(var(--accent-primary-rgb), 0.08) 0%, transparent 70%);
    animation: gradientShift 12s ease-in-out infinite alternate;
}

@keyframes gradientShift {
    0% { background: radial-gradient(ellipse 80% 50% at 40% 50%, rgba(var(--accent-primary-rgb), 0.08) 0%, transparent 70%); }
    33% { background: radial-gradient(ellipse 80% 50% at 55% 45%, rgba(var(--accent-secondary-rgb), 0.06) 0%, transparent 70%); }
    66% { background: radial-gradient(ellipse 80% 50% at 45% 55%, rgba(var(--accent-primary-rgb), 0.06) 0%, transparent 70%); }
    100% { background: radial-gradient(ellipse 80% 50% at 60% 50%, rgba(59,130,246,0.05) 0%, transparent 70%); }
}

/* --- Brighter Glow Orbs --- */
.glow-orb--bright {
    opacity: 0.35;
    filter: blur(100px);
}

.glow-orb-blue { --orb-color: #3b82f6; }
.glow-orb-amber { --orb-color: #f59e0b; }

/* --- Enhanced Section Dividers --- */
.section-divider-glow {
    height: 1px;
    position: relative;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-primary-rgb), 0.2) 20%, rgba(var(--accent-secondary-rgb), 0.15) 50%, rgba(var(--accent-primary-rgb), 0.2) 80%, transparent);
}
.section-divider-glow::after {
    content: '';
    position: absolute;
    inset: -4px 0;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-primary-rgb), 0.06) 20%, rgba(var(--accent-secondary-rgb), 0.04) 50%, rgba(var(--accent-primary-rgb), 0.06) 80%, transparent);
    filter: blur(4px);
}

/* --- Enhanced Card Styles --- */
.glow-card--enhanced {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
}
.glow-card--enhanced:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(var(--accent-primary-rgb), 0.15);
}

/* Card gradient top strip */
.card-gradient-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.4s ease;
}
.glow-card:hover .card-gradient-strip {
    opacity: 1;
}

/* --- Floating Particles --- */
.particles-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent-primary);
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-20vh) translateX(var(--drift-x, 30px));
        opacity: 0;
    }
}

/* --- Hero Heading Text Glow --- */
.hero-heading-glow {
    text-shadow: 0 0 80px rgba(var(--accent-primary-rgb), 0.15), 0 0 160px rgba(var(--accent-primary-rgb), 0.05);
}

/* --- CTA Section Emissive Background --- */
.cta-emissive {
    position: relative;
    overflow: hidden;
}
.cta-emissive::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(ellipse at center, rgba(var(--accent-primary-rgb), 0.1) 0%, rgba(var(--accent-secondary-rgb), 0.05) 40%, transparent 70%);
    filter: blur(60px);
    pointer-events: none;
}

/* --- Enhanced Stat Glow --- */
.stat-value-bright {
    color: var(--accent-glow);
    text-shadow: 0 0 30px rgba(var(--accent-glow-rgb), 0.4), 0 0 80px rgba(var(--accent-primary-rgb), 0.15);
}

/* --- Brighter Button Glow --- */
.btn-primary-glow {
    position: relative;
}
.btn-primary-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    z-index: -1;
    filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-primary-glow:hover::after {
    opacity: 0.5;
}

/* --- Hero Badge Glow --- */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
    background: rgba(var(--accent-primary-rgb), 0.06);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}
.hero-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-primary); }
    50% { opacity: 0.5; box-shadow: 0 0 4px var(--accent-primary); }
}
