/* ============================================
   continu.st -- Geological Strata Design System
   ============================================ */

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

html, body {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background: #F2E6D4;
    color: #6B3E26;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.65;
}

/* Hide SVG filter definitions */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Horizontal Scroll Container --- */
.scroll-container {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- Scene Base --- */
.scene {
    width: 100vw;
    height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

/* --- Scene Grain Overlay --- */
.scene-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 300px 300px;
}

/* --- Horizon Line --- */
.horizon-line {
    position: absolute;
    top: 40%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(107, 62, 38, 0.12);
    z-index: 2;
    pointer-events: none;
}

.horizon-line-dark {
    background: rgba(249, 244, 237, 0.08);
}

/* --- Scene Content --- */
.scene-content {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sky-zone {
    height: 40%;
    display: flex;
    align-items: flex-end;
    padding: 0 8vw 2rem;
}

.earth-zone {
    height: 60%;
    padding: 2rem 8vw 0;
}

/* ============================================
   SCENE 1: SURFACE
   ============================================ */
.scene-surface {
    background: linear-gradient(135deg, #F2E6D4 0%, #F9F4ED 40%, #F2E6D4 100%);
}

.surface-heading {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    color: #6B3E26;
    text-transform: none;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.surface-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.surface-intro {
    max-width: 38ch;
    color: #6B3E26;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

.surface-intro.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Floating Blobs --- */
.floating-blob {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    opacity: 0.2;
}

.blob-1 {
    width: 180px;
    height: 160px;
    background: #C8A46E;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    top: 15%;
    right: 20%;
    animation: blobMorph1 10s ease-in-out infinite, blobFloat1 18s ease-in-out infinite;
}

.blob-2 {
    width: 120px;
    height: 100px;
    background: #D4854A;
    border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%;
    top: 55%;
    right: 10%;
    animation: blobMorph2 12s ease-in-out infinite, blobFloat2 22s ease-in-out infinite;
}

.blob-3 {
    width: 80px;
    height: 70px;
    background: #C8A46E;
    border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%;
    top: 70%;
    left: 15%;
    animation: blobMorph3 8s ease-in-out infinite, blobFloat3 15s ease-in-out infinite;
}

.blob-4 {
    width: 48px;
    height: 42px;
    background: #D4854A;
    border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%;
    top: 25%;
    left: 30%;
    animation: blobMorph1 9s ease-in-out infinite, blobFloat2 20s ease-in-out infinite;
}

/* Blob morph keyframes */
@keyframes blobMorph1 {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25%  { border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%; }
    50%  { border-radius: 60% 40% 50% 50% / 50% 50% 40% 60%; }
    75%  { border-radius: 40% 60% 60% 40% / 60% 40% 30% 70%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%; }
    25%  { border-radius: 30% 70% 50% 50% / 50% 50% 70% 30%; }
    50%  { border-radius: 70% 30% 40% 60% / 30% 70% 50% 50%; }
    75%  { border-radius: 40% 60% 70% 30% / 60% 40% 40% 60%; }
    100% { border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%; }
    33%  { border-radius: 60% 40% 40% 60% / 40% 60% 50% 50%; }
    66%  { border-radius: 50% 50% 60% 40% / 60% 40% 40% 60%; }
    100% { border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%; }
}

@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0); }
    25%  { transform: translate(20px, -15px); }
    50%  { transform: translate(-10px, 10px); }
    75%  { transform: translate(15px, 5px); }
}

@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0); }
    25%  { transform: translate(-15px, 10px); }
    50%  { transform: translate(10px, -20px); }
    75%  { transform: translate(-5px, -10px); }
}

@keyframes blobFloat3 {
    0%, 100% { transform: translate(0, 0); }
    33%  { transform: translate(12px, 8px); }
    66%  { transform: translate(-8px, -12px); }
}

/* ============================================
   SCENE 2: TOPSOIL
   ============================================ */
