/* ============================================================
   historical.quest - Styles
   Palette:
     #1A0A0A  Blackened Crimson (primary dark bg)
     #8B1A1A  Signal Red (accent, threads)
     #F0E2C4  Aged Dossier (light card bg, display text)
     #C4935A  Aged Brass (borders, pins)
     #2D0A0A  Deep Crimson-Black (text on light)
     #3D2B1F  Dark Umber (body text)
     #D4A574  Cork Tan (evidence board bg)
     #6B3030  Muted Carmine (hover states)
   Fonts:
     Special Elite (display/typewriter)
     Source Serif 4 (body)
     Stint Ultra Condensed (labels)
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #1A0A0A;
    color: #F0E2C4;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ---- TYPOGRAPHY UTILITIES ---- */
.typewriter-text {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 56px;
    line-height: 1.2;
    color: #F0E2C4;
    letter-spacing: 8px;
}

.section-heading {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 42px;
    line-height: 1.2;
    color: #F0E2C4;
}

.card-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 28px;
    line-height: 1.25;
    color: #2D0A0A;
    margin-bottom: 12px;
}

.date-stamp {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: 4px;
    color: #8B1A1A;
    text-transform: uppercase;
}

.era-label {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: 4px;
    color: #C4935A;
    text-transform: uppercase;
}

.card-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 16px;
    line-height: 1.7;
    color: #3D2B1F;
    font-weight: 400;
}

/* ============================================================
   SECTION 1: THE BRIEFING (0-100vh)
   ============================================================ */
.section-briefing {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1A0A0A;
    overflow: hidden;
}

.briefing-content {
    text-align: center;
    z-index: 2;
}

#typewriter-container {
    display: inline-block;
    margin-bottom: 32px;
    min-height: 70px;
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 56px;
    background: #F0E2C4;
    vertical-align: bottom;
    margin-left: 4px;
    animation: blink 0.8s step-end infinite;
}

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

.red-line {
    width: 0;
    height: 2px;
    background: #8B1A1A;
    margin: 24px auto;
    transition: width 0.8s ease-out;
}

.red-line.active {
    width: 320px;
}

.classification-label {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    letter-spacing: 6px;
    color: #C4935A;
    opacity: 0;
    transition: opacity 0.6s ease-in;
}

.classification-label.visible {
    opacity: 1;
}

/* Wax Seal */
.wax-seal {
    position: absolute;
    bottom: 60px;
    right: 80px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #8B1A1A 0%, #6B3030 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0) rotate(0deg);
    transition: transform 0.6s ease-out;
    box-shadow: 2px 4px 12px rgba(0,0,0,0.5);
    z-index: 3;
}

.wax-seal.visible {
    transform: scale(1) rotate(-5deg);
}

.seal-letter {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 28px;
    color: #F0E2C4;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.3), -1px -1px 0 rgba(255,255,255,0.1);
}

/* ============================================================
   SECTION 2: THE EVIDENCE BOARD (100vh-300vh)
   ============================================================ */
.section-evidence-board {
    position: relative;
    width: 100%;
    min-height: 200vh;
    padding: 80px 0 120px;
}

