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

:root {
    --deep-bg: #0c1117;
    --aero-glass: #e8f4f8;
    --text-primary: #1a1e23;
    --text-inverted: #f0f6f9;
    --accent-green: #39d98a;
    --accent-sky: #4db8e8;
    --accent-amber: #e8a838;
    --surface-glass: rgba(232, 244, 248, 0.65);
    --border-hud: rgba(57, 217, 138, 0.3);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    color: var(--text-primary);
    background: var(--deep-bg);
    overflow-x: hidden;
}

/* === NAVIGATION === */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#main-nav.scrolled {
    background: rgba(232, 244, 248, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-logo {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-inverted);
    transition: color 0.4s ease;
}

#main-nav.scrolled .nav-logo {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(240, 246, 249, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

#main-nav.scrolled .nav-links a {
    color: rgba(26, 30, 35, 0.7);
}

.nav-links a:hover {
    color: var(--accent-green);
}

/* === SPREADS === */
.spread {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* === BACKGROUNDS === */
.aero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #4db8e8 0%, #87ceeb 30%, #b8e6c8 60%, #d4edba 100%);
    z-index: 0;
}

.cockpit-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0c1117 0%, #121a22 50%, #0c1117 100%);
    z-index: 0;
}

.scan-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(57, 217, 138, 0.03) 3px, rgba(57, 217, 138, 0.03) 4px);
    z-index: 1;
    pointer-events: none;
}

/* === HUD BRACKETS === */
.hud-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--border-hud);
    border-style: solid;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s var(--spring);
}

.hud-tl { top: 24px; left: 24px; border-width: 1px 0 0 1px; transform: translate(-10px, -10px); }
.hud-tr { top: 24px; right: 24px; border-width: 1px 1px 0 0; transform: translate(10px, -10px); }
.hud-bl { bottom: 24px; left: 24px; border-width: 0 0 1px 1px; transform: translate(-10px, 10px); }
.hud-br { bottom: 24px; right: 24px; border-width: 0 1px 1px 0; transform: translate(10px, 10px); }

.spread.in-view .hud-bracket {
    opacity: 1;
    transform: translate(0, 0);
}

/* === HUD FRAME === */
.hud-frame {
    position: relative;
}

.hud-frame::before,
.hud-frame::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--border-hud);
    border-style: solid;
    transition: all 0.6s var(--spring);
}

.hud-frame::before {
    top: -4px;
    left: -4px;
    border-width: 1px 0 0 1px;
}

.hud-frame::after {
    bottom: -4px;
    right: -4px;
    border-width: 0 1px 1px 0;
}

/* === GEAR ANIMATIONS === */
@keyframes rotateGearLarge {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes rotateGearSmall {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.gear-large {
    transform-origin: center;
    animation: rotateGearLarge 30s linear infinite;
}

.gear-medium {
    transform-origin: center;
    animation: rotateGearMedium 20s linear infinite;
}

.gear-small {
    transform-origin: center;
    animation: rotateGearSmall 12.5s linear infinite;
}

/* === COVER SPREAD === */
#cover {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gear-svg {
    position: absolute;
    width: 400px;
    height: 400px;
    bottom: 10%;
    left: 5%;
    z-index: 2;
    opacity: 0.6;
}

.cover-gauge {
    position: absolute;
    bottom: 40px;
    right: 40px;
    z-index: 10;
    text-align: center;
}

.cover-gauge svg {
    width: 120px;
    height: 120px;
}

@keyframes needleRotate {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(220deg); }
    100% { transform: rotate(0deg); }
}

.gauge-needle {
    transform-origin: 60px 60px;
    animation: needleRotate 8s ease-in-out infinite;
}

.gauge-label {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(57, 217, 138, 0.5);
    margin-top: 4px;
}

.cover-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.cover-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(3.5rem, 10vw, 8rem);
    letter-spacing: -0.02em;
    line-height: 0.95;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.cover-tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: rgba(26, 30, 35, 0.7);
    letter-spacing: 0.02em;
}

/* === TELEMETRY READOUTS === */
.telemetry {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(57, 217, 138, 0.4);
    z-index: 10;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.8s ease;
}

.telemetry.typed {
    clip-path: inset(0 0 0 0);
}

.telemetry::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 0.8em;
    background: rgba(57, 217, 138, 0.5);
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1.2s step-end infinite;
}

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

.telemetry-tl { top: 60px; left: 60px; }
.telemetry-br { bottom: 60px; right: 60px; }
.telemetry-center { bottom: 40px; left: 50%; transform: translateX(-50%); }

/* === MECHANISM SPREAD === */
.mechanism-spread {
    display: grid;
    grid-template-columns: 55fr 45fr;
    gap: 0;
    align-items: center;
    color: var(--text-inverted);
}

.mechanism-illustration {
    position: relative;
    z-index: 2;
    padding: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mechanism-svg {
    width: 100%;
    max-width: 450px;
    height: auto;
}

.hud-annotation {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
}

.annotation-line {
    display: block;
    width: 30px;
    height: 1px;
    background: rgba(57, 217, 138, 0.3);
}

.annotation-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(57, 217, 138, 0.6);
    white-space: nowrap;
}

