/* ==========================================================
   cbdc.studio — Goblincore Digital Finance
   Color Palette:
     #4A0E1B  Deep Burgundy (Clotted Blood)
     #0D0A07  Near Black (Loam Dark)
     #E8D5B7  Tarnished Gold (Coin Patina)
     #C4A882  Dull Bronze (Verdigris Light)
     #D4C5AD  Parchment (Vellum)
     #39FF14  Neon Green (Mycelium Glow)
     #2A1A0E  Earth Brown (Wet Soil)
     #6B1E2E  Burgundy Mid (Dried Rust)
     #B8A044  Spore Yellow (Fungal Cap)
   ========================================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    background: #0D0A07;
}

body {
    font-family: 'Alegreya', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    color: #D4C5AD;
    background: #2A1A0E;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Scroll Progress Indicator ---- */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(to bottom, #4A0E1B, #6B1E2E, #39FF14);
    z-index: 1000;
    transition: height 50ms linear;
}

/* ---- Spore Particle Canvas ---- */
#spore-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ---- Mushroom Container ---- */
#mushroom-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

.mushroom-silhouette {
    position: absolute;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.6s ease;
    pointer-events: none;
}

.mushroom-silhouette.visible {
    opacity: 1;
}

/* ---- Mycorrhizal Network ---- */
#mycorrhizal-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: visible;
}

.myco-line {
    stroke: #39FF14;
    stroke-width: 0.8;
    fill: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.myco-line.visible {
    opacity: 0.35;
}

.myco-node {
    fill: #39FF14;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.myco-node.visible {
    opacity: 0.5;
}

.myco-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    fill: #39FF14;
    opacity: 0;
    transition: opacity 0.6s ease 0.5s;
}

.myco-label.visible {
    opacity: 0.4;
}

/* ---- Typography ---- */
h1, h2 {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 800;
    font-variant: small-caps;
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: #E8D5B7;
}

h1 {
    font-size: clamp(2.8rem, 5.5vw, 4.5rem);
    letter-spacing: 0.15em;
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    margin-bottom: 1.2em;
}

h3 {
    font-family: 'Crimson Pro', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #C4A882;
    letter-spacing: 0.04em;
    line-height: 1.5;
    margin-bottom: 0.8em;
}

p {
    margin-bottom: 1.5em;
    color: #D4C5AD;
}

/* Neon term glow */
.neon-term {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #39FF14;
    letter-spacing: 0.06em;
    text-shadow:
        0 0 4px rgba(57, 255, 20, 0.6),
        0 0 8px rgba(57, 255, 20, 0.35),
        0 0 16px rgba(57, 255, 20, 0.15);
}

/* ---- Strata (General) ---- */
.stratum {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.stratum-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.stratum-content {
    position: relative;
    z-index: 2;
    max-width: 680px;
    margin: 0 auto;
    padding: clamp(4rem, 8vh, 8rem) 1.5rem;
}

/* ==================== STRATUM 0: SURFACE ==================== */
#stratum-0 {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2A1A0E;
}

#stratum-0 .stratum-bg {
    background: #2A1A0E;
}

/* Surface texture via SVG pattern */
#surface-texture {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
}

/* Crack line SVG */
#crack-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 70vh;
    z-index: 2;
}

#crack-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

#crack-path.drawn {
    stroke-dashoffset: 0;
}

/* Neon glow from crack */
#crack-glow {
    position: absolute;
    top: 30vh;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 200px;
    background: radial-gradient(ellipse at center, rgba(57, 255, 20, 0.1) 0%, transparent 70%);
    z-index: 1;
    transition: width 800ms ease-out;
    pointer-events: none;
}

#crack-glow.active {
    width: 400px;
}

/* Surface content */
#surface-content {
    position: relative;
    z-index: 3;
    text-align: center;
    opacity: 0;
    transition: opacity 600ms ease;
}

#surface-content.visible {
    opacity: 1;
}

#domain-title {
    margin-bottom: 0.4em;
}

#tagline {
    font-family: 'Crimson Pro', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #C4A882;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

/* Magnetic parallax on surface */
#stratum-0 .stratum-bg,
#surface-texture {
    transition: transform 200ms ease;
}

/* ==================== STRATUM 1: TOPSOIL ==================== */
#stratum-1 {
    background: linear-gradient(to bottom, #2A1A0E 0%, #4A0E1B 15%, #4A0E1B 100%);
}

#stratum-1 .stratum-bg {
    background: transparent;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.6'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

.stratum-1-offset {
    transform: translateX(-25px);
    max-width: 660px;
}

/* ==================== STRATUM 2: ROOT NETWORK ==================== */
#stratum-2 {
    background: linear-gradient(to bottom, #4A0E1B 0%, #1A0810 40%, #0D0A07 100%);
}

