/* ================================================
   RRIPPL.com — Design System
   Ocean-deep palette, ripple physics, radial composition
   ================================================ */

/* --- CSS Custom Properties --- */
:root {
    --abyssal-ink: #0a0e1a;
    --deep-current: #111b2e;
    --lunar-white: #e8ecf4;
    --still-silver: #7b8da6;
    --lantern-amber: #d4943a;
    --depth-teal: #2a8a8a;
    --refraction-violet: #6b5ca5;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    --ripple-ease: cubic-bezier(0.2, 0.8, 0.3, 1);
}

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

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

body {
    background-color: var(--abyssal-ink);
    color: var(--lunar-white);
    font-family: var(--font-body);
    font-weight: 350;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Caustic Overlay --- */
#caustic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

#caustic-svg {
    width: 100%;
    height: 100%;
}

/* --- Depth Particles Canvas --- */
#depth-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

/* --- Surface Tension Lines --- */
#surface-tension-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 3;
}

#tension-svg {
    width: 100%;
    height: 100%;
}

.tension-line {
    transition: d 0.3s ease-out;
}

/* --- Topographic Contours --- */
#topo-contours {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#topo-contours svg {
    width: 100%;
    height: 100%;
}

/* --- Narrative Sections --- */
.narrative-section {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* --- SECTION 1: STILLNESS --- */
#stillness {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-impact {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-ripples {
    position: absolute;
    width: 80vmin;
    height: 80vmin;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Drop element */
.drop-element {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--lunar-white);
    border-radius: 50%;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    z-index: 20;
}

.drop-element.falling {
    animation: dropFall 1.2s var(--ripple-ease) forwards;
}

@keyframes dropFall {
    0% {
        top: 10%;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        top: 50%;
        opacity: 1;
    }
}

.drop-element.impact {
    animation: dropImpact 0.3s ease-out forwards;
}

@keyframes dropImpact {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(3);
        opacity: 0;
    }
}

/* --- Ripple Ring Animations --- */
.ripple-ring {
    transform-origin: center;
}

.ripple-ring.animate {
    animation: rippleExpand 2.4s var(--ripple-ease) forwards;
}

@keyframes rippleExpand {
    0% {
        r: 0;
        opacity: 0.6;
        stroke-width: 1.5px;
    }
    15% {
        opacity: 0.6;
    }
    100% {
        r: 500;
        opacity: 0;
        stroke-width: 0.3px;
    }
}

/* Smaller ripple expansion for clusters */
.cluster-ripples .ripple-ring.animate {
    animation: clusterRippleExpand 2.0s var(--ripple-ease) forwards;
}

@keyframes clusterRippleExpand {
    0% {
        r: 0;
        opacity: 0.5;
        stroke-width: 1.2px;
    }
    15% {
        opacity: 0.5;
    }
    100% {
        r: 350;
        opacity: 0;
        stroke-width: 0.2px;
    }
}

/* Secondary ripples (smaller, offset) */
.secondary-ripples .ripple-ring.animate {
    animation: secondaryRippleExpand 2.0s var(--ripple-ease) forwards;
}

@keyframes secondaryRippleExpand {
    0% {
        r: 0;
        opacity: 0.4;
    }
    100% {
        r: 300;
        opacity: 0;
    }
}

/* Final dissipating ripples */
.dissipating {
    animation: dissipate 4s ease-in-out infinite alternate;
}

@keyframes dissipate {
    0% {
        opacity: var(--initial-opacity, 0.1);
    }
    50% {
        opacity: calc(var(--initial-opacity, 0.1) * 0.5);
    }
    100% {
        opacity: var(--initial-opacity, 0.1);
    }
}

/* --- SECTION 2: IMPACT — Wordmark --- */
#impact {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#impact-center {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.impact-ripples,
.secondary-ripples {
    position: absolute;
    width: 90vmin;
    height: 90vmin;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.secondary-ripples {
    width: 70vmin;
    height: 70vmin;
    left: 35%;
}

.wordmark-container {
    position: relative;
    z-index: 15;
    text-align: center;
}

#wordmark {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(56px, 12vw, 96px);
    letter-spacing: 0.06em;
    color: var(--lunar-white);
    display: inline-flex;
    gap: 0.02em;
}

.letter {
    display: inline-block;
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.6s ease, filter 0.6s ease, color 0.6s ease;
}

.letter.revealed {
    opacity: 1;
    filter: blur(0);
}

.letter.amber-flash {
    color: var(--lantern-amber);
}

.tagline {
    font-family: var(--font-body);
    font-weight: 350;
    font-size: clamp(14px, 2vw, 18px);
    color: var(--still-silver);
    margin-top: 24px;
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

/* --- Blur-Reveal Animation --- */
.blur-reveal {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(12px);
    transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}

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

/* --- SECTION 3: PROPAGATION — Content Clusters --- */
#propagation {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    position: relative;
}

