/* ============================================
   PPEBBL.com - Zen Contemplative Water Design
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    --deep-water: #1a3c40;
    --shallow-pool: #5e8b8a;
    --wet-pebble: #2d3436;
    --dry-sand: #f0e6d3;
    --sunlit-stone: #d4a55a;
    --ripple-white: #e8f4f0;
    --moss-accent: #7d9b76;
    --deep-bed: #0d2b2e;
    --stone-gray-1: #636e72;
    --stone-gray-2: #b2bec3;
    --stone-taupe: #a0927d;
    --stone-light: #dfe6e9;

    --font-display: 'Outfit', sans-serif;
    --font-body: 'Nunito Sans', sans-serif;
    --font-accent: 'Shippori Mincho', serif;

    --radius-sm: 20px;
    --radius-md: 32px;
    --radius-lg: 48px;

    --spacing-inset: 5vw;
}

/* ---- 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);
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--wet-pebble);
    background-color: var(--deep-water);
    transition: background-color 0.8s ease;
    overflow-x: hidden;
}

body[data-section="deep-water"] {
    background-color: var(--deep-water);
}

body[data-section="sand"] {
    background-color: var(--dry-sand);
}

body[data-section="water"] {
    background-color: var(--ripple-white);
}

/* ---- Sand Texture SVG ---- */
.sand-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease;
}

body[data-section="sand"] .sand-texture {
    opacity: 1;
}

/* ---- Caustic Light Overlays ---- */
.caustic-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity 0.8s ease;
}

body[data-section="water"] .caustic-overlay {
    opacity: 0.15;
}

.caustic-1 {
    background: radial-gradient(ellipse at 30% 40%, rgba(94,139,138,0.12) 0%, transparent 70%);
    animation: causticMove1 8s ease-in-out infinite;
}

.caustic-2 {
    background: radial-gradient(ellipse at 60% 60%, rgba(94,139,138,0.12) 0%, transparent 70%);
    animation: causticMove2 13s ease-in-out infinite;
}

@keyframes causticMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, 3%) scale(1.05); }
    66% { transform: translate(-3%, 5%) scale(0.95); }
}

@keyframes causticMove2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-4%, 6%) scale(1.08); }
    50% { transform: translate(6%, -3%) scale(0.92); }
    75% { transform: translate(-2%, -5%) scale(1.03); }
}

/* ---- Click Ripple Container ---- */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.click-ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--shallow-pool);
    pointer-events: none;
    transform: scale(0);
    opacity: 1;
    animation: clickRippleExpand 1.2s ease-out forwards;
}

.click-ripple:nth-child(3n+2) {
    animation-delay: 0.2s;
}

.click-ripple:nth-child(3n) {
    animation-delay: 0.4s;
}

@keyframes clickRippleExpand {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* ============================================
   OPENING VIEWPORT
   ============================================ */
.section-opening {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

.water-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 40%, #1a3c40 0%, #0d2b2e 50%, #1a3c40 100%),
        radial-gradient(ellipse at 30% 60%, rgba(94,139,138,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(94,139,138,0.1) 0%, transparent 40%);
    opacity: 0;
    animation: waterFadeIn 1.5s ease-out 0.4s forwards;
}

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

@keyframes waterUndulate {
    0%, 100% {
        background-position: 50% 40%, 30% 60%, 70% 30%;
    }
    33% {
        background-position: 52% 42%, 28% 58%, 72% 32%;
    }
    66% {
        background-position: 48% 38%, 32% 62%, 68% 28%;
    }
}

.water-surface.active {
    animation: waterFadeIn 1.5s ease-out forwards, waterUndulate 12s ease-in-out 2s infinite;
}

/* Pebble Drop */
.pebble-drop {
    position: relative;
    z-index: 11;
    width: 80px;
    height: 80px;
}

.pebble {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #3d5456, var(--wet-pebble) 60%, #1a2526);
    box-shadow:
        0 4px 20px rgba(0,0,0,0.3),
        0 8px 40px rgba(0,0,0,0.2),
        inset 0 -2px 6px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(-100vh);
    animation: pebbleDrop 1s cubic-bezier(0.22, 1.0, 0.36, 1.0) 1.9s forwards;
}

@keyframes pebbleDrop {
    0% {
        opacity: 1;
        transform: translateY(-100vh);
    }
    70% {
        opacity: 1;
        transform: translateY(0);
    }
    85% {
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Impact Rings */
.impact-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin-top: -40px;
    margin-left: -40px;
    border-radius: 50%;
    border: 2px solid var(--shallow-pool);
    opacity: 0;
    transform: scale(0);
}

.ring-1 {
    animation: impactRing 1.5s ease-out 2.8s forwards;
}

.ring-2 {
    animation: impactRing 1.5s ease-out 3.0s forwards;
}

.ring-3 {
    animation: impactRing 1.5s ease-out 3.2s forwards;
}

@keyframes impactRing {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(5);
        opacity: 0;
    }
}

/* Logotype */
.logotype {
    position: relative;
    z-index: 12;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ripple-white);
    margin-top: 2rem;
    display: flex;
    gap: 0.05em;
}

.logotype .letter {
    opacity: 0;
    display: inline-block;
}

.logotype .letter.visible {
    animation: letterReveal 0.6s ease-out forwards;
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.tagline {
    position: relative;
    z-index: 12;
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 1rem;
    color: var(--shallow-pool);
    margin-top: 0.5rem;
    opacity: 0;
}

.tagline.visible {
    animation: taglineFade 1s ease-out forwards;
}

@keyframes taglineFade {
    to {
        opacity: 0.8;
    }
}

/* ============================================
   RIPPLE TRANSITION ZONE
   ============================================ */
.section-ripple-transition {
    position: relative;
    width: 100%;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(to bottom, var(--deep-water), var(--deep-bed) 30%, var(--deep-water) 60%, var(--dry-sand));
}

.ripple-svg {
    width: 60vw;
    height: 60vw;
    max-width: 600px;
    max-height: 600px;
}

.scroll-ring {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 0.1s linear;
}

/* ============================================
   CONTENT CLUSTERS - Bento Box
   ============================================ */
.section-content {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: var(--spacing-inset);
    z-index: 10;
}

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

.bento-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 0;
}

.bento-block {
    background: var(--ripple-white);
    padding: 2.5rem;
    position: relative;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.06),
        0 8px 24px rgba(0,0,0,0.04),
        0 16px 48px rgba(0,0,0,0.03);
    animation: shadowDrift 20s ease-in-out infinite;
}

