/* ============================================
   ppuzzle.net — Submerged Cyberpunk Aquarium
   ============================================ */

:root {
    --cyan: #00ffd5;
    --magenta: #ff007f;
    --gold: #ffc800;
    --violet: #7b00ff;
    --bg-deep: #060810;
    --bg-surface: #0a0e1a;
    --text-primary: #8a9bb8;
    --text-secondary: #6b7a96;
    --bubble-border: rgba(0, 255, 213, 0.12);
    --bubble-fill: rgba(0, 255, 213, 0.04);
    --glow-cyan: 0 0 30px rgba(0, 255, 213, 0.2);
    --glow-magenta: 0 0 30px rgba(255, 0, 127, 0.2);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    background-image: radial-gradient(ellipse at 50% 30%, var(--bg-surface) 0%, var(--bg-deep) 70%);
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    overflow-x: hidden;
    min-height: 100vh;
}

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

.hero-title {
    font-family: 'Dela Gothic One', cursive;
    font-weight: 400;
    font-size: clamp(5rem, 14vw, 11rem);
    letter-spacing: -0.03em;
    line-height: 0.92;
    text-transform: uppercase;
    color: var(--cyan);
    text-shadow: 3px 0 var(--magenta), -3px 0 var(--violet);
    transition: text-shadow 0.3s ease;
}

.hero-title:hover {
    text-shadow: 6px 0 var(--magenta), -6px 0 var(--violet), 0 3px var(--gold);
}

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.body-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.75;
    max-width: 38ch;
    color: var(--text-secondary);
}

.data-fragment {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: rgba(0, 255, 213, 0.5);
    display: block;
    margin-top: 1rem;
}

.gold-accent {
    color: var(--gold);
    font-weight: 500;
}

.hero-tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    letter-spacing: 0.15em;
}

/* ============================================
   Depth Navigation
   ============================================ */

.depth-nav {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.depth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 213, 0.3);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.4s ease;
}

.depth-dot.active {
    background: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 255, 213, 0.5);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 255, 213, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 213, 0.8); }
}

/* ============================================
   Zone Base Styles
   ============================================ */

.zone {
    position: relative;
    overflow: hidden;
}

.zone-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Zone 1 — Surface
   ============================================ */

.zone-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-deep) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 5vw;
}

.macro-bubble {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.macro-bubble-1 {
    bottom: -10%;
    right: -5%;
    opacity: 0.4;
}

.macro-circle {
    stroke-dasharray: 1560;
    stroke-dashoffset: 1560;
    transition: stroke-dashoffset 4s ease-out;
}

.macro-circle.drawn {
    stroke-dashoffset: 0;
}

.macro-circle-slow {
    transition: stroke-dashoffset 6s ease-out;
}

/* ============================================
   Zone 2 — Twilight
   ============================================ */

.zone-twilight {
    min-height: 100vh;
    padding: 10vh 0;
    background: var(--bg-deep);
}

.twilight-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6vh;
    padding: 5vh 0;
}

/* ============================================
   Zone 3 — Midnight
   ============================================ */

.zone-midnight {
    min-height: 150vh;
    padding: 10vh 0;
    background: var(--bg-deep);
}

.midnight-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 8vh;
    padding: 5vh 0;
}

.macro-bubble-2 {
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.3;
}

/* ============================================
   Zone 4 — Abyss
   ============================================ */

.zone-abyss {
    min-height: 100vh;
    padding: 10vh 0;
    background: #040608;
    display: flex;
    align-items: center;
}

.abyss-content {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5vh 0;
}

.abyss-phrase {
    padding: 2vh 5vw;
}

.abyss-left {
    align-self: flex-start;
    margin-left: 5vw;
}

.abyss-right {
    align-self: flex-end;
    margin-right: 5vw;
}

.abyss-center {
    align-self: center;
    opacity: 0.6;
}

.abyss-text {
    font-family: 'Dela Gothic One', cursive;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    color: var(--cyan);
    text-shadow: 6px 0 var(--magenta), -6px 0 var(--violet), 0 3px var(--gold);
    line-height: 0.92;
    letter-spacing: -0.03em;
}

.macro-bubble-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
}

/* ============================================
   Zone 5 — Hadal
   ============================================ */

.zone-hadal {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--bg-deep) 0%, #1a0a1e 100%);
}

.volcanic-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 200, 0, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

.hadal-content {
    position: relative;
    z-index: 2;
}

.resolution-bubble {
    width: 300px;
    height: 300px;
    border-radius: 48% 52% 55% 45% / 50% 46% 54% 50%;
    background: var(--bubble-fill);
    border: 1px solid var(--bubble-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
}

.resolution-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

/* ============================================
   Bubble Containers — Organic Flow
   ============================================ */

.bubble-container {
    position: relative;
    padding: 2.5rem 2rem;
    border-radius: 48% 52% 55% 45% / 50% 46% 54% 50%;
    background: var(--bubble-fill);
    border: 1px solid var(--bubble-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 420px;
    background-image: radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
}

.bubble-left {
    margin-left: 8vw;
    margin-right: 25vw;
    align-self: flex-start;
}

.bubble-right {
    margin-left: 25vw;
    margin-right: 8vw;
    align-self: flex-end;
}

.bubble-center {
    margin-left: auto;
    margin-right: auto;
    align-self: center;
}

/* ============================================
   Micro Bubbles
   ============================================ */

.micro-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.micro-bubble {
    position: absolute;
    bottom: -20px;
    left: var(--x);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 213, 0.08);
    background: transparent;
    animation:
        bubble-float var(--duration) cubic-bezier(0.4, 0, 0.2, 1) var(--delay) infinite,
        bubble-drift var(--duration) ease-in-out var(--delay) infinite;
}

@keyframes bubble-float {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120vh);
        opacity: 0;
    }
}

