/* ============================================
   PPEBBL.com - Cyberpunk Subaquatic Deep Dive
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-abyss: #020810;
    --midnight-trench: #0A1628;
    --pressure-blue: #122A4A;
    --slate-depth: #5A7A99;
    --steel-mist: #B0C4DE;
    --electric-cyan: #00E5FF;
    --cyan-shadow: #004D5C;
    --violet-biolume: #7B2FBE;
    --toxic-coral: #FF0057;

    --font-display: 'Bungee Shade', cursive;
    --font-decorative: 'Monoton', cursive;
    --font-body: 'Share Tech Mono', monospace;
    --font-accent: 'Orbitron', sans-serif;

    --sidebar-width: 72px;
    --sidebar-expanded: 240px;
    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --bg-current: var(--midnight-trench);
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--midnight-trench);
    color: var(--steel-mist);
    overflow-x: hidden;
    line-height: 1.75;
    letter-spacing: 0.04em;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
}

a {
    color: var(--electric-cyan);
    text-decoration: none;
    transition: color 0.4s var(--ease-organic);
}

a:hover {
    color: var(--violet-biolume);
}

/* --- SVG Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
}

/* --- Sidebar Depth Gauge --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--pressure-blue);
    border-right: 1px solid rgba(0, 229, 255, 0.15);
    z-index: 1000;
    transition: width 0.6s var(--ease-organic);
    overflow: hidden;
    opacity: 0;
    animation: sidebarFadeIn 1.2s var(--ease-organic) 0.8s forwards;
}

@keyframes sidebarFadeIn {
    to { opacity: 1; }
}

#sidebar:hover {
    width: var(--sidebar-expanded);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 24px 0;
    position: relative;
}

.sidebar-brand {
    font-family: var(--font-accent);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    opacity: 0.6;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-bottom: 24px;
}

.depth-line-track {
    position: relative;
    flex: 1;
    width: 2px;
    background: rgba(0, 229, 255, 0.1);
    margin: 12px 0;
}

.depth-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--electric-cyan), var(--violet-biolume));
    opacity: 0.3;
}

.depth-needle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--electric-cyan);
    box-shadow: 0 0 8px var(--electric-cyan), 0 0 20px rgba(0, 229, 255, 0.4);
    z-index: 2;
    transition: top 0.3s var(--ease-organic);
}

.depth-markers {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    height: calc(100% - 200px);
    justify-content: space-between;
    pointer-events: none;
}

.depth-marker {
    font-family: var(--font-accent);
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    opacity: 0.4;
    text-transform: uppercase;
    white-space: nowrap;
    writing-mode: vertical-rl;
}

.depth-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-bottom: 8px;
}

.depth-label {
    font-family: var(--font-accent);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--slate-depth);
    text-transform: uppercase;
}

.depth-value {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: absolute;
    top: 50%;
    left: 72px;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.4s var(--ease-organic);
    white-space: nowrap;
}

#sidebar:hover .sidebar-nav {
    opacity: 1;
}

.nav-label {
    font-family: var(--font-accent);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--slate-depth);
    text-transform: uppercase;
    transition: color 0.4s var(--ease-organic), text-shadow 0.4s var(--ease-organic);
}

.nav-label:hover {
    color: var(--electric-cyan);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* --- Main Content Area --- */
#main-content {
    margin-left: var(--sidebar-width);
    padding-right: 64px;
    position: relative;
}

/* --- Depth Zones (Sections) --- */
.depth-zone {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 80px 0;
}

.zone-surface {
    background: var(--midnight-trench);
}

