/* Palette: #4A6B3A (spore green) #C47A52 (ember orange) */
/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0f0b09;
    color: #b8a99a;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* === CURSOR GLOW === */
#cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle 200px at var(--mx, -200px) var(--my, -200px), rgba(107, 29, 42, 0.12) 0%, transparent 100%);
    transition: none;
}

/* === BOKEH BACKGROUND === */
#bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    will-change: background-position;
    background:
        radial-gradient(circle 80px at 15% 20%, rgba(107, 29, 42, 0.08) 0%, transparent 100%),
        radial-gradient(circle 40px at 75% 35%, rgba(196, 122, 82, 0.06) 0%, transparent 100%),
        radial-gradient(circle 120px at 50% 70%, rgba(107, 29, 42, 0.05) 0%, transparent 100%),
        radial-gradient(circle 30px at 25% 85%, rgba(196, 122, 82, 0.07) 0%, transparent 100%),
        radial-gradient(circle 60px at 85% 60%, rgba(107, 29, 42, 0.06) 0%, transparent 100%),
        radial-gradient(circle 90px at 40% 15%, rgba(196, 122, 82, 0.04) 0%, transparent 100%),
        radial-gradient(circle 50px at 65% 90%, rgba(107, 29, 42, 0.07) 0%, transparent 100%),
        radial-gradient(circle 20px at 10% 50%, rgba(196, 122, 82, 0.09) 0%, transparent 100%);
    animation: bokeh-drift 60s linear infinite alternate;
}

@keyframes bokeh-drift {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 5% 3%, -3% 5%, 4% -2%, -5% 4%, 3% -5%, -4% 3%, 5% -3%, -3% 5%; }
}

/* === SPORE DOTS TEXTURE === */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(circle 2px at 12% 8%, rgba(74, 107, 58, 0.06) 0%, transparent 3px),
        radial-gradient(circle 3px at 34% 22%, rgba(74, 107, 58, 0.06) 0%, transparent 4px),
        radial-gradient(circle 2px at 56% 15%, rgba(74, 107, 58, 0.06) 0%, transparent 3px),
        radial-gradient(circle 4px at 78% 33%, rgba(74, 107, 58, 0.06) 0%, transparent 5px),
        radial-gradient(circle 2px at 23% 45%, rgba(74, 107, 58, 0.06) 0%, transparent 3px),
        radial-gradient(circle 3px at 67% 52%, rgba(74, 107, 58, 0.06) 0%, transparent 4px),
        radial-gradient(circle 2px at 45% 67%, rgba(74, 107, 58, 0.06) 0%, transparent 3px),
        radial-gradient(circle 3px at 89% 72%, rgba(74, 107, 58, 0.06) 0%, transparent 4px),
        radial-gradient(circle 2px at 8% 88%, rgba(74, 107, 58, 0.06) 0%, transparent 3px),
        radial-gradient(circle 4px at 52% 95%, rgba(74, 107, 58, 0.06) 0%, transparent 5px);
}

/* === TRAIL MARKERS NAVIGATION === */
#trail-markers {
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.trail-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    border-left: 1px dashed #6b5a4e;
    opacity: 0.4;
    z-index: -1;
}

.marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b5a4e;
    cursor: pointer;
    position: relative;
    transition: background 400ms ease, box-shadow 400ms ease;
}

.marker:hover {
    background: #b8a99a;
}

.marker.active {
    background: #6b1d2a;
    animation: marker-pulse 2s ease-in-out infinite;
}

@keyframes marker-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(107, 29, 42, 0.4); }
    50% { box-shadow: 0 0 12px rgba(107, 29, 42, 0.8); }
}

.marker-tooltip {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #6b5a4e;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.marker:hover .marker-tooltip {
    opacity: 1;
}

/* === SECTIONS === */
.section-full {
    min-height: 100vh;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-auto {
    min-height: 100vh;
    position: relative;
    z-index: 2;
    padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 6vw, 5rem);
}

/* === FOG GATE (HERO) === */
#fog-gate {
    background: #1a1410;
    overflow: hidden;
}

.mountain-silhouettes {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
}

.mountain-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

.mountain-far {
    height: 30%;
    background: #0f0b09;
    clip-path: polygon(0% 100%, 0% 70%, 5% 60%, 15% 40%, 25% 55%, 35% 25%, 45% 45%, 55% 15%, 65% 35%, 75% 20%, 85% 45%, 95% 30%, 100% 50%, 100% 100%);
    opacity: 0.3;
}

.mountain-mid {
    height: 25%;
    background: #15100c;
    clip-path: polygon(0% 100%, 0% 60%, 10% 45%, 20% 55%, 30% 30%, 40% 50%, 50% 20%, 60% 40%, 70% 25%, 80% 50%, 90% 35%, 100% 55%, 100% 100%);
    opacity: 0.5;
}

.mountain-near {
    height: 20%;
    background: #1a1410;
    clip-path: polygon(0% 100%, 0% 55%, 8% 40%, 18% 55%, 28% 35%, 38% 50%, 48% 25%, 58% 45%, 68% 30%, 78% 50%, 88% 40%, 100% 60%, 100% 100%);
    opacity: 0.8;
}

.fog-gate-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

