/* ============================================
   footprint.bar — Declassified Intelligence Dossier
   Color Palette: Muted Vintage Intelligence
   Fonts: Josefin Sans, Libre Baskerville, IBM Plex Mono
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0d0d0f;
    --bg-secondary: #1a1a1e;
    --bg-tertiary: #252320;
    --text-primary: #c8b89a;
    --text-secondary: #b0a898;
    --text-tertiary: #6b6158;
    --accent-primary: #8c7a5e;
    --accent-secondary: #d4a76a;
    --accent-tertiary: #5a7a6e;
    --signal-red: #8b3a3a;
    --trace-grey: #3a3530;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Noise Texture Overlay --- */
#noise-overlay {
    position: fixed;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    animation: noiseShift 0.1s steps(3) infinite;
}

@keyframes noiseShift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(-1px, 1px); }
    66% { transform: translate(1px, -1px); }
    100% { transform: translate(0, 0); }
}

/* --- Scroll Progress Indicator --- */
#scroll-progress {
    position: fixed;
    left: 32px;
    top: 0;
    width: 2px;
    height: 100vh;
    background: rgba(58, 53, 48, 0.3);
    z-index: 100;
}

#scroll-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: var(--accent-primary);
    transition: height 0.1s linear;
}

.scroll-tick {
    position: absolute;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--trace-grey);
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    transform: translateY(-50%);
}

.scroll-tick:hover,
.scroll-tick.active {
    background: var(--accent-secondary);
    box-shadow: 0 0 8px rgba(212, 167, 106, 0.4);
}

.scroll-tick.passed {
    background: var(--accent-primary);
}

/* --- Section Header Styles --- */
.section-header {
    margin-bottom: 3rem;
    padding-top: 4rem;
}

.section-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 0.75rem;
}

.section-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-primary);
    display: inline-block;
    margin-bottom: 0.5rem;
}

.section-rule {
    height: 1px;
    background: var(--trace-grey);
    margin-top: 0.5rem;
}

/* ============================================
   COVER SHEET
   ============================================ */
.section-cover {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

.seal-watermark {
    position: absolute;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%) scale(1.5);
    width: 400px;
    height: 400px;
    opacity: 0.2;
    animation: sealPulse 6s ease-in-out infinite;
}

@keyframes sealPulse {
    0%, 100% { opacity: 0.18; }
    50% { opacity: 0.23; }
}

.cover-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.cover-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.cover-rule {
    width: 30vw;
    height: 1px;
    background: var(--trace-grey);
    margin: 0 auto 1.5rem;
}

.cover-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    min-height: 1.5em;
}

.cover-subtitle .cursor {
    display: inline-block;
    color: var(--accent-secondary);
    animation: blink 0.7s step-end infinite;
    margin-left: 1px;
}

.cover-subtitle .cursor.fade-out {
    animation: cursorFade 2s ease-out forwards;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes cursorFade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

.cover-circuit-motif {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 250px;
    height: 170px;
    opacity: 0.6;
}

.cover-circuit-motif .circuit-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawCircuit 3s ease-in-out forwards;
    animation-delay: 1s;
}

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

/* ============================================
   SECTION ALPHA — THE TRACE
   ============================================ */
.section-alpha {
    min-height: 100vh;
    padding: 4rem 6rem 6rem;
    background: var(--bg-secondary);
    position: relative;
}

.alpha-content {
    display: flex;
    gap: 6%;
}

.alpha-text {
    flex: 0 0 55%;
    max-width: 55%;
}

.alpha-text p {
    margin-bottom: 1.8rem;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.reveal-text {
    opacity: 0.3;
    filter: blur(1px);
    transition: opacity 0.6s ease-out, filter 0.6s ease-out;
}

.reveal-text.revealed {
    opacity: 1;
    filter: blur(0);
}

.pull-quote {
    border-left: 3px solid var(--accent-secondary);
    padding-left: 1.5rem;
    margin: 2.5rem 0;
}

.pull-quote p {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0.04em;
    color: var(--accent-secondary);
    line-height: 1.5;
    text-align: left;
}

.alpha-diagram {
    flex: 0 0 35%;
    max-width: 35%;
    position: relative;
}

#alpha-circuit {
    width: 100%;
    height: auto;
    max-height: 80vh;
    position: sticky;
    top: 10vh;
}

.node-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.04em;
    fill: var(--text-tertiary);
    text-transform: uppercase;
}

.circuit-node {
    transition: fill 0.4s ease-out, transform 0.4s ease-out;
}

.circuit-node:hover {
    fill: rgba(212, 167, 106, 0.6);
    cursor: pointer;
}

/* Annotation arrows */
.annotation {
    position: absolute;
    width: 60px;
    height: 30px;
    pointer-events: none;
}

.annotation-1 {
    top: 28%;
    left: 50%;
}

.annotation-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.annotation-path.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

/* ============================================
   SECTION BRAVO — THE MAP
   ============================================ */
.section-bravo {
    min-height: 120vh;
    padding: 4rem 3rem;
    background: var(--bg-primary);
    position: relative;
}

