/* ============================================
   SSETTL.com — Seapunk Zen
   Monochrome Aquatic Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deepest-bg: #0b0d10;
    --primary-bg: #161a1f;
    --surface-fill: #22272e;
    --divider: #3a4049;
    --secondary-text: #8a9099;
    --primary-text: #d4d8dc;
    --brightest: #e8edf2;
    --mid-dark: #1c2127;
    --muted-line: #b8b8b8;
    --glow: rgba(200, 220, 235, 0.12);
    --glow-pulse-off: rgba(180, 210, 230, 0.0);
    --glow-pulse-on: rgba(180, 210, 230, 0.08);
    --col-gap: clamp(1.5rem, 3vw, 4rem);
    --headline-size: clamp(2.8rem, 7vw, 6rem);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 1.0625rem;
    line-height: 1.85;
    color: var(--primary-text);
    background: var(--primary-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
.headline {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: var(--headline-size);
    letter-spacing: 0.01em;
    line-height: 1.1;
    color: var(--brightest);
    text-shadow: 0 0 40px rgba(180, 200, 210, 0.15);
}

.headline-smaller {
    font-size: clamp(2.2rem, 5.5vw, 4.5rem);
}

.headline-smallest {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
}

.body-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 1.0625rem;
    line-height: 1.85;
    color: var(--primary-text);
    max-width: 38ch;
    margin-top: 1.5rem;
}

.body-text-dense {
    font-size: 0.9375rem;
    line-height: 1.75;
    max-width: 34ch;
    margin-top: 1rem;
}

.label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted-line);
    line-height: 1.5;
}

/* --- Stagger Reveal --- */
.stagger-reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.stagger-reveal .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

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

/* --- Navigation Glyph --- */
.nav-glyph {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    cursor: pointer;
}

.nav-glyph-inner {
    width: 44px;
    height: 44px;
    border: 1px solid var(--divider);
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: border-radius 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), border-color 0.4s ease;
    position: relative;
    background: rgba(22, 26, 31, 0.8);
    backdrop-filter: blur(8px);
}

.nav-glyph:hover .nav-glyph-inner {
    border-radius: 30% 70% 60% 40% / 60% 30% 70% 40%;
    border-color: var(--secondary-text);
}

.nav-glyph-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary-text);
    animation: glyphPulse 3s ease-in-out infinite;
}

@keyframes glyphPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.nav-menu {
    position: absolute;
    top: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    background: rgba(22, 26, 31, 0.9);
    backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border: 1px solid var(--divider);
    border-radius: 8px;
    min-width: 120px;
}

.nav-glyph.active .nav-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* --- Depth Sections --- */
.depth-section {
    min-height: 100vh;
    position: relative;
    display: grid;
    overflow: hidden;
    scroll-snap-align: start;
}

.section-bg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.section-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--col-gap);
    padding: clamp(3rem, 8vh, 8rem) clamp(1.5rem, 4vw, 4rem);
    align-content: center;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

.content-left .floating-island {
    grid-column: 1 / 6;
}

.content-right .floating-island {
    grid-column: 4 / 9;
}

.content-center-settled .floating-island {
    grid-column: 2 / 7;
}