.scene-topsoil {
    background: linear-gradient(135deg, #F2E6D4 0%, #C8A46E 100%);
}

.scene-heading {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    color: #6B3E26;
    text-transform: none;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.scene-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.stratum-bands {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

.stratum-band {
    flex: 1;
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.stratum-band.revealed {
    opacity: 1;
    transform: translateY(0);
}

.band-light {
    background: rgba(242, 230, 212, 0.7);
    border-radius: 30% 70% 70% 30% / 100% 100% 0% 0%;
}

.band-mid {
    background: rgba(200, 164, 110, 0.5);
}

.band-dark {
    background: rgba(168, 92, 58, 0.35);
    border-radius: 0% 0% 30% 70% / 0% 0% 100% 100%;
}

.band-text {
    max-width: 38ch;
    color: #6B3E26;
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    line-height: 1.65;
}

.band-dark .band-text {
    color: #F2E6D4;
}

/* Isometric grid overlay */
.iso-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.04;
    background-image:
        repeating-linear-gradient(
            60deg,
            transparent,
            transparent 62px,
            #6B3E26 62px,
            #6B3E26 63px
        ),
        repeating-linear-gradient(
            -60deg,
            transparent,
            transparent 62px,
            #6B3E26 62px,
            #6B3E26 63px
        );
}

/* ============================================
   SCENE 3: CLAY LAYER
   ============================================ */
.scene-clay {
    background: linear-gradient(135deg, #C8A46E 0%, #A85C3A 100%);
}

.scene-clay .scene-heading {
    color: #F2E6D4;
}

.excavation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    height: 100%;
    padding: 1rem 0;
    perspective: 800px;
}

.excavation-block {
    position: relative;
    padding: 2rem;
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0;
    transform: translateY(40px);
}

.excavation-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.block-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: -1;
}

.block-revealed .block-surface {
    background: rgba(242, 230, 212, 0.15);
}

.block-partial .block-surface {
    background: rgba(242, 230, 212, 0.08);
}

.block-buried .block-surface {
    background: rgba(46, 26, 14, 0.2);
}

.block-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #F9F4ED;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.block-text {
    max-width: 38ch;
    color: #F2E6D4;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.6;
}

.block-buried {
    opacity: 0;
}

.block-buried.revealed {
    opacity: 0.5;
    transform: translateY(0) scale(0.92);
}

.block-partial {
    opacity: 0;
}

.block-partial.revealed {
    opacity: 0.75;
    transform: translateY(0) scale(0.96);
}

/* Isometric skew for excavation blocks */
.block-pos-1 {
    transform-origin: bottom left;
}

.block-pos-2 {
    transform-origin: bottom right;
}

.block-pos-3 {
    transform-origin: top left;
}

.block-pos-4 {
    transform-origin: top right;
}

/* ============================================
   SCENE 4: BEDROCK
   ============================================ */
.scene-bedrock {
    background: #2E1A0E;
}

.scene-bedrock .scene-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-sample-column {
    position: relative;
    max-width: 480px;
    width: 90%;
    text-align: center;
    padding: 4rem 2rem;
    opacity: 0;
    transform: translateY(-60px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.core-sample-column.revealed {
    opacity: 1;
    transform: translateY(0);
}

.core-blob {
    position: absolute;
    width: 200px;
    height: 300px;
    background: #7B9E87;
    opacity: 0.15;
    z-index: 0;
    filter: blur(1px);
}

.core-blob-left {
    left: -80px;
    top: 10%;
    border-radius: 60% 40% 50% 50% / 40% 60% 40% 60%;
    animation: blobMorph1 11s ease-in-out infinite;
}

.core-blob-right {
    right: -80px;
    bottom: 10%;
    border-radius: 40% 60% 30% 70% / 60% 40% 70% 30%;
    animation: blobMorph2 13s ease-in-out infinite;
}

.core-text-wrapper {
    position: relative;
    z-index: 1;
}

.core-heading {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    color: #F9F4ED;
    margin-bottom: 2rem;
    line-height: 1.15;
}

.core-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: #F9F4ED;
    max-width: 38ch;
    margin: 0 auto 1.5rem;
    line-height: 1.65;
    opacity: 0.85;
}

.core-caption {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.85rem;
    color: #9C7B5C;
    display: block;
    margin-top: 1.5rem;
}

/* ============================================
   SCENE 5: MINERAL VEIN
   ============================================ */
.scene-mineral {
    background: linear-gradient(135deg, #7B9E87 0%, #A85C3A 50%, #D4854A 100%);
}

.mineral-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.3;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(123, 158, 135, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(212, 133, 74, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(168, 92, 58, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 20%, rgba(123, 158, 135, 0.2) 0%, transparent 40%);
}

.mineral-content {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.mineral-statement {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: -0.02em;
    color: #F9F4ED;
    text-align: center;
    max-width: 14ch;
    line-height: 1.1;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
                transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.mineral-statement.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SCENE 6: CORE
   ============================================ */
.scene-core {
    background: #2E1A0E;
}

.scene-core .scene-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-final {
    text-align: center;
    position: relative;
    z-index: 3;
}

.core-final-heading {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    color: #F9F4ED;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
                transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.core-final-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.core-final-meta {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: #F9F4ED;
    max-width: 42ch;
    margin: 0 auto 1rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

.core-final-meta.revealed {
    opacity: 0.85;
    transform: translateY(0);
}

.core-final-timestamp {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.85rem;
    color: #9C7B5C;
    display: block;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s;
}

.core-final-timestamp.revealed {
    opacity: 1;
}

/* Dense core blobs */
.core-blob-float {
    opacity: 0.1;
}

.blob-dense-1 {
    width: 200px;
    height: 180px;
    background: #6B3E26;
    border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%;
    top: 10%;
    left: 10%;
    animation: blobMorph1 16s ease-in-out infinite, blobFloat1 30s ease-in-out infinite;
}

.blob-dense-2 {
    width: 150px;
    height: 130px;
    background: #A85C3A;
    border-radius: 30% 70% 50% 50% / 50% 50% 70% 30%;
    top: 60%;
    right: 15%;
    animation: blobMorph2 18s ease-in-out infinite, blobFloat2 35s ease-in-out infinite;
}

.blob-dense-3 {
    width: 100px;
    height: 90px;
    background: #7B9E87;
    border-radius: 60% 40% 40% 60% / 60% 40% 60% 40%;
    top: 30%;
    right: 25%;
    animation: blobMorph3 14s ease-in-out infinite, blobFloat3 28s ease-in-out infinite;
}

.blob-dense-4 {
    width: 120px;
    height: 110px;
    background: #6B3E26;
    border-radius: 40% 60% 60% 40% / 40% 60% 40% 60%;
    bottom: 15%;
    left: 20%;
    animation: blobMorph2 20s ease-in-out infinite, blobFloat1 32s ease-in-out infinite;
}

.blob-dense-5 {
    width: 80px;
    height: 70px;
    background: #D4854A;
    border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%;
    top: 75%;
    left: 60%;
    animation: blobMorph1 15s ease-in-out infinite, blobFloat3 25s ease-in-out infinite;
}

/* ============================================
   DEPTH GAUGE
   ============================================ */
.depth-gauge {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 36px;
    display: flex;
    z-index: 100;
    cursor: pointer;
}

.gauge-segment {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.gauge-label {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: #6B3E26;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
}

.gauge-segment:hover .gauge-label {
    opacity: 1;
}

.gauge-indicator {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 10px solid #F9F4ED;
    transition: left 0.3s ease;
    z-index: 101;
    filter: drop-shadow(0 -1px 2px rgba(46, 26, 14, 0.3));
    pointer-events: none;
}

/* ============================================
   ANIMATIONS - Stratum Reveal
   ============================================ */
.stratum-band[data-depth="0"] {
    transition-delay: 0s;
}

.stratum-band[data-depth="1"] {
    transition-delay: 0.12s;
}

.stratum-band[data-depth="2"] {
    transition-delay: 0.24s;
}

/* Excavation block stagger */
.block-pos-1 {
    transition-delay: 0s;
}

.block-pos-2 {
    transition-delay: 0.12s;
}

.block-pos-3 {
    transition-delay: 0.24s;
}

.block-pos-4 {
    transition-delay: 0.36s;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .sky-zone {
        padding: 0 5vw 1rem;
    }

    .earth-zone {
        padding: 1rem 5vw 0;
    }

    .excavation-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 1rem;
    }

    .excavation-block {
        padding: 1.5rem;
    }

    .core-sample-column {
        padding: 2rem 1rem;
    }

    .core-blob {
        display: none;
    }

    .depth-gauge {
        height: 28px;
    }
}

@media (max-width: 480px) {
    .surface-heading {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .stratum-band {
        padding: 1rem;
    }

    .band-text {
        font-size: 0.85rem;
    }
}
