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

:root {
    --bg-primary: #1a1715;
    --bg-secondary: #2a2420;
    --surface-parchment: #d4c9b5;
    --text-primary: #3d3630;
    --accent-brick: #8b4513;
    --accent-verdigris: #5a7a6b;
    --highlight-amber: #c4953a;
    --grid-ghost: #4a443e;
    --text-meta: #7a7165;
    --hex-w: min(320px, 85vw);
    --hex-h: calc(var(--hex-w) * 1.155);
}

html {
    scroll-behavior: smooth;
    background: var(--bg-primary);
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === FIXED HEX BACKGROUND === */
#hex-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.12;
}

/* === SCROLL PROGRESS === */
#scroll-progress {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 100;
    opacity: 0.8;
}

/* === SECTION DARK === */
.section-dark {
    background: var(--bg-secondary);
    color: var(--surface-parchment);
}

/* === BRIEFING ROOM (Hero) === */
#briefing-room {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.briefing-content {
    padding: 2rem;
}

#hero-title {
    font-family: 'Alfa Slab One', serif;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface-parchment);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.stamp-letter {
    display: inline-block;
    transform: translateY(var(--offset, 0));
}

#tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--text-meta);
    letter-spacing: 0.05em;
    min-height: 1.5em;
}

#cursor {
    color: var(--highlight-amber);
    animation: blink 1.06s step-end infinite;
}

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

#chevron-down {
    margin-top: 3rem;
    animation: float 2.8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* === CLASSIFICATION STAMPS === */
.classification-stamp {
    text-align: center;
    padding: 3rem 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.classification-stamp.revealed {
    opacity: 1;
    transform: translateY(0);
}

.stamp-text {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-brick);
    padding: 8px 20px;
    border: 2px solid var(--accent-brick);
    outline: 1px solid var(--accent-brick);
    outline-offset: 3px;
    transform: rotate(-4deg);
    filter: blur(0.3px);
}

/* === HONEYCOMB ARRAY === */
#honeycomb-array {
    padding: 4rem 1rem 6rem;
    position: relative;
    display: flex;
    justify-content: center;
}

.field-lines-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.field-line {
    fill: none;
    stroke: var(--grid-ghost);
    stroke-width: 1;
    transition: stroke 0.4s ease;
}

.field-line.active {
    stroke: var(--highlight-amber);
    stroke-dasharray: 8 4;
    animation: dash-flow 1s linear infinite;
}

@keyframes dash-flow {
    to { stroke-dashoffset: -12; }
}

.hex-grid {
    display: grid;
    grid-template-columns: repeat(3, var(--hex-w));
    gap: 4px 4px;
    position: relative;
    z-index: 1;
}

.hex-grid .hex-cell:nth-child(n+4) {
    margin-top: calc(var(--hex-h) * -0.25);
}

.hex-grid .hex-cell:nth-child(4),
.hex-grid .hex-cell:nth-child(5),
.hex-grid .hex-cell:nth-child(6) {
    transform: translateX(calc(var(--hex-w) * 0.5));
}

.hex-cell {
    width: var(--hex-w);
    height: var(--hex-h);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    cursor: pointer;
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: translateY(40px);
}

.hex-cell.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hex-cell:hover {
    transform: scale(1.05) !important;
    z-index: 2;
}

.hex-inner {
    width: 100%; height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-bg {
    position: absolute;
    inset: 0;
    filter: saturate(0.3) contrast(1.2) sepia(0.4);
}

.hex-overlay {
    position: absolute;
    inset: 0;
    background: rgba(42, 36, 32, 0.7);
    transition: background 0.4s ease;
}

.hex-cell:hover .hex-overlay {
    background: rgba(42, 36, 32, 0.4);
}

.hex-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--surface-parchment);
}

.hex-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-meta);
    margin-bottom: 0.75rem;
    letter-spacing: 0.1em;
}

.hex-content h2 {
    font-family: 'Alfa Slab One', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--surface-parchment);
}

.hex-content p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    line-height: 1.6;
    color: var(--text-meta);
}

/* === REDACTED DOSSIER === */
#redacted-dossier {
    min-height: 100vh;
    background: var(--surface-parchment);
    position: relative;
    padding: 5rem 1.5rem;
    /* noise grain */
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 3px 3px;
}

.dossier-content {
    max-width: 700px;
    margin: 0 auto;
}

.dossier-header {
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--text-meta);
}

.dossier-label {
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-meta);
}

.dossier-paragraph {
    border-left: 3px solid var(--accent-brick);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.dossier-paragraph.revealed {
    opacity: 1;
    transform: translateY(0);
}

.dossier-paragraph p {
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    color: var(--text-primary);
}

/* === REDACTION === */
.redacted {
    background: var(--bg-primary);
    color: transparent;
    border-radius: 1px;
    padding: 1px 6px;
    display: inline-block;
    min-width: 40px;
    user-select: none;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}

.redacted:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.redacted.flash {
    animation: redact-flash 1.3s ease forwards;
}

@keyframes redact-flash {
    0% { color: transparent; }
    15% { color: var(--accent-brick); background: rgba(26,23,21,0.3); }
    75% { color: var(--accent-brick); background: rgba(26,23,21,0.3); }
    100% { color: transparent; background: var(--bg-primary); }
}

/* === SIGNAL TERMINUS (Footer) === */
#signal-terminus {
    background: var(--bg-primary);
    padding: 5rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.terminus-hex {
    width: 280px;
    height: 323px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--bg-secondary);
}

.terminus-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.terminus-inner h2 {
    font-family: 'Alfa Slab One', serif;
    color: var(--surface-parchment);
}

/* === MONO TEXT UTILITY === */
.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-meta);
}

/* === MOBILE === */
@media (max-width: 768px) {
    .hex-grid {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 12px;
    }
    .hex-grid .hex-cell:nth-child(n+4) {
        margin-top: 0;
    }
    .hex-grid .hex-cell:nth-child(4),
    .hex-grid .hex-cell:nth-child(5),
    .hex-grid .hex-cell:nth-child(6) {
        transform: none;
    }
    .hex-grid .hex-cell:nth-child(even) {
        transform: translateX(16px);
    }
    .hex-grid .hex-cell:nth-child(odd) {
        transform: translateX(-16px);
    }
    .hex-cell.revealed:nth-child(even) {
        transform: translateX(16px);
    }
    .hex-cell.revealed:nth-child(odd) {
        transform: translateX(-16px);
    }
    .field-lines-svg {
        display: none;
    }
}