.mechanism-text-area {
    position: relative;
    z-index: 2;
    padding: 4rem;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.mechanism-text {
    columns: 2;
    column-gap: 2rem;
    margin-bottom: 2rem;
}

.mechanism-text p {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    margin-bottom: 1rem;
}

.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.3;
    color: var(--accent-amber);
    padding: 1.5rem 0;
    margin: 1.5rem 0;
    border-left: 2px solid rgba(232, 168, 56, 0.3);
    padding-left: 1.5rem;
}

/* === GALLERY SPREAD === */
.gallery-spread {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
}

.gallery-title {
    position: relative;
    z-index: 10;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--text-primary);
    margin-bottom: 3rem;
}

.gallery-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1100px;
    width: 100%;
}

/* === GLASS PANEL === */
.glass-panel {
    background: rgba(232, 244, 248, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.glass-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.25) 0%,
        rgba(255,255,255,0.05) 50%,
        rgba(255,255,255,0.15) 100%);
    pointer-events: none;
    border-radius: inherit;
}

/* === STREAM CARDS === */
.stream-card {
    padding: 1.5rem;
}

/* Card reflection */
.stream-card::before {
    content: '';
    position: absolute;
    bottom: -40px;
    left: 10%;
    right: 10%;
    height: 40px;
    background: linear-gradient(180deg, rgba(232, 244, 248, 0.15) 0%, transparent 100%);
    filter: blur(4px);
    border-radius: 0 0 16px 16px;
    z-index: -1;
}

.card-gauge {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
}

.card-title {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(26, 30, 35, 0.7);
    margin-bottom: 1rem;
}

.card-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--accent-green);
    opacity: 0.7;
}

/* === DEEP DIVE SPREAD === */
.deep-dive-spread {
    padding: 8rem 2rem;
    color: var(--text-inverted);
}

.deep-dive-content {
    position: relative;
    z-index: 2;
    max-width: 680px;
    margin: 0 auto;
}

.deep-dive-spread .section-heading {
    margin-bottom: 2.5rem;
}

.body-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    margin-bottom: 2rem;
    color: rgba(240, 246, 249, 0.85);
}

.sub-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    margin: 3rem 0 1.5rem;
}

.full-bleed-illustration {
    margin: 3rem -4rem;
    padding: 2rem;
}

.full-bleed-illustration svg {
    width: 100%;
    height: auto;
}

.margin-line {
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: rgba(57, 217, 138, 0.1);
    z-index: 2;
}

.margin-left { left: 8%; }
.margin-right { right: 8%; }

.tick {
    width: 8px;
    height: 1px;
    background: rgba(57, 217, 138, 0.2);
    position: absolute;
    left: -3.5px;
}

.margin-left .tick:nth-child(1) { top: 10%; }
.margin-left .tick:nth-child(2) { top: 25%; }
.margin-left .tick:nth-child(3) { top: 40%; }
.margin-left .tick:nth-child(4) { top: 55%; }
.margin-left .tick:nth-child(5) { top: 70%; }
.margin-left .tick:nth-child(6) { top: 85%; }

.margin-right .tick:nth-child(1) { top: 15%; }
.margin-right .tick:nth-child(2) { top: 30%; }
.margin-right .tick:nth-child(3) { top: 45%; }
.margin-right .tick:nth-child(4) { top: 60%; }
.margin-right .tick:nth-child(5) { top: 75%; }
.margin-right .tick:nth-child(6) { top: 90%; }

.margin-gauge {
    position: absolute;
    z-index: 2;
    width: 60px;
    height: 60px;
}

.margin-gauge-1 { left: 4%; top: 30%; }
.margin-gauge-2 { right: 4%; top: 60%; }

.margin-gauge .gauge-needle {
    transform-origin: 30px 30px;
}

/* === OUTRO SPREAD === */
.outro-spread {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.compass-rose {
    position: absolute;
    z-index: 2;
    opacity: 0.4;
}

.compass-rose svg {
    width: 300px;
    height: 300px;
}

@keyframes compassRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.compass-needle {
    transform-origin: 100px 100px;
    animation: compassRotate 60s linear infinite;
}

.outro-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.outro-text {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.outro-domain {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(57, 217, 138, 0.5);
}

/* === REVEAL ANIMATIONS === */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s ease, transform 0.9s var(--spring);
}

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

.pull-quote.reveal {
    transform: translateX(15px);
}

.pull-quote.reveal.visible {
    transform: translateX(0);
}

/* Staggered card delays */
.stream-card:nth-child(1) { transition-delay: 0s; }
.stream-card:nth-child(2) { transition-delay: 0.1s; }
.stream-card:nth-child(3) { transition-delay: 0.2s; }
.stream-card:nth-child(4) { transition-delay: 0.3s; }
.stream-card:nth-child(5) { transition-delay: 0.4s; }
.stream-card:nth-child(6) { transition-delay: 0.5s; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .mechanism-spread {
        grid-template-columns: 1fr;
    }

    .mechanism-text {
        columns: 1;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
    }

    .full-bleed-illustration {
        margin: 2rem -1rem;
    }

    .margin-line,
    .margin-gauge {
        display: none;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        gap: 1rem;
    }

    .gear-svg {
        width: 250px;
        height: 250px;
    }
}
