/* economics.quest - Bauhaus meets Geological Survey */
/* Palette:
   Parchment #F4F0E8 | Anthracite #1C2632 | Graphite #3A3A3A
   Bullion Gold #C4883A | Verdigris #3A7D8C | Sienna Clay #8B5E3C
   Gilt Edge #E8D5A3 | Weathered Bronze #8A7E6B | Oxidized Iron #9C3D3D
   Mid-depth parchment #E8E4DA | Deep parchment #D8D2C8
*/

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    --parchment: #F4F0E8;
    --anthracite: #1C2632;
    --graphite: #3A3A3A;
    --bullion: #C4883A;
    --verdigris: #3A7D8C;
    --sienna: #8B5E3C;
    --gilt: #E8D5A3;
    --bronze: #8A7E6B;
    --iron: #9C3D3D;
    --mid-parchment: #E8E4DA;
    --deep-parchment: #D8D2C8;
    --muted-body: #C8C0B0;
    --depth-bg: #F4F0E8;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 17px;
    line-height: 1.72;
    font-weight: 400;
    color: var(--graphite);
    background-color: var(--parchment);
    overflow-x: hidden;
}

/* ===== STRATIGRAPHIC COLUMN (Desktop) ===== */
#strat-column {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    z-index: 100;
    background: var(--anthracite);
}

#strat-svg {
    width: 100%;
    height: 100%;
}

.strat-label {
    font-family: 'Inconsolata', monospace;
    font-size: 7px;
    letter-spacing: 0.04em;
    fill: #F4F0E8;
}

#strat-marker {
    fill: #E8D5A3;
    transition: transform 0.3s ease-out;
}

/* ===== MOBILE STRAT BAR ===== */
#strat-bar-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    z-index: 100;
    flex-direction: row;
}

.strat-bar-band {
    flex: 1;
    position: relative;
}

#strat-bar-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 20%;
    height: 100%;
    background: #E8D5A3;
    opacity: 0.6;
    transition: left 0.3s ease-out;
    pointer-events: none;
}

/* ===== HERO SECTION ===== */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parchment);
    margin-left: 60px;
    width: calc(100% - 60px);
    scroll-snap-align: start;
    overflow: hidden;
}

#hero-cross-section {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 100%;
    opacity: 0;
    animation: fadeInCrossSection 0.5s ease-out 0.5s forwards;
}

@keyframes fadeInCrossSection {
    to { opacity: 1; }
}

#cross-section-svg {
    width: 100%;
    height: 100%;
}

.stratum {
    opacity: 0;
}

.strat-boundary {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
}

/* Hero title */
#hero-title {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-top: 20vh;
}

#hero-title h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 56px);
    color: var(--anthracite);
    letter-spacing: 0.2em;
    animation: settleLetters 1s ease-out 2s forwards;
    opacity: 0;
}

@keyframes settleLetters {
    0% {
        opacity: 0;
        letter-spacing: 0.2em;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.01em;
    }
}

.hero-subtitle {
    font-family: 'Inconsolata', monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--bronze);
    margin-top: 12px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ===== MAIN CONTENT ===== */
#content {
    margin-left: 60px;
    width: calc(100% - 60px);
    padding: 0 40px;
    max-width: 1200px;
}

/* ===== MARGIN NOTES ===== */
.margin-note {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-top: 1px solid rgba(138, 126, 107, 0.2);
    border-bottom: 1px solid rgba(138, 126, 107, 0.2);
    margin: 24px 0;
}

.margin-fossil {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.margin-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: var(--bronze);
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== MODULE ROWS ===== */
.module-row {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    align-items: flex-start;
}

/* Alternate row layout offset for geological strata effect */
.module-row:nth-child(odd) {
    padding-top: 8px;
}

.module-row:nth-child(even) {
    padding-top: 16px;
}

/* ===== THEOREM BLOCKS ===== */
.theorem-block {
    flex: 0 0 55%;
    background: var(--depth-bg);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(138, 126, 107, 0.15);
    transition: background-color 0.6s ease;
}

.theorem-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 56px);
    letter-spacing: 0.01em;
    color: var(--anthracite);
    margin-bottom: 24px;
    line-height: 1.2;
}

.theorem-block p {
    margin-bottom: 16px;
    color: var(--graphite);
}

.theorem-block p:last-child {
    margin-bottom: 0;
}

/* Compass watermark */
.compass-watermark {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 80px;
    height: 80px;
    pointer-events: none;
}

