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

:root {
    --bg-deep: #071E3D;
    --bg-mid: #0A3D5C;
    --bg-surface: #0E2A47;
    --bg-sediment: #0C1B2E;
    --text-primary: #D4E4ED;
    --text-secondary: #8A9AAC;
    --text-body: #B8C8D6;
    --accent-bio: #0AFFCE;
    --accent-gold: #E8A838;
    --accent-red: #C4443A;
    --depth-factor: 0;
    --sediment-ease: cubic-bezier(0.23, 0.85, 0.32, 1.0);
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-body);
    background-color: var(--bg-deep);
    overflow-x: hidden;
    position: relative;
}

/* ===== MARINE SNOW CANVAS ===== */
#marine-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ===== DEPTH GAUGE ===== */
#depth-gauge {
    position: fixed;
    right: 0;
    top: 0;
    width: 8px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

#depth-gauge-track {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: rgba(10, 255, 206, 0.06);
}

#depth-gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--accent-bio), rgba(10, 255, 206, 0.3));
    transition: height 0.3s var(--sediment-ease);
}

.depth-marker {
    position: absolute;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    opacity: 0.4;
    transition: opacity 0.6s var(--sediment-ease);
}

.depth-marker.active {
    opacity: 1;
}

.depth-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent-bio);
    line-height: 1;
}

.depth-zone-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    line-height: 1;
    margin-top: 2px;
}

/* ===== DEPTH ZONES ===== */
.depth-zone {
    position: relative;
    min-height: 100vh;
    z-index: 2;
    padding: 80px 40px;
}

#zone-epipelagic {
    background: linear-gradient(180deg, #0A3D5C 0%, #071E3D 100%);
    min-height: 120vh;
    padding-top: 100px;
}

#zone-mesopelagic {
    background: linear-gradient(180deg, #071E3D 0%, #0C1B2E 100%);
    min-height: 110vh;
}

#zone-bathypelagic {
    background: linear-gradient(180deg, #0C1B2E 0%, #060E1A 100%);
    min-height: 110vh;
}

#zone-abyssal {
    background: #060E1A;
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== ZONE HEADERS ===== */
.zone-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 5;
}

.zone-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(72px, 10vw, 120px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(10, 255, 206, 0.15), 0 0 60px rgba(10, 255, 206, 0.05);
    line-height: 1;
}

.zone-title-small {
    font-size: clamp(48px, 6vw, 72px);
}

.zone-depth-reading {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent-bio);
    display: block;
    margin-top: 12px;
}

/* ===== HEXAGONAL GRID ===== */
.hex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    max-width: 1100px;
    margin: 0 auto;
    transform: rotate(3deg);
    gap: 8px;
    padding: 20px;
}

.hex-grid-dense .hex-cell {
    opacity: 0;
    transform: translateY(30px) translateX(var(--hex-dart, 0px));
    transition: opacity 0.8s var(--sediment-ease), transform 0.8s var(--sediment-ease);
}

.hex-grid-dense .hex-cell.visible {
    opacity: 1;
    transform: translateY(0) translateX(0);
}

.hex-grid-sparse {
    gap: 16px;
}

.hex-grid-sparse .hex-cell {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s var(--sediment-ease), transform 1s var(--sediment-ease);
}

.hex-grid-sparse .hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== HEX CELLS ===== */
.hex-cell {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: var(--bg-sediment);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
    transition: background 0.4s var(--sediment-ease);
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: radial-gradient(ellipse at center, rgba(10, 255, 206, 0.12) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.6s var(--sediment-ease);
    pointer-events: none;
    z-index: 1;
}

.hex-cell.hex-glow::before {
    opacity: 1;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    border: 1px solid rgba(10, 255, 206, 0);
    transition: border-color 0.4s var(--sediment-ease);
    pointer-events: none;
    z-index: 2;
}

.hex-cell:hover::after {
    border-color: rgba(10, 255, 206, 0.4);
}

.hex-inner {
    padding: 30px 20px;
    text-align: center;
    transform: rotate(-3deg);
    position: relative;
    z-index: 3;
    width: 100%;
}

/* Hex sizes */
.hex-size-1 {
    width: 120px;
    height: 138px;
    flex-shrink: 0;
}

.hex-size-3 {
    width: 260px;
    height: 300px;
    flex-shrink: 0;
}

.hex-size-7 {
    width: 400px;
    height: 460px;
    flex-shrink: 0;
}

.hex-empty {
    background: transparent;
    opacity: 0.1;
}

/* Hex content typography */
.hex-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(10, 255, 206, 0.15), 0 0 60px rgba(10, 255, 206, 0.05);
    margin-bottom: 16px;
    line-height: 1.1;
}

.hex-subheading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(22px, 3vw, 32px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(10, 255, 206, 0.1);
    margin-bottom: 12px;
    line-height: 1.1;
}

.hex-body {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-body);
}

.hex-data {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent-bio);
}

/* Hex flash effects */
.hex-flash-gold.visible {
    animation: flashGold 2s 1s var(--sediment-ease) forwards;
}

.hex-flash-red.visible {
    animation: flashRed 2s 1.2s var(--sediment-ease) forwards;
}

@keyframes flashGold {
    0%, 100% { background: var(--bg-sediment); }
    30% { background: linear-gradient(135deg, var(--bg-sediment), rgba(232, 168, 56, 0.25)); }
    70% { background: linear-gradient(135deg, var(--bg-sediment), rgba(232, 168, 56, 0.15)); }
}

