/* Design Notes — desca.dev
 * Smoothly transition `--bg-hue` when they begin playing,
 * only when the container element is visible.
 * Fira Code" (from Google Fonts) Interactions:** are scroll-based
 * Interactions:** Scroll-based descent experience
 * Interactions:** are scroll-driven
 * IntersectionObserver` observes each stratum element.
 */

/* Warm amber gradient from #c4652a to #e8c49a creates a visceral sense of descending into warmer strata.
   IntersectionObserver positioned on a floating stratum container, values interpolation.
   Fira Code (Google Fonts) Interactions has */
:root {
    --bg-hue: 30;
    --surface-bg: #f5ebe0;
    --sediment-bg: #f0e6d8;
    --bedrock-bg: #e8c49a;
    --mantle-bg: #d4a574;
    --core-bg: #1a0f08;
    --accent-teal: #2a7a6e;
    --accent-amber: #c4652a;
    --text-dark: #2c1810;
    --text-mid: #9c7a5a;
    --solar-corona: #fff3d4;
    --amber-haze: #f0c878;
}

/* desca.dev - Geological Descent Design System */
/* Colors: #f5ebe0, #f0e6d8, #faf5ef, #fff3d4, #f0c878, #e8c49a, #d4a574, #9c7a5a, #4a3728, #2c1810, #1a0f08, #2a7a6e, #c4652a */

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

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

body {
    font-family: 'Karla', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    color: #2c1810;
    background: #f5ebe0;
    overflow-x: hidden;
}

/* ========================================
   DEPTH INDICATOR (left edge)
   ======================================== */

.depth-indicator {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.depth-indicator.visible {
    opacity: 1;
}

.depth-track {
    width: 3px;
    height: 200px;
    background: rgba(44, 24, 16, 0.15);
    border-radius: 2px;
    position: relative;
}

.depth-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, #d4a574, #c4652a, #2a7a6e);
    border-radius: 2px;
    transition: height 0.3s ease;
}

.depth-marker {
    position: absolute;
    left: 50%;
    top: 0%;
    transform: translate(-50%, -50%);
    width: 11px;
    height: 11px;
    background: #c4652a;
    border: 2px solid #faf5ef;
    border-radius: 50%;
    transition: top 0.3s ease;
    box-shadow: 0 0 8px rgba(196, 101, 42, 0.4);
}

.depth-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
}

.depth-label {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(44, 24, 16, 0.3);
    transition: color 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.depth-label.active {
    color: #c4652a;
    transform: translateX(4px);
}

/* ========================================
   LENS FLARE SYSTEM
   ======================================== */

.lens-flare {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    z-index: 2;
}

.lens-flare--hero {
    width: 600px;
    height: 600px;
    top: -150px;
    right: -100px;
    background: radial-gradient(circle, 
        rgba(255, 243, 212, 0.6) 0%, 
        rgba(240, 200, 120, 0.3) 30%, 
        rgba(240, 200, 120, 0.1) 50%, 
        transparent 70%
    );
    animation: flareFloat 8s ease-in-out infinite;
}

.lens-flare--ambient {
    width: 300px;
    height: 300px;
    top: 10%;
    right: 5%;
    background: radial-gradient(circle, 
        rgba(255, 243, 212, 0.3) 0%, 
        rgba(240, 200, 120, 0.15) 40%, 
        transparent 70%
    );
    animation: flareFloat 12s ease-in-out infinite reverse;
}

.lens-flare--deep {
    width: 400px;
    height: 400px;
    bottom: 20%;
    left: -100px;
    background: radial-gradient(circle, 
        rgba(196, 101, 42, 0.2) 0%, 
        rgba(212, 165, 116, 0.1) 40%, 
        transparent 70%
    );
    animation: flareFloat 10s ease-in-out infinite;
}

@keyframes flareFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(10px, -15px) scale(1.05); }
    50% { transform: translate(-5px, 10px) scale(0.98); }
    75% { transform: translate(8px, 5px) scale(1.02); }
}

/* ========================================
   STRATA SECTIONS
   ======================================== */

