/* opensource.bar - Earth-toned geological descent */

/* ========== CSS Custom Properties ========== */
:root {
    --surface-bg: #e8ddd0;
    --canopy-bg: #ddd0be;
    --understory-bg: #c4a882;
    --root-bg: #8b6f4e;
    --bedrock-bg: #3b2f1e;
    --text-primary: #3b2f1e;
    --text-secondary: #5c4a3a;
    --text-tertiary: #8b7355;
    --curve-color: #6b8f71;
    --accent: #7a9e7e;
    --text-light: #e8ddd0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.75;
    color: var(--text-secondary);
    background-color: var(--surface-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Skeleton Loading ========== */
.skeleton-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 600ms ease;
}

.skeleton-overlay.hidden {
    opacity: 0;
}

.skeleton-block {
    position: absolute;
    background-color: #ddd0be;
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.skeleton-s1 {
    top: 42vh;
    left: 10%;
    width: 80%;
    height: 4rem;
}

.skeleton-s2a {
    top: 110vh;
    left: 5%;
    width: 30%;
    height: 6rem;
}

.skeleton-s2b {
    top: 130vh;
    left: 5%;
    width: 28%;
    height: 6rem;
}

.skeleton-s3 {
    top: 250vh;
    left: 10%;
    width: 80%;
    height: 2rem;
}

.skeleton-s4a {
    top: 380vh;
    left: 25%;
    width: 50%;
    height: 5rem;
}

.skeleton-s4b {
    top: 420vh;
    left: 25%;
    width: 50%;
    height: 5rem;
}

.skeleton-s5 {
    top: 530vh;
    left: 35%;
    width: 30%;
    height: 1.5rem;
}

/* ========== Stratum Base ========== */
.stratum {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.stratum-1 {
    --bg: #e8ddd0;
    --text: #3b2f1e;
    --curve: #6b8f71;
    min-height: 100vh;
    background: linear-gradient(to bottom, #e8ddd0 90%, #ddd0be 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-2 {
    --bg: #ddd0be;
    --text: #3b2f1e;
    --curve: #6b8f71;
    min-height: 120vh;
    background: linear-gradient(to bottom, #ddd0be 90%, #c4a882 100%);
}

.stratum-3 {
    --bg: #c4a882;
    --text: #3b2f1e;
    --curve: #6b8f71;
    min-height: 100vh;
    background: linear-gradient(to bottom, #c4a882 90%, #8b6f4e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-4 {
    --bg: #8b6f4e;
    --text: #e8ddd0;
    --curve: #7a9e7e;
    min-height: 140vh;
    background: linear-gradient(to bottom, #8b6f4e 90%, #3b2f1e 100%);
    color: #e8ddd0;
}

.stratum-5 {
    --bg: #3b2f1e;
    --text: #e8ddd0;
    --curve: #7a9e7e;
    min-height: 80vh;
    background-color: #3b2f1e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e8ddd0;
}

/* ========== Typography ========== */
.headline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 9rem);
    letter-spacing: 0.02em;
    color: var(--text);
    text-align: center;
    line-height: 1.1;
    max-width: 90vw;
}

.text-block p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.75;
    color: var(--text);
}

.text-block p strong {
    font-weight: 500;
}

.timeline-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8b7355;
}

.bedrock-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.75;
    color: #e8ddd0;
    text-align: center;
}

/* ========== Stratum 1 — Surface ========== */
.stratum-1-content {
    position: relative;
    z-index: 2;
    padding: 0 5vw;
}

.fault-line {
    position: absolute;
    top: 55%;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
    opacity: 0.6;
}

.root-hint {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.root-hint.visible {
    opacity: 1;
}

/* ========== Stratum 2 — Canopy ========== */
.stratum-2-layout {
    display: flex;
    min-height: 120vh;
    position: relative;
}

.stratum-2-text {
    width: 35%;
    padding: 10vh 5vw 10vh 8vw;
    display: flex;
    flex-direction: column;
    gap: 6rem;
    justify-content: center;
}

.stratum-2-visual {
    width: 65%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tree-rings {
    width: 400px;
    height: 400px;
    opacity: 0;
    transition: opacity 1s ease;
}

.tree-rings.visible {
    opacity: 1;
}

/* ========== Stratum 3 — Understory ========== */
.stratum-3-layout {
    width: 100%;
    position: relative;
    padding: 0 5vw;
}

.timeline-curve {
    width: 100%;
    height: 200px;
    display: block;
}

.timeline-labels {
    position: relative;
    width: 100%;
    height: 40px;
    margin-top: 1rem;
}

.timeline-label {
    position: absolute;
    transform: translateX(-50%);
}

/* ========== Stratum 4 — Root Network ========== */
.root-network-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.stratum-4-content {
    position: relative;
    z-index: 2;
    width: 50%;
    margin: 0 auto;
    padding: 8vh 0 10vh;
}

.root-block {
    position: relative;
}

/* ========== Stratum 5 — Bedrock ========== */
.stratum-5-content {
    text-align: center;
    padding: 2rem;
}

/* ========== Flowing Curve Animations ========== */
.flowing-curve path {
    stroke-dasharray: var(--path-length, 3000);
    stroke-dashoffset: var(--path-length, 3000);
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.flowing-curve.visible path {
    stroke-dashoffset: 0;
}

/* ========== Fade-in Animation ========== */
.fade-in {
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1), transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* ========== Grain Overlay ========== */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ========== Root Network Paths in Stratum 4 ========== */
.root-network-svg path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.root-network-svg.visible path {
    stroke-dashoffset: 0;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .stratum-2-layout {
        flex-direction: column;
    }

    .stratum-2-text {
        width: 100%;
        padding: 8vh 6vw;
        gap: 4rem;
    }

    .stratum-2-visual {
        width: 100%;
        padding: 4vh 0;
    }

    .tree-rings {
        width: 280px;
        height: 280px;
    }

    .stratum-4-content {
        width: 85%;
    }

    .headline {
        font-size: clamp(2.5rem, 8vw, 5rem);
    }

    .timeline-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .stratum-2-text {
        padding: 6vh 5vw;
        gap: 3rem;
    }

    .stratum-4-content {
        width: 90%;
    }
}
