:root {
    --abyssal-ink: #0a0e1a;
    --twilight-navy: #0f2027;
    --reef-teal: #00d4aa;
    --caustic-cyan: #00e5ff;
    --jellyfish-rose: #ff6eb4;
    --sunlit-foam: #e0f7fa;
    --pearl-mist: #f0fdfa;
    --phosphor-white: #e8f5f1;
    --deep-current: #0d3b3b;
    --angler-gold: #ffd700;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--sunlit-foam);
    color: var(--deep-current);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Depth Gauge */
.depth-gauge {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.gauge-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--reef-teal);
    opacity: 0.2;
}

.gauge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--reef-teal);
    opacity: 0.3;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: opacity 400ms ease, box-shadow 400ms ease;
}

.gauge-dot.active {
    opacity: 1;
    box-shadow: 0 0 8px var(--reef-teal);
}

/* Zones */
.zone {
    position: relative;
    overflow: hidden;
}

/* Surface */
.zone-surface {
    min-height: 100vh;
    background: var(--sunlit-foam);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 15vw;
    text-align: center;
}

.caustic-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(0, 229, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(0, 212, 170, 0.06) 0%, transparent 50%);
    animation: caustic-shift 18s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes caustic-shift {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05) translateX(2%); }
    100% { opacity: 0.8; transform: scale(1) translateX(-1%); }
}

.surface-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: var(--deep-current);
    letter-spacing: 0.04em;
    line-height: 1.1;
    position: relative;
    z-index: 2;
}

.surface-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--deep-current);
    max-width: 38em;
    margin-top: 1.5rem;
    opacity: 0.7;
    position: relative;
    z-index: 2;
}

.scroll-hint {
    position: absolute;
    bottom: 3rem;
    animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
}

/* Shallows */
.zone-shallows {
    min-height: 150vh;
    background: linear-gradient(180deg, #e0f7fa 0%, #80cbc4 40%, #26a69a 100%);
    position: relative;
    padding: clamp(4rem, 8vh, 8rem) clamp(2rem, 4vw, 4rem);
}

.zone-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 3rem;
    text-align: center;
    color: var(--deep-current);
}

.zone-heading.light {
    color: var(--phosphor-white);
}

/* Radiolarian background */
.radiolarian-bg {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            60deg,
            transparent,
            transparent 28px,
            rgba(13, 59, 59, 0.04) 28px,
            rgba(13, 59, 59, 0.04) 29px
        ),
        repeating-linear-gradient(
            -60deg,
            transparent,
            transparent 28px,
            rgba(13, 59, 59, 0.04) 28px,
            rgba(13, 59, 59, 0.04) 29px
        );
    pointer-events: none;
}

/* Card Flip Tiles */
.flip-tile {
    position: absolute;
    left: var(--x, 10%);
    top: var(--y, 10vh);
    width: 280px;
    height: 180px;
    perspective: 1000px;
    transform: rotate(var(--rot, 0deg));
    cursor: pointer;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 600ms ease-in-out;
    transform-style: preserve-3d;
}

.flip-tile:hover .flip-inner,
.flip-tile.flipped .flip-inner {
    transform: rotateY(180deg);
    box-shadow: 0 0 20px rgba(255, 110, 180, 0.3);
}

.flip-front, .flip-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.flip-front {
    background: rgba(240, 253, 250, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.flip-back {
    background: rgba(240, 253, 250, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 212, 170, 0.4);
    transform: rotateY(180deg);
}

.tile-keyword {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--deep-current);
    letter-spacing: 0.03em;
}

.flip-back p {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--deep-current);
    line-height: 1.5;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    background: rgba(0, 212, 170, 0.12);
    padding: 1px 4px;
    border-radius: 2px;
}

