/* ============================================
   economic.wiki — Stratigraphic Stylesheet
   ============================================ */

/* --- SVG Hatch Pattern Definitions (applied via CSS backgrounds) --- */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #f1ede4;
    color: #1c1b19;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Core Sample Minimap --- */
#core-sample {
    position: fixed;
    left: 0;
    top: 0;
    width: 12px;
    height: 100vh;
    z-index: 1000;
    background: linear-gradient(
        to bottom,
        #f1ede4 0%,
        #e8e2d4 12%,
        #e8e2d4 20%,
        #b8a88a 28%,
        #b8a88a 36%,
        #d4cbb3 44%,
        #d4cbb3 55%,
        #b8a88a 60%,
        #2a2a1f 75%,
        #1e1d2a 90%,
        #1e1d2a 100%
    );
    border-right: 1px solid #3d3a35;
}

#core-sample-viewport-tick {
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 3px;
    background: #9e7c3c;
    transition: top 0.1s linear;
    box-shadow: 0 0 4px rgba(158, 124, 60, 0.5);
}

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

.stratum-content {
    width: 680px;
    margin-left: calc(50% - 340px - 8%);
    padding: 60px 48px;
    position: relative;
}

/* --- Annotation Margin --- */
.annotation-margin {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    padding: 60px 24px 60px 0;
    pointer-events: none;
}

.annotation {
    position: absolute;
    left: 0;
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    line-height: 1.55;
    color: #6b6459;
    padding-left: 40px;
    pointer-events: auto;
}

.annotation p {
    margin: 0;
}

.annotation em {
    font-style: italic;
}

.connector-line {
    position: absolute;
    left: 0;
    top: 8px;
    width: 32px;
    height: 0;
    border-top: 1px dashed #6b6459;
    display: block;
    transition: border-color 0.2s ease, border-style 0.2s ease;
}

.annotation:hover .connector-line {
    border-top-style: solid;
    border-color: #9e7c3c;
}

.annotation:hover {
    color: #1c1b19;
}

/* --- Stratum Title --- */
.stratum-title {
    font-family: 'Stint Ultra Expanded', 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1.6rem, 3.2vw, 2.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 8px;
    line-height: 1.3;
}

.stratum-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #6b6459;
    letter-spacing: 0.05em;
    margin-bottom: 32px;
}

/* --- Body Text --- */
.stratum-content p {
    margin-bottom: 24px;
}

.key-term {
    font-weight: 600;
}

/* --- Fossil Specimens (Inset Quotations) --- */
.fossil-specimen {
    margin: 32px 60px;
    padding: 20px 24px;
    border-left: 2px solid #9e7c3c;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.fossil-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 500;
    font-style: italic;
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 12px !important;
}

.fossil-attribution {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #6b6459;
    margin-bottom: 0 !important;
}

.fossil-attribution em {
    font-style: italic;
}

/* --- Boundary Lines --- */
.boundary-line {
    display: block;
    width: 680px;
    height: 24px;
    margin-left: calc(50% - 340px - 8%);
    position: relative;
    z-index: 10;
}

.boundary-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.6s ease-in-out;
}

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

/* --- Marker Beds --- */
.marker-bed {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(61, 58, 53, 0.06) 3px,
        rgba(61, 58, 53, 0.06) 4px
    );
}

.marker-bed-content {
    width: 680px;
    margin-left: calc(50% - 340px - 8%);
    padding: 24px 48px;
}

.marker-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #6b6459;
    letter-spacing: 0.08em;
}

/* ============================================
   STRATUM COLORS & TEXTURES
   ============================================ */

/* Surface: Holocene Dust #f1ede4 */
.stratum-surface {
    background-color: #f1ede4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.stratum-surface .stratum-content {
    padding-top: 0;
    padding-bottom: 80px;
}

#site-title {
    font-family: 'Stint Ultra Expanded', 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 5vw;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #1c1b19;
    position: relative;
    left: 12%;
    top: 30%;
    margin-bottom: 16px;
}

#site-subtitle {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 18px;
    color: #3d3a35;
    position: relative;
    left: 12%;
    margin-bottom: 0;
}

#descent-line {
    position: relative;
    left: calc(12% + 2px);
    width: 2px;
    height: 0;
    margin-top: 24px;
    overflow: visible;
    transition: height 1.2s ease-out;
}

#descent-line.active {
    height: 200px;
}

#descent-chevron {
    position: relative;
    left: calc(12% - 6px);
    font-size: 20px;
    color: #3d3a35;
    opacity: 0;
    margin-top: 8px;
    transition: opacity 0.3s ease;
    animation: breathe 3s ease-in-out infinite;
    width: 20px;
    text-align: center;
}

