/* ============================================
   bada.casa — The House of the Sea
   A single-page vertical descent
   ============================================ */

/* --- CSS Custom Properties for Counter Animate --- */
@property --depth {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}

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

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

body {
    font-family: 'Lora', serif;
    color: #8b6f4e;
    background: #f5ead6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.display-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    letter-spacing: -0.02em;
}

.body-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    max-width: 38ch;
    text-align: left;
}

.depth-number, .depth-unit {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Zone Structure --- */
.zone {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.zone-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin-left: 12vw;
    padding-top: 15vh;
    padding-bottom: 10vh;
}

/* --- Fade-in Animation --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   ZONE 1: SURFACE
   ============================================ */
#zone-1 {
    background: #f5ead6;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
}

#zone-1 .zone-content {
    padding-top: 35vh;
}

#hero-title {
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: #5a3e28;
    opacity: 0;
    animation: heroFadeIn 1.5s ease-out 0.8s forwards;
}

#hero-subtitle {
    color: #8b6f4e;
    font-size: 1.1rem;
    margin-top: 1.5rem;
    opacity: 0;
    animation: heroFadeIn 1.5s ease-out 1.4s forwards;
}

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

/* Caustic Light Patterns */
.caustics {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(201,169,110,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(250,243,231,0.2) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(201,169,110,0.1) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(250,243,231,0.15) 0%, transparent 40%);
    background-size:
        60% 60%,
        50% 50%,
        70% 70%,
        45% 45%;
    animation:
        causticMove1 8s ease-in-out infinite alternate,
        causticMove2 13s ease-in-out infinite alternate,
        causticMove3 21s ease-in-out infinite alternate;
}

@keyframes causticMove1 {
    0% { background-position: 0% 0%, 50% 50%, 30% 70%, 80% 20%; }
    100% { background-position: 30% 20%, 20% 70%, 60% 40%, 50% 60%; }
}

@keyframes causticMove2 {
    0% { background-position: 0% 0%, 50% 50%, 30% 70%, 80% 20%; }
    100% { background-position: 50% 40%, 80% 30%, 10% 60%, 30% 80%; }
}

@keyframes causticMove3 {
    0% { background-position: 0% 0%, 50% 50%, 30% 70%, 80% 20%; }
    100% { background-position: 70% 10%, 40% 80%, 80% 20%, 10% 40%; }
}

/* ============================================
   ZONE 2: PHOTIC LAYER
   ============================================ */
#zone-2 {
    background: linear-gradient(180deg, #f5ead6 0%, #e8d9bc 30%, #d9c9a5 100%);
    min-height: 150vh;
}

#zone-2 .zone-content {
    padding-top: 12vh;
}

#zone-2 .zone-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #5a3e28;
    margin-bottom: 6vh;
}

#zone-2 .body-text {
    color: #5a3e28;
    margin-bottom: 3rem;
}

/* Inflated 3D Forms — Zone 2 */
.dome-1 {
    position: absolute;
    top: 10%;
    right: -10vw;
    width: 60vw;
    height: 30vw;
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at 40% 30%, #f5ead6, #d4917a 25%, #c9a96e 45%, #8b6f4e 70%, #5a3e28);
    box-shadow:
        inset 0 -20px 60px rgba(90,62,40,0.4),
        inset 0 10px 30px rgba(245,234,214,0.3),
        0 20px 80px rgba(30,18,9,0.5);
    opacity: 0.35;
    z-index: 0;
}

.arch-1 {
    position: absolute;
    bottom: 5%;
    right: 5vw;
    width: 25vw;
    height: 45vw;
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at 50% 25%, #f5ead6 0%, #c9a96e 35%, #8b6f4e 65%, #5a3e28 100%);
    box-shadow:
        inset 0 -30px 80px rgba(90,62,40,0.5),
        inset 0 15px 40px rgba(245,234,214,0.2),
        0 30px 100px rgba(30,18,9,0.4);
    opacity: 0.3;
    z-index: 0;
}

/* ============================================
   THERMOCLINES
   ============================================ */
.thermocline {
    position: relative;
    height: 50vh;
    overflow: hidden;
}

