:root {
    --void: #080f0a;
    --surface: #0d1f12;
    --border: #1b4332;
    --primary: #2dc653;
    --secondary: #52b788;
    --muted: #74c69d;
    --ghost: #b7e4c7;
    --alert: #e09f3e;
    --font-body: "IBM Plex Mono", monospace;
    --font-heading: "Share Tech Mono", monospace;
    --font-meta: "Overpass Mono", monospace;
    --noise-opacity: 0.06;
    --ripple-duration: 1.2s;
    --ease-ripple: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--muted);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--noise-opacity);
    filter: url(#noise-filter);
    background: transparent;
    mix-blend-mode: overlay;
    transition: opacity 1s ease;
}

#noise-overlay::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-conic-gradient(var(--surface) 0%, transparent 0.0015%, transparent 0.25%, var(--surface) 0.26%) 50% 50% / 200px 200px;
    opacity: 0.4;
}

/* Navigation - Frequency Band */
#freq-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 2rem;
    background: rgba(10, 20, 12, 0.85);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-meta);
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    backdrop-filter: blur(4px);
}

.freq-label {
    color: var(--muted);
    opacity: 0.5;
    cursor: pointer;
    transition: color 0.4s var(--ease-ripple), opacity 0.4s var(--ease-ripple);
    text-transform: uppercase;
    position: relative;
}

.freq-label.active {
    color: var(--primary);
    opacity: 1;
}

.freq-label::after {
    content: "";
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 100%;
    height: 1px;
    background: var(--primary);
    transition: transform 0.6s var(--ease-ripple);
}

.freq-label.active::after {
    transform: translateX(-50%) scaleX(1);
}

.freq-indicator {
    display: none;
}

/* Sections */
.section {
    position: relative;
    overflow: hidden;
}

/* Section 1 - Signal Acquisition */
.section--signal {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
}

.ripple-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ripple-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--primary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    width: 0;
    height: 0;
}

.ripple-ring.animate {
    animation: ripple-expand 2s var(--ease-ripple) forwards;
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 120vmax;
        height: 120vmax;
        opacity: 0;
    }
}

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

.signal-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--secondary);
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
}

.signal-title.revealed {
    opacity: 1;
}

.signal-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--muted);
    letter-spacing: 0.04em;
    opacity: 0;
}

.signal-subtitle.revealed {
    opacity: 1;
}

.char-glyph {
    display: inline-block;
    transition: none;
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 2fr 5fr 3fr;
    min-height: 100%;
    gap: 0;
}

@media (max-width: 1200px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
    .data-rail {
        display: none;
    }
    .context-panel {
        display: none;
    }
}

/* Data Rail */
.data-rail {
    border-right: 1px solid var(--border);
    background: var(--void);
    overflow: hidden;
    position: relative;
    padding: 2rem 0.75rem;
}

.data-rail__inner {
    height: 100%;
    overflow: hidden;
    position: relative;
}

.data-rail__feed {
    font-family: var(--font-meta);
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--muted);
    opacity: 0.4;
    line-height: 2.2;
    white-space: nowrap;
    animation: scroll-feed 30s linear infinite;
}

@keyframes scroll-feed {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.data-rail__feed .feed-line {
    display: block;
}

/* Content Main */
.content-main {
    padding: 4rem 2rem;
}

.content-block--left {
    padding-left: 15%;
    max-width: 55ch;
}

.content-block--center {
    padding-left: 10%;
    max-width: 55ch;
}

.section-heading {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--secondary);
    margin-bottom: 2.5rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.meta-text {
    font-family: var(--font-meta);
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--muted);
    opacity: 0.6;
}

/* Context Panel */
.context-panel {
    padding: 2rem 1rem;
    border-left: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.route-svg {
    width: 100%;
    max-height: 80vh;
}

.route-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s var(--ease-ripple);
}

.route-path.drawn {
    stroke-dashoffset: 0;
}

.route-node {
    opacity: 0;
    transition: opacity 0.6s var(--ease-ripple);
}

