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

:root {
    --deep-navy: #0c1e2e;
    --dark-teal: #2a3a3f;
    --lavender: #8b7ea8;
    --slate: #9aacb8;
    --parchment: #f0e8d8;
    --warm-tan: #d4c8b0;
    --rust-orange: #d4785a;
    --teal-glow: #00e5c7;
    --teal-secondary: #4ecdc4;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Mono', monospace;
    background-color: var(--deep-navy);
    color: var(--parchment);
    overflow-x: hidden;
    letter-spacing: 0.04em;
    line-height: 1.75;
    font-size: clamp(0.85rem, 1.8vw, 1.1rem);
}

/* ===== SCANLINES ===== */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* ===== HUD OVERLAY ===== */
#hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--teal-glow);
    border-style: solid;
    opacity: 0.4;
}

.hud-tl { top: 16px; left: 16px; border-width: 2px 0 0 2px; }
.hud-tr { top: 16px; right: 16px; border-width: 2px 2px 0 0; }
.hud-bl { bottom: 16px; left: 16px; border-width: 0 0 2px 2px; }
.hud-br { bottom: 16px; right: 16px; border-width: 0 2px 2px 0; }

.hud-status {
    position: absolute;
    top: 20px;
    left: 70px;
    display: flex;
    gap: 24px;
    font-size: 0.7rem;
    color: var(--teal-glow);
    opacity: 0.6;
    text-transform: uppercase;
}

.hud-signal {
    position: absolute;
    top: 20px;
    right: 70px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--teal-glow);
    opacity: 0.6;
}

.signal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ===== SECTIONS ===== */
.section {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    position: relative;
}

/* ===== HEADER SECTION ===== */
.section-header {
    background: var(--deep-navy);
    overflow: hidden;
}

.radar-container {
    width: 280px;
    height: 280px;
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeIn 1s ease 0.3s forwards;
}

.radar-svg {
    width: 100%;
    height: 100%;
}

.radar-sweep {
    transform-origin: 150px 150px;
    animation: radar-spin 4s linear infinite;
}

@keyframes radar-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radar-blip {
    opacity: 0;
    animation: blip-flash 4s ease-in-out infinite;
}

.blip-1 { animation-delay: 0.5s; }
.blip-2 { animation-delay: 1.8s; }
.blip-3 { animation-delay: 3.1s; }

@keyframes blip-flash {
    0%, 20% { opacity: 0; }
    25% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.header-text {
    text-align: center;
    opacity: 0;
    animation: fadeIn 1s ease 0.8s forwards;
}

.station-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--parchment);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
    position: relative;
}

.glitch-text {
    animation: glitch-skew 8s ease-in-out infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    color: var(--teal-glow);
    clip-path: inset(0 0 80% 0);
    animation: glitch-before 8s ease-in-out infinite;
}

.glitch-text::after {
    color: var(--rust-orange);
    clip-path: inset(80% 0 0 0);
    animation: glitch-after 8s ease-in-out infinite;
}

@keyframes glitch-skew {
    0%, 95%, 100% { transform: skew(0deg); }
    96% { transform: skew(-2deg); }
    97% { transform: skew(1deg); }
}

@keyframes glitch-before {
    0%, 95%, 100% { transform: translate(0); }
    96% { transform: translate(-3px, 1px); }
    97% { transform: translate(2px, -1px); }
}

@keyframes glitch-after {
    0%, 95%, 100% { transform: translate(0); }
    96% { transform: translate(3px, -1px); }
    97% { transform: translate(-2px, 1px); }
}

.station-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--teal-glow);
    letter-spacing: 0.2em;
    margin-bottom: 24px;
}

.station-status {
    font-size: 0.85rem;
    color: var(--slate);
    min-height: 1.75em;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.65rem;
    color: var(--slate);
    opacity: 0.5;
    letter-spacing: 0.15em;
    animation: fadeIn 1s ease 3s forwards;
    opacity: 0;
}

.scroll-arrow {
    width: 16px;
    height: 16px;
    border-right: 1.5px solid var(--teal-glow);
    border-bottom: 1.5px solid var(--teal-glow);
    transform: rotate(45deg);
    animation: bounce-arrow 2s ease-in-out infinite;
}

@keyframes bounce-arrow {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(6px); }
}

/* ===== CASE FILE SECTIONS ===== */
.section-case {
    background: var(--dark-teal);
    border-top: 1px solid rgba(0, 229, 199, 0.1);
}

.section-case.case-dark {
    background: var(--deep-navy);
}

.case-file {
    max-width: 800px;
    width: 100%;
    background: rgba(12, 30, 46, 0.6);
    border: 1px solid rgba(0, 229, 199, 0.15);
    padding: 40px;
    position: relative;
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(154, 172, 184, 0.2);
}

.case-number {
    font-size: 0.75rem;
    color: var(--teal-glow);
    letter-spacing: 0.15em;
    font-weight: 700;
}

.case-status {
    font-size: 0.65rem;
    padding: 4px 12px;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.status-open {
    color: var(--teal-glow);
    border: 1px solid var(--teal-glow);
}

.status-classified {
    color: var(--rust-orange);
    border: 1px solid var(--rust-orange);
}

.status-closed {
    color: var(--slate);
    border: 1px solid var(--slate);
}

.case-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--parchment);
    margin-bottom: 24px;
    letter-spacing: 0.06em;
}

