/* =============================================
   sim-ai.org — Muji-Neon Fusion
   ============================================= */

:root {
    --bg-primary: #0d0d12;
    --bg-secondary: #1a1a1f;
    --surface: #2a2a32;
    --neon-cyan: #00e5ff;
    --neon-violet: #b400ff;
    --text-primary: #e8e5e0;
    --text-secondary: #9a9590;
    --neon-coral: #ff3d6a;
    --gutter: 2.5rem;
    --padding-edge: 5vw;
    --max-width: 1200px;
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Scroll Container ---- */
.scroll-container {
    width: 100%;
}

/* ---- Stage (each section) ---- */
.stage {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--padding-edge);
}

/* ---- Dot Grid Overlay ---- */
.dot-grid-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(228, 225, 220, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

/* ---- Circuit Background ---- */
.circuit-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.08;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cline x1='0' y1='30' x2='120' y2='30' stroke='%2300e5ff' stroke-width='1'/%3E%3Cline x1='0' y1='60' x2='120' y2='60' stroke='%2300e5ff' stroke-width='1'/%3E%3Cline x1='0' y1='90' x2='120' y2='90' stroke='%2300e5ff' stroke-width='1'/%3E%3Cline x1='30' y1='0' x2='30' y2='120' stroke='%2300e5ff' stroke-width='1'/%3E%3Cline x1='60' y1='0' x2='60' y2='120' stroke='%2300e5ff' stroke-width='1'/%3E%3Cline x1='90' y1='0' x2='90' y2='120' stroke='%2300e5ff' stroke-width='1'/%3E%3Ccircle cx='30' cy='30' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='60' cy='30' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='90' cy='30' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='30' cy='60' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='60' cy='60' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='90' cy='60' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='30' cy='90' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='60' cy='90' r='2' fill='%2300e5ff'/%3E%3Ccircle cx='90' cy='90' r='2' fill='%2300e5ff'/%3E%3C/svg%3E");
    animation: circuitPulse 6s ease-in-out infinite;
}

.circuit-bg--faint {
    opacity: 0.05;
}

@keyframes circuitPulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.04; }
}

.circuit-bg--faint {
    animation-name: circuitPulseFaint;
}

@keyframes circuitPulseFaint {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.02; }
}

/* ---- Progress Dots ---- */
.progress-dots {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--surface);
    transition: transform 0.4s var(--bounce), background-color 0.3s ease;
    cursor: pointer;
}

.dot.active {
    background: var(--neon-cyan);
    transform: scale(1.5);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* ---- Signal Pulse Divider ---- */
.signal-pulse {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 1px;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-violet));
    z-index: 5;
    transition: width 1.2s ease-out;
}

.signal-pulse.active {
    width: 100%;
}

/* =============================================
   Stage Zero: Hero
   ============================================= */
.stage-hero {
    background: var(--bg-primary);
    perspective: 800px;
}

.hero-word {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
    width: 100%;
    white-space: nowrap;
}

.hero-letter {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 12rem);
    letter-spacing: -0.03em;
    color: var(--bg-secondary);
    display: inline-block;
    transition: transform 0.1s linear, opacity 0.3s ease;
    will-change: transform, opacity;
    text-shadow: 0 0 40px rgba(0, 229, 255, 0.05);
}

/* =============================================
   Stage One: Concept
   ============================================= */
.stage-concept {
    background: var(--bg-primary);
}

.concept-layout {
    display: flex;
    align-items: center;
    gap: var(--gutter);
    max-width: var(--max-width);
    width: 100%;
    z-index: 2;
    position: relative;
}

.concept-text {
    flex: 0 0 60%;
    max-width: 60%;
}

