/* ============================================
   PPEBBL.com v2 — Subaqueous Environment
   ============================================ */

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

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

body {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    color: #c8dce8;
    background: #0b1d2e;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Water Distortion on elements --- */
[data-distort] {
    filter: url(#water-distort);
}

/* --- Navigation Pill --- */
.nav-pill {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 0;
    background: rgba(11, 29, 46, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 40px;
    padding: 6px 8px;
    border: 1px solid rgba(200, 220, 232, 0.1);
}

.nav-link {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a9bb0;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 30px;
    transition: color 0.6s ease-out, background 0.6s ease-out;
}

.nav-link:hover {
    color: #00e5c8;
    background: rgba(0, 229, 200, 0.08);
}

/* --- Typography --- */
.section-heading {
    font-family: 'Tenor Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 6rem);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    line-height: 1.1;
    color: #c8dce8;
}

.hero-title {
    font-family: 'Tenor Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 14vw, 14rem);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    line-height: 0.9;
    color: #c8dce8;
    opacity: 0;
    filter: blur(12px);
    animation: emerge-through-water 1.2s cubic-bezier(0.22, 1, 0.36, 1) 1.5s forwards;
}

.hero-sub {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    color: #7a9bb0;
    letter-spacing: 0.04em;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fade-in-slow 2s ease-out 2.8s forwards;
}

.body-text {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    max-width: 60ch;
    margin-bottom: 1.5em;
}

.label-mono {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a9bb0;
}

.card-title {
    font-family: 'Tenor Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 3rem);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    line-height: 1.15;
    margin: 0.5em 0 0.4em;
}

.card-body {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 1rem);
    line-height: 1.7;
    color: #a3bcc8;
}

/* --- Animations --- */
@keyframes emerge-through-water {
    0% {
        opacity: 0;
        filter: blur(12px);
    }
    100% {
        opacity: 1;
        filter: blur(0px) url(#water-distort);
    }
}

@keyframes fade-in-slow {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes caustic-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.06; }
    33% { transform: translate(30px, -20px) scale(1.1); opacity: 0.09; }
    66% { transform: translate(-20px, 15px) scale(0.95); opacity: 0.05; }
}

@keyframes caustic-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1.05); opacity: 0.04; }
    50% { transform: translate(-40px, 25px) scale(0.9); opacity: 0.08; }
}

@keyframes caustic-drift-3 {
    0%, 100% { transform: translate(10px, -10px) scale(0.95); opacity: 0.05; }
    40% { transform: translate(20px, 20px) scale(1.1); opacity: 0.07; }
    80% { transform: translate(-30px, 5px) scale(1); opacity: 0.04; }
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.35;
    }
    50% {
        transform: translateY(-50vh) translateX(var(--wobble, 15px));
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-100vh) translateX(calc(var(--wobble, 15px) * -1));
        opacity: 0;
    }
}

@keyframes scroll-hint-pulse {
    0%, 100% { opacity: 0; transform: translateX(0); }
    20% { opacity: 0.7; transform: translateX(8px); }
    40% { opacity: 0; transform: translateX(16px); }
    60% { opacity: 0.7; transform: translateX(8px); }
    80% { opacity: 0; transform: translateX(16px); }
}

@keyframes ripple-expand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* --- Caustic Light Overlay --- */
.caustic-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    animation: fade-in-slow 2s ease-in 0.4s forwards;
}

.caustic-overlay::before,
.caustic-overlay::after {
    content: '';
    position: absolute;
    inset: -50%;
    border-radius: 50%;
}

.caustic-overlay::before {
    background: radial-gradient(ellipse 600px 400px at 30% 40%, rgba(0, 229, 200, 0.08) 0%, transparent 70%),
                radial-gradient(ellipse 400px 300px at 70% 60%, rgba(122, 155, 176, 0.06) 0%, transparent 70%),
                radial-gradient(ellipse 500px 350px at 50% 30%, rgba(200, 220, 232, 0.05) 0%, transparent 70%);
    animation: caustic-drift-1 12s ease-in-out infinite;
}

