/* ===================================================
   economics.day - Graffiti-Bombed Economics Library
   Palette: warm-earthy | Layout: layered-depth
   =================================================== */

/* --- 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: 18px;
    line-height: 1.7;
    color: #3B2A1A;
    background: #3B2A1A;
    overflow-x: hidden;
    cursor: default;
}

/* --- Spotlight Overlay (cursor-follow) --- */
#spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: radial-gradient(
        circle 180px at var(--mx, 50%) var(--my, 50%),
        transparent 0%,
        rgba(42, 42, 42, 0.35) 100%
    );
    transition: none;
}

/* --- Dust/Atmosphere Overlay --- */
#dust-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: linear-gradient(
        to bottom,
        rgba(59, 42, 26, 0) 0%,
        rgba(59, 42, 26, 0.15) 100%
    );
}

/* --- Home Glyph --- */
#home-glyph {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1001;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    text-decoration: none;
}

#home-glyph:hover {
    opacity: 1;
}

/* --- Navigation Arrows --- */
#nav-arrows {
    position: fixed;
    right: 24px;
    bottom: 32px;
    z-index: 1001;
}

.nav-arrow {
    opacity: 0.5;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.nav-arrow:hover {
    opacity: 1;
}

/* --- THE WALL (Layer 0) --- */
#wall {
    position: relative;
    width: 100%;
    min-height: 100vh;
    /* Layered background simulating aged plaster, exposed brick, mineral grain */
    background:
        /* Noise grain simulation */
        radial-gradient(ellipse at 20% 50%, rgba(196, 149, 106, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(196, 149, 106, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 111, 71, 0.12) 0%, transparent 45%),
        /* Corner darkening - plaster aging */
        radial-gradient(ellipse at 0% 0%, rgba(59, 42, 26, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 0%, rgba(59, 42, 26, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 0% 100%, rgba(59, 42, 26, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(59, 42, 26, 0.4) 0%, transparent 50%),
        /* Base surface: warm ochre to deep umber gradient */
        linear-gradient(180deg, #3B2A1A 0%, #5C3D2E 15%, #C4956A 40%, #8B6F47 60%, #5C3D2E 80%, #3B2A1A 100%);
    background-blend-mode: multiply, multiply, multiply, normal, normal, normal, normal, normal;
    /* Additional texture repeating pattern via pseudo */
}

#wall::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Subtle brick/plaster pattern */
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 60px,
            rgba(92, 61, 46, 0.05) 60px,
            rgba(92, 61, 46, 0.05) 62px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 30px,
            rgba(92, 61, 46, 0.04) 30px,
            rgba(92, 61, 46, 0.04) 32px
        );
    pointer-events: none;
    z-index: 0;
}

/* --- Layer 1: Botanical Substrate --- */
.botanical-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.botanical-svg {
    position: absolute;
    opacity: 0.3;
    transition: opacity 0.6s ease;
}

.botanical-svg.near-cursor {
    opacity: 0.6;
}

.botanical-wheat {
    top: 2%;
    left: 5%;
    width: 220px;
    height: auto;
}

.botanical-tulip {
    top: 28%;
    right: 3%;
    width: 200px;
    height: auto;
}

.botanical-cotton {
    top: 48%;
    left: 8%;
    width: 210px;
    height: auto;
}

.botanical-coffee {
    top: 62%;
    right: 6%;
    width: 190px;
    height: auto;
}

.botanical-tobacco {
    top: 78%;
    left: 4%;
    width: 230px;
    height: auto;
}

/* SVG Draw Animation */
.draw-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0s;
}

.botanical-svg.drawing .draw-path {
    animation: drawStroke 2.5s ease forwards;
}

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

/* Stagger the strokes within each SVG */
.botanical-svg.drawing .draw-path:nth-child(1) { animation-delay: 0s; }
.botanical-svg.drawing .draw-path:nth-child(2) { animation-delay: 0.1s; }
.botanical-svg.drawing .draw-path:nth-child(3) { animation-delay: 0.2s; }
.botanical-svg.drawing .draw-path:nth-child(4) { animation-delay: 0.3s; }
.botanical-svg.drawing .draw-path:nth-child(5) { animation-delay: 0.35s; }
.botanical-svg.drawing .draw-path:nth-child(6) { animation-delay: 0.4s; }
.botanical-svg.drawing .draw-path:nth-child(7) { animation-delay: 0.5s; }
.botanical-svg.drawing .draw-path:nth-child(8) { animation-delay: 0.6s; }
.botanical-svg.drawing .draw-path:nth-child(9) { animation-delay: 0.7s; }
.botanical-svg.drawing .draw-path:nth-child(10) { animation-delay: 0.8s; }
.botanical-svg.drawing .draw-path:nth-child(11) { animation-delay: 0.9s; }
.botanical-svg.drawing .draw-path:nth-child(12) { animation-delay: 1.0s; }
.botanical-svg.drawing .draw-path:nth-child(13) { animation-delay: 1.1s; }
.botanical-svg.drawing .draw-path:nth-child(14) { animation-delay: 1.2s; }
.botanical-svg.drawing .draw-path:nth-child(15) { animation-delay: 1.3s; }
.botanical-svg.drawing .draw-path:nth-child(16) { animation-delay: 1.4s; }
.botanical-svg.drawing .draw-path:nth-child(17) { animation-delay: 1.5s; }
.botanical-svg.drawing .draw-path:nth-child(18) { animation-delay: 1.6s; }
.botanical-svg.drawing .draw-path:nth-child(19) { animation-delay: 1.7s; }
.botanical-svg.drawing .draw-path:nth-child(20) { animation-delay: 1.8s; }

/* --- Layer 2: Graffiti Stratum --- */
.graffiti-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.graffiti-tag {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-style: italic;
    color: #F2E8D5;
    text-shadow:
        2px 2px 8px rgba(196, 149, 106, 0.6),
        -1px -1px 4px rgba(59, 42, 26, 0.3);
    mix-blend-mode: multiply;
    opacity: 0.35;
    transition: filter 0.4s ease, opacity 0.4s ease;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.graffiti-tag.near-cursor {
    filter: drop-shadow(0 0 12px rgba(160, 82, 45, 0.4));
    opacity: 0.55;
}

.graffiti-scarcity {
    top: 6%;
    left: 40%;
    font-size: 96px;
    transform: rotate(-5deg);
}

.graffiti-equilibrium {
    top: 22%;
    left: -2%;
    font-size: 72px;
    transform: rotate(3deg);
}

.graffiti-externality {
    top: 52%;
    right: -1%;
    font-size: 80px;
    transform: rotate(-7deg);
}

.graffiti-surplus {
    top: 70%;
    left: 30%;
    font-size: 64px;
    transform: rotate(4deg);
}

.graffiti-demand {
    top: 40%;
    left: 55%;
    font-size: 110px;
    transform: rotate(-2deg);
}

.graffiti-invisible {
    top: 85%;
    left: 10%;
    font-size: 56px;
    transform: rotate(6deg);
}

/* --- Candlestick Chart Fragments --- */
.candlestick-cluster {
    position: absolute;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    pointer-events: none;
}

.cluster-1 {
    top: 15%;
    right: 10%;
}

.cluster-2 {
    top: 55%;
    left: 15%;
}

.cluster-3 {
    top: 82%;
    right: 25%;
}

.candle {
    width: 6px;
    height: 24px;
    position: relative;
}

.candle::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 8px;
    top: -8px;
}

.candle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    bottom: -6px;
}

.candle-positive {
    background: #6B8F71;
}

.candle-positive::before,
.candle-positive::after {
    background: #6B8F71;
}

.candle-negative {
    background: #6B2D2D;
}

.candle-negative::before,
.candle-negative::after {
    background: #6B2D2D;
}

.candle.tall {
    height: 36px;
}

/* --- Supply/Demand Crosshairs --- */
.crosshair {
    position: absolute;
    width: 200px;
    height: 200px;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.crosshair.near-cursor {
    opacity: 1;
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #4E7E6B;
}

.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: #4E7E6B;
}

.crosshair-1 {
    top: 18%;
    left: 35%;
}

.crosshair-2 {
    top: 65%;
    right: 20%;
}

/* --- Isoquant Curves --- */
.isoquant {
    position: absolute;
    width: 500px;
    height: auto;
    pointer-events: none;
    animation: breathe 8s ease-in-out infinite;
}

.isoquant-1 {
    top: 30%;
    left: -5%;
}

.isoquant-2 {
    top: 72%;
    right: -3%;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* --- Network Traces --- */
.network-traces {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.trace {
    stroke: rgba(78, 126, 107, 0.12);
    stroke-width: 1;
    stroke-dasharray: 8 6;
    transition: stroke 0.4s ease;
}

.trace.near-cursor {
    stroke: rgba(78, 126, 107, 0.7);
}

/* --- Layer 3: Content Surface --- */
.content-layer {
    position: relative;
    z-index: 4;
    padding: 12vh 0 20vh 0;
}

/* --- Content Panels (shared) --- */
.content-panel {
    position: relative;
    max-width: 55%;
    padding: 36px 40px 32px 40px;
    margin-bottom: 5vh;
}

/* Zigzag placement */
.panel-left {
    margin-left: 12%;
    margin-right: auto;
}

.panel-right {
    margin-left: auto;
    margin-right: 12%;
}

.panel-center {
    margin-left: 22%;
    margin-right: auto;
}

/* Breathing spaces between panels */
.content-panel:nth-child(odd) {
    margin-top: 8vh;
}

.content-panel:nth-child(even) {
    margin-top: 12vh;
}

/* Large breathing gaps after certain panels */
.content-panel[data-section="intro"] {
    margin-top: 8vh;
    margin-bottom: 25vh;
}

.content-panel[data-section="scarcity"] {
    margin-bottom: 20vh;
}

.content-panel[data-section="speculation"] {
    margin-bottom: 22vh;
}

.content-panel[data-section="trade"] {
    margin-bottom: 18vh;
}

.content-panel[data-section="invisible-hand"] {
    margin-bottom: 20vh;
}

/* --- Vellum Panels --- */
.vellum-panel {
    background: rgba(242, 232, 213, 0.92);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-shadow:
        0 8px 32px rgba(59, 42, 26, 0.4),
        0 2px 8px rgba(59, 42, 26, 0.2);
    clip-path: polygon(
        0% 3%, 3% 0%, 7% 2.5%, 12% 0.5%, 18% 2%, 24% 0%, 30% 1.5%,
        36% 0.3%, 42% 2.2%, 48% 0.8%, 54% 1.8%, 60% 0.2%, 66% 2.5%,
        72% 0.6%, 78% 1.9%, 84% 0.1%, 90% 2.3%, 95% 0.4%, 100% 1.5%,
        100% 100%, 0% 100%
    );
}

/* --- Chalkboard Panels --- */
.chalkboard-panel {
    background: #2A2A2A;
    border: 2px solid #5C3D2E;
    box-shadow:
        0 8px 32px rgba(59, 42, 26, 0.4),
        inset 0 0 60px rgba(42, 42, 42, 0.5);
    /* Chalk dust texture */
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(242, 232, 213, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(242, 232, 213, 0.02) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(242, 232, 213, 0.025) 0%, transparent 45%);
    background-color: #2A2A2A;
}

/* --- Panel Pin/Tape/Paperclip Decorations --- */
.panel-pin {
    position: absolute;
    top: -8px;
    z-index: 5;
}

.pushpin {
    left: 30px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #C4956A, #A0522D, #5C3D2E);
    box-shadow: 0 2px 4px rgba(59, 42, 26, 0.5);
}

.tape {
    left: 20px;
    width: 60px;
    height: 18px;
    background: rgba(242, 232, 213, 0.45);
    transform: rotate(-2deg);
    border-radius: 1px;
}

.paperclip {
    right: 24px;
    left: auto;
    width: 12px;
    height: 32px;
    border: 2px solid #C4956A;
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    top: -16px;
}

.paperclip::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    width: 8px;
    height: 20px;
    border: 2px solid #C4956A;
    border-radius: 4px 4px 0 0;
    border-bottom: none;
    border-top: none;
}

/* --- Torn Edge for Vellum --- */
.panel-torn-edge {
    display: none; /* handled by clip-path on vellum */
}

/* --- Typography --- */
.display-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-style: italic;
    font-size: clamp(48px, 6vw, 96px);
    color: #3B2A1A;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 20px;
    text-shadow:
        2px 2px 8px rgba(196, 149, 106, 0.6),
        -1px -1px 4px rgba(59, 42, 26, 0.3);
}

.chalk-text {
    color: #F2E8D5;
    text-shadow:
        2px 2px 8px rgba(196, 149, 106, 0.6),
        -1px -1px 4px rgba(59, 42, 26, 0.3),
        0 0 3px rgba(242, 232, 213, 0.3);
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    color: #3B2A1A;
    margin-bottom: 16px;
}

.chalk-body {
    color: #F2E8D5;
}

.data-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #6B8F71;
    margin-top: 12px;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}