#descent-chevron.visible {
    opacity: 0.5;
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.stratum-surface .boundary-line {
    position: absolute;
    bottom: 0;
}

/* Holocene / Contemporary: Quaternary Till #e8e2d4 */
.stratum-holocene {
    background-color: #e8e2d4;
    /* Stipple pattern (sandstone) */
    background-image: radial-gradient(circle, #3d3a35 0.5px, transparent 0.5px);
    background-size: 12px 12px;
    background-blend-mode: normal;
    min-height: 700px;
}

.stratum-holocene .stratum-content,
.stratum-holocene .boundary-line {
    position: relative;
}

/* Override the radial gradient to be very low opacity */
.stratum-holocene::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #3d3a35 0.5px, transparent 0.5px);
    background-size: 12px 12px;
    opacity: 0.05;
    pointer-events: none;
}

.stratum-holocene {
    background-image: none;
    background-color: #e8e2d4;
}

/* Quaternary / Keynesian: Quaternary Till #e8e2d4 blending to Cretaceous Marl #b8a88a */
.stratum-quaternary {
    background-color: #e8e2d4;
    min-height: 800px;
    position: relative;
}

.stratum-quaternary::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Horizontal lines (shale) */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 7px,
        #3d3a35 7px,
        #3d3a35 8px
    );
    opacity: 0.04;
    pointer-events: none;
}

/* Unconformity */
.stratum-unconformity {
    background-color: #b8a88a;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.unconformity-content {
    width: 680px;
    margin-left: calc(50% - 340px - 8% + 40px);
    padding: 20px 48px;
    text-align: center;
    transition: margin-left 0.6s ease-in-out;
}

.unconformity-boundary {
    width: 100%;
    height: 40px;
    margin-left: 0;
}

.unconformity-path {
    stroke-width: 2;
}

.unconformity-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #6b6459;
    letter-spacing: 0.1em;
    margin-top: 8px;
}

/* Cretaceous / Neoclassical: Cretaceous Marl #b8a88a */
.stratum-cretaceous {
    background-color: #b8a88a;
    color: #1c1b19;
    min-height: 800px;
    position: relative;
}

.stratum-cretaceous::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Brick pattern (limestone) */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 15px,
            #3d3a35 15px,
            #3d3a35 16px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 30px,
            #3d3a35 30px,
            #3d3a35 31px
        );
    opacity: 0.05;
    pointer-events: none;
}

.stratum-cretaceous .stratum-title,
.stratum-cretaceous .key-term {
    color: #1c1b19;
}

/* Jurassic / Classical: Jurassic Chalk #d4cbb3 */
.stratum-jurassic {
    background-color: #d4cbb3;
    min-height: 900px;
    position: relative;
}

.stratum-jurassic::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Stipple pattern (sandstone/chalk) */
    background-image: radial-gradient(circle, #3d3a35 0.6px, transparent 0.6px);
    background-size: 10px 10px;
    opacity: 0.05;
    pointer-events: none;
}

/* Carboniferous / Mercantilist: Carboniferous Seam #2a2a1f */
.stratum-carboniferous {
    background-color: #2a2a1f;
    color: #e8e2d4;
    min-height: 700px;
    position: relative;
}

.stratum-carboniferous::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Horizontal dense lines (coal seam) */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 4px,
        rgba(232, 226, 212, 0.06) 4px,
        rgba(232, 226, 212, 0.06) 5px
    );
    pointer-events: none;
}

.stratum-carboniferous .stratum-title {
    color: #e8e2d4;
}

.stratum-carboniferous .stratum-date {
    color: #b8a88a;
}

.stratum-carboniferous .key-term {
    color: #e8e2d4;
    font-weight: 600;
}

.stratum-carboniferous .fossil-specimen {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: #9e7c3c;
}

.stratum-carboniferous .fossil-text {
    color: #d4cbb3;
}

.stratum-carboniferous .fossil-attribution {
    color: #b8a88a;
}

.stratum-carboniferous .boundary-line .boundary-path {
    stroke: #6b6459;
}

.stratum-carboniferous .annotation {
    color: #b8a88a;
}

.stratum-carboniferous .annotation:hover {
    color: #e8e2d4;
}

.stratum-carboniferous .connector-line {
    border-top-color: #6b6459;
}

/* Precambrian / Ancient: Precambrian Slate #1e1d2a */
.stratum-precambrian {
    background-color: #1e1d2a;
    color: #d4cbb3;
    min-height: 700px;
    position: relative;
}