@keyframes shadowDrift {
    0%, 100% {
        box-shadow:
            0 2px 8px rgba(0,0,0,0.06),
            0 8px 24px rgba(0,0,0,0.04),
            0 16px 48px rgba(0,0,0,0.03);
    }
    25% {
        box-shadow:
            4px 6px 8px rgba(0,0,0,0.06),
            6px 12px 24px rgba(0,0,0,0.04),
            8px 20px 48px rgba(0,0,0,0.03);
    }
    50% {
        box-shadow:
            2px 4px 8px rgba(0,0,0,0.06),
            -2px 10px 24px rgba(0,0,0,0.04),
            -4px 18px 48px rgba(0,0,0,0.03);
    }
    75% {
        box-shadow:
            -4px 2px 8px rgba(0,0,0,0.06),
            -6px 8px 24px rgba(0,0,0,0.04),
            -8px 16px 48px rgba(0,0,0,0.03);
    }
}

.block-large {
    border-radius: var(--radius-lg);
}

.block-medium {
    border-radius: var(--radius-md);
}

.block-small {
    border-radius: var(--radius-sm);
}

/* Grid placements */
.block-a {
    grid-column: 1 / 8;
    grid-row: 1;
}

.block-b {
    grid-column: 8 / 13;
    grid-row: 1;
}

.block-c {
    grid-column: 1 / 5;
    grid-row: 2;
}

.block-d {
    grid-column: 5 / 10;
    grid-row: 2;
}

.block-e {
    grid-column: 10 / 13;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.block-f {
    grid-column: 1 / 13;
    grid-row: 3;
    background: var(--deep-water);
    color: var(--ripple-white);
}

.block-f h2 {
    color: var(--ripple-white);
}

.block-f p {
    color: var(--stone-light);
}

/* Reveal animation */
.reveal-block {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms cubic-bezier(0.23, 1.0, 0.32, 1.0),
                transform 800ms cubic-bezier(0.23, 1.0, 0.32, 1.0);
}

.reveal-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Typography in blocks */
.bento-block h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--deep-water);
    margin-bottom: 1rem;
}

.bento-block h3 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--deep-water);
    margin-bottom: 0.75rem;
}

.bento-block p {
    color: var(--wet-pebble);
    margin-bottom: 0.75rem;
}

.bento-block p:last-child {
    margin-bottom: 0;
}

.epigraph,
.card-epigraph {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 1rem;
    color: var(--shallow-pool);
    margin-bottom: 1.5rem;
}

/* Stone Clusters (CSS-only decorative) */
.stone-cluster {
    display: flex;
    gap: 0;
    position: relative;
    height: 100px;
    margin-bottom: 1.5rem;
}

.stone {
    border-radius: 50%;
    position: absolute;
}

.stone-1 {
    width: 70px;
    height: 55px;
    background: radial-gradient(ellipse at 40% 35%, var(--stone-light), var(--stone-gray-1));
    border-radius: 50%;
    left: 10px;
    top: 20px;
}

.stone-2 {
    width: 50px;
    height: 45px;
    background: radial-gradient(ellipse at 40% 35%, var(--stone-gray-2), var(--stone-taupe));
    border-radius: 50%;
    left: 55px;
    top: 35px;
}

.stone-3 {
    width: 40px;
    height: 35px;
    background: radial-gradient(ellipse at 40% 35%, var(--stone-taupe), var(--stone-gray-1));
    border-radius: 50%;
    left: 90px;
    top: 15px;
}

