/* ============================================================
   footprint.broker — Forensic Cartography Archive
   Color Palette:
     #0D0A07 Coal Bedrock (deep substrate)
     #1A150F Dark Loam (primary bg)
     #2A2118 Compressed Peat (secondary bg)
     #3D3226 Fossil Clay (mid stratum)
     #C4A265 Oxidized Brass (accent)
     #D4956A Fired Terracotta (warm highlight)
     #A8937A Weathered Parchment (text primary)
     #7A6B5A Faded Ink (specimen tags)
     #8B3A3A Dried Oxide (alert/trace)
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    --stratum-depth: 0;
    --grain-opacity: 0;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.15vw, 1.12rem);
    line-height: 1.85;
    color: #A8937A;
    background-color: #0D0A07;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Hidden SVG defs --- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1000;
    pointer-events: none;
    opacity: var(--grain-opacity, 0);
    mix-blend-mode: overlay;
    filter: url(#grain);
    background: transparent;
    transition: opacity 0.8s ease-out;
}

#grain-overlay.active {
    opacity: 0.06;
}

#grain-overlay.deep {
    opacity: 0.12;
}

/* --- Footprint Scroll Indicator --- */
#footprint-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 86px;
    z-index: 900;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

#footprint-indicator.visible {
    opacity: 0.2;
    transform: scale(1);
}

#footprint-indicator svg {
    width: 100%;
    height: 100%;
}

.indicator-fill {
    transition: y 0.1s linear;
}

/* --- Strata / Sections --- */
.stratum {
    position: relative;
    min-height: 100vh;
    padding: 80px 40px;
    overflow: hidden;
}

#opening {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #0D0A07;
    padding: 0;
}

#stratum-1 {
    background-color: #1A150F;
    background-image: linear-gradient(to bottom, rgba(61, 50, 38, 0.15) 0%, #1A150F 100%);
}

#stratum-2 {
    background-color: #1A150F;
    background-image: linear-gradient(to bottom, #1A150F, rgba(26, 21, 15, 0.95));
}

#stratum-3 {
    background-color: #161210;
    background-image: linear-gradient(to bottom, #2A1A0F, #121010);
}

#stratum-4 {
    background-color: #100E0B;
    background-image: linear-gradient(to bottom, #121010, #0D0A07);
    box-shadow: inset 0 2px 60px rgba(107, 66, 38, 0.06);
}

/* Deep warm accent for card hover glow - #6B4226 */
#stratum-4 .evidence-card:hover {
    box-shadow: 0 12px 40px rgba(13, 10, 7, 0.6), 0 0 30px rgba(107, 66, 38, 0.08);
}

/* #6B4226 - Dark amber used for deep evidence card backgrounds */
#stratum-3 .evidence-card,
#stratum-4 .evidence-card {
    background: linear-gradient(135deg, rgba(42, 26, 15, 0.6), rgba(107, 66, 38, 0.15));
    border-bottom: 1px solid #6B4226;
}

.stratum-final {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #0D0A07;
}

/* --- Contour Background Lines --- */
.contour-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.contour-line {
    stroke-dasharray: 2400;
    stroke-dashoffset: 0;
    animation: contourDrift 120s linear infinite;
}

@keyframes contourDrift {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -2400; }
}

/* --- Opening / Hero Section --- */
.opening-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    width: 100%;
    height: 100vh;
}

#hero-footprint {
    width: clamp(280px, 40vw, 500px);
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

#footprint-outline {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    transition: stroke-dashoffset 2.5s ease-in-out;
}

#footprint-outline.drawn {
    stroke-dashoffset: 0;
}

#footprint-bg {
    transition: opacity 1.2s ease;
}

#footprint-bg.filled {
    opacity: 0.5;
}

#tread-lines {
    transition: opacity 1s ease 1.5s;
}

#tread-lines.visible {
    opacity: 1;
}

#hero-text {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#hero-text.visible {
    opacity: 1;
}

#hero-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C4A265;
    text-shadow: 0 0 30px rgba(196, 162, 101, 0.15);
    margin-bottom: 24px;
}