.marker-note {
    font-family: 'Permanent Marker', cursive;
    font-size: 22px;
    color: #5C3D2E;
    margin-top: 16px;
    display: inline-block;
}

.chalk-marker {
    color: #A0522D;
}

.annotation-text {
    font-family: 'Permanent Marker', cursive;
    font-size: 18px;
    color: #A0522D;
    margin-top: 12px;
    display: inline-block;
}

.chalk-annotation {
    color: #C4956A;
}

/* --- First Panel Special Styling --- */
.content-panel[data-section="intro"] .display-heading {
    font-size: clamp(56px, 8vw, 120px);
    color: #F2E8D5;
    text-shadow:
        3px 3px 12px rgba(196, 149, 106, 0.7),
        -2px -2px 6px rgba(59, 42, 26, 0.4);
}

.content-panel[data-section="intro"] {
    background: rgba(59, 42, 26, 0.85);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    clip-path: none;
    box-shadow:
        0 12px 48px rgba(59, 42, 26, 0.6),
        0 4px 12px rgba(59, 42, 26, 0.3);
}

.content-panel[data-section="intro"] .body-text {
    color: #F2E8D5;
    font-size: 20px;
}

.content-panel[data-section="intro"] .annotation-text {
    color: #C4956A;
}

/* --- Links / Interactive --- */
a {
    color: #4E7E6B;
    text-decoration: none;
    border-bottom: 1px solid rgba(78, 126, 107, 0.3);
    transition: border-color 0.3s ease;
}

a:hover {
    border-color: #4E7E6B;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-panel {
        max-width: 88%;
        margin-left: 6% !important;
        margin-right: 6% !important;
        padding: 24px 20px 20px 20px;
    }

    .graffiti-tag {
        font-size: 48px !important;
    }

    .graffiti-scarcity { font-size: 56px !important; }
    .graffiti-demand { font-size: 64px !important; }

    .botanical-svg {
        width: 120px !important;
    }

    .display-heading {
        font-size: clamp(32px, 8vw, 56px);
    }

    .content-panel[data-section="intro"] .display-heading {
        font-size: clamp(40px, 10vw, 72px);
    }

    #spotlight-overlay {
        display: none;
    }
}

/* --- Selection Color --- */
::selection {
    background: rgba(160, 82, 45, 0.4);
    color: #F2E8D5;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #3B2A1A;
}

::-webkit-scrollbar-thumb {
    background: #5C3D2E;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8B6F47;
}