.caustic-overlay::after {
    background: radial-gradient(ellipse 350px 500px at 60% 50%, rgba(0, 229, 200, 0.06) 0%, transparent 70%),
                radial-gradient(ellipse 450px 300px at 25% 70%, rgba(163, 188, 200, 0.05) 0%, transparent 70%);
    animation: caustic-drift-2 16s ease-in-out infinite 2s;
}

.caustic-mid::before {
    animation-duration: 14s;
    animation-delay: 1s;
}

.caustic-mid::after {
    animation-duration: 18s;
    animation-delay: 3s;
}

.caustic-river {
    opacity: 0.5;
    animation: none;
}

.caustic-river::before {
    animation: caustic-drift-3 10s ease-in-out infinite;
}

/* --- Section: Abyss (Opening) --- */
.section-abyss {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1d2e;
    overflow: hidden;
}

.abyss-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

/* --- Sediment Layers --- */
.sediment-layers {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 3;
}

.sediment-layers svg {
    width: 100%;
    height: 100%;
}

/* --- Wave Dividers --- */
.wave-divider {
    position: relative;
    height: 80px;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    flex-shrink: 0;
}

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

.wave-dark-to-slate { background: #1a2a3a; }
.wave-slate-to-dark { background: #0b1d2e; }
.wave-dark-to-mid { background: #2d4a5e; }
.wave-mid-to-shallow { background: #e4eff5; }
.wave-shallow-to-light { background: #f2f7fa; }

/* --- Section: Descent (Layered Depth) --- */
.section-descent {
    position: relative;
    min-height: 80vh;
    background: #1a2a3a;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.depth-layer {
    position: absolute;
    inset: 0;
}

.depth-bg {
    z-index: 1;
}

.depth-mid {
    z-index: 2;
}

.depth-fg {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
}

.descent-content {
    padding: clamp(3rem, 8vw, 8rem);
    padding-left: clamp(3rem, 12vw, 14rem);
    max-width: 70ch;
}

/* --- Pebble Silhouettes (background decoration) --- */
.pebble-silhouette {
    position: absolute;
    border-radius: 48% 52% 45% 55% / 50% 48% 52% 50%;
    background: rgba(45, 74, 94, 0.2);
    filter: blur(40px);
}

.sil-1 {
    width: 35vw;
    height: 30vw;
    top: 5%;
    right: -5%;
    border-radius: 52% 48% 55% 45% / 46% 54% 48% 52%;
    background: rgba(45, 74, 94, 0.15);
}

.sil-2 {
    width: 20vw;
    height: 18vw;
    bottom: 15%;
    right: 20%;
    border-radius: 44% 56% 50% 50% / 53% 47% 55% 45%;
    background: rgba(26, 42, 58, 0.2);
}

.sil-3 {
    width: 25vw;
    height: 22vw;
    top: 30%;
    right: 8%;
    border-radius: 55% 45% 42% 58% / 48% 52% 46% 54%;
    background: rgba(45, 74, 94, 0.12);
    filter: blur(60px);
}

.sil-4 {
    width: 40vw;
    height: 35vw;
    top: -10%;
    left: -10%;
    border-radius: 47% 53% 52% 48% / 44% 56% 49% 51%;
    background: rgba(45, 74, 94, 0.18);
    filter: blur(50px);
}

.sil-5 {
    width: 28vw;
    height: 25vw;
    bottom: 5%;
    right: 5%;
    border-radius: 53% 47% 44% 56% / 51% 49% 55% 45%;
    background: rgba(26, 42, 58, 0.15);
    filter: blur(45px);
}

/* --- Section: River Gallery --- */
.section-river {
    position: relative;
    background: #0b1d2e;
    padding: clamp(3rem, 6vw, 6rem) 0 clamp(2rem, 4vw, 4rem);
    overflow: hidden;
}

.river-heading {
    padding-left: clamp(2rem, 6vw, 8rem);
    margin-bottom: 1rem;
}

.river-scroll-hint {
    padding-left: clamp(2rem, 6vw, 8rem);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hint-arrow {
    font-size: 1.2rem;
    color: #7a9bb0;
    animation: scroll-hint-pulse 3s ease-in-out forwards;
}

.river-track {
    display: flex;
    gap: clamp(2rem, 4vw, 5rem);
    padding: 2rem clamp(2rem, 6vw, 8rem);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #2d4a5e #0b1d2e;
    min-height: 60vh;
    align-items: center;
}

.river-track::-webkit-scrollbar {
    height: 4px;
}

.river-track::-webkit-scrollbar-track {
    background: #0b1d2e;
}

.river-track::-webkit-scrollbar-thumb {
    background: #2d4a5e;
    border-radius: 4px;
}

/* --- Pebble Cards --- */
.pebble-card {
    flex: 0 0 auto;
    width: clamp(280px, 30vw, 380px);
    padding: clamp(2rem, 3vw, 3.5rem);
    background: #1a2a3a;
    border-radius: var(--radius);
    scroll-snap-align: center;
    transform: scale(0.92);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.6s ease-out;
    position: relative;
    cursor: default;
    overflow: hidden;
}

.pebble-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    border: 1px solid rgba(200, 220, 232, 0.06);
    pointer-events: none;
}

.pebble-card:hover {
    box-shadow: 0 0 20px rgba(0, 229, 200, 0.15);
}

.pebble-card.snapped {
    transform: scale(1);
}

.pebble-card-light {
    background: #e4eff5;
    color: #1a2a3a;
}

.pebble-card-light .card-title {
    color: #1a2a3a;
}

.pebble-card-light .card-body {
    color: #2d4a5e;
}

.pebble-card-light .label-mono {
    color: #7a9bb0;
}

.pebble-card-light::before {
    border-color: rgba(45, 74, 94, 0.1);
}

.pebble-card-light:hover {
    box-shadow: 0 0 25px rgba(0, 229, 200, 0.12);
}

/* --- Section: Deep Exploration --- */
.section-deep {
    position: relative;
    min-height: 80vh;
    background: #2d4a5e;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.depth-bg-deep {
    z-index: 1;
}

.depth-fg-deep {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    width: 100%;
}

.deep-content {
    padding: clamp(3rem, 8vw, 8rem);
    width: 100%;
}

.deep-content .section-heading {
    margin-bottom: clamp(2rem, 4vw, 4rem);
}

.deep-columns {
    display: flex;
    gap: clamp(3rem, 6vw, 8rem);
    align-items: flex-start;
}

.deep-col-wide {
    flex: 2;
}

.deep-col-narrow {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding-top: 0.5rem;
}

.data-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.data-value {
    font-family: 'Tenor Sans', sans-serif;
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    letter-spacing: 0.04em;
    color: #e4eff5;
}

/* --- Section: Tidal Pool --- */
.section-tidal {
    position: relative;
    background: #e4eff5;
    padding: clamp(4rem, 8vw, 8rem) clamp(2rem, 6vw, 6rem);
    overflow: hidden;
}

.tidal-heading {
    color: #1a2a3a;
    margin-bottom: clamp(2rem, 4vw, 5rem);
    text-align: left;
    padding-left: clamp(1rem, 3vw, 4rem);
}

.tidal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto;
    gap: 6px;
    max-width: 1200px;
    margin: 0 auto;
}

.tidal-stone {
    background: #f2f7fa;
    border-radius: var(--radius);
    padding: clamp(1.5rem, 2.5vw, 2.5rem);
    transition: box-shadow 0.6s ease-out;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.tidal-stone .card-title {
    color: #1a2a3a;
    font-size: clamp(1.2rem, 2vw, 2rem);
}

.tidal-stone .card-body {
    color: #2d4a5e;
    font-size: clamp(0.8rem, 0.9vw, 0.95rem);
}

.tidal-stone:hover {
    box-shadow: 0 0 20px rgba(0, 229, 200, 0.15);
}

/* Irregular grid placement to mimic tidal pool stones */
.stone-a {
    grid-column: 1 / 3;
    grid-row: 1;
}

.stone-b {
    grid-column: 3;
    grid-row: 1 / 3;
}

.stone-c {
    grid-column: 4;
    grid-row: 1;
}

.stone-d {
    grid-column: 1;
    grid-row: 2;
}

.stone-e {
    grid-column: 2;
    grid-row: 2 / 4;
}

.stone-f {
    grid-column: 3 / 5;
    grid-row: 3;
}

.stone-g {
    grid-column: 1;
    grid-row: 3;
}

/* --- Section: Surface (second horizontal gallery) --- */
.section-surface {
    position: relative;
    background: #f2f7fa;
    padding: clamp(3rem, 6vw, 6rem) 0 clamp(4rem, 8vw, 8rem);
    overflow: hidden;
}

.surface-heading {
    color: #1a2a3a;
    padding-left: clamp(2rem, 6vw, 8rem);
    margin-bottom: 2rem;
}

.surface-track {
    display: flex;
    gap: clamp(2rem, 4vw, 5rem);
    padding: 2rem clamp(2rem, 6vw, 8rem);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c8dce8 #f2f7fa;
    min-height: 40vh;
    align-items: center;
}

.surface-track::-webkit-scrollbar {
    height: 4px;
}

.surface-track::-webkit-scrollbar-track {
    background: #f2f7fa;
}

.surface-track::-webkit-scrollbar-thumb {
    background: #c8dce8;
    border-radius: 4px;
}

/* --- Footer Estuary --- */
.footer-estuary {
    background: #f2f7fa;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.estuary-content {
    text-align: center;
    padding: 4rem 2rem;
}

.estuary-line {
    font-family: 'Tenor Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 4rem);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: #7a9bb0;
    margin-bottom: 2rem;
}

.estuary-mark {
    display: block;
    color: #a3bcc8;
}

/* --- Bubble Elements --- */
.bubble {
    position: absolute;
    width: var(--size, 8px);
    height: var(--size, 8px);
    border-radius: 50%;
    background: #00e5c8;
    opacity: 0;
    pointer-events: none;
    animation: bubble-rise var(--duration, 3.5s) ease-out var(--delay, 0s) forwards;
    z-index: 10;
}

/* --- Ripple Effect --- */
.ripple {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #00e5c8;
    pointer-events: none;
    animation: ripple-expand 600ms ease-out forwards;
    z-index: 100;
}

/* --- Reveal Animation --- */
.reveal-group {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
    .deep-columns {
        flex-direction: column;
        gap: 2rem;
    }

    .deep-col-narrow {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .tidal-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .stone-a { grid-column: 1 / 3; grid-row: auto; }
    .stone-b { grid-column: 1; grid-row: auto; }
    .stone-c { grid-column: 2; grid-row: auto; }
    .stone-d { grid-column: 1; grid-row: auto; }
    .stone-e { grid-column: 2; grid-row: auto; }
    .stone-f { grid-column: 1 / 3; grid-row: auto; }
    .stone-g { grid-column: 1 / 3; grid-row: auto; }

    .descent-content {
        padding: clamp(2rem, 5vw, 4rem);
    }
}

@media (max-width: 600px) {
    .nav-pill {
        top: 12px;
        padding: 4px 6px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.65rem;
    }

    .tidal-grid {
        grid-template-columns: 1fr;
    }

    .stone-a, .stone-b, .stone-c, .stone-d,
    .stone-e, .stone-f, .stone-g {
        grid-column: 1;
        grid-row: auto;
    }

    .pebble-card {
        width: clamp(260px, 80vw, 340px);
    }
}