#hero-subtitle {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    color: #8B6F47;
    transform: rotate(-1.5deg);
    opacity: 0;
    transition: opacity 2s ease;
    transition-delay: 3s;
}

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

/* --- Stratum Headers --- */
.stratum-header {
    position: relative;
    z-index: 10;
    margin-bottom: 60px;
    max-width: 900px;
}

.stratum-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C4A265;
    text-shadow: 0 0 30px rgba(196, 162, 101, 0.15);
    margin-bottom: 16px;
}

.stratum-annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    color: #8B6F47;
    transform: rotate(-1.5deg);
    display: inline-block;
}

/* --- Specimen Labels (Monospace) --- */
.specimen-label {
    font-family: 'Inconsolata', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7A6B5A;
    display: block;
    margin-bottom: 8px;
}

/* --- Geological Boundary Lines --- */
.stratum-boundary {
    position: relative;
    height: 30px;
    z-index: 20;
    overflow: hidden;
}

.stratum-boundary svg {
    width: 100%;
    height: 100%;
}

.boundary-line {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.boundary-line.drawn {
    stroke-dashoffset: 0;
}

/* --- Evidence Grid --- */
.evidence-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Evidence Cards --- */
.evidence-card {
    position: relative;
    background: rgba(42, 33, 24, 0.6);
    border: none;
    padding: 24px 20px 20px;
    transform: rotate(var(--rotation, 0deg)) translateY(40px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease, box-shadow 0.3s ease;
    transition-delay: var(--delay, 0ms);
}

.evidence-card.revealed {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) translateY(0);
}

.evidence-card.wide {
    grid-column: span 2;
}

.evidence-card:hover {
    transform: rotate(var(--rotation, 0deg)) translateY(-6px);
    box-shadow: 0 12px 40px rgba(13, 10, 7, 0.6);
}

.evidence-card:hover .specimen-tape {
    opacity: 0.7;
}

/* --- Specimen Tape --- */
.specimen-tape {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        45deg,
        rgba(196, 162, 101, 0.4),
        rgba(196, 162, 101, 0.4) 2px,
        rgba(196, 162, 101, 0.2) 2px,
        rgba(196, 162, 101, 0.2) 4px
    );
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* --- Card Content --- */
.card-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #D4956A;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.card-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.88rem, 1vw, 1rem);
    line-height: 1.85;
    color: #A8937A;
}

/* --- Evidence Pins --- */
.evidence-pin {
    position: absolute;
    bottom: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid #C4A265;
    background: transparent;
    animation: pinPulse 4s ease-in-out infinite;
}

@keyframes pinPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Connection Lines --- */
.connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.connection-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.connection-path {
    stroke: #7A6B5A;
    stroke-width: 1;
    stroke-dasharray: 4, 6;
    fill: none;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* --- Faint Footprint Decorations --- */
.faint-footprint {
    position: absolute;
    width: 80px;
    height: auto;
    z-index: 2;
    opacity: 0.08;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.faint-footprint.revealed {
    opacity: 0.12;
}

/* --- Annotation Reveals --- */
[data-reveal] {
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateX(0) rotate(-1.5deg);
}

/* --- Final Stratum --- */
.final-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    z-index: 10;
}

.converging-contours {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.converge-line {
    stroke-dasharray: 3000;
    stroke-dashoffset: 0;
    animation: contourDrift 120s linear infinite;
}

.final-text {
    position: relative;
    z-index: 10;
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C4A265;
    text-shadow: 0 0 40px rgba(196, 162, 101, 0.2);
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.final-text.revealed {
    opacity: 1;
}

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

    .evidence-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .evidence-card.wide {
        grid-column: span 1;
    }

    #footprint-indicator {
        width: 30px;
        height: 65px;
        top: 10px;
        right: 10px;
    }

    .stratum-header {
        margin-bottom: 40px;
    }
}

@media (max-width: 480px) {
    .stratum {
        padding: 40px 16px;
    }

    .evidence-card {
        padding: 20px 16px 16px;
    }
}

/* --- Annotation class (reused) --- */
.annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    color: #8B6F47;
}