.thermocline-1-2 {
    background: linear-gradient(180deg, #f5ead6, #e8d9bc);
}

.thermocline-2-3 {
    background: linear-gradient(180deg, #d9c9a5, #8b6f4e);
}

.thermocline-3-4 {
    background: linear-gradient(180deg, #8b6f4e, #5a3e28);
}

.thermocline-4-5 {
    background: linear-gradient(180deg, #5a3e28, #1e1209);
}

.sediment-lines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 37px,
            rgba(201,169,110,0.15) 37px,
            rgba(201,169,110,0.15) 38px,
            transparent 38px,
            transparent 89px,
            rgba(201,169,110,0.1) 89px,
            rgba(201,169,110,0.1) 90px,
            transparent 90px,
            transparent 143px,
            rgba(201,169,110,0.12) 143px,
            rgba(201,169,110,0.12) 144px,
            transparent 144px,
            transparent 201px,
            rgba(201,169,110,0.08) 201px,
            rgba(201,169,110,0.08) 202px
        );
}

/* ============================================
   ZONE 3: TWILIGHT ZONE
   ============================================ */
#zone-3 {
    background: linear-gradient(180deg, #8b6f4e 0%, #6d5438 50%, #5a3e28 100%);
    min-height: 150vh;
}

#zone-3 .zone-content {
    padding-top: 12vh;
}

#zone-3 .zone-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #c9a96e;
    margin-bottom: 6vh;
}

#zone-3 .body-text {
    color: #f5ead6;
    margin-bottom: 3rem;
}

#topo-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Inflated walls — Zone 3 */
.wall-left {
    position: absolute;
    top: 20%;
    left: -15vw;
    width: 35vw;
    height: 60vh;
    border-radius: 0 50% 50% 0;
    background: radial-gradient(ellipse at 70% 50%, #8b6f4e, #5a3e28 60%, #1e1209);
    box-shadow:
        inset -20px 0 50px rgba(30,18,9,0.5),
        inset 10px 0 30px rgba(139,111,78,0.3),
        20px 0 80px rgba(30,18,9,0.4);
    opacity: 0.5;
    z-index: 0;
}

.wall-right {
    position: absolute;
    bottom: 10%;
    right: -20vw;
    width: 45vw;
    height: 70vh;
    border-radius: 50% 0 0 50%;
    background: radial-gradient(ellipse at 30% 50%, #8b6f4e, #5a3e28 55%, #1e1209);
    box-shadow:
        inset 20px 0 60px rgba(30,18,9,0.5),
        inset -10px 0 30px rgba(139,111,78,0.2),
        -30px 0 100px rgba(30,18,9,0.5);
    opacity: 0.45;
    z-index: 0;
}

/* ============================================
   ZONE 4: MIDNIGHT ZONE
   ============================================ */
#zone-4 {
    background: linear-gradient(180deg, #5a3e28 0%, #3a2518 40%, #1e1209 100%);
    min-height: 150vh;
}

#zone-4 .zone-content {
    padding-top: 12vh;
}

#zone-4 .zone-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #c9a96e;
    margin-bottom: 6vh;
}

#zone-4 .body-text {
    color: #faf3e7;
    margin-bottom: 3rem;
}

#topo-canvas-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Massive inflated forms — Zone 4 */
.massive-left {
    position: absolute;
    top: 5%;
    left: -25vw;
    width: 55vw;
    height: 80vh;
    border-radius: 0 50% 50% 0;
    background: radial-gradient(ellipse at 80% 40%, #5a3e28, #3a2518 50%, #1e1209);
    box-shadow:
        inset -30px 0 80px rgba(30,18,9,0.6),
        inset 15px 0 40px rgba(90,62,40,0.2),
        30px 0 120px rgba(30,18,9,0.5);
    opacity: 0.6;
    z-index: 0;
}

.massive-right {
    position: absolute;
    bottom: -5%;
    right: -30vw;
    width: 65vw;
    height: 90vh;
    border-radius: 50% 0 0 50%;
    background: radial-gradient(ellipse at 20% 60%, #5a3e28, #3a2518 45%, #1e1209);
    box-shadow:
        inset 30px 0 80px rgba(30,18,9,0.6),
        inset -15px 0 40px rgba(90,62,40,0.15),
        -30px 0 120px rgba(30,18,9,0.6);
    opacity: 0.55;
    z-index: 0;
}

/* ============================================
   ZONE 5: ABYSS
   ============================================ */
#zone-5 {
    background: #1e1209;
    min-height: 100vh;
}

#zone-5 .zone-content {
    padding-top: 15vh;
}