.stone-cluster-alt {
    height: 80px;
}

.stone-4 {
    width: 55px;
    height: 50px;
    background: radial-gradient(ellipse at 35% 30%, var(--stone-gray-2), var(--stone-gray-1));
    border-radius: 50%;
    left: 5px;
    top: 10px;
}

.stone-5 {
    width: 45px;
    height: 40px;
    background: radial-gradient(ellipse at 45% 35%, var(--stone-light), var(--stone-taupe));
    border-radius: 50%;
    left: 40px;
    top: 30px;
}

/* ============================================
   RIVER SECTION - Horizontal Scroll
   ============================================ */
.section-river {
    position: relative;
    width: 100%;
    padding: 4rem var(--spacing-inset);
    overflow: hidden;
    z-index: 10;
}

.river-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.river-label-text {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 1rem;
    color: var(--shallow-pool);
}

.wave-edge {
    position: relative;
    width: 100%;
    height: 30px;
    overflow: visible;
}

.wave-edge svg {
    width: 100%;
    height: 30px;
}

.wave-path {
    stroke-dasharray: 8 4;
    animation: waveFlow 4s linear infinite;
}

@keyframes waveFlow {
    to {
        stroke-dashoffset: -48;
    }
}

.river-track {
    display: flex;
    gap: 2rem;
    padding: 2rem 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.river-track::-webkit-scrollbar {
    display: none;
}

.river-track:active {
    cursor: grabbing;
}

.river-card {
    flex: 0 0 min(380px, 80vw);
    scroll-snap-align: center;
    background: rgba(255,255,255,0.85);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.05),
        0 8px 24px rgba(0,0,0,0.03),
        0 16px 48px rgba(0,0,0,0.02);
    animation: shadowDrift 20s ease-in-out infinite;
}

.river-card h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--deep-water);
    margin-bottom: 0.75rem;
}

.river-card p {
    color: var(--wet-pebble);
    margin-bottom: 0.75rem;
}

.river-card p:last-child {
    margin-bottom: 0;
}

.river-card .card-epigraph {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 1rem;
    color: var(--shallow-pool);
    margin-bottom: 1.5rem;
}

/* ============================================
   SETTLING SECTION - Closing
   ============================================ */
.section-settling {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
    padding: var(--spacing-inset);
}

.settling-water {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 50%, var(--deep-water) 0%, var(--deep-bed) 70%);
    z-index: 0;
}

.settling-ripples {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    pointer-events: none;
}

.settle-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid var(--shallow-pool);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
}

.settle-ring-1 {
    width: 300px;
    height: 300px;
}

.settle-ring-2 {
    width: 200px;
    height: 200px;
}

.settle-ring-3 {
    width: 100px;
    height: 100px;
}

.settle-ring.contracting {
    animation: settleContract 2s ease-in-out forwards;
}

.settle-ring-1.contracting {
    animation-delay: 0s;
}

.settle-ring-2.contracting {
    animation-delay: 0.3s;
}

.settle-ring-3.contracting {
    animation-delay: 0.6s;
}

@keyframes settleContract {
    0% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
    30% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

.settling-content {
    position: relative;
    z-index: 5;
    text-align: center;
    max-width: 600px;
}

.settling-content h2 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ripple-white);
    margin-bottom: 1rem;
}

.settling-content p {
    color: var(--stone-light);
    margin-bottom: 1.5rem;
}

.settle-epigraph {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 1rem;
    color: var(--shallow-pool);
    margin-bottom: 2rem;
}

.settle-pebble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #3d5456, var(--wet-pebble) 60%, #1a2526);
    margin: 2rem auto 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 1s ease, transform 1s ease;
}

.settle-pebble.visible {
    opacity: 1;
    transform: scale(1);
}

.closing-mark {
    position: relative;
    z-index: 5;
    margin-top: 4rem;
}

.closing-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shallow-pool);
    opacity: 0.5;
}

/* ============================================
   NAVIGATION - Pebble Dots
   ============================================ */
.pebble-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.pebble-nav.visible {
    opacity: 1;
}

.nav-pebble {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--shallow-pool);
    background: transparent;
    cursor: pointer;
    transition: transform 300ms ease-out, background-color 300ms ease, box-shadow 300ms ease;
    padding: 0;
}

.nav-pebble:hover {
    transform: translateY(-4px);
    background: rgba(94,139,138,0.2);
}

.nav-pebble.active {
    background: var(--shallow-pool);
    box-shadow: 0 0 12px rgba(94,139,138,0.5);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .block-a {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .block-b {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .block-c {
        grid-column: 1;
        grid-row: auto;
    }

    .block-d {
        grid-column: 2;
        grid-row: auto;
    }

    .block-e {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .block-f {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}

@media (max-width: 600px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .block-c,
    .block-d {
        grid-column: 1;
    }

    .river-card {
        flex: 0 0 85vw;
    }

    .pebble-nav {
        bottom: 1rem;
        right: 1rem;
    }

    .logotype {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }
}