.zone-twilight {
    background: linear-gradient(180deg, var(--midnight-trench) 0%, #0D1F3A 100%);
    margin-top: -15vh;
    z-index: 2;
}

.zone-midnight {
    background: linear-gradient(180deg, #0D1F3A 0%, var(--pressure-blue) 50%, #0A1225 100%);
    margin-top: -15vh;
    z-index: 3;
}

.zone-abyssal {
    background: linear-gradient(180deg, #0A1225 0%, #060E1C 50%, var(--deep-abyss) 100%);
    margin-top: -15vh;
    z-index: 4;
}

.zone-hadal {
    background: var(--deep-abyss);
    margin-top: -15vh;
    z-index: 5;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone-content {
    position: relative;
    z-index: 10;
    padding: 0 48px;
    width: 100%;
    max-width: 1200px;
}

/* --- Hero (Surface Zone) --- */
.zone-surface .zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--electric-cyan);
    text-shadow:
        0 0 20px var(--electric-cyan),
        0 0 40px rgba(0, 229, 255, 0.2),
        0 0 80px rgba(0, 229, 255, 0.08),
        3px 3px 0 var(--cyan-shadow);
    opacity: 0;
    animation: heroFadeIn 1.5s var(--ease-organic) 0.6s forwards;
    position: relative;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: var(--slate-depth);
    margin-top: 24px;
    opacity: 0;
    animation: taglineFadeIn 1.2s var(--ease-organic) 1.8s forwards;
    letter-spacing: 0.12em;
    text-transform: lowercase;
}

@keyframes taglineFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

.descent-line {
    width: 1px;
    height: 0;
    background: var(--electric-cyan);
    opacity: 0.4;
    margin-top: 48px;
    animation: lineGrow 2s var(--ease-organic) 2.5s forwards;
}

@keyframes lineGrow {
    to {
        height: 120px;
    }
}

/* --- Ambient Blobs --- */
.ambient-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
    mix-blend-mode: screen;
    z-index: 1;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.2) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    animation: blobDrift1 40s ease-in-out infinite alternate;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at center, rgba(123, 47, 190, 0.18) 0%, transparent 70%);
    top: 40%;
    right: 15%;
    animation: blobDrift2 35s ease-in-out infinite alternate;
}

.blob-3 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.15) 0%, transparent 70%);
    top: 10%;
    right: 5%;
    animation: blobDrift3 50s ease-in-out infinite alternate;
}

.blob-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle at center, rgba(123, 47, 190, 0.2) 0%, transparent 70%);
    bottom: 10%;
    left: 5%;
    animation: blobDrift1 45s ease-in-out infinite alternate-reverse;
}

.blob-5 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.18) 0%, transparent 70%);
    top: 30%;
    right: 20%;
    animation: blobDrift2 38s ease-in-out infinite alternate;
}

.blob-6 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.12) 0%, transparent 70%);
    top: 20%;
    left: 15%;
    animation: blobDrift3 55s ease-in-out infinite alternate-reverse;
}

.blob-7 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.25) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobPulse 5s ease-in-out infinite;
}

@keyframes blobDrift1 {
    0% { transform: translate(0, 0) scale(1); border-radius: 50% 40% 60% 50%; }
    33% { transform: translate(30px, -40px) scale(1.05); border-radius: 40% 60% 50% 50%; }
    66% { transform: translate(-20px, 20px) scale(0.95); border-radius: 60% 50% 40% 60%; }
    100% { transform: translate(15px, -15px) scale(1.02); border-radius: 50% 50% 60% 40%; }
}

@keyframes blobDrift2 {
    0% { transform: translate(0, 0) scale(1); border-radius: 60% 40% 50% 50%; }
    33% { transform: translate(-25px, 30px) scale(1.08); border-radius: 50% 50% 40% 60%; }
    66% { transform: translate(35px, -20px) scale(0.92); border-radius: 40% 60% 60% 40%; }
    100% { transform: translate(-10px, 25px) scale(1.03); border-radius: 55% 45% 50% 50%; }
}

@keyframes blobDrift3 {
    0% { transform: translate(0, 0) scale(1); border-radius: 45% 55% 50% 50%; }
    50% { transform: translate(20px, -35px) scale(1.06); border-radius: 55% 45% 55% 45%; }
    100% { transform: translate(-30px, 15px) scale(0.97); border-radius: 50% 50% 45% 55%; }
}

@keyframes blobPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}

/* --- Interactive Blobs --- */
.interactive-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 2;
    transition: transform 1.5s var(--ease-organic);
    filter: blur(20px);
}

.i-blob-1 {
    width: 150px;
    height: 150px;
    background: rgba(0, 229, 255, 0.4);
    top: 60%;
    left: 40%;
}

.i-blob-2 {
    width: 120px;
    height: 120px;
    background: rgba(123, 47, 190, 0.4);
    top: 25%;
    left: 60%;
}

.i-blob-3 {
    width: 180px;
    height: 180px;
    background: rgba(0, 229, 255, 0.35);
    top: 45%;
    right: 10%;
}

