/* ============================================
   okurairi.net - Subaquatic Watercolor Design
   ============================================ */

/* CSS Custom Properties */
:root {
    --foam-white: #e8f4f8;
    --shallow-azure: #5ba3b5;
    --living-coral: #e87461;
    --twilight-indigo: #1a3a5c;
    --abyssal-teal: #0a4f5c;
    --bioluminescent-cyan: #00e5ff;
    --trench-midnight: #060d14;
    --slate-ink: #2c3e50;
    --pearl-white: #f0f5f8;
    --sea-anemone-pink: #d4a0a0;
    --pale-azure: #b8d4e3;

    --zone-bg: var(--foam-white);
    --zone-text: var(--slate-ink);
    --zone-accent: var(--bioluminescent-cyan);
    --doc-height: 500vh;
    --current-depth: 0;
    --wave-phase: 0deg;
    --timeline-left: 15%;
}

/* Wave phase animation for botanical sync */
@keyframes wavePhase {
    from { --wave-phase: 0deg; }
    to { --wave-phase: 360deg; }
}

/* Ambient bubble rise animation */
@keyframes rise {
    from {
        transform: translateY(100vh) scale(0.8);
        opacity: 0.6;
    }
    to {
        transform: translateY(-20vh) scale(1.1);
        opacity: 0;
    }
}

/* Bubble lateral sway */
@keyframes sway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(var(--sway-distance, 20px)); }
}

/* Bubble burst effect */
@keyframes burst {
    0% {
        transform: scale(0) translate(var(--burst-x, 0), var(--burst-y, 0));
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5) translate(calc(var(--burst-x, 0) * 3), calc(var(--burst-y, 0) * 3));
        opacity: 0;
    }
}

/* Timeline marker glow pulse */
@keyframes glowPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

/* Hero bubble entry */
@keyframes heroBubbleFadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Hero bubble ascend */
@keyframes heroBubbleAscend {
    from { transform: translateY(0); }
    to { transform: translateY(-15vh); opacity: 0; }
}

/* Hero letter stagger */
@keyframes letterFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero subtitle fade */
@keyframes subtitleFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Kelp sway animation */
@keyframes kelpSway {
    0%, 100% { transform: skewX(0deg); }
    25% { transform: skewX(3deg); }
    75% { transform: skewX(-3deg); }
}

/* Anemone tendril wave */
@keyframes tendrilWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

/* Zoom-focus reveal */
@keyframes zoomFocusIn {
    from {
        transform: scale(0.92);
        opacity: 0;
        filter: blur(4px);
    }
    to {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

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

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.015em;
    color: var(--zone-text);
    background: linear-gradient(
        to bottom,
        #e8f4f8 0%,
        #e8f4f8 10%,
        #5ba3b5 30%,
        #1a3a5c 55%,
        #0a4f5c 75%,
        #060d14 100%
    );
    background-attachment: fixed;
    min-height: var(--doc-height);
    overflow-x: hidden;
    position: relative;
    transition: background-color 1.2s ease, color 0.8s ease;
}

/* ============================================
   Watercolor Paper Texture
   ============================================ */

#paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#paper-texture.visible {
    opacity: 1;
}

/* SVG turbulence texture via inline background */
#paper-texture::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='t'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23t)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: multiply;
    opacity: 0.04;
}

body.deep-zone #paper-texture::before {
    mix-blend-mode: screen;
}

/* ============================================
   Timeline Line
   ============================================ */

#timeline-line {
    position: fixed;
    left: var(--timeline-left);
    top: 0;
    width: 4px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.6;
}

/* ============================================
   Ambient Bubbles Container
   ============================================ */

#ambient-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

.ambient-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.1) 40%,
        transparent 60%,
        rgba(0, 0, 0, 0.05) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: rise var(--rise-duration, 10s) linear infinite, sway var(--sway-duration, 4s) ease-in-out infinite;
    animation-delay: var(--bubble-delay, 0s);
    bottom: -30px;
    left: var(--bubble-left, 50%);
    width: var(--bubble-size, 16px);
    height: var(--bubble-size, 16px);
}

/* Burst bubbles from interaction */
.burst-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(0, 229, 255, 0.5) 0%,
        rgba(0, 229, 255, 0.1) 50%,
        transparent 100%
    );
    pointer-events: none;
    animation: burst 0.6s ease-out forwards;
    z-index: 100;
}

/* ============================================
   Depth Zones
   ============================================ */

.depth-zone {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 8vw, 6rem);
    padding-left: calc(var(--timeline-left) + 60px);
}

.zone-sentinel {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* Zone 1: Surface */
.zone-surface {
    align-items: center;
    justify-content: center;
    padding-left: clamp(2rem, 8vw, 6rem);
}

.zone-surface .hero-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Zone text color transitions */
.zone-surface { color: var(--slate-ink); }
.zone-epipelagic { color: var(--slate-ink); }
.zone-mesopelagic { color: var(--pale-azure); }
.zone-bathypelagic { color: var(--pale-azure); }
.zone-abyssal { color: var(--pearl-white); }

.zone-mesopelagic h2,
.zone-mesopelagic h3 { color: var(--pearl-white); }
.zone-bathypelagic h2,
.zone-bathypelagic h3 { color: var(--pearl-white); }
.zone-abyssal h2,
.zone-abyssal h3 { color: var(--pearl-white); }

/* ============================================
   Hero Bubble & Text
   ============================================ */

.hero-bubble {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 30%,
        rgba(255, 255, 255, 0.7) 0%,
        rgba(232, 244, 248, 0.3) 30%,
        rgba(91, 163, 181, 0.15) 60%,
        transparent 80%
    );
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 40px rgba(91, 163, 181, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    margin-bottom: 24px;
    position: relative;
}

.hero-bubble.animate-in {
    animation: heroBubbleFadeIn 0.6s ease-out forwards;
}

.hero-bubble.animate-ascend {
    animation: heroBubbleAscend 2s ease-in forwards;
}

.hero-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--twilight-indigo);
    white-space: nowrap;
}

