/* ============================================================
   footprint.markets - Geological Narrative Experience
   ============================================================ */

/* --- Color Palette ---
   Old Growth:       #1a2a16
   Living Canopy:    #2d4a22
   Lichen:           #4a6741
   Fern Mist:        #8fa888
   Birch Bark:       #e8e2d6
   Dried Clay:       #c4a882
   Depleted Ash:     #6b6b6b
   Core Sample Red:  #8b3a3a
   Mycelium Gold:    #b89f5a
   Subsoil Dark:     #3d2b1f
*/

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: #2c3e28;
    background-color: #e8e2d6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Typography --- */
.section-heading {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(2.2rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    color: #1a2a16;
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    max-width: 38em;
    margin-bottom: 1.5rem;
    color: #2c3e28;
}

.pull-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: #8fa888;
    text-shadow: 0 1px 3px rgba(26, 42, 22, 0.2);
    border: none;
    padding: 2rem 0;
    margin: 2rem 0;
    line-height: 1.4;
    max-width: 36em;
}

.data-callout {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 1.1em;
    color: #b89f5a;
    letter-spacing: 0.02em;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5a7a52;
    display: block;
    margin: 0.3rem 0;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e8e2d6;
    overflow: hidden;
    z-index: 30;
}

#hero-contours {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

#hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

#hero-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(2.8rem, 8vw, 6.5rem);
    letter-spacing: 0.02em;
    color: #1a2a16;
    margin-bottom: 0.6rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#hero-title.revealed {
    opacity: 1;
}

#hero-title .char {
    display: inline-block;
    opacity: 0;
    clip-path: polygon(0% 100%, 5% 95%, 12% 100%, 20% 92%, 28% 100%, 35% 96%, 42% 100%, 50% 94%, 58% 100%, 65% 97%, 72% 100%, 80% 93%, 88% 100%, 95% 96%, 100% 100%, 100% 100%, 0% 100%);
    transition: clip-path 0.5s ease-out, opacity 0.4s ease-out;
}

#hero-title .char.eroded {
    opacity: 1;
    clip-path: polygon(0% 0%, 5% 0%, 12% 0%, 20% 0%, 28% 0%, 35% 0%, 42% 0%, 50% 0%, 58% 0%, 65% 0%, 72% 0%, 80% 0%, 88% 0%, 95% 0%, 100% 0%, 100% 100%, 0% 100%);
}

#hero-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #8fa888;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#hero-subtitle.visible {
    opacity: 0.6;
}

/* --- Strata System --- */
.stratum {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 8vh 5vw;
    overflow: hidden;
}

.stratum--surface {
    z-index: 30;
    background-color: #e8e2d6;
}

.stratum--substrate {
    z-index: 20;
    background-color: #3d2b1f;
}

.stratum--substrate .section-heading {
    color: #d4ddd0;
}

.stratum--substrate .body-text {
    color: #d4ddd0;
}

.stratum--substrate .pull-quote {
    color: #8fa888;
}

/* Stratum depth transitions */
.stratum[data-depth="1"] {
    background-color: #e8e2d6;
}