/* --- Pressure Zone Dividers --- */
.pressure-zone {
    position: relative;
    width: 100%;
    height: 50px;
    overflow: hidden;
    z-index: 10;
}

.particle-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Section Typography --- */
.depth-indicator {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    opacity: 0.6;
    text-transform: uppercase;
    display: block;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.section-heading {
    font-family: var(--font-decorative);
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--violet-biolume);
    text-shadow:
        0 0 15px rgba(123, 47, 190, 0.5),
        0 0 30px rgba(123, 47, 190, 0.2);
    margin-bottom: 48px;
    line-height: 1.3;
}

/* --- Card Flip System --- */
.card-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.cluster-asymmetric-left {
    justify-content: flex-start;
    max-width: 800px;
}

.cluster-asymmetric-right {
    justify-content: flex-end;
    max-width: 900px;
    margin-left: auto;
}

.cluster-sparse {
    justify-content: flex-start;
    gap: 40px;
    max-width: 750px;
}

.flip-card {
    width: 240px;
    height: 300px;
    perspective: 1000px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
}

.flip-card.card-wide {
    width: 360px;
}

.flip-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-organic), transform 0.6s var(--ease-organic);
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s var(--ease-organic);
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flip-card-front {
    background: var(--midnight-trench);
    border: 1px solid rgba(0, 229, 255, 0.1);
    align-items: center;
    position: relative;
    overflow: hidden;
}

.card-label {
    font-family: var(--font-accent);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    opacity: 0.8;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    z-index: 2;
}

.card-glow-edge {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--electric-cyan) 50%, transparent 100%);
    opacity: 0.6;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.flip-card-back {
    background: var(--pressure-blue);
    border: 1px solid rgba(123, 47, 190, 0.2);
    transform: rotateY(180deg);
}

.flip-card-back h3 {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--electric-cyan);
    margin-bottom: 12px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.flip-card-back p {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--steel-mist);
    line-height: 1.7;
    opacity: 0.85;
}

/* --- Hadal Zone (Footer) --- */
.hadal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.hadal-glow {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.2) 0%, transparent 70%);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobPulse 5s ease-in-out infinite;
    z-index: 0;
}

.hadal-brand {
    font-family: var(--font-decorative);
    font-size: 1rem;
    color: var(--electric-cyan);
    opacity: 0.5;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    letter-spacing: 0.2em;
    position: relative;
    z-index: 1;
}

.hadal-whisper {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--slate-depth);
    opacity: 0.4;
    margin-top: 16px;
    max-width: 400px;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.hadal-coordinates {
    font-family: var(--font-accent);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--electric-cyan);
    opacity: 0.25;
    margin-top: 24px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

/* --- Sonar Ring Effect (on interaction points) --- */
.sonar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--electric-cyan);
    opacity: 0;
    pointer-events: none;
    animation: sonarExpand 1.5s var(--ease-organic) forwards;
}

@keyframes sonarExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        margin-top: -100px;
        margin-left: -100px;
    }
}

/* --- Scroll-based Card Visibility (set via JS) --- */
.flip-card[data-visible="true"] {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 48px;
        --sidebar-expanded: 180px;
    }

    #main-content {
        padding-right: 24px;
    }

    .zone-content {
        padding: 0 20px;
    }

    .flip-card {
        width: 100%;
        max-width: 320px;
        height: 260px;
    }

    .flip-card.card-wide {
        width: 100%;
        max-width: 320px;
    }

    .card-cluster {
        flex-direction: column;
        align-items: flex-start;
    }

    .cluster-asymmetric-right {
        margin-left: 0;
    }

    .hero-title {
        font-size: clamp(2.2rem, 10vw, 4rem);
    }

    .section-heading {
        font-size: clamp(1.2rem, 6vw, 2rem);
    }

    .depth-markers {
        display: none;
    }

    .sidebar-brand {
        font-size: 0.5rem;
    }

    .zone-twilight,
    .zone-midnight,
    .zone-abyssal,
    .zone-hadal {
        margin-top: -10vh;
    }
}

@media (max-width: 480px) {
    :root {
        --sidebar-width: 40px;
    }

    .zone-content {
        padding: 0 12px;
    }

    .flip-card {
        height: 240px;
    }
}

/* --- Subtle Grid Overlay --- */
#main-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    height: 100vh;
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.008) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.008) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}