.cork-board {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 1900px;
    background: #D4A574;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.5s ease;
    /* Cork grid texture overlay */
    background-image:
        linear-gradient(rgba(139,107,53,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,107,53,0.05) 1px, transparent 1px);
    background-size: 80px 80px;
    filter: url(#cork-texture);
}

.cork-board.visible {
    opacity: 1;
}

/* Thread SVG overlay */
.thread-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.thread-line {
    stroke: #8B1A1A;
    stroke-width: 2px;
    stroke-dasharray: 8 4;
    fill: none;
    transition: stroke-width 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
}

.thread-line:hover {
    stroke-width: 4px;
}

/* ---- Evidence Cards ---- */
.evidence-card {
    position: absolute;
    left: var(--card-left, 5%);
    top: var(--card-top, 0);
    transform: rotate(var(--card-rotate, 0deg));
    background: #F0E2C4;
    border: 1px solid #C4935A;
    border-radius: 2px;
    padding: 32px 24px 24px;
    box-shadow: 3px 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.evidence-card.card-primary {
    width: min(480px, 44%);
}

.evidence-card.card-secondary {
    width: min(320px, 30%);
}

.evidence-card.visible {
    opacity: 1;
}

.evidence-card:hover {
    transform: rotate(var(--card-rotate, 0deg)) translateY(-4px);
    box-shadow: 4px 8px 24px rgba(0,0,0,0.35);
    z-index: 10;
}

/* Push Pin */
.push-pin {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #C4935A, #8B6B35);
    box-shadow: 0 4px 4px rgba(0,0,0,0.2);
    z-index: 6;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.push-pin.visible {
    opacity: 1;
    animation: pin-drop 0.3s ease-out;
}

@keyframes pin-drop {
    0% { transform: translateX(-50%) translateY(-20px); }
    60% { transform: translateX(-50%) translateY(2px); }
    100% { transform: translateX(-50%) translateY(0); }
}

.evidence-card:hover .push-pin {
    transform: translateX(-50%) rotate(15deg);
}

/* Push pin triangle shadow */
.push-pin::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 5px solid rgba(0,0,0,0.15);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(196,147,90,0.4);
}

/* ---- Redacted Blocks ---- */
.redacted-block {
    position: relative;
    margin-top: 16px;
    padding: 8px 12px;
    background: rgba(26,10,10,0.04);
    border-left: 3px solid #8B1A1A;
    cursor: pointer;
    overflow: hidden;
}

.redacted-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 13px;
    line-height: 1.5;
    color: #3D2B1F;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.redacted-bar {
    position: absolute;
    top: 50%;
    left: 12px;
    right: 12px;
    height: 1em;
    transform: translateY(-50%);
    background: #1A0A0A;
    border-radius: 2px;
    transition: opacity 0.3s ease;
}

.redacted-block.revealed .redacted-text {
    opacity: 1;
}

.redacted-block.revealed .redacted-bar {
    opacity: 0;
}

/* Card glow on thread hover */
.evidence-card.thread-hover {
    box-shadow: 0 0 8px rgba(139,26,26,0.3), 3px 4px 12px rgba(0,0,0,0.25);
}

/* ============================================================
   SECTION 3: THE STRING MAP (300vh-400vh)
   ============================================================ */
.section-string-map {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 80px 20px;
    background: #1A0A0A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.string-map-container {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

.section-subheading {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    letter-spacing: 6px;
    color: #C4935A;
    margin-top: 12px;
    margin-bottom: 48px;
    text-transform: uppercase;
}

.string-map-svg {
    width: 100%;
    max-width: 1200px;
    height: auto;
}

.svg-era-text {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    letter-spacing: 3px;
    fill: #C4935A;
    text-anchor: middle;
    opacity: 0.6;
}

.svg-event-label {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    fill: #F0E2C4;
    text-anchor: middle;
}

.event-node {
    fill: #8B1A1A;
    stroke: #C4935A;
    stroke-width: 2;
    transition: r 0.3s ease;
    cursor: pointer;
}

.event-node:hover {
    r: 12;
}

.event-node-secondary {
    fill: #6B3030;
    stroke: #C4935A;
    stroke-width: 1.5;
    transition: r 0.3s ease;
    cursor: pointer;
}

.event-node-secondary:hover {
    r: 10;
}

.string-thread {
    stroke: #8B1A1A;
    stroke-width: 2;
    stroke-dasharray: 8 4;
    fill: none;
    opacity: 0;
    transition: opacity 0.6s ease, stroke-width 0.3s ease;
}

.string-thread.visible {
    opacity: 1;
}

.string-thread:hover {
    stroke-width: 4;
}

/* ============================================================
   SECTION 4: THE DEBRIEF (final 100vh)
   ============================================================ */
.section-debrief {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 80px 20px;
    background: #1A0A0A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.debrief-content {
    max-width: 720px;
    width: 100%;
    padding: 48px;
    background: #F0E2C4;
    border: 1px solid #C4935A;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.debrief-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.field-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.report-label {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 18px;
    color: #2D0A0A;
    letter-spacing: 4px;
}

.report-classification {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    letter-spacing: 4px;
    color: #8B1A1A;
}

.report-divider {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8B1A1A, transparent);
    margin: 24px 0;
}

.debrief-heading {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 28px;
    line-height: 1.25;
    color: #2D0A0A;
    margin-bottom: 20px;
}

.debrief-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 16px;
    line-height: 1.7;
    color: #3D2B1F;
    margin-bottom: 16px;
}

.debrief-body b, .debrief-body strong {
    font-weight: 700;
}

.debrief-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.stamp-text {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 18px;
    color: #8B1A1A;
    letter-spacing: 4px;
    border: 2px solid #8B1A1A;
    padding: 8px 16px;
    transform: rotate(-3deg);
    display: inline-block;
}

.date-filed {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 14px;
    letter-spacing: 4px;
    color: #6B3030;
}

.debrief-seal {
    position: absolute;
    top: -24px;
    right: -24px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #8B1A1A 0%, #6B3030 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 4px 12px rgba(0,0,0,0.4);
    transform: rotate(-8deg);
}

.seal-text {
    font-family: 'Stint Ultra Condensed', sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
    color: #F0E2C4;
    text-align: center;
    line-height: 1.4;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.3), -1px -1px 0 rgba(255,255,255,0.1);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .evidence-card.card-primary {
        width: min(90%, 480px);
    }
    .evidence-card.card-secondary {
        width: min(80%, 320px);
    }
    .evidence-card {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        margin: 24px auto;
    }
    .cork-board {
        min-height: auto;
    }
    .typewriter-text {
        font-size: 36px;
    }
    .typewriter-cursor {
        height: 36px;
    }
}
