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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    font-weight: 400;
    line-height: 1.75;
    color: #1a3a5c;
    overflow-x: hidden;
    background: #0a2540;
}

/* Palette tokens: #f0f7fc #4cd964 */
.success-accent { color: #4cd964; }
.surface-bg { background-color: #f0f7fc; }

h1, h2, h3, h4 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #0a2540;
}

/* === Noise Overlay === */
.noise-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
}

/* === Atmosphere (Plane 0) === */
.atmosphere {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #48b1e8 0%, #0a6abf 50%, #0a2540 100%);
    z-index: 0;
    will-change: transform;
}

/* === Caustics (Plane 1) === */
.caustics-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
    background:
        conic-gradient(from 0deg at 30% 40%, transparent 0deg, rgba(255,255,255,0.08) 60deg, transparent 120deg),
        conic-gradient(from 120deg at 70% 60%, transparent 0deg, rgba(0,212,255,0.06) 60deg, transparent 120deg),
        radial-gradient(ellipse at 50% 50%, rgba(72,177,232,0.1) 0%, transparent 70%);
    animation: caustics-rotate 60s linear infinite;
    mix-blend-mode: overlay;
}

@keyframes caustics-rotate {
    from { transform: rotate(0deg) scale(1.5); }
    to { transform: rotate(360deg) scale(1.5); }
}

/* === Bubbles Container (Plane 4) === */
.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
}

.micro-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(72,177,232,0.3) 50%, rgba(0,212,255,0.1) 100%);
    animation: float-up linear infinite;
    will-change: transform;
}

@keyframes float-up {
    0% { transform: translateY(110vh) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    50% { transform: translateY(50vh) translateX(20px); }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) translateX(-10px); opacity: 0; }
}

/* === Depth Navigation === */
.depth-nav {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.depth-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(72,177,232,0.3) 50%, rgba(0,212,255,0.1) 100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.depth-dot:hover {
    transform: scale(1.3);
}

.depth-dot.active {
    width: 20px;
    height: 20px;
    box-shadow: 0 0 12px rgba(0,212,255,0.6);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0,212,255,0.6); }
    50% { box-shadow: 0 0 20px rgba(0,212,255,0.9); }
}

/* === Layer Panels (Plane 2) === */
.layer-panel {
    position: relative;
    min-height: 100vh;
    width: calc(100% - 6vw);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 5rem);
    border-radius: 2rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6vh;
}

.layer-panel:last-child {
    margin-bottom: 0;
}

/* === Section 1: Surface (Hero) === */
.surface {
    background: transparent;
    flex-direction: column;
    text-align: center;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    color: #0a2540;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: #1a3a5c;
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
    z-index: 2;
}

.scroll-chevron {
    animation: chevron-fade 2.5s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes chevron-fade {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(8px); }
}

/* === Macro Bubbles === */
.macro-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6) 0%, rgba(72,177,232,0.2) 50%, rgba(0,212,255,0.05) 100%);
    z-index: 1;
    pointer-events: none;
}

.macro-bubble-hero {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: macro-pulse 4s ease-in-out infinite;
}

.macro-bubble-plasma {
    width: 400px;
    height: 400px;
    top: 10%;
    right: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes macro-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

/* === Network Graph SVG === */
.network-graph {
    width: 60%;
    height: 60%;
}

.graph-node {
    fill: #00d4ff;
    animation: node-pulse 2s ease-in-out infinite;
}

.graph-node:nth-child(2) { animation-delay: 0.5s; }
.graph-node:nth-child(3) { animation-delay: 1s; }
.graph-node:nth-child(4) { animation-delay: 1.5s; }

@keyframes node-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.graph-edge {
    stroke: #00d4ff;
    stroke-width: 1.5;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: edge-draw 3s ease forwards infinite;
}

.graph-edge:nth-child(2) { animation-delay: 0.3s; }
.graph-edge:nth-child(3) { animation-delay: 0.6s; }
.graph-edge:nth-child(4) { animation-delay: 0.9s; }
.graph-edge:nth-child(5) { animation-delay: 1.2s; }

@keyframes edge-draw {
    0% { stroke-dashoffset: 100; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -100; }
}

/* === Frosted Panels === */
.frosted-panel {
    width: 100%;
    max-width: 1000px;
    padding: clamp(2rem, 4vw, 4rem);
    border-radius: 1.25rem;
    position: relative;
}

.frosted-panel.light {
    background: rgba(240, 247, 252, 0.75);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 8px 32px rgba(10,37,64,0.12);
}

.frosted-panel.dark {
    background: rgba(10, 37, 64, 0.6);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 8px 32px rgba(10,37,64,0.3);
    color: #ffffff;
}

.frosted-panel.dark h2,
.frosted-panel.dark h3,
.frosted-panel.dark h4 {
    color: #ffffff;
}

.frosted-panel.dark p {
    color: rgba(255,255,255,0.85);
}

/* === Section Headings === */
.section-heading {
    font-size: clamp(2.2rem, 6vw, 5rem);
    margin-bottom: 2rem;
}

.section-intro {
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    max-width: 700px;
    margin-bottom: 2.5rem;
}

/* === Two Column Layout === */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    margin-bottom: 2rem;
}

.col h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: #0a2540;
}

.frosted-panel.dark .col h3 {
    color: #ffffff;
}

/* === Meso Bubbles === */
.meso-bubbles {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.meso-bubble {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, rgba(72,177,232,0.3) 50%, rgba(0,212,255,0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -10px 30px rgba(0,0,0,0.05);
}

.bubble-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #3d7eb8;
    text-align: center;
}

/* === Glossy Cards === */
.card-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.glossy-card {
    background: rgba(240, 247, 252, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 16px rgba(10,37,64,0.1);
}

.glossy-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.glossy-card p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* === Section 5: Horizon === */
.horizon {
    background: transparent;
    text-align: center;
    flex-direction: column;
}

.horizon-title {
    font-size: clamp(2rem, 5vw, 4rem);
    color: #ffb347;
    margin-bottom: 2rem;
}

.brand-mark {
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    color: #ffffff;
    opacity: 0.7;
}

/* === Zoom Focus Animation === */
.zoom-focus {
    opacity: 0;
    transform: scale(0.88);
    filter: blur(4px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
                filter 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-focus.visible {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* === Responsive === */
@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .card-row {
        grid-template-columns: 1fr;
    }

    .macro-bubble-plasma {
        width: 200px;
        height: 200px;
        top: 5%;
        right: -5%;
    }

    .layer-panel {
        width: calc(100% - 4vw);
        padding: clamp(1.5rem, 4vw, 3rem);
    }
}