.bravo-network {
    position: relative;
    width: 100%;
    height: 80vh;
    margin-top: 2rem;
}

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

.bravo-connection {
    stroke: var(--trace-grey);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    fill: none;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity 0.8s ease-out, stroke 0.5s ease;
}

.bravo-connection.visible {
    opacity: 1;
}

.bravo-connection.active-trace {
    stroke: var(--accent-tertiary);
    stroke-dashoffset: 0;
    animation: flowTrace 3s linear infinite;
}

@keyframes flowTrace {
    to { stroke-dashoffset: -16; }
}

.bravo-node-circle {
    stroke: var(--accent-primary);
    stroke-width: 1.5;
    fill: none;
    cursor: pointer;
    transition: fill 0.4s ease-out, transform 0.4s ease-out, stroke 0.3s ease;
}

.bravo-node-circle:hover {
    fill: rgba(212, 167, 106, 0.6);
    stroke: var(--accent-secondary);
}

.bravo-node-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.04em;
    fill: var(--text-tertiary);
    text-transform: uppercase;
    pointer-events: none;
    text-anchor: middle;
}

.bravo-node-group {
    transition: opacity 0.5s ease;
}

.bravo-node-group.dimmed {
    opacity: 0.4;
}

.bravo-node-group.highlighted .bravo-node-circle {
    fill: rgba(212, 167, 106, 0.6);
    stroke: var(--accent-secondary);
    filter: drop-shadow(0 0 12px rgba(212, 167, 106, 0.3));
}

/* Detail cards */
.bravo-detail-card {
    position: absolute;
    background: var(--bg-tertiary);
    border: 1px solid var(--trace-grey);
    padding: 1rem 1.2rem;
    max-width: 220px;
    opacity: 0;
    transform: translateY(8px) scale(0.3) rotate(-2deg);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
    pointer-events: none;
    z-index: 10;
}

.bravo-detail-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
}

.bravo-detail-card h4 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-secondary);
    margin-bottom: 0.4rem;
}

.bravo-detail-card p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--text-tertiary);
}

/* ============================================
   SECTION CHARLIE — THE ARCHIVE
   ============================================ */
.section-charlie {
    min-height: 100vh;
    padding: 4rem 2rem 6rem;
    background: var(--bg-secondary);
}

.section-charlie .section-header {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

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

.charlie-content p {
    margin-bottom: 2rem;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    color: var(--text-secondary);
}

.charlie-inline-illustration {
    display: block;
    width: 100%;
    max-width: 500px;
    height: auto;
    margin: 2rem auto;
    opacity: 0.7;
}

/* ============================================
   SECTION DELTA — THE SEAL
   ============================================ */
.section-delta {
    height: 50vh;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary), #0d0d0f);
    position: relative;
}

.delta-seal {
    width: 200px;
    height: 200px;
    opacity: 0;
    transition: opacity 1.5s ease-in;
}

.delta-seal.visible {
    opacity: 1;
}

.delta-text {
    margin-top: 2rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity 1.5s ease-in 0.5s;
}

.delta-text.visible {
    opacity: 1;
}

/* ============================================
   SVG Path Animation Base
   ============================================ */
.animate-on-scroll {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease-in-out, stroke 0.5s ease;
}

.animate-on-scroll.drawn {
    stroke-dashoffset: 0;
}

.animate-on-scroll.active {
    stroke: var(--accent-tertiary);
}

/* ============================================
   Responsive — Below 768px
   ============================================ */
@media (max-width: 768px) {
    .section-alpha {
        padding: 3rem 1.5rem 4rem;
    }

    .alpha-content {
        flex-direction: column;
    }

    .alpha-text {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .alpha-diagram {
        flex: 1 1 100%;
        max-width: 100%;
        margin-top: 2rem;
    }

    #alpha-circuit {
        position: relative;
        top: auto;
        max-height: 400px;
    }

    .section-bravo {
        padding: 3rem 1.5rem;
    }

    .bravo-network {
        height: 60vh;
    }

    #scroll-progress {
        left: 0;
        top: auto;
        bottom: 0;
        width: 100vw;
        height: 2px;
    }

    #scroll-progress-fill {
        width: 0%;
        height: 100%;
        transition: width 0.1s linear;
    }

    .scroll-tick {
        top: -3px;
        left: auto;
        transform: translateX(-50%);
    }

    .cover-circuit-motif {
        width: 150px;
        height: 100px;
        bottom: 1rem;
        right: 1rem;
    }

    .seal-watermark {
        width: 250px;
        height: 250px;
    }

    .annotation {
        display: none;
    }

    .section-charlie {
        padding: 3rem 1.5rem 4rem;
    }
}

@media (max-width: 480px) {
    .cover-title {
        font-size: 2.2rem;
        letter-spacing: 0.08em;
    }

    .section-alpha {
        padding: 2rem 1rem 3rem;
    }

    .section-bravo {
        padding: 2rem 1rem;
        min-height: 80vh;
    }

    .bravo-network {
        height: 50vh;
    }
}
