/* =========================================
   quirk.bar — Cold War Radar Speakeasy
   Blobitecture HUD on Parchment Substrate
   ========================================= */

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

:root {
    --sage: #7FA67D;
    --obsidian: #1A1610;
    --wheat: #BFA882;
    --walnut: #8B6F47;
    --deep-bark: #2C2416;
    --teal: #5B8A7A;
    --parchment: #E8DCC0;
    --sienna: #A0522D;
    --warm-gold: #C4A36E;
}

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--deep-bark);
    background: var(--parchment);
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* --- Parchment Substrate --- */
#parchment-substrate {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(191,168,130,0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(139,111,71,0.15) 0%, transparent 50%),
        linear-gradient(180deg, #E8DCC0 0%, #D8C8A8 50%, #E0D4B8 100%);
    background-size: cover;
}

#parchment-substrate::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 100px, rgba(139,111,71,0.03) 100px, rgba(139,111,71,0.03) 101px),
        repeating-linear-gradient(90deg, transparent, transparent 100px, rgba(139,111,71,0.03) 100px, rgba(139,111,71,0.03) 101px);
}

/* --- HUD Grid Overlay --- */
#hud-grid {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(127,166,125,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127,166,125,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* --- Circuit Traces --- */
#circuit-traces {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.trace {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: trace-draw 8s ease-in-out forwards;
}
.trace-2 { animation-delay: 1s; }
.trace-3 { animation-delay: 2s; }
.trace-4 { animation-delay: 3s; }

@keyframes trace-draw {
    to { stroke-dashoffset: 0; }
}

.node {
    animation: node-pulse 3s ease-in-out infinite;
}
.node:nth-child(2) { animation-delay: 0.5s; }
.node:nth-child(3) { animation-delay: 1s; }
.node:nth-child(4) { animation-delay: 1.5s; }

@keyframes node-pulse {
    0%, 100% { opacity: 0.2; r: 3; }
    50% { opacity: 0.8; r: 5; }
}

/* --- Sections (shared) --- */
section {
    position: relative;
    z-index: 2;
}

.section-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 5vw;
    margin-bottom: 3rem;
}

.marker-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--sage);
    white-space: nowrap;
    text-transform: uppercase;
}

.marker-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--sage), transparent);
    opacity: 0.4;
}

/* --- RADAR HERO --- */
#radar-hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.radar-container {
    position: relative;
    width: min(70vw, 500px);
    height: min(70vw, 500px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--sage);
}

.radar-ring-outer {
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.radar-ring-mid {
    width: 66%;
    height: 66%;
    opacity: 0.25;
}

.radar-ring-inner {
    width: 33%;
    height: 33%;
    opacity: 0.2;
}

.radar-sweep-line {
    position: absolute;
    width: 50%;
    height: 2px;
    top: 50%;
    left: 50%;
    transform-origin: left center;
    background: linear-gradient(90deg, var(--sage), transparent);
    animation: radar-sweep 4s linear infinite;
}

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

.radar-sweep-line::after {
    content: '';
    position: absolute;
    top: -60px;
    left: 0;
    width: 100%;
    height: 120px;
    background: conic-gradient(from -30deg at 0% 50%, rgba(127,166,125,0.15), transparent 60deg);
    transform-origin: left center;
}

.radar-blips {
    position: absolute;
    inset: 0;
}

.blip {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sage);
    animation: blip-flash 4s ease-in-out infinite;
}

.blip-1 { top: 25%; left: 60%; animation-delay: 0.5s; }
.blip-2 { top: 65%; left: 35%; animation-delay: 1.8s; }
.blip-3 { top: 40%; left: 75%; animation-delay: 3.1s; }

@keyframes blip-flash {
    0%, 80%, 100% { opacity: 0; transform: scale(0.5); }
    10%, 30% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.8); }
}

.radar-center-text {
    position: relative;
    text-align: center;
    z-index: 3;
}

.brand-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 9vw, 8rem);
    letter-spacing: -0.03em;
    color: var(--deep-bark);
    line-height: 1;
    text-shadow: 0 0 40px rgba(232,220,192,0.5);
}

.signal-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: var(--sage);
    margin-top: 1rem;
    animation: status-blink 2s step-end infinite;
}

@keyframes status-blink {
    0%, 80% { opacity: 1; }
    50%, 70% { opacity: 0; }
}

.hero-coordinates {
    position: absolute;
    bottom: 15vh;
    left: 5vw;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.coord {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: var(--walnut);
    opacity: 0.5;
    letter-spacing: 0.1em;
}

.scroll-indicator {
    position: absolute;
    bottom: 5vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: scroll-bob 2s ease-in-out infinite;
}

.scroll-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--walnut);
    opacity: 0.6;
}

.scroll-arrow {
    width: 12px;
    height: 12px;
    border-right: 1px solid var(--walnut);
    border-bottom: 1px solid var(--walnut);
    transform: rotate(45deg);
    opacity: 0.5;
}

@keyframes scroll-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- DOSSIER FRAGMENTS --- */
#dossier-fragments {
    padding: 10vh 0;
    min-height: 100vh;
}