/* --- Section Backgrounds (Descent narrative) --- */
.section-surface {
    background: linear-gradient(to bottom, #1c2127, var(--primary-bg));
}

.section-drift {
    background: var(--primary-bg);
}

.section-descent {
    background: linear-gradient(to bottom, var(--primary-bg), var(--mid-dark));
}

.section-depths {
    background: linear-gradient(to bottom, var(--mid-dark), var(--deepest-bg));
}

.section-settled {
    background: var(--deepest-bg);
}

/* --- Floating Islands --- */
.floating-island {
    transition: transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.island-meta {
    grid-column: 1 / 4;
    align-self: end;
    padding-bottom: 2rem;
}

.island-meta .label {
    margin-top: 0.25rem;
}

/* --- Hero Bubble --- */
.hero-bubble {
    grid-column: 2 / 7;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(220px, 40vw, 320px);
    height: clamp(220px, 40vw, 320px);
}

.hero-bubble-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-bubble-path {
    animation: heroBubbleMorph 20s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}

@keyframes heroBubbleMorph {
    0% {
        d: path("M150,10 C220,10 280,50 290,120 C300,190 260,260 190,285 C120,310 40,270 15,200 C-10,130 30,50 90,20 C110,12 130,10 150,10 Z");
    }
    25% {
        d: path("M150,15 C230,5 290,70 285,140 C280,210 240,270 170,290 C100,310 30,260 10,190 C-10,120 40,40 100,15 C120,8 140,15 150,15 Z");
    }
    50% {
        d: path("M150,20 C210,0 285,55 295,130 C305,205 255,275 180,295 C105,315 25,265 5,195 C-15,125 35,35 95,10 C115,2 135,20 150,20 Z");
    }
    75% {
        d: path("M150,8 C225,15 275,60 288,130 C300,200 250,265 185,288 C115,310 35,275 12,205 C-10,135 25,45 85,18 C105,8 135,8 150,8 Z");
    }
    100% {
        d: path("M150,10 C220,10 280,50 290,120 C300,190 260,260 190,285 C120,310 40,270 15,200 C-10,130 30,50 90,20 C110,12 130,10 150,10 Z");
    }
}

.hero-bubble-text {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-bubble-text .headline {
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.05em;
}

.hero-bubble-text .label {
    margin-top: 0.5rem;
}

/* --- Morph Dividers --- */
.morph-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    z-index: 1;
    pointer-events: none;
}

.morph-divider svg {
    width: 100%;
    height: 100%;
    display: block;
}

.morph-path {
    fill: none;
    stroke: var(--divider);
    stroke-width: 0.5;
    animation: morphDivider 20s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.section-surface .morph-path {
    stroke: rgba(58, 64, 73, 0.5);
}

@keyframes morphDivider {
    0% {
        d: path("M0,60 C360,20 720,100 1080,40 C1260,20 1380,70 1440,60 L1440,120 L0,120 Z");
    }
    50% {
        d: path("M0,40 C240,80 480,20 720,70 C960,120 1200,30 1440,50 L1440,120 L0,120 Z");
    }
    100% {
        d: path("M0,70 C300,30 600,90 900,50 C1100,30 1300,80 1440,45 L1440,120 L0,120 Z");
    }
}

/* --- Void Zones --- */
.void-zone {
    height: clamp(40vh, 50vh, 60vh);
    position: relative;
    background: var(--primary-bg);
    overflow: hidden;
}

.void-zone-deep {
    background: linear-gradient(to bottom, var(--mid-dark), var(--deepest-bg));
}

.void-zone-deepest {
    background: var(--deepest-bg);
}

/* --- Bubble System --- */
.bubble-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border: 1px solid rgba(200, 220, 235, 0.08);
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
    will-change: transform;
    backdrop-filter: blur(1px);
}

.bubble-inner {
    width: 100%;
    height: 100%;
    animation: bubbleSway var(--sway-duration) ease-in-out infinite alternate;
}

@keyframes bubbleRise {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-110vh);
        opacity: 0;
    }
}

@keyframes bubbleSway {
    0% { transform: translateX(calc(var(--sway) * -1)); }
    100% { transform: translateX(var(--sway)); }
}

/* --- Bubble Clusters (in void zones) --- */
.bubble-cluster {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
}

/* --- Morph Blobs --- */
.morph-blob {
    position: absolute;
    width: clamp(120px, 20vw, 250px);
    height: clamp(120px, 20vw, 250px);
    border-radius: 30% 70% 60% 40% / 60% 30% 70% 40%;
    background: radial-gradient(ellipse at center, var(--glow-pulse-on), var(--glow-pulse-off));
    animation: morphBlob 18s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
    pointer-events: none;
}

.morph-blob-ambient {
    top: 20%;
    right: 15%;
}

.morph-blob-deep {
    top: 30%;
    left: 10%;
}

@keyframes morphBlob {
    0% {
        border-radius: 30% 70% 60% 40% / 60% 30% 70% 40%;
        opacity: 0.4;
    }
    25% {
        border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%;
        opacity: 0.7;
    }
    50% {
        border-radius: 40% 60% 70% 30% / 70% 40% 60% 30%;
        opacity: 0.5;
    }
    75% {
        border-radius: 70% 30% 50% 50% / 30% 70% 50% 50%;
        opacity: 0.8;
    }
    100% {
        border-radius: 30% 70% 60% 40% / 60% 30% 70% 40%;
        opacity: 0.4;
    }
}