.route-node.visible {
    opacity: 1;
    animation: node-pulse 2s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { transform-origin: center; r: 3; }
    50% { r: 4.5; }
}

/* Section 2 - Routes */
.section--routes {
    min-height: 60vh;
    background: var(--void);
}

/* Section 3 - Checkpoint */
.section--checkpoint {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
    position: relative;
}

.checkpoint-content {
    position: absolute;
    top: 35%;
    left: 60%;
    transform: translate(-50%, -50%);
}

.coordinate-text {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--muted);
    opacity: 0.6;
    letter-spacing: 0.15em;
}

.skyline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    overflow: hidden;
    opacity: 0.3;
}

.skyline-building {
    position: absolute;
    bottom: 0;
    background: var(--surface);
}

/* Section 4 - Network */
.section--network {
    min-height: 80vh;
    background: var(--void);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

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

.network-connection {
    stroke: var(--border);
    stroke-width: 0.5;
    fill: none;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s var(--ease-ripple);
}

.network-connection.drawn {
    stroke-dashoffset: 0;
}

.network-node {
    fill: var(--primary);
    opacity: 0;
    transition: opacity 0.4s var(--ease-ripple);
}

.network-node.visible {
    opacity: 1;
    animation: network-node-pulse 2.5s ease-in-out infinite;
}

.network-node.alert {
    fill: var(--alert);
}

@keyframes network-node-pulse {
    0%, 100% { r: 3; }
    50% { r: 4; }
}

.network-node-ripple {
    fill: none;
    stroke: var(--alert);
    stroke-width: 0.5;
    opacity: 0;
}

.network-node-ripple.animate {
    animation: alert-ripple 2s var(--ease-ripple) infinite;
}

@keyframes alert-ripple {
    0% { r: 3; opacity: 0.6; }
    100% { r: 30; opacity: 0; }
}

.network-label {
    font-family: var(--font-meta);
    font-size: 0.6rem;
    fill: var(--muted);
    opacity: 0.5;
    letter-spacing: 0.1em;
}

.network-data-strip {
    margin-top: 2rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    width: 100%;
    max-width: 1200px;
}

/* Section 5 - Fade */
.section--fade {
    min-height: 100vh;
    background: var(--void);
}

.fade-text {
    transition: opacity 0.8s ease, filter 0.8s ease;
}

.fade-text.dissolving {
    opacity: 0.15;
    filter: blur(2px);
}

.fade-domain {
    margin-top: 4rem;
    text-align: left;
    padding-left: 15%;
}

.fade-domain-text {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.1em;
    color: var(--secondary);
    transition: opacity 2s ease, color 2s ease;
}

.fade-domain-text.fading {
    opacity: 0.05;
    color: var(--void);
}

/* Signal Meter */
.signal-meter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.signal-bar {
    height: 2px;
    background: var(--primary);
    opacity: 0.6;
    transition: width 1s var(--ease-ripple), opacity 1s ease;
}

.signal-bar:nth-child(1) { width: 60px; }
.signal-bar:nth-child(2) { width: 48px; }
.signal-bar:nth-child(3) { width: 36px; }
.signal-bar:nth-child(4) { width: 24px; }
.signal-bar:nth-child(5) { width: 12px; }

.signal-meter.diminishing .signal-bar {
    opacity: 0.1;
    width: 4px;
}

/* Noise Pulse Animation for Checkpoint */
.section--checkpoint #noise-overlay-local {
    animation: noise-pulse 6s ease-in-out infinite;
}

@keyframes noise-pulse {
    0%, 100% { opacity: 0.04; }
    50% { opacity: 0.10; }
}

/* Section entrance animations */
.section-heading,
.body-text {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s var(--ease-ripple), transform 0.8s var(--ease-ripple);
}

.section-heading.in-view,
.body-text.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Ripple click feedback */
.click-ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--primary);
    pointer-events: none;
    animation: click-ripple-expand var(--ripple-duration) var(--ease-ripple) forwards;
}

@keyframes click-ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Selection */
::selection {
    background: var(--primary);
    color: var(--void);
}