#zone-5 .zone-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #c9a96e;
    margin-bottom: 8vh;
}

#zone-5 .body-text {
    color: #faf3e7;
    margin-bottom: 3rem;
}

/* Depth Counter */
#depth-counter-container {
    margin: 8vh 0;
}

#depth-counter {
    font-size: clamp(4rem, 8vw, 6rem);
    color: #5eb5a6;
    line-height: 1;
}

.depth-unit {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: #5eb5a6;
    vertical-align: super;
    margin-left: 0.15em;
}

.abyss-title {
    font-size: clamp(2.5rem, 7vw, 5rem);
    color: #faf3e7;
    margin-top: 8vh;
    margin-bottom: 3vh;
}

.abyss-closing {
    color: #8b6f4e;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    line-height: 2;
}

/* Bioluminescent dots */
.bioluminescent-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #5eb5a6;
    box-shadow: 0 0 8px rgba(94,181,166,0.6), 0 0 20px rgba(94,181,166,0.3);
    animation: bioPulse 4s ease-in-out infinite alternate;
    z-index: 0;
}

.bio-1 { top: 15%; right: 20%; animation-delay: 0s; }
.bio-2 { top: 35%; right: 45%; animation-delay: 0.8s; }
.bio-3 { top: 55%; right: 12%; animation-delay: 1.6s; }
.bio-4 { top: 70%; right: 65%; animation-delay: 2.4s; }
.bio-5 { top: 25%; right: 75%; animation-delay: 3.2s; }
.bio-6 { top: 80%; right: 30%; animation-delay: 0.4s; width: 3px; height: 3px; }
.bio-7 { top: 45%; right: 55%; animation-delay: 2s; width: 2px; height: 2px; }

@keyframes bioPulse {
    0% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.5); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

/* ============================================
   DEPTH GAUGE
   ============================================ */
#depth-gauge {
    position: fixed;
    right: 24px;
    top: 10vh;
    height: 80vh;
    width: 20px;
    z-index: 100;
    pointer-events: none;
}

#depth-track {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(201,169,110,0.2);
}

#depth-dot {
    position: absolute;
    left: 50%;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5eb5a6;
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(94,181,166,0.44);
    transition: top 0.1s linear;
}

/* ============================================
   HAECKEL SVG ORGANISMS
   ============================================ */
.haeckel-organism {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}

.haeckel-1 {
    width: 180px;
    height: 180px;
    bottom: 10%;
    right: 15%;
    animation: haeckelSpin 120s linear infinite;
}

.haeckel-2 {
    width: 220px;
    height: 220px;
    top: 40%;
    right: 8%;
    animation: haeckelSpin 120s linear infinite reverse;
}

.haeckel-3 {
    width: 160px;
    height: 160px;
    top: 60%;
    right: 25%;
    animation: haeckelSpin 120s linear infinite;
}

.haeckel-4 {
    width: 200px;
    height: 200px;
    top: 30%;
    right: 10%;
    animation: haeckelSpin 120s linear infinite reverse;
}

@keyframes haeckelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .zone-content {
        margin-left: 8vw;
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .zone-content {
        margin-left: 0;
        max-width: 100%;
        padding-left: 24px;
        padding-right: 24px;
    }

    .dome-1 {
        width: 80vw;
        right: -20vw;
    }

    .arch-1 {
        width: 40vw;
        height: 60vw;
    }

    .wall-left {
        width: 50vw;
        left: -25vw;
    }

    .wall-right {
        width: 60vw;
        right: -30vw;
    }

    .massive-left {
        width: 70vw;
        left: -35vw;
    }

    .massive-right {
        width: 80vw;
        right: -40vw;
    }

    #depth-gauge {
        right: 12px;
    }

    .haeckel-organism {
        opacity: 0.1;
    }

    .haeckel-1 { width: 120px; height: 120px; }
    .haeckel-2 { width: 140px; height: 140px; }
    .haeckel-3 { width: 100px; height: 100px; }
    .haeckel-4 { width: 130px; height: 130px; }
}