/* --- Bioluminescent Dots --- */
.biolum-cluster {
    grid-column: 5 / 9;
    position: relative;
    min-height: 200px;
}

.biolum-dot {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: rgba(200, 220, 235, 0.6);
    left: var(--x);
    top: var(--y);
    box-shadow: 0 0 12px 4px rgba(200, 220, 235, 0.15), 0 0 30px 8px rgba(180, 210, 230, 0.08);
    animation: biolumPulse 6s ease-in-out var(--delay) infinite;
}

@keyframes biolumPulse {
    0%, 100% {
        opacity: 0.1;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* --- Sediment Visual --- */
.sediment-visual {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 4px;
    overflow: hidden;
    height: 160px;
}

.sediment-layer {
    flex: 1;
    transition: transform 0.8s ease;
    position: relative;
}

.sediment-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent, rgba(200, 220, 235, 0.03));
}

/* --- Asymmetric Connector --- */
.asymmetric-connector {
    grid-column: 5 / 6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.connector-line {
    width: 1px;
    height: 0;
    background: var(--divider);
    transition: height 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.connector-line.animated {
    height: 80px;
}

/* --- Ripple Visual --- */
.ripple-visual {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ripple-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 1px solid rgba(200, 220, 235, 0.1);
    border-radius: 50%;
    animation: rippleExpand 9s ease-out var(--delay) infinite;
}

@keyframes rippleExpand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 0.8;
        border-color: rgba(200, 220, 235, 0.15);
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        border-color: rgba(200, 220, 235, 0.0);
    }
}

/* --- Floor Particles --- */
.floor-particles {
    grid-column: 1 / -1;
    position: relative;
    height: 60px;
    margin-top: 3rem;
}

.floor-particle {
    position: absolute;
    bottom: 0;
    left: var(--x);
    width: 2px;
    height: 2px;
    background: var(--secondary-text);
    border-radius: 50%;
    animation: particleSettle 8s ease-in var(--delay) infinite;
    opacity: 0;
}

@keyframes particleSettle {
    0% {
        transform: translateY(-60px);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    80% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(0);
        opacity: 0;
    }
}

/* --- Settled Footer --- */
.settled-footer {
    grid-column: 2 / 7;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--divider);
}

.settled-footer .label {
    margin-top: 0.25rem;
}

/* --- Glow / Bioluminescent Pulse Background --- */
.section-descent .section-bg-layer {
    background: radial-gradient(ellipse 40% 50% at 70% 40%, var(--glow-pulse-on), transparent);
    animation: bgBiolum 12s ease-in-out infinite;
}

.section-depths .section-bg-layer {
    background: radial-gradient(ellipse 30% 40% at 30% 60%, rgba(180, 210, 230, 0.04), transparent);
    animation: bgBiolum 15s ease-in-out infinite;
}

@keyframes bgBiolum {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* --- Prefers Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .hero-bubble-path,
    .morph-path,
    .morph-blob,
    .bubble,
    .bubble-inner,
    .biolum-dot,
    .ripple-ring,
    .floor-particle,
    .nav-glyph-pulse {
        animation: none !important;
    }

    .stagger-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .stagger-reveal .char {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-content {
        grid-template-columns: repeat(4, 1fr);
        padding: clamp(2rem, 6vh, 4rem) clamp(1rem, 3vw, 2rem);
    }

    .content-left .floating-island,
    .content-right .floating-island,
    .content-center-settled .floating-island {
        grid-column: 1 / -1;
    }

    .hero-bubble {
        grid-column: 1 / -1;
        width: clamp(180px, 60vw, 280px);
        height: clamp(180px, 60vw, 280px);
        justify-self: center;
    }

    .island-meta {
        grid-column: 1 / -1;
    }

    .biolum-cluster {
        grid-column: 1 / -1;
    }

    .asymmetric-connector {
        grid-column: 1 / -1;
    }

    .island-secondary {
        grid-column: 1 / -1;
    }

    .settled-footer {
        grid-column: 1 / -1;
    }

    .floor-particles {
        grid-column: 1 / -1;
    }

    .nav-glyph {
        top: 1rem;
        right: 1rem;
    }
}