.concept-visual {
    flex: 0 0 40%;
    max-width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.concept-text p {
    color: var(--text-primary);
    margin-bottom: 1.2rem;
}

.concept-text p:last-child {
    margin-bottom: 0;
}

/* ---- 3D Simulation Cube ---- */
.cube-container {
    width: 200px;
    height: 200px;
    perspective: 600px;
}

.cube {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    animation: cubeRotate 20s linear infinite;
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(0, 229, 255, 0.25);
    background: rgba(0, 229, 255, 0.06);
    backface-visibility: visible;
}

.cube-front  { transform: translateZ(100px); }
.cube-back   { transform: rotateY(180deg) translateZ(100px); }
.cube-right  { transform: rotateY(90deg) translateZ(100px); }
.cube-left   { transform: rotateY(-90deg) translateZ(100px); }
.cube-top    { transform: rotateX(90deg) translateZ(100px); }
.cube-bottom { transform: rotateX(-90deg) translateZ(100px); }

@keyframes cubeRotate {
    0%   { transform: rotateX(0deg) rotateY(0deg); }
    100% { transform: rotateX(360deg) rotateY(600deg); }
}

/* =============================================
   Stage Two: Process
   ============================================= */
.stage-process {
    background: var(--bg-primary);
}

.process-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 2;
    position: relative;
    max-width: var(--max-width);
}

/* ---- Capsule ---- */
.capsule {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px;
    padding: 1rem 2.5rem 1rem 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.05);
}

.capsule-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.capsule-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: var(--text-primary);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* ---- Node Sphere ---- */
.node-sphere {
    position: relative;
    width: 48px;
    height: 48px;
    animation: nodeSpin 16s linear infinite;
}

.node-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--neon-violet);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: rotate(var(--angle)) translateX(20px) translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(180, 0, 255, 0.4);
}

@keyframes nodeSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================
   Stage Three: Vision
   ============================================= */
.stage-vision {
    background: linear-gradient(180deg, var(--bg-primary) 0%, #1a0a2e 100%);
}

.vision-layout {
    max-width: var(--max-width);
    width: 100%;
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 var(--padding-edge);
}

.vision-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1.25rem, 3vw, 2.5rem);
    letter-spacing: 0.01em;
    line-height: 1.6;
    color: var(--text-secondary);
}

.vision-word {
    display: inline-block;
    transition: color 0.3s ease;
    margin-right: 0.3em;
}

.vision-word.highlight {
    color: var(--neon-cyan);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

/* =============================================
   Stage Four: Footer
   ============================================= */
.stage-footer {
    background: var(--bg-primary);
}

.footer-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 2;
    position: relative;
}

.footer-line {
    width: 120px;
    height: 1px;
    background: var(--neon-violet);
    box-shadow: 0 0 12px rgba(180, 0, 255, 0.3);
}

.footer-domain {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* =============================================
   Bounce-Enter Animation
   ============================================= */
.bounce-target {
    opacity: 0;
    transform: scale(0.85) translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s var(--bounce);
}

.bounce-target.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Stagger delay for capsules */
.capsule.bounce-target {
    transition-delay: var(--delay, 0ms);
}

.node-sphere.bounce-target {
    transition-delay: var(--delay, 0ms);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .concept-layout {
        flex-direction: column;
        text-align: center;
    }

    .concept-text,
    .concept-visual {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .cube-container {
        width: 140px;
        height: 140px;
    }

    .cube {
        width: 140px;
        height: 140px;
    }

    .cube-face {
        width: 140px;
        height: 140px;
    }

    .cube-front  { transform: translateZ(70px); }
    .cube-back   { transform: rotateY(180deg) translateZ(70px); }
    .cube-right  { transform: rotateY(90deg) translateZ(70px); }
    .cube-left   { transform: rotateY(-90deg) translateZ(70px); }
    .cube-top    { transform: rotateX(90deg) translateZ(70px); }
    .cube-bottom { transform: rotateX(-90deg) translateZ(70px); }

    .capsule {
        max-width: 300px;
        padding: 0.85rem 2rem 0.85rem 1.25rem;
    }

    .capsule-text {
        white-space: normal;
    }

    .hero-letter {
        font-size: clamp(2.5rem, 10vw, 6rem);
    }

    .progress-dots {
        right: 0.75rem;
    }

    .stage {
        padding: 3vw;
    }
}

@media (max-width: 480px) {
    .section-heading {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }

    .vision-text {
        font-size: clamp(1rem, 5vw, 1.5rem);
    }

    .process-layout {
        gap: 1.25rem;
    }

    .capsule {
        max-width: 260px;
        gap: 0.75rem;
        padding: 0.75rem 1.5rem 0.75rem 1rem;
    }
}