/* Twilight Zone */
.zone-twilight {
    min-height: 200vh;
    background: linear-gradient(180deg, #26a69a 0%, var(--twilight-navy) 30%);
    padding: clamp(6rem, 12vh, 10rem) clamp(2rem, 6vw, 6rem);
    position: relative;
}

.dep-graph {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.graph-node {
    animation: node-breathe 4s ease-in-out infinite;
}

.graph-node:nth-child(even) { animation-delay: -2s; }

@keyframes node-breathe {
    0%, 100% { r: 8; opacity: 0.3; }
    50% { r: 9.5; opacity: 0.5; }
}

.graph-edge {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.graph-edge.drawn {
    stroke-dashoffset: 0;
}

.twilight-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6rem;
    max-width: 42em;
}

.content-panel {
    background: rgba(15, 32, 39, 0.7);
    border-left: 3px solid var(--reef-teal);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border-radius: 4px;
}

.light-text {
    color: var(--phosphor-white);
    margin-bottom: 1rem;
    max-width: 38em;
}

/* Abyss */
.zone-abyss {
    min-height: 150vh;
    background: linear-gradient(180deg, var(--twilight-navy) 0%, var(--abyssal-ink) 100%);
    position: relative;
    padding: 8rem 2rem;
}

.abyss-node {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--reef-teal);
    opacity: 0.3;
    transition: opacity 500ms ease;
    text-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
    white-space: nowrap;
}

.abyss-node.glowing {
    opacity: 1;
    text-shadow: 0 0 30px rgba(0, 212, 170, 0.6);
}

.abyss-node.accent-rose {
    color: var(--jellyfish-rose);
    text-shadow: 0 0 20px rgba(255, 110, 180, 0.3);
}

.abyss-node.accent-rose.glowing {
    text-shadow: 0 0 30px rgba(255, 110, 180, 0.6);
}

.constellation-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Particles */
.particle {
    position: absolute;
    bottom: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--reef-teal) 0%, transparent 70%);
    opacity: 0.4;
    animation: rise linear infinite;
    pointer-events: none;
}

@keyframes rise {
    0% { bottom: 0; opacity: 0.2; transform: translateX(0); }
    25% { opacity: 0.6; transform: translateX(10px); }
    50% { opacity: 0.8; transform: translateX(-5px); }
    75% { opacity: 0.5; transform: translateX(8px); }
    100% { bottom: 100%; opacity: 0; transform: translateX(0); }
}

/* Floor */
.zone-floor {
    min-height: 100vh;
    background: var(--abyssal-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

.seabed {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    animation: hue-cycle 60s linear infinite;
    pointer-events: none;
}

@keyframes hue-cycle {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.floor-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 38em;
}

.floor-statement {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--caustic-cyan);
    letter-spacing: 0.03em;
    line-height: 1.2;
    margin-bottom: 2rem;
}

.floor-text {
    color: var(--phosphor-white);
    opacity: 0.7;
    margin-bottom: 2rem;
}

.floor-domain {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--reef-teal);
    letter-spacing: 0.06em;
    opacity: 0.5;
}

/* Bubbles */
.bubble {
    position: absolute;
    bottom: -20px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: bubble-rise 15s ease-in infinite;
    pointer-events: none;
}

@keyframes bubble-rise {
    0% { bottom: -20px; opacity: 0.6; transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { opacity: 0.4; transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { bottom: 100%; opacity: 0; transform: translateX(0); }
}

/* Scroll Animations */
.scroll-fade {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .flip-tile {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        max-width: 320px;
        margin: 1rem auto;
        transform: none;
    }

    .zone-surface {
        padding: 2rem 8vw;
    }

    .depth-gauge { display: none; }

    .abyss-node {
        position: relative;
        left: auto !important;
        top: auto !important;
        display: block;
        text-align: center;
        margin: 2rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .caustic-overlay { animation: none; }
    .scroll-hint { animation: none; opacity: 0.7; }
    .graph-node { animation: none; }
    .particle { animation: none; display: none; }
    .bubble { animation: none; display: none; }
    .seabed { animation: none; }
    .scroll-fade { opacity: 1; transform: none; transition: none; }
    .flip-inner { transition: none; }
    .abyss-node { opacity: 0.8; transition: none; }
    .graph-edge { stroke-dashoffset: 0; transition: none; }
}