.stratum-precambrian::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Cross-hatch (metamorphic) */
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 8px,
            rgba(212, 203, 179, 0.04) 8px,
            rgba(212, 203, 179, 0.04) 9px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 8px,
            rgba(212, 203, 179, 0.04) 8px,
            rgba(212, 203, 179, 0.04) 9px
        );
    pointer-events: none;
}

.stratum-precambrian .stratum-title {
    color: #d4cbb3;
}

.stratum-precambrian .stratum-date {
    color: #9e7c3c;
}

.stratum-precambrian .key-term {
    color: #d4cbb3;
    font-weight: 600;
}

.stratum-precambrian .fossil-specimen {
    background: rgba(255, 255, 255, 0.02);
    border-left-color: #9e7c3c;
}

.stratum-precambrian .fossil-text {
    color: #b8a88a;
}

.stratum-precambrian .fossil-attribution {
    color: #6b6459;
}

.stratum-precambrian .annotation {
    color: #6b6459;
}

.stratum-precambrian .annotation:hover {
    color: #d4cbb3;
}

.stratum-precambrian .connector-line {
    border-top-color: #6b6459;
}

/* Bedrock */
#bedrock {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bedrock-content {
    width: 680px;
    margin-left: calc(50% - 340px - 8%);
    padding: 80px 48px;
    text-align: center;
}

.bedrock-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #6b6459;
    letter-spacing: 0.05em;
}

/* ============================================
   PYRITE VEIN PULSE ANIMATION
   ============================================ */
@keyframes pyritePulse {
    0%, 100% { stroke: #3d3a35; }
    50% { stroke: #9e7c3c; }
}

#descent-line.active line {
    animation: pyritePulse 3s ease-in-out 1.2s 1;
}

/* ============================================
   UNCONFORMITY ACTIVE STATE
   ============================================ */
.stratum-unconformity.active .unconformity-content {
    margin-left: calc(50% - 340px - 8% + 40px);
}

/* Column shift for strata adjacent to unconformity */
.stratum.shifted .stratum-content {
    margin-left: calc(50% - 340px - 8% + 40px);
    transition: margin-left 0.6s ease-in-out;
}

.stratum.shifted .boundary-line {
    margin-left: calc(50% - 340px - 8% + 40px);
    transition: margin-left 0.6s ease-in-out;
}

.stratum.shifted .annotation-margin {
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.4s ease-in, transform 0.4s ease-in;
}

/* ============================================
   STRATUM TRANSITION ANIMATIONS
   ============================================ */
.stratum {
    transition: background-color 0.4s ease;
}

/* ============================================
   MOBILE / RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
    .annotation-margin {
        position: relative;
        width: 100%;
        right: auto;
        height: auto;
        padding: 0 48px 40px;
    }

    .annotation {
        position: relative;
        left: auto;
        padding-left: 20px;
        margin-bottom: 16px;
        border-left: 1px dashed #6b6459;
    }

    .connector-line {
        display: none;
    }

    .stratum-content {
        width: 100%;
        margin-left: 0;
        padding: 48px 32px;
    }

    .boundary-line {
        width: 100%;
        margin-left: 0;
    }

    .marker-bed-content {
        width: 100%;
        margin-left: 0;
        padding: 24px 32px;
    }

    .bedrock-content {
        width: 100%;
        margin-left: 0;
        padding: 60px 32px;
    }

    .unconformity-content {
        width: 100%;
        margin-left: 0;
    }

    #site-title {
        font-size: 8vw;
        left: 5%;
    }

    #site-subtitle {
        left: 5%;
    }

    #descent-line {
        left: calc(5% + 2px);
    }

    #descent-chevron {
        left: calc(5% - 6px);
    }

    .fossil-specimen {
        margin: 24px 20px;
    }

    #core-sample {
        width: 8px;
    }

    #core-sample-viewport-tick {
        width: 8px;
    }
}

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

    .stratum-content {
        padding: 36px 20px;
    }

    .annotation-margin {
        padding: 0 20px 32px;
    }

    .marker-bed-content {
        padding: 20px;
    }

    .fossil-specimen {
        margin: 20px 8px;
        padding: 16px 18px;
    }

    #site-title {
        font-size: 10vw;
    }
}

/* ============================================
   ANNOTATION POSITIONING (DESKTOP)
   ============================================ */
@media (min-width: 1101px) {
    .stratum {
        display: flex;
        flex-wrap: nowrap;
    }

    .stratum-content {
        flex: 0 0 680px;
    }

    .annotation-margin {
        flex: 0 0 280px;
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: auto;
        max-height: 100vh;
    }

    .stratum-surface {
        display: flex;
        flex-direction: column;
    }

    .marker-bed {
        display: flex;
        align-items: center;
    }

    #bedrock {
        display: flex;
    }

    .stratum-unconformity {
        display: flex;
    }
}