.hero-text .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.5s ease-out forwards;
}

.hero-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.7);
    opacity: 0;
    margin-top: 8px;
}

.hero-subtitle.visible {
    animation: subtitleFade 0.8s ease-out forwards;
}

/* Small trail bubbles from hero */
.trail-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: rise var(--trail-duration, 3s) ease-in forwards;
    pointer-events: none;
}

/* ============================================
   Timeline Markers
   ============================================ */

.timeline-marker {
    position: absolute;
    left: var(--timeline-left);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    z-index: 5;
}

.marker-glow {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        var(--bioluminescent-cyan) 0%,
        rgba(0, 229, 255, 0.3) 40%,
        transparent 70%
    );
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    animation: glowPulse 3s ease-in-out infinite;
}

.depth-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.7);
    position: absolute;
    top: 50%;
    left: 60px;
    transform: translateY(-50%);
    white-space: nowrap;
}

/* ============================================
   Content Blocks
   ============================================ */

.content-block {
    max-width: 920px;
    position: relative;
    margin-bottom: 3rem;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    /* Zoom-focus initial state */
    transform: scale(0.92);
    opacity: 0;
    filter: blur(4px);
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.content-block.revealed {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
}

.content-block.unrevealed {
    transform: scale(0.92);
    opacity: 0;
    filter: blur(4px);
}

.connector-line {
    position: absolute;
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.zone-surface .card,
.zone-epipelagic .card {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(91, 163, 181, 0.15);
}

h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3.2vw, 2.4rem);
    color: var(--pearl-white);
    text-shadow: 0 2px 12px rgba(0, 229, 255, 0.15);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.zone-surface h2,
.zone-epipelagic h2 {
    color: var(--twilight-indigo);
    text-shadow: none;
}

h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.zone-surface h3,
.zone-epipelagic h3 {
    color: var(--twilight-indigo);
}

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

.closing-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--bioluminescent-cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    text-align: center;
    margin-top: 1.5rem;
    letter-spacing: 0.05em;
}

/* ============================================
   Watercolor Bleed Dividers
   ============================================ */

.depth-zone::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: 0;
    width: 100%;
    height: 80px;
    background: radial-gradient(ellipse at 50% 50%, rgba(91, 163, 181, 0.15) 0%, transparent 70%);
    filter: blur(20px);
    pointer-events: none;
    z-index: 0;
}

.zone-mesopelagic::after {
    background: radial-gradient(ellipse at 50% 50%, rgba(26, 58, 92, 0.2) 0%, transparent 70%);
}

.zone-bathypelagic::after {
    background: radial-gradient(ellipse at 50% 50%, rgba(0, 229, 255, 0.08) 0%, transparent 70%);
}

.zone-abyssal::after {
    display: none;
}

/* ============================================
   Botanical SVG Animations
   ============================================ */

.botanical {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.botanical-kelp-left {
    left: 0;
    bottom: 0;
    width: 80px;
    height: 400px;
    opacity: 0.7;
}

.botanical-coral-right {
    right: 20px;
    bottom: 40px;
    width: 120px;
    height: 200px;
}

.botanical-anemone-left {
    left: calc(var(--timeline-left) - 30px);
    bottom: 20px;
    width: 100px;
    height: 160px;
}

.botanical-kelp-deep {
    right: 10px;
    bottom: 0;
    width: 60px;
    height: 300px;
}

.botanical-abyss {
    left: calc(var(--timeline-left) + 20px);
    bottom: 40px;
    width: 100px;
    height: 120px;
}

.kelp-frond {
    animation: kelpSway 8s ease-in-out infinite;
    transform-origin: bottom center;
}

.anemone-tendril {
    animation: tendrilWave 6s ease-in-out infinite;
    transform-origin: bottom center;
}

.coral-branch {
    animation: kelpSway 10s ease-in-out infinite;
    transform-origin: bottom left;
}

/* ============================================
   Responsive - Below 768px
   ============================================ */

@media (max-width: 768px) {
    :root {
        --timeline-left: 8px;
    }

    .depth-zone {
        padding: 2rem 16px;
        padding-left: 40px;
    }

    .zone-surface {
        padding-left: 16px;
    }

    .hero-bubble {
        width: 80px;
        height: 80px;
    }

    .hero-text {
        font-size: clamp(0.9rem, 4vw, 1.3rem);
    }

    h2 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .timeline-marker {
        width: 32px;
        height: 32px;
    }

    .marker-glow {
        width: 32px;
        height: 32px;
    }

    .depth-label {
        left: 40px;
        font-size: 0.65rem;
    }

    .connector-line {
        display: none;
    }

    .content-block {
        padding: 1.2rem;
    }

    .botanical {
        transform: scale(0.6);
        transform-origin: bottom left;
    }

    .botanical-coral-right {
        transform-origin: bottom right;
    }
}

/* ============================================
   Selection styling
   ============================================ */

::selection {
    background: rgba(0, 229, 255, 0.3);
    color: var(--pearl-white);
}

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

::-webkit-scrollbar-track {
    background: var(--trench-midnight);
}

::-webkit-scrollbar-thumb {
    background: var(--abyssal-teal);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--shallow-azure);
}