.content-cluster {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.content-cluster[data-offset="30"] .cluster-content,
.content-cluster[data-offset="35"] .cluster-content {
    margin-left: 5%;
    margin-right: auto;
}

.content-cluster[data-offset="70"] .cluster-content,
.content-cluster[data-offset="65"] .cluster-content {
    margin-right: 5%;
    margin-left: auto;
}

.cluster-impact {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.cluster-ripples {
    position: absolute;
    width: 60vmin;
    height: 60vmin;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.content-cluster[data-offset="30"] .cluster-ripples,
.content-cluster[data-offset="35"] .cluster-ripples {
    left: 30%;
}

.content-cluster[data-offset="70"] .cluster-ripples,
.content-cluster[data-offset="65"] .cluster-ripples {
    left: 70%;
}

.cluster-content {
    position: relative;
    z-index: 12;
    max-width: 560px;
    padding: 48px 32px;
}

.drop-trigger {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--lunar-white);
    border-radius: 50%;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scale(0);
    opacity: 0;
    transition: transform 0.3s var(--ripple-ease), opacity 0.3s ease;
}

.drop-trigger.visible {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    animation: dropPulse 0.4s ease-out forwards;
}

@keyframes dropPulse {
    0% {
        transform: translateX(-50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: translateX(-50%) scale(0);
        opacity: 0;
    }
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(40px, 7vw, 72px);
    letter-spacing: 0.02em;
    color: var(--lunar-white);
    margin-bottom: 24px;
    line-height: 1.1;
}

.section-body {
    font-family: var(--font-body);
    font-weight: 350;
    font-size: 17px;
    line-height: 1.75;
    color: var(--lunar-white);
    margin-bottom: 24px;
    max-width: 480px;
}

.measurement {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--still-silver);
    display: block;
    margin-top: 16px;
}

.dm-mono {
    font-family: var(--font-mono);
}

/* --- SECTION 4: INTERFERENCE --- */
#interference {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.interference-zone {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interference-ripples-a,
.interference-ripples-b {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    mix-blend-mode: screen;
    pointer-events: none;
}

.interference-content {
    position: relative;
    z-index: 15;
    text-align: center;
    max-width: 700px;
    padding: 48px 32px;
}

.interference-text {
    font-family: var(--font-body);
    font-weight: 350;
    font-size: 17px;
    line-height: 1.75;
    color: var(--lunar-white);
    margin-bottom: 20px;
}

.fragment-left {
    text-align: left;
    max-width: 480px;
    margin-right: auto;
}

.fragment-right {
    text-align: right;
    max-width: 480px;
    margin-left: auto;
}

/* Interference section active glow */
#interference .section-heading {
    color: var(--refraction-violet);
}

/* --- SECTION 5: DISSIPATION --- */
#dissipation {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#final-impact {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.final-ripples {
    position: absolute;
    width: 120vmin;
    height: 120vmin;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.dissipation-content {
    position: relative;
    z-index: 15;
    text-align: center;
    max-width: 700px;
    padding: 48px 32px;
}

.final-statement {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(32px, 5vw, 56px);
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: var(--lunar-white);
    margin-bottom: 32px;
}

.amber-accent {
    color: var(--lantern-amber);
}

/* --- Impact Point Base --- */
.impact-point {
    position: relative;
}

/* --- Scroll-linked ripple drift --- */
.ripple-system {
    pointer-events: none;
}

/* --- Responsive (Single-column fallback) --- */
@media (max-width: 768px) {
    .content-cluster {
        padding: 48px 20px;
    }

    .content-cluster[data-offset="30"] .cluster-content,
    .content-cluster[data-offset="35"] .cluster-content,
    .content-cluster[data-offset="70"] .cluster-content,
    .content-cluster[data-offset="65"] .cluster-content {
        margin-left: auto;
        margin-right: auto;
    }

    .content-cluster[data-offset="30"] .cluster-ripples,
    .content-cluster[data-offset="35"] .cluster-ripples,
    .content-cluster[data-offset="70"] .cluster-ripples,
    .content-cluster[data-offset="65"] .cluster-ripples {
        left: 50%;
    }

    .section-heading {
        font-size: clamp(32px, 10vw, 56px);
    }

    .cluster-content {
        max-width: 100%;
        padding: 32px 16px;
    }

    /* Concentric spacing rhythm for mobile */
    .content-cluster:nth-child(1) { margin-top: 48px; }
    .content-cluster:nth-child(2) { margin-top: 32px; }
    .content-cluster:nth-child(3) { margin-top: 24px; }
    .content-cluster:nth-child(4) { margin-top: 32px; }

    .fragment-left,
    .fragment-right {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .interference-content {
        padding: 32px 16px;
    }
}

/* --- Selection --- */
::selection {
    background: var(--depth-teal);
    color: var(--lunar-white);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--abyssal-ink);
}

::-webkit-scrollbar-thumb {
    background: var(--still-silver);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--depth-teal);
}