@keyframes flashRed {
    0%, 100% { background: var(--bg-sediment); }
    30% { background: linear-gradient(135deg, var(--bg-sediment), rgba(196, 68, 58, 0.25)); }
    70% { background: linear-gradient(135deg, var(--bg-sediment), rgba(196, 68, 58, 0.15)); }
}

/* Chevron pattern cell */
.chevron-cell {
    display: block;
    width: 60px;
    height: 60px;
    background: repeating-linear-gradient(
        60deg,
        transparent,
        transparent 8px,
        rgba(10, 255, 206, 0.08) 8px,
        rgba(10, 255, 206, 0.08) 10px
    ),
    repeating-linear-gradient(
        -60deg,
        transparent,
        transparent 8px,
        rgba(10, 255, 206, 0.08) 8px,
        rgba(10, 255, 206, 0.08) 10px
    );
    margin: 0 auto;
}

/* Radiolarian SVGs */
.radiolarian {
    width: 60px;
    height: 60px;
    color: var(--accent-bio);
    opacity: 0.3;
    animation: radiolarian-spin 120s linear infinite;
}

@keyframes radiolarian-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== FILAMENT NETWORK (Zone 3) ===== */
.filament-network {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 800px;
}

.filament-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.filament-line {
    stroke: var(--accent-bio);
    stroke-width: 1;
    opacity: 0.1;
    animation: filament-pulse 4s ease-in-out infinite alternate;
}

.filament-line:nth-child(2) { animation-delay: 0.5s; }
.filament-line:nth-child(3) { animation-delay: 1s; }
.filament-line:nth-child(4) { animation-delay: 1.5s; }
.filament-line:nth-child(5) { animation-delay: 2s; }
.filament-line:nth-child(6) { animation-delay: 2.5s; }
.filament-line:nth-child(7) { animation-delay: 3s; }

@keyframes filament-pulse {
    from { opacity: 0.05; }
    to { opacity: 0.15; }
}

/* Content nodes */
.content-node {
    position: absolute;
    max-width: 280px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s var(--sediment-ease), transform 1.2s var(--sediment-ease);
}

.content-node.visible {
    opacity: 1;
    transform: translateY(0);
}

.node-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(10, 255, 206, 0.1);
    margin-bottom: 8px;
}

.node-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.node-text-secondary {
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 4px;
}

.node-data {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 32px;
    letter-spacing: 0.08em;
    color: var(--accent-bio);
    display: block;
    text-shadow: 0 0 20px rgba(10, 255, 206, 0.3);
}

/* ===== ABYSSAL ZONE ===== */
.abyssal-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    position: relative;
    z-index: 5;
}

.abyssal-hex {
    width: min(80vw, 700px);
    height: min(80vw, 700px);
    max-height: 80vh;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: var(--bg-sediment);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 2s var(--sediment-ease), transform 2s var(--sediment-ease);
}

.abyssal-hex.visible {
    opacity: 1;
    transform: scale(1);
}

.abyssal-hex-glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(ellipse at center, rgba(10, 255, 206, 0.15) 0%, transparent 60%);
    animation: abyssal-glow 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes abyssal-glow {
    from { opacity: 0.5; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.05); }
}

.abyssal-hex-inner {
    padding: 60px 40px;
    text-align: center;
    max-width: 480px;
}

.abyssal-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(48px, 8vw, 96px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 40px rgba(10, 255, 206, 0.2), 0 0 80px rgba(10, 255, 206, 0.08);
    margin-bottom: 24px;
    line-height: 1;
}

.abyssal-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.abyssal-coord {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--accent-bio);
    opacity: 0.6;
}

.abyss-fade {
    height: 200px;
    width: 100%;
    position: relative;
    z-index: 5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .depth-zone {
        padding: 60px 20px;
    }

    .hex-grid {
        transform: rotate(0deg);
        gap: 6px;
    }

    .hex-inner {
        transform: rotate(0deg);
        padding: 20px 15px;
    }

    .hex-size-1 {
        width: 80px;
        height: 92px;
    }

    .hex-size-3 {
        width: 180px;
        height: 207px;
    }

    .hex-size-7 {
        width: 280px;
        height: 322px;
    }

    .hex-heading {
        font-size: 24px;
    }

    .hex-body {
        font-size: 13px;
    }

    .filament-network {
        min-height: 600px;
    }

    .content-node {
        max-width: 200px;
        position: relative;
        left: auto !important;
        top: auto !important;
        margin: 20px auto;
    }

    .filament-svg {
        display: none;
    }

    .abyssal-hex-inner {
        padding: 40px 24px;
    }

    .abyssal-heading {
        font-size: 36px;
    }

    .depth-marker {
        display: none;
    }

    #depth-gauge {
        width: 4px;
    }

    #depth-gauge-track {
        width: 4px;
    }
}

@media (max-width: 480px) {
    .hex-size-1 {
        width: 60px;
        height: 69px;
    }

    .hex-size-3 {
        width: 140px;
        height: 161px;
    }

    .hex-size-7 {
        width: 220px;
        height: 253px;
    }

    .hex-body {
        font-size: 12px;
        line-height: 1.5;
    }

    .hex-data {
        font-size: 14px;
    }
}