.stratum[data-depth="2"] {
    background: linear-gradient(175deg, #3d2b1f 0%, #4a3f2e 50%, #6b6b6b 100%);
}

.stratum[data-depth="3"] {
    background-color: #e8e2d6;
}

.stratum[data-depth="4"] {
    background: linear-gradient(175deg, #6b6b6b 0%, #3d4a35 50%, #2d4a22 100%);
}

.stratum[data-depth="4"] .section-heading {
    color: #d4ddd0;
}

.stratum[data-depth="4"] .body-text {
    color: #d4ddd0;
}

.stratum[data-depth="5"] {
    background: linear-gradient(175deg, #2d4a22 0%, #2c3e28 50%, #1a2a16 100%);
}

.stratum[data-depth="5"] .section-heading {
    color: #d4ddd0;
}

.stratum[data-depth="5"] .body-text {
    color: #d4ddd0;
}

.stratum[data-depth="5"] .data-label {
    color: #8fa888;
}

/* Stratum content positioning */
.stratum-content {
    position: relative;
    z-index: 10;
    max-width: 680px;
    padding: 4rem 2rem;
    background: rgba(232, 226, 214, 0.06);
    border: 2px solid #4a6741;
    box-shadow: 0 8px 24px rgba(26, 42, 22, 0.15);
    transition: transform 0.4s ease;
}

.stratum-content--left {
    margin-left: 8%;
    margin-right: auto;
    transform: rotate(-1.2deg);
}

.stratum-content--left:hover {
    transform: rotate(0deg);
}

.stratum-content--right {
    margin-left: auto;
    margin-right: 8%;
    transform: rotate(0.8deg);
}

.stratum-content--right:hover {
    transform: rotate(0deg);
}

.stratum-content--center {
    margin: 0 auto;
    transform: rotate(-0.5deg);
    text-align: center;
}

.stratum-content--center:hover {
    transform: rotate(0deg);
}

/* Grain overlay on surface containers */
.stratum-content::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#erosion-grain);
    opacity: 0.04;
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* On dark strata, content container gets semi-transparent dark bg */
.stratum--substrate .stratum-content,
.stratum[data-depth="2"] .stratum-content,
.stratum[data-depth="4"] .stratum-content {
    background: rgba(29, 20, 12, 0.4);
    border-color: #4a6741;
    backdrop-filter: blur(2px);
}

.stratum[data-depth="5"] .stratum-content {
    background: rgba(26, 42, 22, 0.3);
    border-color: #8fa888;
    backdrop-filter: blur(2px);
}

/* Stratum animation states */
.stratum .stratum-content {
    opacity: 0;
    transform-origin: center bottom;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.stratum-content--left {
    transform: rotate(-1.2deg) translateY(30px);
}

.stratum-content--right {
    transform: rotate(0.8deg) translateY(30px);
}

.stratum-content--center {
    transform: rotate(-0.5deg) translateY(30px);
}

.stratum.in-view .stratum-content {
    opacity: 1;
}

.stratum.in-view .stratum-content--left {
    transform: rotate(-1.2deg) translateY(0);
}

.stratum.in-view .stratum-content--right {
    transform: rotate(0.8deg) translateY(0);
}

.stratum.in-view .stratum-content--center {
    transform: rotate(-0.5deg) translateY(0);
}

.stratum.exiting .stratum-content {
    transform: scaleY(0.95) rotate(0deg);
    filter: brightness(0.85);
}

/* --- Contour Fields --- */
.contour-field {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.contour-field svg {
    width: 100%;
    height: 100%;
}

.contour-line {
    fill: none;
    stroke: #8fa888;
    stroke-width: 1;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* --- Fault Lines --- */
.fault-line {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: visible;
    z-index: 25;
    margin: -20px 0;
}

.fault-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fault-path {
    stroke: #c4a882;
    stroke-width: 2;
    fill: none;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 4px 8px rgba(26, 42, 22, 0.12));
}

.fault-line.in-view .fault-path {
    clip-path: inset(0 0 0 0);
}

/* --- Core Samples --- */
.core-sample {
    position: absolute;
    left: 3%;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    z-index: 15;
    cursor: pointer;
    transition: width 0.3s ease;
    opacity: 0;
    transform: translateY(-50%) translateX(-20px);
    transition: opacity 0.8s ease, transform 0.8s ease, width 0.3s ease;
}

.stratum.in-view .core-sample {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.core-sample:hover,
.core-sample.expanded {
    width: 160px;
}

.core-band {
    width: 100%;
    position: relative;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.core-band::after {
    content: attr(data-label) ' — ' attr(data-value);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: #5a7a52;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.core-sample:hover .core-band::after,
.core-sample.expanded .core-band::after {
    opacity: 1;
}

/* Dark strata core sample label color */
.stratum--substrate .core-band::after,
.stratum[data-depth="2"] .core-band::after,
.stratum[data-depth="4"] .core-band::after,
.stratum[data-depth="5"] .core-band::after {
    color: #d4ddd0;
}

/* --- Root Networks --- */
.root-network {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: visible;
    z-index: 15;
    pointer-events: none;
}

.root-svg {
    width: 100%;
    height: 100%;
}

.root-branch {
    fill: none;
    stroke: #4a6741;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.7;
}

/* --- Leaf Silhouettes --- */
.leaf-silhouettes {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.leaf-silhouette {
    position: absolute;
    opacity: 0.08;
    fill: #4a6741;
    animation: leaf-drift 120s linear infinite;
}

@keyframes leaf-drift {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Depth Navigation Sidebar --- */
.depth-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
    z-index: 100;
    background: rgba(232, 226, 214, 0.5);
    backdrop-filter: blur(4px);
    border-radius: 4px 0 0 4px;
}

.depth-marker {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s ease;
}

.depth-marker:hover {
    transform: scale(1.2);
}

.depth-marker.active .tick-mark {
    width: 20px;
    background: #1a2a16;
}

.tick-mark {
    width: 12px;
    height: 2px;
    background: #8fa888;
    transition: width 0.3s ease, background 0.3s ease;
}

.tick-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(26, 42, 22, 0.3);
    flex-shrink: 0;
}

/* --- Mobile Depth Bar --- */
.mobile-depth-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    z-index: 100;
    flex-direction: row;
}

.depth-strip {
    flex: 1;
    height: 100%;
}

.depth-indicator {
    position: absolute;
    top: -4px;
    left: 0;
    width: 20px;
    height: 14px;
    background: #b89f5a;
    border-radius: 2px;
    transition: left 0.3s ease;
}

/* --- Closing Section --- */
.closing-mark {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #8fa888;
    display: inline-block;
}

/* --- Contour line path drawing animation --- */
.contour-draw {
    stroke-dasharray: var(--contour-length, 2000);
    stroke-dashoffset: var(--contour-length, 2000);
    animation: draw-contour 1.5s ease-in-out forwards;
}

@keyframes draw-contour {
    to {
        stroke-dashoffset: 0;
    }
}

/* --- Root path drawing --- */
.root-draw {
    stroke-dasharray: var(--root-length, 500);
    stroke-dashoffset: var(--root-length, 500);
    transition: stroke-dashoffset 2s ease-out;
}

.root-draw.grown {
    stroke-dashoffset: 0;
}

/* --- Responsive: Below 768px --- */
@media (max-width: 768px) {
    .depth-sidebar {
        display: none;
    }

    .mobile-depth-bar {
        display: flex;
    }

    .stratum {
        padding: 6vh 4vw;
    }

    .stratum-content {
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        transform: rotate(0deg) !important;
        padding: 2rem 1.5rem;
    }

    .stratum.in-view .stratum-content {
        transform: rotate(0deg) translateY(0) !important;
    }

    .fault-line {
        height: 50px;
    }

    .fault-svg {
        transform: rotate(0deg);
    }

    .core-sample {
        position: relative;
        left: 0;
        top: 0;
        transform: none !important;
        width: 100% !important;
        flex-direction: row;
        height: 12px;
        margin-bottom: 2rem;
        gap: 2px;
    }

    .stratum.in-view .core-sample {
        transform: none !important;
    }

    .core-band {
        height: 100% !important;
        flex: 1;
    }

    .core-band::after {
        display: none;
    }

    .pull-quote {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    .root-network {
        height: 200px;
    }
}

/* --- Print (minimal) --- */
@media print {
    .depth-sidebar,
    .mobile-depth-bar,
    .fault-line,
    .contour-field,
    .leaf-silhouettes,
    .root-network {
        display: none;
    }
}