.case-content {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.case-log {
    color: var(--slate);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.case-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-row {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
}

.data-label {
    color: var(--lavender);
    min-width: 90px;
    font-weight: 700;
}

.data-value {
    color: var(--parchment);
}

.threat-unknown {
    color: var(--teal-glow);
}

.threat-elevated {
    color: var(--rust-orange);
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== POLAROID ===== */
.polaroid {
    width: 220px;
    flex-shrink: 0;
    background: var(--parchment);
    padding: 12px 12px 40px 12px;
    box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.4);
}

.polaroid-image {
    width: 100%;
    aspect-ratio: 4 / 5;
    filter: contrast(0.85) sepia(0.15) brightness(0.9);
}

.lighthouse-image {
    background: 
        radial-gradient(ellipse at 50% 40%, var(--parchment), var(--warm-tan)),
        linear-gradient(180deg, var(--dark-teal) 0%, var(--slate) 100%);
    position: relative;
    overflow: hidden;
}

.lighthouse-image::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 45%;
    width: 10%;
    height: 40%;
    background: linear-gradient(180deg, var(--parchment) 0%, var(--warm-tan) 60%, var(--dark-teal) 100%);
    box-shadow: 0 -20px 40px rgba(0, 229, 199, 0.3);
}

.fog-image {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(154, 172, 184, 0.6), transparent 60%),
        radial-gradient(ellipse at 70% 50%, rgba(154, 172, 184, 0.4), transparent 50%),
        linear-gradient(180deg, var(--slate) 0%, var(--warm-tan) 100%);
}

.polaroid-caption {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--dark-teal);
    text-align: center;
    margin-top: 8px;
    letter-spacing: 0.05em;
}

.case-details {
    flex: 1;
    min-width: 250px;
}

/* ===== WAVEFORM ===== */
.waveform-container {
    width: 100%;
    max-width: 400px;
    background: rgba(0, 229, 199, 0.03);
    border: 1px solid rgba(0, 229, 199, 0.1);
    padding: 12px;
    margin-bottom: 16px;
}

#waveform-canvas {
    width: 100%;
    height: 120px;
    display: block;
}

/* ===== REDACTION ===== */
.redaction-bar {
    position: absolute;
    bottom: 70px;
    left: 40px;
    right: 40px;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        var(--deep-navy),
        var(--deep-navy) 8px,
        transparent 8px,
        transparent 12px
    );
    opacity: 0.5;
}

.redacted-case {
    position: relative;
}

.redacted-text {
    filter: blur(1.5px);
    user-select: none;
    color: var(--slate);
}

.stamp-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-family: 'Inter', sans-serif;
    font-size: 4rem;
    font-weight: 700;
    color: var(--rust-orange);
    opacity: 0.3;
    letter-spacing: 0.15em;
    border: 4px solid var(--rust-orange);
    padding: 8px 24px;
    pointer-events: none;
}

/* ===== TRANSMISSIONS ===== */
.section-transmissions {
    background: var(--deep-navy);
    border-top: 1px solid rgba(0, 229, 199, 0.1);
    align-items: flex-start;
    padding: 80px 40px;
}

.section-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--teal-glow);
    letter-spacing: 0.2em;
    margin-bottom: 32px;
    font-weight: 700;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.transmission-feed {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
}

.transmission-entry {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-left: 2px solid rgba(0, 229, 199, 0.2);
    transition: border-color 0.3s, background 0.3s;
    flex-wrap: wrap;
}

.transmission-entry:hover {
    border-left-color: var(--teal-glow);
    background: rgba(0, 229, 199, 0.03);
}

.tx-time {
    color: var(--lavender);
    flex-shrink: 0;
    font-weight: 700;
}

.tx-source {
    color: var(--teal-glow);
    flex-shrink: 0;
    font-size: 0.7rem;
}

.tx-content {
    color: var(--slate);
}

.tx-corrupted {
    border-left-color: var(--rust-orange);
    opacity: 0.6;
}

.tx-corrupted .tx-content {
    color: var(--rust-orange);
}

/* ===== FOOTER ===== */
.section-footer {
    min-height: 50vh;
    background: var(--deep-navy);
    border-top: 1px solid rgba(0, 229, 199, 0.1);
}

.footer-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.footer-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: 0.15em;
}

.footer-sub {
    font-size: 0.7rem;
    color: var(--slate);
    letter-spacing: 0.1em;
}

.footer-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--teal-glow);
}

.status-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal-glow);
    box-shadow: 0 0 8px var(--teal-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}

.footer-timestamp {
    font-size: 0.7rem;
    color: var(--slate);
}

.footer-warning {
    font-size: 0.6rem;
    color: var(--rust-orange);
    letter-spacing: 0.12em;
    opacity: 0.6;
}

/* ===== SCROLL REVEAL ===== */
.case-file,
.transmission-entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.case-file.visible,
.transmission-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Preserve individual case-file rotations */
.case-file.visible {
    transform: translateY(0) rotate(var(--rot, 0deg));
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    .section { padding: 60px 20px; }
    .case-file { padding: 24px; }
    .case-content { flex-direction: column; }
    .polaroid { width: 180px; align-self: center; }
    .hud-status, .hud-signal { display: none; }
    .stamp-overlay { font-size: 2.5rem; }
}