/* --- BLOBITECTURE CONTAINERS --- */
.blob-container {
    position: relative;
    margin: 4rem auto;
    max-width: 700px;
    padding: 3rem 2.5rem;
    background: rgba(232,220,192,0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(139,111,71,0.15);
    transition: border-color 0.5s ease;
}

.blob-1 {
    border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%;
    animation: morph-1 8s ease-in-out infinite;
    margin-left: 8vw;
}

.blob-2 {
    border-radius: 55% 45% 40% 60% / 45% 55% 45% 55%;
    animation: morph-2 10s ease-in-out infinite;
    margin-right: 8vw;
    margin-left: auto;
}

.blob-3 {
    border-radius: 45% 55% 60% 40% / 60% 45% 55% 45%;
    animation: morph-3 7s ease-in-out infinite;
    margin-left: 12vw;
}

@keyframes morph-1 {
    0%, 100% { border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%; }
    25% { border-radius: 55% 45% 45% 55% / 45% 60% 40% 55%; }
    50% { border-radius: 45% 55% 60% 40% / 60% 45% 55% 45%; }
    75% { border-radius: 60% 40% 45% 55% / 40% 55% 45% 60%; }
}

@keyframes morph-2 {
    0%, 100% { border-radius: 55% 45% 40% 60% / 45% 55% 45% 55%; }
    33% { border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%; }
    66% { border-radius: 60% 40% 45% 55% / 40% 55% 45% 60%; }
}

@keyframes morph-3 {
    0%, 100% { border-radius: 45% 55% 60% 40% / 60% 45% 55% 45%; }
    25% { border-radius: 60% 40% 45% 55% / 40% 55% 45% 60%; }
    50% { border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%; }
    75% { border-radius: 55% 45% 40% 60% / 45% 55% 45% 55%; }
}

.blob-container:hover {
    border-color: rgba(127,166,125,0.4);
}

.blob-container::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(127,166,125,0.1), transparent 50%);
    pointer-events: none;
}

.dossier-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--deep-bark);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.dossier-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--walnut);
}

.highlight {
    color: var(--sienna);
    font-weight: 600;
    position: relative;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--sienna);
    opacity: 0.3;
}

.redaction-bar {
    width: 60%;
    height: 1.2rem;
    background: var(--deep-bark);
    margin: 1.2rem 0;
    opacity: 0.8;
    border-radius: 2px;
}

.caveat-text {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--sienna);
    font-style: italic;
}

.stamp-mark {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.4rem 1rem;
    border: 2px solid var(--warm-gold);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--sienna);
    transform: rotate(-3deg);
    opacity: 0.7;
}

.transmission-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    line-height: 2;
    color: var(--sage);
    background: rgba(26,22,16,0.05);
    padding: 1.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--sage);
    overflow-x: auto;
}

.transmission-text code {
    font-family: inherit;
}

/* --- SPECIMEN GRID --- */
#specimen-grid {
    padding: 10vh 0;
    min-height: 100vh;
}

.specimen-layout {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2rem;
    padding: 0 5vw;
}

.specimen-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.specimen-large {
    grid-column: 1 / 5;
    grid-row: 1 / 3;
}

.specimen-card:nth-child(2) {
    grid-column: 5 / 9;
    border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%;
    animation: morph-2 9s ease-in-out infinite;
}

.specimen-card:nth-child(3) {
    grid-column: 2 / 5;
    border-radius: 45% 55% 55% 45% / 50% 50% 50% 50%;
    animation: morph-3 11s ease-in-out infinite;
}

.specimen-card:nth-child(4) {
    grid-column: 5 / 8;
    border-radius: 55% 45% 45% 55% / 45% 55% 55% 45%;
    animation: morph-1 12s ease-in-out infinite;
}

.specimen-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--sage);
    opacity: 0.7;
}

.specimen-visual {
    width: 120px;
    height: 120px;
}

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

.specimen-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--deep-bark);
}

.specimen-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.9rem;
    color: var(--walnut);
    line-height: 1.6;
    max-width: 280px;
}

/* --- FREQUENCY LOG --- */
#frequency-log {
    padding: 10vh 0;
    min-height: 80vh;
}

.log-entries {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 5vw;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.log-entry {
    position: relative;
    padding: 2rem;
    padding-left: 3rem;
    border-left: 2px solid var(--sage);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.log-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

.log-entry::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 2rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sage);
}

.log-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--walnut);
    opacity: 0.6;
    display: block;
    margin-bottom: 0.25rem;
}

.log-freq {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: var(--sage);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.75rem;
}

.log-waveform {
    height: 40px;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.log-waveform canvas {
    width: 100%;
    height: 100%;
}

.log-message {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--walnut);
}

/* --- SIGNAL LOST --- */
#signal-lost {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--obsidian);
    overflow: hidden;
}

.static-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(232,220,192,0.03) 2px,
        rgba(232,220,192,0.03) 4px
    );
    animation: static-scroll 0.5s linear infinite;
    pointer-events: none;
}

@keyframes static-scroll {
    from { transform: translateY(0); }
    to { transform: translateY(4px); }
}

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

.signal-lost-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 8vw, 7rem);
    letter-spacing: -0.03em;
    color: var(--parchment);
    opacity: 0;
    animation: signal-fade 1s ease forwards;
    text-shadow: 0 0 60px rgba(127,166,125,0.3);
}

.signal-lost-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: var(--sage);
    margin-top: 1rem;
    opacity: 0;
    animation: signal-fade 1s ease 0.5s forwards;
}

.terminal-prompt {
    margin-top: 3rem;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: var(--sage);
    opacity: 0;
    animation: signal-fade 1s ease 1s forwards;
}

.prompt-char {
    animation: cursor-blink 1s step-end infinite;
}

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

@keyframes signal-fade {
    to { opacity: 1; }
}

/* --- Scroll Reveal Utility --- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .specimen-layout {
        grid-template-columns: 1fr;
    }

    .specimen-large,
    .specimen-card:nth-child(2),
    .specimen-card:nth-child(3),
    .specimen-card:nth-child(4) {
        grid-column: 1 / -1;
    }

    .blob-1, .blob-2, .blob-3 {
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .hero-coordinates {
        left: 5vw;
        bottom: 12vh;
    }
}