@keyframes bubble-drift {
    0%, 100% { margin-left: 0; }
    25% { margin-left: 10px; }
    75% { margin-left: -10px; }
}

/* ============================================
   Glitch Effects
   ============================================ */

.glitch-bar {
    position: absolute;
    left: 10%;
    height: 3px;
    width: 40%;
    background: linear-gradient(90deg, var(--magenta) 0% 33%, var(--cyan) 33% 66%, var(--violet) 66% 100%);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

.glitch-bar-top {
    top: 0;
}

.glitch-bar-bottom {
    bottom: 0;
    left: 30%;
    width: 35%;
}

.glitch-bar-mid {
    top: 50%;
    left: 20%;
    width: 50%;
}

.glitch-bar-abyss {
    top: 30%;
    left: 5%;
    width: 60%;
}

.glitch-bar.flash {
    animation: glitch-scan 0.15s steps(3) forwards;
}

@keyframes glitch-scan {
    0% { opacity: 0; transform: translateX(-20px); }
    33% { opacity: 0.8; transform: translateX(10px); }
    66% { opacity: 0.4; transform: translateX(-5px); }
    100% { opacity: 0; transform: translateX(0); }
}

/* Hero scanline — flickers periodically */
.hero-scanline {
    position: absolute;
    top: 35%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 20%, var(--magenta) 30%, var(--cyan) 50%, var(--violet) 70%, transparent 80%);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    animation: hero-flicker 8s ease-in-out infinite;
}

@keyframes hero-flicker {
    0%, 96%, 100% { opacity: 0; }
    97% { opacity: 0.7; transform: translateY(-2px); }
    98% { opacity: 0.3; transform: translateY(3px); }
    99% { opacity: 0.6; transform: translateY(-1px); }
}

/* Pixel Displacement Blocks */
.pixel-block {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    opacity: 0.15;
}

.pixel-block-1 {
    width: 60px;
    height: 4px;
    top: 15%;
    left: 12%;
    background: linear-gradient(90deg, var(--magenta) 33%, var(--cyan) 33% 66%, var(--violet) 66%);
}

.pixel-block-2 {
    width: 40px;
    height: 3px;
    top: 45%;
    right: 18%;
    background: linear-gradient(90deg, var(--cyan) 33%, var(--violet) 33% 66%, var(--magenta) 66%);
}

.pixel-block-3 {
    width: 25px;
    height: 6px;
    top: 72%;
    left: 60%;
    background: linear-gradient(90deg, var(--violet) 33%, var(--magenta) 33% 66%, var(--cyan) 66%);
}

.pixel-block-4 {
    width: 50px;
    height: 3px;
    top: 25%;
    left: 8%;
    background: linear-gradient(90deg, var(--magenta) 33%, var(--gold) 33% 66%, var(--violet) 66%);
}

.pixel-block-5 {
    width: 35px;
    height: 4px;
    bottom: 20%;
    right: 12%;
    background: linear-gradient(90deg, var(--cyan) 33%, var(--magenta) 33% 66%, var(--gold) 66%);
}

/* ============================================
   Siphonophore Tendrils
   ============================================ */

.tendrils-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.tendril {
    fill: none;
    stroke: var(--cyan);
    stroke-opacity: 0.1;
    stroke-width: 0.75;
    stroke-dasharray: 4 8;
    animation: tendril-flow 8s linear infinite;
}

.tendril-2 {
    stroke-opacity: 0.06;
    animation-duration: 12s;
    animation-direction: reverse;
}

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

/* ============================================
   Puzzle Piece Decorations
   ============================================ */

.puzzle-decoration {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    animation: puzzle-spin 30s linear infinite;
}

.puzzle-deco-1 {
    top: 15%;
    right: 8%;
}

.puzzle-deco-2 {
    bottom: 20%;
    left: 5%;
    animation-direction: reverse;
}

.puzzle-deco-3 {
    top: 10%;
    right: 12%;
    animation-duration: 35s;
}

.puzzle-deco-4 {
    bottom: 25%;
    left: 8%;
    animation-duration: 40s;
    animation-direction: reverse;
}

.puzzle-deco-5 {
    top: 55%;
    right: 5%;
    animation-duration: 28s;
}

.puzzle-deco-6 {
    bottom: 15%;
    right: 20%;
    animation-duration: 45s;
}

@keyframes puzzle-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Bounce-Enter Animation System
   ============================================ */

@keyframes bounce-in {
    0%   { opacity: 0; transform: translateY(60px) scale(0.85); }
    50%  { opacity: 1; transform: translateY(-12px) scale(1.02); }
    70%  { transform: translateY(4px) scale(0.99); }
    100% { transform: translateY(0) scale(1); }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(60px) scale(0.85);
}

.animate-on-scroll.visible {
    animation: bounce-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--i, 0) * 0.12s);
}

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

@media (max-width: 768px) {
    .bubble-container {
        max-width: 85vw;
        border-radius: 30px;
        padding: 2rem 1.5rem;
    }

    .bubble-left {
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .bubble-right {
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .abyss-left {
        margin-left: 3vw;
    }

    .abyss-right {
        margin-right: 3vw;
    }

    .resolution-bubble {
        width: 220px;
        height: 220px;
    }

    .depth-nav {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(3rem, 16vw, 6rem);
    }

    .abyss-text {
        font-size: clamp(1.5rem, 8vw, 3rem);
    }
}
