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

:root {
    --ice-blue: #c8d7eb;
    --cyan: #52b4e6;
    --slate: #6a7d9b;
    --gold: #d4a853;
    --deep-navy: #10182e;
    --purple: #8b6cc4;
    --red: #c4463a;
    --abyss: #080c18;

    --font-display: 'Libre Baskerville', Georgia, serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--abyss);
    color: var(--ice-blue);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === FOG OVERLAY === */
#fog-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: radial-gradient(ellipse at center, rgba(8,12,24,0.85), rgba(8,12,24,0.98));
    backdrop-filter: blur(20px);
    pointer-events: none;
    transition: opacity 3s ease-out, backdrop-filter 3s ease-out;
}

#fog-overlay.cleared {
    opacity: 0;
    backdrop-filter: blur(0px);
}

/* === HUD FRAME === */
#hud-frame {
    position: fixed;
    inset: 12px;
    z-index: 999;
    pointer-events: none;
    border: 1px solid rgba(82, 180, 230, 0.08);
}

.hud-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: rgba(82, 180, 230, 0.3);
    border-style: solid;
}

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

.hud-status {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: rgba(16, 24, 46, 0.7);
    border: 1px solid rgba(82, 180, 230, 0.12);
    border-top: none;
}

.hud-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 300;
    color: var(--cyan);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hud-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cyan);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; box-shadow: 0 0 6px var(--cyan); }
}

/* === HERO === */
#hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#constellation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

#hero-content h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: var(--ice-blue);
}

#hero-content h1 .accent {
    color: var(--cyan);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 2vw, 1.25rem);
    color: var(--slate);
    margin-top: 1rem;
    letter-spacing: 0.02em;
}

.hero-hash {
    margin-top: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(16, 24, 46, 0.6);
    border: 1px solid rgba(82, 180, 230, 0.15);
    border-radius: 4px;
}

.hero-hash .mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--slate);
}

.hero-hash .hash-value {
    color: var(--cyan);
    opacity: 0.7;
}

.mono {
    font-family: var(--font-mono);
}

/* === MODULE GRID === */
#module-grid {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    column-gap: 2vw;
    row-gap: 3vh;
}

#connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* === GLASS MODULES === */
.glass-module {
    position: relative;
    z-index: 1;
    background: rgba(16, 24, 46, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(200, 215, 235, 0.08);
    border-radius: 8px;
    padding: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out, border-color 0.3s;
}

.glass-module.revealed {
    opacity: 1;
    transform: translateY(0);
}

.glass-module:hover {
    border-color: rgba(82, 180, 230, 0.2);
}

/* Module grid placement */
.module-1 { grid-column: 1 / 5; }
.module-2 { grid-column: 5 / 9; }
.module-3 { grid-column: 1 / 6; }
.module-4 { grid-column: 6 / 9; }
.module-5 { grid-column: 1 / 4; }
.module-6 { grid-column: 4 / 9; }
.module-7 { grid-column: 1 / 5; }
.module-8 { grid-column: 5 / 9; }

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.module-index {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--slate);
    letter-spacing: 0.1em;
}

.module-status-light {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    opacity: 0.5;
    animation: pulse-dot 3s ease-in-out infinite;
}

.glass-module h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--ice-blue);
    margin-bottom: 1rem;
}

.glass-module p {
    font-size: 0.95rem;
    color: rgba(200, 215, 235, 0.75);
    line-height: 1.7;
}

.glass-module strong {
    color: var(--ice-blue);
    font-weight: 500;
}

.glass-module code {
    background: rgba(82, 180, 230, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--cyan);
}

