:root {
    --midnight-loam: #0A1F12;
    --root-dark: #132B1A;
    --understory: #1C3D24;
    --canopy: #2D5F3B;
    --moss-glow: #3E7A4A;
    --lichen: #7A9E7E;
    --mist: #A8BFA8;
    --fog: #C2D4C6;
    --dew: #E0EDE3;
    --pollen: #D4C17A;
}

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

body {
    background-color: var(--root-dark);
    color: var(--fog);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    line-height: 1.75;
    overflow-x: hidden;
    letter-spacing: 0.005em;
}

/* Background Canvas */
#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Strata */
.stratum {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 128px 24px;
}

/* THE SURFACE */
.stratum-surface {
    min-height: 100vh;
    background: transparent;
}

.hero-text {
    font-family: 'Commissioner', sans-serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 100;
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--canopy);
    opacity: 0.3;
    text-align: center;
    transition: opacity 0.1s linear;
}

/* THE SEDIMENT */
.stratum-sediment {
    min-height: 150vh;
    background: transparent;
    padding-top: 128px;
    padding-bottom: 128px;
}

.section-marker {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--lichen);
    margin-bottom: 64px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.section-marker.revealed {
    opacity: 1;
    transform: translateY(0);
}

.sediment-column {
    width: clamp(30rem, 55vw, 51.25rem);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* Card Flip */
.card-flip-container {
    perspective: 1200px;
    height: 280px;
}

.card-flip-container.card-large {
    height: 320px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 2s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.card-flip-inner.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 1px solid rgba(62, 122, 74, 0.125);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.card-front {
    background: rgba(19, 43, 26, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.card-back {
    transform: rotateY(180deg);
    background: var(--understory);
}

.card-front-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--mist);
}

.card-shape {
    width: 100%;
    height: 100%;
}

/* Fossil cards */
.card-front-fossil {
    background: rgba(19, 43, 26, 0.4);
}

.card-back-fossil {
    background: var(--understory);
}

.fossil-shape {
    width: 100%;
    height: 100%;
}

/* THE BEDROCK */
.stratum-bedrock {
    min-height: 150vh;
    background: transparent;
    padding-top: 128px;
    padding-bottom: 128px;
}

.bedrock-column {
    width: clamp(30rem, 55vw, 51.25rem);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bedrock-sentence {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    line-height: 1.75;
    color: var(--fog);
    padding: 100px 0;
}

.bedrock-sentence span {
    display: inline;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bedrock-sentence.stagger-revealed span {
    opacity: 1;
    transform: translateY(0);
}

.temporal-line {
    width: 100%;
    height: 1px;
    background: var(--canopy);
    opacity: 0.2;
}

/* THE FOSSIL RECORD */
.stratum-fossil {
    min-height: 150vh;
    background: transparent;
    padding-top: 128px;
    padding-bottom: 128px;
}

.fossil-column {
    width: clamp(30rem, 55vw, 51.25rem);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 80px;
}

/* THE CORE */
.stratum-core {
    min-height: 100vh;
    background: var(--midnight-loam);
}

.core-shape {
    width: 200px;
    height: 200px;
    margin-bottom: 48px;
}

.core-polygon {
    width: 100%;
    height: 100%;
    animation: coreRotate 30s linear infinite;
}

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

.core-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.75;
    color: var(--fog);
    text-align: center;
    max-width: 360px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.8s ease, transform 1.8s ease;
}

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

/* Data point clusters */
.data-cluster {
    position: absolute;
    pointer-events: none;
}

.data-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--moss-glow);
    opacity: 0.5;
    position: absolute;
}

/* Responsive */
@media (max-width: 768px) {
    .stratum {
        padding: 64px 24px;
    }

    .sediment-column,
    .bedrock-column,
    .fossil-column {
        width: 100%;
    }

    .card-flip-container {
        height: 240px;
    }

    .card-flip-container.card-large {
        height: 260px;
    }

    .bedrock-sentence {
        padding: 64px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-text {
        font-weight: 500;
        opacity: 1;
        transition: none;
    }

    .section-marker {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .card-flip-inner {
        transition: transform 0.5s ease;
    }

    .bedrock-sentence span {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .core-polygon {
        animation: none;
    }

    .core-text {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
