/* ============================================================
   simulai.net - Seapunk Computational Design
   Colors: #0a1223, #0f1d3a, #00d2ff, #c8e6f5, #0a8f9e, #e8f4f8, #ff6b8a
   Fonts: Space Grotesk 700, DM Sans 400/500, IBM Plex Mono 400
   ============================================================ */

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

:root {
    --abyssal-ink: #0a1223;
    --twilight-depth: #0f1d3a;
    --bioluminescent-cyan: #00d2ff;
    --frost-veil: #c8e6f5;
    --pelagic-teal: #0a8f9e;
    --abalone-pearl: #e8f4f8;
    --coral-signal: #ff6b8a;
    --marine-mist: rgba(150, 220, 255, 0.08);
    --scroll-y: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: var(--frost-veil);
    background: linear-gradient(180deg, #0f1d3a 0%, #0a1223 40%, #060d18 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    line-height: 1.7;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Grain Overlay Canvas
   ============================================================ */

#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    mix-blend-mode: overlay;
    transition: opacity 800ms ease;
}

#grain-canvas.visible {
    opacity: 0.035;
}

/* ============================================================
   Parallax Layers
   ============================================================ */

.parallax-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.parallax-layer--bg {
    z-index: 1;
    height: 200vh;
    transform: translateY(calc(var(--scroll-y) * -0.7px));
    will-change: transform;
}

.parallax-layer--mid {
    z-index: 2;
    height: 300vh;
    transform: translateY(calc(var(--scroll-y) * -0.4px));
    will-change: transform;
}

.parallax-layer--fg {
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

/* ============================================================
   Deep Current SVG Curves
   ============================================================ */

.deep-current-svg {
    position: absolute;
    top: 30vh;
    left: 0;
    width: 100%;
    height: 400px;
}

.deep-current {
    fill: none;
    stroke: rgba(0, 210, 255, 0.12);
    stroke-width: 1.5;
    stroke-dasharray: 20 30;
    stroke-dashoffset: 0;
    animation: flow-current 16s linear infinite;
}

.deep-current--2 {
    stroke: rgba(0, 210, 255, 0.08);
    animation-duration: 20s;
    animation-direction: reverse;
}

@keyframes flow-current {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -100; }
}

/* ============================================================
   Wave Sine SVG
   ============================================================ */

.wave-sine-svg {
    position: absolute;
    top: 110vh;
    left: 0;
    width: 100%;
    height: 100px;
}

.wave-sine {
    fill: none;
    stroke: rgba(0, 210, 255, 0.12);
    stroke-width: 1.5;
    stroke-dasharray: 15 25;
    animation: flow-wave 12s linear infinite;
}

@keyframes flow-wave {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -80; }
}

/* ============================================================
   Neural Spiral SVG
   ============================================================ */

.neural-spiral-svg {
    position: absolute;
    right: -5%;
    top: 20%;
    width: 400px;
    height: 400px;
    opacity: 0.15;
}

.neural-spiral {
    fill: none;
    stroke: rgba(0, 210, 255, 0.2);
    stroke-width: 1.5;
    stroke-dasharray: 10 15;
    animation: flow-spiral 18s linear infinite;
}

@keyframes flow-spiral {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -50; }
}

/* ============================================================
   Bioluminescent Particles
   ============================================================ */

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 210, 255, 0.6), transparent);
    animation: bioluminesce var(--particle-duration, 18s) linear infinite;
    opacity: 0;
}

