/* ===========================
   THE RED RIVER — styles.css
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Courier+Prime:wght@400;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

html { height: 100%; }

body {
    height: 100%;
    margin: 0;
    font-family: 'Crimson Text', serif;
    background: linear-gradient(180deg, #1a2a3a 0%, #0f1a2a 40%, #050808 100%) fixed;
    color: #d8d8d8;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Typography ── */
.font-display {
    font-family: 'IM Fell English', serif;
    letter-spacing: 0.03em;
    font-weight: 400;
}
.font-mono { font-family: 'Courier Prime', monospace; }

.doc-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-weight: 400;
}
.doc-subtitle {
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    line-height: 1.6;
    letter-spacing: 0.01em;
    font-weight: 400;
}
.doc-caption {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    opacity: 0.5;
    font-weight: 600;
}

/* ── Film Grain ── */
@keyframes filmGrain {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(2px, 2px); }
}
.grain {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0.05;
    pointer-events: none;
    background-image: url('data:image/svg+xml,%3Csvg viewBox=%220 0 400 400%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22noiseFilter%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%226%22 numOctaves=%224%22/%3E%3C/filter%3E%3Crect width=%22400%22 height=%22400%22 fill=%22%23fff%22 filter=%22url(%23noiseFilter)%22/%3E%3C/svg%3E');
    background-size: 300px 300px;
    animation: filmGrain 0.15s infinite;
}

/* ── Navigation ── */
.nav-link {
    position: relative;
    transition: color 0.4s ease;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -6px; left: 0;
    width: 0; height: 0.5px;
    background: #c9cdd0;
    transition: width 0.5s ease;
}
.nav-link:hover::after,
.nav-link.active-link::after { width: 100%; }

/* ── Scroll Reveal ── */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Home page: use animation instead of intersection observer */
#page-home .scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    animation: fadeInUp 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Cinematic Image ── */
.cinematic-image {
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
}
.cinematic-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(15,30,45,0.25) 100%);
    z-index: 2;
    pointer-events: none;
}

.archive-panel {
    box-shadow:
            0 30px 90px rgba(0, 0, 0, 0.45),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.archive-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
            radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.13), transparent 36%),
            radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.11), transparent 38%);
}

.science-panel {
    box-shadow:
            0 30px 90px rgba(0, 0, 0, 0.45),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.science-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
            radial-gradient(circle at 18% 8%, rgba(74, 222, 128, 0.10), transparent 36%),
            radial-gradient(ellipse at 50% 110%, rgba(21, 128, 61, 0.14), transparent 50%);
}

.bibliography-panel {
    box-shadow:
            0 32px 95px rgba(0, 0, 0, 0.46),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.source-row {
    position: relative;
    display: grid;
    grid-template-columns: 48px 190px 1fr;
    gap: 2rem;
    padding: 2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.source-row-last {
    border-bottom: none;
}

.source-number {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.28);
    padding-top: 0.35rem;
}

.source-category {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.62rem;
    line-height: 1.55;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.32);
    padding-top: 0.35rem;
}

.source-title {
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 1.2rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.84);
    margin-bottom: 0.45rem;
}

.source-meta {
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.92rem;
    line-height: 1.65;
    max-width: 42rem;
    margin-bottom: 0.8rem;
}

.source-link {
    display: inline-block;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    color: rgba(147, 197, 253, 0.52);
    text-decoration: none;
    border-bottom: 1px solid rgba(147, 197, 253, 0.22);
    transition:
            color 0.35s ease,
            border-color 0.35s ease;
}

.source-link:hover {
    color: rgba(191, 219, 254, 0.88);
    border-color: rgba(191, 219, 254, 0.55);
}

.bibliography-link:hover {
    color: rgba(191, 219, 254, 0.85);
    border-color: rgba(191, 219, 254, 0.55);
}

@media (max-width: 768px) {
    .source-row {
        grid-template-columns: 36px 1fr;
        gap: 1rem;
        padding: 1.75rem 0;
    }

    .source-category {
        grid-column: 2;
        font-size: 0.58rem;
        margin-bottom: 0.35rem;
    }

    .source-content {
        grid-column: 2;
    }

    .source-title {
        font-size: 1.08rem;
    }

    .source-meta {
        font-size: 0.88rem;
    }

    .source-link {
        font-size: 0.58rem;
        word-break: break-word;
    }
}




.stat-number {
    font-family: var(--font-display, Georgia, serif);
    font-size: clamp(3.25rem, 7vw, 5.75rem);
    line-height: 0.85;
    letter-spacing: -0.06em;
}

.system-chain {
    box-shadow:
            0 28px 80px rgba(0, 0, 0, 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.system-chain::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
            radial-gradient(circle at 18% 8%, rgba(125, 211, 252, 0.055), transparent 34%),
            radial-gradient(circle at 88% 92%, rgba(127, 29, 29, 0.12), transparent 38%);
}

.system-chain::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.16),
            transparent
    );
}

.science-hero-number {
    font-family: var(--font-display, Georgia, serif);
    font-size: clamp(4rem, 11vw, 8rem);
    line-height: 0.85;
    letter-spacing: -0.075em;
}

.science-stat-number {
    font-family: var(--font-display, Georgia, serif);
    font-size: clamp(3rem, 6vw, 4.8rem);
    line-height: 0.85;
    letter-spacing: -0.06em;
}

.closing-card {
    box-shadow:
            0 30px 90px rgba(0, 0, 0, 0.45),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0d0d0d; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }