/* ===== CSS Custom Properties ===== */
:root {
    --obsidian: #0A0A0A;
    --charcoal: #1A1A1A;
    --smoke: #2C2C2C;
    --imperial-gold: #D4A530;
    --antique-brass: #B8952A;
    --pale-gilt: #E8D5A3;
    --parchment: #F5F0E6;
    --electric-amber: #FF8C00;
    --park-green: #8B7D3C;
    --left-panel-width: 45%;
    --right-panel-width: 55%;
    --divider-width: 2px;
}

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

html {
    scroll-behavior: smooth;
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: var(--parchment);
    background: var(--obsidian);
    overflow: hidden;
    height: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Split Container ===== */
#split-container {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ===== Left Panel - The Blueprint ===== */
#left-panel {
    width: var(--left-panel-width);
    height: 100vh;
    background: var(--obsidian);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

#left-panel.collapsed {
    width: 0;
}

/* City Map */
#city-map {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 640px;
}

#city-svg {
    width: 100%;
    height: 100%;
    will-change: transform;
}

.city-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 400ms ease, transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.city-block.built {
    opacity: 1;
    transform: translateY(0);
}

.draw-line {
    transition: stroke-dashoffset 800ms ease;
}

.draw-line.drawn {
    stroke-dashoffset: 0 !important;
}

/* Window flicker animation */
.window-flicker {
    animation: flicker var(--flicker-duration, 3s) var(--flicker-delay, 0s) infinite alternate;
}

@keyframes flicker {
    0%, 40% { opacity: var(--flicker-min, 0.3); }
    50%, 100% { opacity: var(--flicker-max, 1); }
}

/* Transit-map navigation */
#transit-nav {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    z-index: 10;
}

.transit-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--imperial-gold);
    opacity: 0.4;
    z-index: -1;
}

.station {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.station-node {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--imperial-gold);
    background: transparent;
    transition: background 300ms ease, transform 300ms ease;
    flex-shrink: 0;
}

.station.active .station-node {
    background: var(--imperial-gold);
}

.station.pulse .station-node {
    animation: stationPulse 300ms ease;
}

@keyframes stationPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.station-label {
    font-family: 'Righteous', cursive;
    font-size: 14px;
    color: var(--imperial-gold);
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    opacity: 0.6;
    transition: opacity 300ms ease;
}

.station.active .station-label {
    opacity: 1;
}

/* Blueprint annotations */
#blueprint-annotations {
    position: absolute;
    left: 20px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--antique-brass);
    opacity: 0;
    transition: opacity 300ms ease;
    white-space: nowrap;
    overflow: hidden;
}

.annotation.visible {
    opacity: 1;
}

.annotation .char {
    opacity: 0;
    transition: opacity 60ms ease;
}

.annotation.visible .char {
    opacity: 1;
}

/* Vertical label */
#vertical-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-family: 'Dela Gothic One', cursive;
    font-size: 80px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--imperial-gold);
    opacity: 0.06;
    pointer-events: none;
    white-space: nowrap;
}

/* ===== Dividing Line ===== */
#dividing-line {
    width: var(--divider-width);
    height: 100vh;
    background: var(--imperial-gold);
    position: relative;
    flex-shrink: 0;
    z-index: 20;
    transition: opacity 700ms ease;
}

#dividing-line.hidden {
    opacity: 0;
}

#line-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--imperial-gold);
    box-shadow: 0 0 4px var(--imperial-gold);
    animation: lineGlow 4s ease-in-out infinite;
}

@keyframes lineGlow {
    0%, 100% { box-shadow: 0 0 0px rgba(212, 165, 48, 0.3); }
    50% { box-shadow: 0 0 8px rgba(212, 165, 48, 0.3); }
}

/* ===== Right Panel - The Showroom ===== */
#right-panel {
    width: var(--right-panel-width);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: var(--charcoal);
    scroll-snap-type: y proximity;
    transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

#right-panel.expanded {
    width: 100%;
}