.module-meta {
    margin-top: 1.2rem;
    font-size: 0.7rem;
    color: var(--slate);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* === VULNERABILITY TICKER === */
.vuln-ticker {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ticker-item {
    font-size: 0.75rem;
    color: var(--slate);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.severity {
    font-size: 0.6rem;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.severity.high {
    background: rgba(196, 70, 58, 0.2);
    color: var(--red);
    border: 1px solid rgba(196, 70, 58, 0.3);
}

.severity.medium {
    background: rgba(212, 168, 83, 0.15);
    color: var(--gold);
    border: 1px solid rgba(212, 168, 83, 0.25);
}

/* === DEPENDENCY TREE === */
.tree-visualization {
    margin-top: 1rem;
}

.tree-node {
    position: relative;
    padding-left: 1.5rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(82, 180, 230, 0.15);
}

.tree-node::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1rem;
    height: 1px;
    background: rgba(82, 180, 230, 0.15);
}

.tree-node.root {
    padding-left: 0;
}

.tree-node.root::before,
.tree-node.root::after {
    display: none;
}

.tree-node span {
    font-size: 0.8rem;
    color: var(--cyan);
    background: rgba(82, 180, 230, 0.06);
    padding: 0.2em 0.6em;
    border-radius: 3px;
    border: 1px solid rgba(82, 180, 230, 0.1);
    display: inline-block;
    transition: background 0.3s, border-color 0.3s;
}

.tree-node span:hover {
    background: rgba(82, 180, 230, 0.12);
    border-color: rgba(82, 180, 230, 0.3);
}

.tree-node.leaf span {
    color: var(--slate);
    border-color: rgba(106, 125, 155, 0.15);
    background: rgba(106, 125, 155, 0.05);
}

.tree-branch {
    margin-left: 0.5rem;
}

/* === FORMAT CARDS === */
.format-cards {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.format-card {
    padding: 1rem;
    background: rgba(8, 12, 24, 0.5);
    border: 1px solid rgba(200, 215, 235, 0.06);
    border-radius: 6px;
    transition: border-color 0.3s;
}

.format-card:hover {
    border-color: rgba(139, 108, 196, 0.25);
}

.format-card h3 {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--purple);
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.format-card p {
    font-size: 0.82rem;
    line-height: 1.55;
}

/* === TIMELINE === */
.timeline {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: rgba(200, 215, 235, 0.7);
}

.timeline-year {
    font-size: 0.75rem;
    color: var(--gold);
    min-width: 3.5rem;
    letter-spacing: 0.05em;
}

/* === CODE BLOCK === */
.code-block {
    margin-top: 1rem;
    background: rgba(8, 12, 24, 0.7);
    border: 1px solid rgba(200, 215, 235, 0.06);
    border-radius: 8px;
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    background: rgba(16, 24, 46, 0.6);
    font-size: 0.7rem;
    color: var(--slate);
    letter-spacing: 0.05em;
}

.code-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.code-dot.red { background: var(--red); opacity: 0.7; }
.code-dot.yellow { background: var(--gold); opacity: 0.7; }
.code-dot.green { background: #4a9; opacity: 0.7; }

.code-block pre {
    padding: 1rem;
    font-size: 0.78rem;
    line-height: 1.8;
    color: var(--ice-blue);
    overflow-x: auto;
}

.code-block code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* === LIVING GRAPH CANVAS === */
#living-graph {
    width: 100%;
    height: 200px;
    margin-top: 1rem;
    border-radius: 6px;
    background: rgba(8, 12, 24, 0.4);
    border: 1px solid rgba(200, 215, 235, 0.05);
}

/* === CTA / SCAN INPUT === */
.cta-area {
    margin-top: 1.5rem;
}

.scan-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: rgba(8, 12, 24, 0.6);
    border: 1px solid rgba(82, 180, 230, 0.15);
    border-radius: 6px;
}

.prompt-char {
    color: var(--cyan);
    font-size: 0.85rem;
}

#scan-input {
    background: none;
    border: none;
    outline: none;
    color: var(--ice-blue);
    font-size: 0.85rem;
    flex: 1;
}

#scan-input::placeholder {
    color: var(--slate);
    opacity: 0.5;
}

.cursor-blink {
    color: var(--cyan);
    animation: blink 1s step-end infinite;
}

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

.attestation {
    margin-top: 0.8rem;
    font-size: 0.72rem;
    color: var(--gold);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1s ease;
}

.attestation.visible {
    opacity: 1;
}

/* === FOOTER === */
#observatory-footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid rgba(200, 215, 235, 0.05);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: var(--slate);
    letter-spacing: 0.06em;
}

.footer-hash {
    opacity: 0.5;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #module-grid {
        display: flex;
        flex-direction: column;
        padding: 2rem 1rem 4rem;
        gap: 1.5rem;
    }

    .glass-module {
        padding: 1.5rem;
    }

    #hud-frame {
        display: none;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
}