.stratum {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.stratum--surface {
    background: #f5ebe0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.stratum--sediment {
    background: #f0e6d8;
    padding: 120px 0 160px;
}

.stratum--bedrock {
    background: #e8c49a;
    padding: 120px 0 160px;
}

.stratum--mantle {
    background: linear-gradient(180deg, #d4a574 0%, #9c7a5a 100%);
    padding: 120px 0 160px;
}

.stratum--core {
    background: linear-gradient(180deg, #4a3728 0%, #1a0f08 100%);
    padding: 120px 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   HERO SECTION
   ======================================== */

.stratum__content--hero {
    text-align: center;
    position: relative;
    z-index: 3;
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 12vw;
    letter-spacing: -0.01em;
    line-height: 1.05;
    color: #2c1810;
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1.2s ease forwards;
    animation-delay: 0.3s;
}

.hero-title__main {
    display: inline;
}

.hero-title__ext {
    font-weight: 400;
    color: #2a7a6e;
    font-size: 0.5em;
    vertical-align: baseline;
}

.hero-subtitle {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 14px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #9c7a5a;
    margin-top: 24px;
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeIn 1s ease forwards;
    animation-delay: 0.9s;
}

.scroll-hint {
    position: absolute;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: heroFadeIn 1s ease forwards, scrollBounce 2s ease-in-out infinite;
    animation-delay: 1.5s, 2.5s;
}

.scroll-hint__text {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9c7a5a;
}

.scroll-hint__arrow {
    color: #9c7a5a;
}

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

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ========================================
   STRATA DIVIDERS (geological SVG)
   ======================================== */

.strata-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: 5;
}

.strata-divider svg {
    width: 100%;
    height: 80px;
    display: block;
}

/* ========================================
   PANELS
   ======================================== */

.stratum__panel {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 32px;
    position: relative;
    z-index: 3;
}

.stratum__panel--raised {
    background: rgba(250, 245, 239, 0.6);
    border-radius: 16px;
    padding: 64px 48px;
    box-shadow: 0 8px 40px rgba(44, 24, 16, 0.08), 0 2px 8px rgba(44, 24, 16, 0.04);
    backdrop-filter: blur(8px);
    max-width: 860px;
    margin: 0 auto;
}

.stratum__panel--inset {
    background: rgba(250, 245, 239, 0.5);
    border-radius: 16px;
    padding: 64px 48px;
    box-shadow: inset 0 2px 12px rgba(44, 24, 16, 0.06), 0 8px 40px rgba(44, 24, 16, 0.1);
    max-width: 860px;
    margin: 0 auto;
}

.stratum__panel--deep {
    background: rgba(250, 245, 239, 0.35);
    border-radius: 16px;
    padding: 64px 48px;
    box-shadow: 0 12px 48px rgba(26, 15, 8, 0.15);
    backdrop-filter: blur(12px);
    max-width: 860px;
    margin: 0 auto;
}

.stratum__panel--core {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 32px;
    text-align: center;
}

/* ========================================
   STRATUM CONTENT
   ======================================== */

.stratum__label {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9c7a5a;
    display: block;
    margin-bottom: 16px;
}

.stratum__label--light {
    color: #d4a574;
}

.stratum__title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 5vw, 56px);
    letter-spacing: -0.01em;
    line-height: 1.05;
    color: #2c1810;
    margin-bottom: 24px;
}

.stratum__title--light {
    color: #f0e6d8;
}

.stratum__body {
    font-family: 'Karla', sans-serif;
    font-size: 18px;
    line-height: 1.7;
    color: #4a3728;
    margin-bottom: 40px;
    max-width: 640px;
}

.stratum__body--light {
    color: #e8c49a;
}

.stratum__content--core {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========================================
   CODE CRYSTALS
   ======================================== */

.code-crystal {
    border-left: 4px solid;
    border-image: linear-gradient(180deg, #c4652a, #e8c49a) 1;
    background: #1a0f08;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #d4a574;
    box-shadow: 0 4px 24px rgba(26, 15, 8, 0.2), inset 0 1px 0 rgba(212, 165, 116, 0.1);
    margin-top: 32px;
}

.code-crystal--deep {
    border-color: #c4652a;
    box-shadow: 0 4px 32px rgba(196, 101, 42, 0.15), inset 0 1px 0 rgba(196, 101, 42, 0.1);
}

.code-crystal__header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(212, 165, 116, 0.1);
    border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}

.code-crystal__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(212, 165, 116, 0.3);
}

.code-crystal__dot:first-child { background: #c4652a; }
.code-crystal__dot:nth-child(2) { background: #d4a574; }
.code-crystal__dot:nth-child(3) { background: #2a7a6e; }

.code-crystal__filename {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 11px;
    color: #9c7a5a;
    margin-left: auto;
    letter-spacing: 0.05em;
}

.code-crystal__body {
    padding: 24px;
    overflow-x: auto;
}

.code-crystal__body code {
    font-family: 'Fira Code', 'Space Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #e8c49a;
    tab-size: 2;
}

/* ========================================
   KNOWLEDGE GRID
   ======================================== */

.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.knowledge-card {
    background: rgba(250, 245, 239, 0.7);
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    border: 1px solid rgba(212, 165, 116, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.knowledge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(44, 24, 16, 0.1);
}

.knowledge-card__icon {
    margin-bottom: 16px;
}

.knowledge-card__title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #2c1810;
    margin-bottom: 8px;
}

.knowledge-card__desc {
    font-family: 'Karla', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #9c7a5a;
}

/* ========================================
   INSIGHT BLOCKS
   ======================================== */

.insight-blocks {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 40px;
}

.insight-block {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 20px;
    padding: 24px;
    background: rgba(250, 245, 239, 0.25);
    border-radius: 12px;
    border-left: 3px solid #2a7a6e;
    transition: background 0.3s ease;
}

.insight-block:hover {
    background: rgba(250, 245, 239, 0.4);
}

.insight-block__number {
    grid-row: 1 / 3;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 36px;
    color: rgba(42, 122, 110, 0.3);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.insight-block__title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #2c1810;
    line-height: 1.3;
}

.insight-block__text {
    font-family: 'Karla', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #4a3728;
}

/* ========================================
   CORE GLOW
   ======================================== */

.core-glow {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 48px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-glow__ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid;
}

.core-glow__ring--outer {
    width: 240px;
    height: 240px;
    border-color: rgba(212, 165, 116, 0.15);
    animation: coreRingPulse 4s ease-in-out infinite;
}

.core-glow__ring--middle {
    width: 160px;
    height: 160px;
    border-color: rgba(196, 101, 42, 0.25);
    animation: coreRingPulse 4s ease-in-out infinite 0.5s;
}

.core-glow__ring--inner {
    width: 100px;
    height: 100px;
    border-color: rgba(240, 200, 120, 0.35);
    animation: coreRingPulse 4s ease-in-out infinite 1s;
}

.core-glow__center {
    position: relative;
    width: 64px;
    height: 64px;
    background: radial-gradient(circle, #f0c878 0%, #c4652a 60%, transparent 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(240, 200, 120, 0.4), 0 0 80px rgba(196, 101, 42, 0.2);
    animation: coreGlow 3s ease-in-out infinite;
}

.core-glow__symbol {
    font-family: 'Nunito', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #1a0f08;
}

@keyframes coreRingPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.6; }
}

@keyframes coreGlow {
    0%, 100% { box-shadow: 0 0 40px rgba(240, 200, 120, 0.4), 0 0 80px rgba(196, 101, 42, 0.2); }
    50% { box-shadow: 0 0 60px rgba(240, 200, 120, 0.6), 0 0 120px rgba(196, 101, 42, 0.3); }
}

/* ========================================
   CORE MESSAGE
   ======================================== */

.core-message {
    font-family: 'Karla', sans-serif;
    font-size: 18px;
    line-height: 1.8;
    color: #d4a574;
    text-align: center;
    margin-bottom: 48px;
}

/* ========================================
   ASCEND LINK
   ======================================== */

.ascend-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 24px;
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 32px;
    transition: all 0.3s ease;
}

.ascend-link:hover {
    border-color: #d4a574;
    background: rgba(212, 165, 116, 0.1);
    transform: translateY(-2px);
}

.ascend-link__text {
    font-family: 'Nunito Sans', 'Space Mono', sans-serif;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #d4a574;
}

.ascend-link__arrow {
    color: #d4a574;
    transition: transform 0.3s ease;
}

.ascend-link:hover .ascend-link__arrow {
    transform: translateY(-3px);
}

/* ========================================
   SCROLL REVEAL ANIMATIONS
   ======================================== */

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ========================================
   Z-AXIS DEPTH TRANSFORMS
   ======================================== */

.stratum__panel {
    transition: transform 0.1s ease;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .depth-indicator {
        display: none;
    }

    .hero-title {
        font-size: 16vw;
    }

    .stratum__panel--raised,
    .stratum__panel--inset,
    .stratum__panel--deep {
        padding: 40px 24px;
        margin: 0 16px;
        border-radius: 12px;
    }

    .knowledge-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .insight-block {
        grid-template-columns: 48px 1fr;
    }

    .insight-block__number {
        font-size: 28px;
    }

    .stratum--sediment,
    .stratum--bedrock,
    .stratum--mantle {
        padding: 80px 0 120px;
    }

    .stratum__title {
        font-size: clamp(28px, 7vw, 40px);
    }

    .core-glow {
        width: 180px;
        height: 180px;
    }

    .core-glow__ring--outer {
        width: 180px;
        height: 180px;
    }

    .core-glow__ring--middle {
        width: 120px;
        height: 120px;
    }

    .core-glow__ring--inner {
        width: 76px;
        height: 76px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .hero-title {
        font-size: 20vw;
    }

    .hero-title__ext {
        font-size: 0.4em;
    }

    .code-crystal__body code {
        font-size: 11px;
    }

    .stratum__body {
        font-size: 16px;
    }
}