.particle--1  { width: 4px; height: 4px; left: 8%;  top: 60vh;  --particle-duration: 18s; animation-delay: 0s; }
.particle--2  { width: 6px; height: 6px; left: 15%; top: 80vh;  --particle-duration: 22s; animation-delay: 2s; }
.particle--3  { width: 3px; height: 3px; left: 25%; top: 50vh;  --particle-duration: 15s; animation-delay: 4s; }
.particle--4  { width: 5px; height: 5px; left: 35%; top: 90vh;  --particle-duration: 20s; animation-delay: 1s; }
.particle--5  { width: 7px; height: 7px; left: 45%; top: 70vh;  --particle-duration: 25s; animation-delay: 3s; }
.particle--6  { width: 4px; height: 4px; left: 55%; top: 55vh;  --particle-duration: 17s; animation-delay: 5s; }
.particle--7  { width: 6px; height: 6px; left: 65%; top: 85vh;  --particle-duration: 21s; animation-delay: 0.5s; }
.particle--8  { width: 3px; height: 3px; left: 72%; top: 45vh;  --particle-duration: 16s; animation-delay: 2.5s; }
.particle--9  { width: 8px; height: 8px; left: 80%; top: 75vh;  --particle-duration: 23s; animation-delay: 4.5s; }
.particle--10 { width: 5px; height: 5px; left: 88%; top: 65vh;  --particle-duration: 19s; animation-delay: 1.5s; }
.particle--11 { width: 4px; height: 4px; left: 12%; top: 120vh; --particle-duration: 20s; animation-delay: 6s; }
.particle--12 { width: 6px; height: 6px; left: 30%; top: 140vh; --particle-duration: 22s; animation-delay: 7s; }
.particle--13 { width: 3px; height: 3px; left: 48%; top: 110vh; --particle-duration: 16s; animation-delay: 8s; }
.particle--14 { width: 5px; height: 5px; left: 60%; top: 130vh; --particle-duration: 18s; animation-delay: 3.5s; }
.particle--15 { width: 7px; height: 7px; left: 78%; top: 150vh; --particle-duration: 24s; animation-delay: 5.5s; }
.particle--16 { width: 4px; height: 4px; left: 20%; top: 170vh; --particle-duration: 19s; animation-delay: 9s; }
.particle--17 { width: 6px; height: 6px; left: 42%; top: 160vh; --particle-duration: 21s; animation-delay: 10s; }
.particle--18 { width: 3px; height: 3px; left: 58%; top: 180vh; --particle-duration: 15s; animation-delay: 11s; }
.particle--19 { width: 5px; height: 5px; left: 75%; top: 200vh; --particle-duration: 20s; animation-delay: 6.5s; }
.particle--20 { width: 8px; height: 8px; left: 90%; top: 190vh; --particle-duration: 23s; animation-delay: 7.5s; }

@keyframes bioluminesce {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.2;
    }
    25% {
        transform: translateY(-50px) translateX(15px);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-100px) translateX(-10px);
        opacity: 0.5;
    }
    75% {
        transform: translateY(-150px) translateX(20px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-200px) translateX(5px);
        opacity: 0.2;
    }
}

/* ============================================================
   Thermocline Particles
   ============================================================ */

.thermocline {
    position: relative;
    height: 30vh;
    background: linear-gradient(180deg, #060d18 0%, #0a1223 30%, #0f1d3a 70%, rgba(10, 143, 158, 0.1) 100%);
    overflow: hidden;
}

.thermocline__particles {
    position: absolute;
    inset: 0;
}

.thermo-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 210, 255, 0.5), transparent);
    animation: thermo-rise var(--rise-duration, 12s) ease-in-out infinite;
}

.thermo-particle--1 { width: 3px; height: 3px; left: 10%; bottom: 0; --rise-duration: 10s; animation-delay: 0s; }
.thermo-particle--2 { width: 5px; height: 5px; left: 22%; bottom: 0; --rise-duration: 14s; animation-delay: 1.5s; }
.thermo-particle--3 { width: 4px; height: 4px; left: 35%; bottom: 0; --rise-duration: 11s; animation-delay: 3s; }
.thermo-particle--4 { width: 6px; height: 6px; left: 48%; bottom: 0; --rise-duration: 16s; animation-delay: 0.5s; }
.thermo-particle--5 { width: 3px; height: 3px; left: 60%; bottom: 0; --rise-duration: 13s; animation-delay: 2s; }
.thermo-particle--6 { width: 5px; height: 5px; left: 72%; bottom: 0; --rise-duration: 15s; animation-delay: 4s; }
.thermo-particle--7 { width: 4px; height: 4px; left: 84%; bottom: 0; --rise-duration: 12s; animation-delay: 5s; }
.thermo-particle--8 { width: 6px; height: 6px; left: 92%; bottom: 0; --rise-duration: 18s; animation-delay: 1s; }

@keyframes thermo-rise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-15vh) translateX(10px);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-30vh) translateX(-5px);
        opacity: 0;
    }
}

/* ============================================================
   Navigation Organism
   ============================================================ */

.nav-organism {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(10, 18, 35, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 210, 255, 0.12);
    transform: translateY(-100%);
    transition: transform 500ms ease-out;
    pointer-events: none;
}

.nav-organism.visible {
    transform: translateY(0);
    pointer-events: auto;
}

.nav-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.nav-link {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frost-veil);
    text-decoration: none;
    transition: color 300ms ease;
}

.nav-link:hover {
    color: var(--bioluminescent-cyan);
}

/* ============================================================
   Hero: The Abyss
   ============================================================ */

.hero {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero__content {
    text-align: center;
    z-index: 5;
}

.hero__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--abalone-pearl);
    margin-bottom: 1.5rem;
}