.compass-bg {
    width: 100%;
    height: 100%;
}

/* ===== DATA WINDOWS ===== */
.data-window {
    flex: 0 0 40%;
    aspect-ratio: 1 / 1;
    background: var(--anthracite);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(138, 126, 107, 0.2);
}

.data-window-label {
    position: absolute;
    top: 12px;
    left: 16px;
    font-family: 'Inconsolata', monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--bronze);
    z-index: 2;
}

/* Body text color on slate/dark backgrounds: #C8C0B0 */
.data-window .viz-body-text {
    fill: #C8C0B0;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 14px;
}

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

.viz-label {
    font-family: 'Inconsolata', monospace;
    letter-spacing: 0.04em;
}

/* Morph curves */
.morph-curve {
    transition: d 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Flow lines */
.flow-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    opacity: 0;
    transition: opacity 0.6s ease, stroke-dashoffset 3s linear;
}

.flow-line.active {
    opacity: 0.4;
    stroke-dashoffset: 0;
}

/* Data window hover tooltip */
.data-window .curve-tooltip {
    position: absolute;
    padding: 4px 8px;
    background: rgba(28, 38, 50, 0.9);
    border: 1px solid var(--bronze);
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    color: var(--gilt);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 10;
}

.data-window:hover .morph-curve {
    stroke: var(--bullion);
    stroke-width: 3;
}

/* Equilibrium point */
.eq-point {
    transition: r 0.6s ease-out 1.2s, opacity 0.4s ease-out 1.2s;
}

.eq-label {
    transition: opacity 0.4s ease-out 1.5s;
}

/* ===== DEEP STRATUM (Final Section) ===== */
#deep-stratum {
    scroll-snap-align: start;
    padding: 80px 0 120px;
    text-align: center;
}

.deep-content {
    max-width: 640px;
    margin: 0 auto;
}

.deep-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--anthracite);
    letter-spacing: 0.01em;
    margin-bottom: 24px;
}

.deep-text {
    font-size: 18px;
    line-height: 1.8;
    color: var(--graphite);
    margin-bottom: 40px;
}

.deep-sigil {
    display: flex;
    justify-content: center;
}

.deep-compass {
    width: 120px;
    height: 120px;
}

.compass-label {
    font-family: 'Inconsolata', monospace;
    letter-spacing: 0.04em;
}

#compass-needle {
    transform-origin: 60px 60px;
    transition: transform 0.4s ease-out;
}

/* ===== COMPASS ROSE - SCROLL INDICATOR ===== */
#compass-rose {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#compass-rose.visible {
    opacity: 1;
}

#compass-rose-svg {
    width: 100%;
    height: 100%;
}

#compass-rose-svg .compass-label {
    font-family: 'Inconsolata', monospace;
}

#compass-needle-line {
    transform-origin: 24px 24px;
    transition: transform 0.3s ease-out;
}

/* ===== STRAT COLUMN BRIGHTNESS PULSE ===== */
.strat-band.active {
    filter: brightness(1.3);
    transition: filter 0.2s ease;
}

.strat-band {
    transition: filter 0.4s ease;
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {
    #strat-column {
        display: none;
    }

    #strat-bar-mobile {
        display: flex;
    }

    #hero {
        margin-left: 0;
        width: 100%;
        padding-top: 6px;
    }

    #content {
        margin-left: 0;
        width: 100%;
        padding: 0 16px;
    }

    .module-row {
        flex-direction: column;
    }

    .theorem-block {
        flex: none;
        width: 100%;
        padding: 32px 20px;
    }

    .data-window {
        flex: none;
        width: 100%;
    }

    .margin-text {
        font-size: 12px;
    }

    #compass-rose {
        width: 32px;
        height: 32px;
        bottom: 16px;
        right: 16px;
    }

    .theorem-title {
        font-size: clamp(22px, 5vw, 36px);
    }

    #hero-cross-section {
        width: 140px;
    }
}

/* ===== ANIMATION UTILITY CLASSES ===== */
.stratum-revealed {
    opacity: 1 !important;
    transition: opacity 0.4s ease-out;
}

.boundary-drawn {
    stroke-dashoffset: 0 !important;
    transition: stroke-dashoffset 0.6s ease-out;
}

/* Scroll depth background transition applied via JS custom property */
.theorem-block {
    background-color: var(--depth-bg);
}

/* ===== SELECTION STYLING ===== */
::selection {
    background: var(--gilt);
    color: var(--anthracite);
}