#title-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 8vw, 7rem);
    letter-spacing: -0.04em;
    line-height: 0.92;
    color: #e8d5c4;
    text-shadow: 0 0 40px rgba(107, 29, 42, 0.3);
    margin-bottom: 3rem;
}

#title-text .title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#title-text .title-char.visible {
    opacity: 1;
    transform: translateY(0);
}

#title-text .title-char.dot {
    color: #6b1d2a;
}

.scroll-instruction {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #6b5a4e;
    text-transform: uppercase;
    animation: pulse-fade 3s ease-in-out infinite;
}

@keyframes pulse-fade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* === MOUNTAIN DIVIDERS === */
.mountain-divider {
    position: relative;
    height: 120px;
    z-index: 2;
    overflow: hidden;
}

.mountain-div-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1410;
    opacity: var(--m-opacity, 0.5);
}

/* === SVG RIDGE LINES === */
.ridge-line {
    display: block;
    width: 100%;
    height: 60px;
    position: relative;
    z-index: 2;
}

.ridge-line path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.ridge-line.animated path {
    stroke-dashoffset: 0;
}

/* === SECTION TITLES === */
.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 8vw, 7rem);
    letter-spacing: -0.04em;
    line-height: 0.92;
    color: #e8d5c4;
    text-shadow: 0 0 40px rgba(107, 29, 42, 0.3);
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-title::first-letter {
    color: #6b1d2a;
}

/* === DOSSIER GRID === */
.dossier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(1rem, 3vw, 2.5rem);
}

.dossier-card {
    background: #2a1f18;
    padding: clamp(1.2rem, 2vw, 2rem);
    position: relative;
    transform: rotate(var(--card-rotation, 0deg));
    transition: box-shadow 400ms cubic-bezier(0.25, 0.1, 0.25, 1), transform 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
    overflow: hidden;
}

.dossier-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #6b1d2a;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.dossier-card:hover::after {
    transform: scaleX(1);
}

.dossier-card:hover {
    box-shadow: inset 0 0 15px rgba(0,0,0,0.2), 0 0 40px rgba(107, 29, 42, 0.08);
}

/* Scratch marks texture on cards */
.dossier-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(184, 169, 154, 0.03) 10px, rgba(184, 169, 154, 0.03) 11px);
    pointer-events: none;
}

.card-tall {
    grid-row: span 2;
}

.card-meta {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #6b5a4e;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.8rem;
}

.dossier-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: #e8d5c4;
    letter-spacing: -0.02em;
    margin-bottom: 0.8rem;
    line-height: 1.2;
}

.dossier-card p {
    color: #b8a99a;
    margin-bottom: 0.8rem;
}

.dossier-card p:last-child {
    margin-bottom: 0;
}

/* Dark cards for Archive section */
.card-dark {
    background: #1a1410;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.4);
}

.card-dark .dossier-card::before {
    opacity: 1;
}

/* Ring stains */
.ring-stain {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(107, 29, 42, 0.15);
    box-shadow: 0 0 8px rgba(107, 29, 42, 0.05), inset 0 0 4px rgba(107, 29, 42, 0.05);
    pointer-events: none;
}

/* === THE STAIRWELL === */
#stairwell {
    background: #0f0b09;
}

.stairwell-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    border-left: 1px solid #2a1f18;
    height: 0;
    transition: height 2s ease-out;
}

#stairwell.in-view .stairwell-line {
    height: 100%;
}

.stairwell-quote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2em;
    position: relative;
    z-index: 2;
}

.quote-word {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 5rem);
    letter-spacing: -0.04em;
    line-height: 1;
    color: #e8d5c4;
    text-shadow: 0 0 40px rgba(107, 29, 42, 0.3);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.quote-word.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === THE VAULT FLOOR === */
#vault-floor {
    background: #0a0706;
}

.vault-lamp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, #2a1a0f 0%, transparent 60%);
    pointer-events: none;
}

.vault-card {
    position: relative;
    z-index: 3;
    background: #15100c;
    border: 1px solid #3d2b1f;
    padding: clamp(2rem, 4vw, 4rem);
    max-width: 680px;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 0 60px rgba(0,0,0,0.3);
}

.vault-card .card-meta {
    margin-bottom: 1.2rem;
}

.vault-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2vw, 2rem);
    color: #e8d5c4;
    letter-spacing: -0.02em;
    margin-bottom: 1.2rem;
    text-shadow: 0 0 40px rgba(107, 29, 42, 0.3);
}

.vault-card p {
    color: #b8a99a;
    margin-bottom: 1rem;
}

.vault-card p:last-child {
    margin-bottom: 0;
}

/* === ARCHIVE BASEMENT (FOOTER) === */
#archive-basement {
    position: relative;
    z-index: 2;
    background: #0a0706;
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.basement-lamp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, #2a1a0f 0%, transparent 60%);
    pointer-events: none;
}

.basement-lines {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.basement-line {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #6b5a4e;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.basement-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === VAULT SECTION ENHANCED CURSOR GLOW === */
body.in-vault #cursor-glow {
    background: radial-gradient(circle 300px at var(--mx, -200px) var(--my, -200px), rgba(107, 29, 42, 0.2) 0%, transparent 100%);
}

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

    .dossier-grid {
        grid-template-columns: 1fr;
    }

    .card-tall {
        grid-row: span 1;
    }
}