/* Grid overlay */
#grid-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--right-panel-width);
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(rgba(44, 44, 44, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(44, 44, 44, 0.15) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ===== Content Sections ===== */
.content-section {
    position: relative;
    padding: 0 60px;
    scroll-snap-align: start;
    overflow: hidden;
    z-index: 2;
    background: linear-gradient(180deg, var(--charcoal), var(--obsidian));
}

.content-section[data-height="80vh"] { min-height: 80vh; }
.content-section[data-height="50vh"] { min-height: 50vh; }
.content-section[data-height="30vh"] { min-height: 30vh; }

/* Sealed bar */
.sealed-bar {
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 4px;
    background: var(--imperial-gold);
    transform: translateY(-50%);
    transition: none;
    z-index: 3;
}

.content-section.unsealing .sealed-bar {
    animation: unseal 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes unseal {
    0% {
        top: 50%;
        height: 4px;
        transform: translateY(-50%);
        left: 30px;
        right: 30px;
    }
    100% {
        top: 0;
        height: 100%;
        transform: translateY(0);
        left: 0;
        right: 0;
        background: transparent;
    }
}

/* Section content */
.section-content {
    opacity: 0;
    padding: 80px 0;
    transition: opacity 400ms ease 600ms;
}

.content-section.revealed .section-content {
    opacity: 1;
}

.content-section.revealed .sealed-bar {
    display: none;
}

.section-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(36px, 5vw, 64px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--imperial-gold);
    margin-bottom: 24px;
    line-height: 1.1;
}

.section-subtitle {
    font-family: 'Righteous', cursive;
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--pale-gilt);
    margin-bottom: 32px;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.section-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: var(--parchment);
    max-width: 560px;
    margin-bottom: 20px;
}

.section-body:last-of-type {
    margin-bottom: 0;
}

/* ===== Hero Convergence Sections ===== */
.hero-convergence {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, var(--imperial-gold), var(--obsidian) 70%);
    background-size: 200% 200%;
    background-position: center;
    position: relative;
    z-index: 5;
    scroll-snap-align: center;
    opacity: 0;
    transition: opacity 800ms ease;
}

.hero-convergence.active {
    opacity: 1;
}

.hero-content {
    text-align: center;
}

.hero-text {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(48px, 10vw, 160px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--imperial-gold);
    line-height: 0.95;
    text-shadow: 0 0 60px rgba(212, 165, 48, 0.3);
}

/* ===== Gold Particle Burst (convergence transition) ===== */
.gold-particle {
    position: fixed;
    width: 3px;
    height: 3px;
    background: var(--imperial-gold);
    border-radius: 50%;
    pointer-events: none;
    z-index: 25;
    opacity: 0;
}

.gold-particle.burst {
    animation: particleBurst 800ms ease-out forwards;
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--px, 40px), var(--py, -30px)) scale(0);
    }
}

/* ===== CTA Link ===== */
.cta-link {
    display: inline-block;
    font-family: 'Righteous', cursive;
    font-size: 18px;
    color: var(--imperial-gold);
    border: 2px solid var(--imperial-gold);
    padding: 14px 32px;
    margin-top: 32px;
    letter-spacing: 0.02em;
    transition: background 300ms ease, color 300ms ease, border-color 300ms ease;
}

.cta-link:hover {
    background: var(--electric-amber);
    color: var(--obsidian);
    border-color: var(--electric-amber);
}

/* ===== Footer Skyline ===== */
#skyline-footer {
    position: relative;
    background: var(--obsidian);
    padding-top: 0;
    padding-bottom: 20px;
    text-align: center;
    overflow: hidden;
    height: 0;
    opacity: 0;
    transition: height 500ms ease, opacity 500ms ease;
}

#skyline-footer.visible {
    height: 240px;
    opacity: 1;
}

#skyline {
    position: relative;
    width: 100%;
    height: 200px;
}

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

.win {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--imperial-gold);
    animation: windowFlicker var(--win-dur, 2.5s) var(--win-delay, 0s) infinite alternate;
}

@keyframes windowFlicker {
    0%, 30% { opacity: 0.3; }
    50%, 100% { opacity: 1; }
}

#footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--antique-brass);
    margin-top: 10px;
}

/* ===== Gold Proximity Warmth ===== */
.gold-warm {
    transition: filter 200ms ease;
}

/* ===== Scroll Velocity Glow ===== */
#line-glow.velocity-boost {
    box-shadow: 0 0 16px rgba(212, 165, 48, 0.5);
    transition: box-shadow 150ms ease;
}

/* ===== Beacon animation ===== */
#beacon.active {
    animation: beaconPulse 2s ease-in-out infinite;
}

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

/* ===== Responsive: Single Column for < 768px ===== */
@media (max-width: 768px) {
    #split-container {
        flex-direction: column;
    }

    #left-panel {
        width: 100%;
        height: 60px;
        overflow: hidden;
    }

    #left-panel.collapsed {
        width: 100%;
        height: 0;
    }

    #city-map {
        display: none;
    }

    #vertical-label {
        display: none;
    }

    #blueprint-annotations {
        display: none;
    }

    #transit-nav {
        flex-direction: row;
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        justify-content: center;
        gap: 16px;
        padding: 12px 16px;
        width: 100%;
        overflow-x: auto;
    }

    .transit-line {
        width: 100%;
        height: 2px;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
    }

    .station-label {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 11px;
    }

    #dividing-line {
        width: 100%;
        height: 2px;
    }

    #line-glow {
        width: 100%;
        height: 2px;
    }

    #right-panel {
        width: 100%;
        height: calc(100vh - 62px);
    }

    #right-panel.expanded {
        width: 100%;
    }

    #grid-overlay {
        width: 100%;
    }

    .content-section {
        padding: 0 24px;
    }

    .hero-text {
        font-size: clamp(32px, 12vw, 80px);
    }

    .section-title {
        font-size: clamp(28px, 6vw, 48px);
    }
}