.hero__title-main {
    display: inline;
    background: linear-gradient(90deg, #c8e6f5, #00d2ff, #e8f4f8, #00d2ff, #c8e6f5);
    background-size: 300% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(30px);
}

.hero__title-main.animate-in {
    animation: hero-fade-up 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards,
               shimmer 8s ease-in-out 1 forwards;
    animation-delay: 0ms, 900ms;
}

.hero__title-main.shimmer-hover {
    animation: shimmer 4s ease-in-out 1;
}

.hero__title-main.done {
    opacity: 1;
    transform: translateY(0);
    -webkit-text-fill-color: transparent;
    background: linear-gradient(90deg, #c8e6f5, #00d2ff, #e8f4f8, #00d2ff, #c8e6f5);
    background-size: 300% 100%;
    background-position: 0% 0%;
    background-clip: text;
    -webkit-background-clip: text;
}

.hero__title-suffix {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: -0.02em;
    color: var(--frost-veil);
    background: rgba(15, 29, 58, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(150, 220, 255, 0.15);
    border-radius: 8px;
    padding: 0.15em 0.4em;
    margin-left: 0.2em;
    vertical-align: baseline;
    opacity: 0;
    transform: translateX(30px);
}

.hero__title-suffix.animate-in {
    animation: suffix-slide-in 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__title-suffix.done {
    opacity: 1;
    transform: translateX(0);
}

.hero__tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 400;
    color: var(--frost-veil);
    letter-spacing: 0.01em;
    line-height: 1.6;
    max-width: 36rem;
    margin: 0 auto;
    opacity: 0;
}

.hero__tagline.animate-in {
    animation: hero-fade-up 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__tagline.done {
    opacity: 1;
    transform: translateY(0);
}

.hero__scroll-cue {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    z-index: 5;
}

.hero__scroll-cue.animate-in {
    animation: hero-fade-up 500ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__scroll-cue.done {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hero__scroll-cue svg {
    animation: bounce-cue 2s ease-in-out infinite;
}

@keyframes hero-fade-up {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes suffix-slide-in {
    0% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes bounce-cue {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ============================================================
   Content Sections
   ============================================================ */

.content-section {
    position: relative;
    padding: clamp(4rem, 10vh, 8rem) 0;
}

.section-container {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 4rem);
}

/* Frost Panel */
.frost-panel {
    background: rgba(200, 230, 245, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(150, 220, 255, 0.1);
}

/* Open Water */
.open-water {
    background: transparent;
}

.open-water .section-heading {
    letter-spacing: 0.03em;
}

/* ============================================================
   Typography
   ============================================================ */

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: 0.01em;
    color: var(--abalone-pearl);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.subsection-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    letter-spacing: 0.03em;
    color: var(--abalone-pearl);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    font-weight: 400;
    color: var(--frost-veil);
    line-height: 1.7;
    letter-spacing: 0.01em;
    margin-bottom: 1.25rem;
}

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

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1rem);
    letter-spacing: -0.02em;
    color: var(--bioluminescent-cyan);
}

.mono-accent {
    font-style: italic;
    color: var(--abalone-pearl);
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    text-align: center;
}

.code-block {
    padding: 1rem 1.5rem;
    border-left: 2px solid rgba(0, 210, 255, 0.25);
    background: rgba(15, 29, 58, 0.3);
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.code-annotation {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    color: rgba(200, 230, 245, 0.5);
    line-height: 1.5;
}

/* ============================================================
   Pulse Line (Section Divider)
   ============================================================ */

.pulse-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 210, 255, 0.3), transparent);
    margin: 1.5rem 0;
    animation: pulse-line 4s ease-in-out infinite;
}

@keyframes pulse-line {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ============================================================
   Frost Cards
   ============================================================ */

.frost-card {
    background: rgba(15, 29, 58, 0.4);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(0, 210, 255, 0.08);
    border-radius: 12px;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 1.5rem;
    box-shadow: inset 0 1px 0 rgba(200, 230, 245, 0.05), 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: border-color 400ms ease, box-shadow 400ms ease;
    position: relative;
    overflow: hidden;
}

.frost-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle 200px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 210, 255, 0.04), transparent);
    opacity: 0;
    transition: opacity 400ms ease;
    pointer-events: none;
}

.frost-card:hover {
    border-color: rgba(0, 210, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(200, 230, 245, 0.08), 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 210, 255, 0.05);
}

.frost-card:hover::before {
    opacity: 1;
}

.frost-card:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Section Reveal Animations
   ============================================================ */

.section-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.section-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    padding: clamp(3rem, 6vh, 5rem) 0;
    text-align: center;
}

.footer-text {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.footer-caption {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    color: rgba(200, 230, 245, 0.4);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.5;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .nav-inner {
        gap: 1rem;
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.75rem;
    }

    .neural-spiral-svg {
        width: 250px;
        height: 250px;
        right: -10%;
    }

    .hero__title-suffix {
        font-size: clamp(1.2rem, 3vw, 2rem);
    }
}

@media (max-width: 480px) {
    .nav-inner {
        gap: 0.75rem;
    }

    .frost-card {
        padding: 1.25rem;
    }
}