#stratum-2 .stratum-bg {
    background: transparent;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

.stratum-2-offset {
    transform: translateX(30px);
}

/* ==================== STRATUM 3: BEDROCK ==================== */
#stratum-3 {
    background: #0D0A07;
}

#stratum-3 .stratum-bg {
    background: #0D0A07;
}

.vein-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.stratum-3-center {
    max-width: 560px;
    transform: translateX(0);
}

/* Specimen cards */
.specimen {
    position: relative;
    padding: 2.5rem 2rem;
    margin-bottom: 3rem;
    border: 1px solid #C4A882;
    clip-path: var(--clip);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.specimen.in-view {
    opacity: 1;
    transform: translateY(0);
}

.specimen h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    margin-bottom: 0.8em;
}

/* ==================== STRATUM 4: THE VAULT ==================== */
#stratum-4 {
    min-height: 100vh;
    background: #0D0A07;
    display: flex;
    align-items: center;
    justify-content: center;
}

#stratum-4 .stratum-bg {
    background: #0D0A07;
}

.vault-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3rem;
}

.vault-coin {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid #E8D5B7;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 40% 35%, rgba(232, 213, 183, 0.06) 0%, rgba(13, 10, 7, 0.95) 60%);
    animation: vault-rotate 60s linear infinite, vault-glow 4s ease-in-out infinite alternate;
    padding: 2rem;
}

.vault-text {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 800;
    font-variant: small-caps;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #E8D5B7;
}

.vault-seal {
    opacity: 0.7;
}

.vault-hash {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #39FF14;
    letter-spacing: 0.06em;
    text-shadow:
        0 0 4px rgba(57, 255, 20, 0.4),
        0 0 8px rgba(57, 255, 20, 0.2);
}

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

@keyframes vault-glow {
    from {
        box-shadow: 0 0 20px rgba(57, 255, 20, 0.08), 0 0 60px rgba(57, 255, 20, 0.04);
    }
    to {
        box-shadow: 0 0 30px rgba(57, 255, 20, 0.2), 0 0 80px rgba(57, 255, 20, 0.08);
    }
}

/* ---- Coin Artifacts ---- */
.coin-artifact {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 1px solid #C4A882;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 40% 35%, rgba(196, 168, 130, 0.08) 0%, transparent 60%);
    transition: border-color 300ms ease, box-shadow 300ms ease;
    flex-shrink: 0;
}

.coin-artifact:hover {
    border-color: #E8D5B7;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.15);
}

.coin-artifact.coin-left {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.coin-artifact.coin-large {
    width: 160px;
    height: 160px;
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.coin-glyph {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 800;
    font-variant: small-caps;
    font-size: 2rem;
    color: #E8D5B7;
    letter-spacing: -0.02em;
}

.coin-symbol {
    width: 60%;
    height: 60%;
}

/* ---- Data Fragments ---- */
.data-fragment {
    margin: 1.5em 0;
    padding: 1rem 1.2rem;
    border-left: 2px solid rgba(57, 255, 20, 0.3);
    background: rgba(57, 255, 20, 0.02);
}

.data-label {
    display: block;
    font-family: 'Crimson Pro', 'Georgia', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #C4A882;
    margin-bottom: 0.4em;
    letter-spacing: 0.04em;
}

.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #39FF14;
    letter-spacing: 0.06em;
    text-shadow:
        0 0 4px rgba(57, 255, 20, 0.4),
        0 0 8px rgba(57, 255, 20, 0.2);
    word-break: break-all;
}

/* ---- Content Block Animations ---- */
.content-block {
    margin-bottom: clamp(3rem, 5vh, 5rem);
    overflow: hidden;
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Magnetic cursor effect on specimens ---- */
.specimen.magnetic-active {
    transition: transform 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .vault-coin {
        animation: none;
        box-shadow: 0 0 25px rgba(57, 255, 20, 0.14);
    }

    #crack-path {
        stroke-dashoffset: 0;
    }

    #surface-content {
        opacity: 1;
    }

    #crack-glow {
        width: 400px;
    }

    .animate-on-scroll,
    .specimen {
        opacity: 1;
        transform: none;
    }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .stratum-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .stratum-1-offset {
        transform: translateX(-10px);
    }

    .stratum-2-offset {
        transform: translateX(10px);
    }

    .stratum-3-center {
        max-width: 100%;
    }

    .coin-artifact.coin-left,
    .coin-artifact.coin-large {
        float: none;
        margin: 0 auto 1.5rem auto;
    }

    .specimen {
        padding: 1.5rem 1rem;
    }

    .vault-coin {
        width: 220px;
        height: 220px;
    }
}
