/* p9.rs - Dopamine Nocturnal Urbanism */

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

:root {
    --midnight-abyss: #0a1628;
    --indigo-depth: #1a0a2e;
    --navy-fathom: #0d2847;
    --electric-tangerine: #ff6b35;
    --vivid-magenta: #e040fb;
    --liquid-gold: #d4a853;
    --warm-parchment: #e8dcc8;
    --steel-blue-gray: #a8b4c4;
    --antiqued-gold: #c8b8a0;
    --champagne-fizz: #f5e6c8;
    --mid-navy: #122040;
    --light-navy: #1a2a4a;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--midnight-abyss);
    color: var(--steel-blue-gray);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* Bubble Canvas */
#bubble-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Sections Base */
.section {
    position: relative;
    z-index: 1;
}

.section-inner {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

/* Typography */
.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--electric-tangerine);
    opacity: 0.7;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 1.5rem;
}

.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.75rem, 4vw, 3rem);
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

.section-heading.accent {
    color: var(--electric-tangerine);
}

.section-heading.secondary {
    color: var(--antiqued-gold);
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: var(--steel-blue-gray);
    line-height: 1.75;
    max-width: 42ch;
    margin-bottom: 1.5rem;
}

/* ========== HERO ========== */
#hero {
    height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(170deg, #0a1628 0%, #1a0a2e 60%, #0d2847 100%);
}

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

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--warm-parchment);
    letter-spacing: 0.08em;
    line-height: 0.9;
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 0 0 80px rgba(232, 220, 200, 0.15), 0 0 160px rgba(212, 168, 83, 0.08);
}

@keyframes heroFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tagline {
    position: relative;
    height: 2em;
    margin-top: 1.5rem;
    opacity: 0;
    animation: heroFadeIn 1.5s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tagline-item {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: var(--antiqued-gold);
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 0.8s ease;
    white-space: nowrap;
}

.tagline-item.active {
    opacity: 1;
}

/* ========== SIGNAL SECTION ========== */
.diagonal-section {
    background: var(--indigo-depth);
    clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
    padding: 4rem 0;
    margin-top: -5vw;
}

.diagonal-section .section-inner {
    display: flex;
    gap: 4rem;
    align-items: center;
    padding: 8rem 2rem;
}

.signal-content {
    flex: 0 0 45%;
}

.signal-skyline {
    flex: 1;
    position: relative;
    transform: translateY(calc(var(--parallax, 0) * -0.3px));
    transition: transform 0.1s linear;
}

.skyline-svg {
    width: 100%;
    height: auto;
    opacity: 0.7;
}

.window-glow {
    animation: windowPulse 3s ease-in-out infinite alternate;
}

.window-glow:nth-child(even) {
    animation-delay: -1.5s;
}

@keyframes windowPulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.9; }
}

.edge-pulse {
    animation: edgePulse 4s ease-in-out infinite alternate;
}

@keyframes edgePulse {
    0% { opacity: 0.1; stroke-width: 0.3; }
    100% { opacity: 0.5; stroke-width: 0.8; }
}

.diagonal-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--liquid-gold);
    opacity: 0;
    z-index: 3;
}

.diagonal-line-bottom {
    bottom: 0;
    transform: rotate(-6deg);
    transform-origin: left center;
}

.diagonal-line-top {
    top: 0;
    transform: rotate(6deg);
    transform-origin: left center;
}

.diagonal-line.visible {
    animation: drawLine 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes drawLine {
    0% {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
    }
    100% {
        opacity: 0.4;
        clip-path: inset(0 0 0 0);
    }
}

/* ========== FREQUENCY SECTION ========== */
.reverse-diagonal-section {
    background: var(--navy-fathom);
    clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 92%);
    padding: 4rem 0;
    margin-top: -5vw;
}

.reverse-diagonal-section .section-inner {
    padding: 8rem 2rem;
    text-align: center;
}

.section-heading-elastic {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--electric-tangerine);
    letter-spacing: 0.5em;
    margin-bottom: 3rem;
    transition: letter-spacing 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.section-heading-elastic.snapped {
    letter-spacing: 0.04em;
}

.frequency-content {
    max-width: 600px;
    margin: 0 auto;
}

.frequency-content .body-text {
    max-width: 100%;
    text-align: center;
}

/* ========== DISTRICT SECTION ========== */
.diagonal-section-alt {
    background: var(--midnight-abyss);
    clip-path: polygon(0 6%, 100% 0, 100% 94%, 0 100%);
    padding: 4rem 0;
    min-height: 80vh;
    margin-top: -5vw;
}

.diagonal-section-alt .section-inner {
    padding: 8rem 2rem;
    text-align: center;
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-width: 800px;
    margin: 2rem auto 0;
}

.grid-cell {
    background: var(--cell-bg, #0d2847);
    aspect-ratio: 1.2;
    border: 1px solid rgba(168, 180, 196, 0.05);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.grid-cell:hover {
    transform: scale(1.08);
    background-color: var(--electric-tangerine) !important;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
    z-index: 2;
}

.grid-cell.wide {
    grid-column: span 2;
}

.grid-cell.tall {
    grid-row: span 2;
}

/* ========== DEPTH SECTION ========== */
.depth-section {
    background: var(--indigo-depth);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.depth-inner {
    text-align: center;
    padding: 6rem 2rem;
}

.depth-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--steel-blue-gray);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.5;
}

.depth-bar {
    color: var(--electric-tangerine);
    opacity: 0.6;
    animation: depthPulse 2s ease-in-out infinite;
}

@keyframes depthPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ========== RESONANCE SECTION ========== */
.final-diagonal-section {
    background: linear-gradient(170deg, #0d2847, #0a1628);
    clip-path: polygon(0 0, 100% 10%, 100% 100%, 0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -5vw;
}

.resonance-inner {
    text-align: center;
    padding: 8rem 2rem;
}

.resonance-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--warm-parchment);
    letter-spacing: 0.08em;
    line-height: 0.9;
    position: relative;
    text-shadow:
        0 0 80px rgba(232, 220, 200, 0.15);
}

.resonance-title.aberration {
    text-shadow:
        calc(var(--aberration, 0) * -1px) 0 0 var(--electric-tangerine),
        calc(var(--aberration, 0) * 1px) 0 0 var(--vivid-magenta),
        0 0 80px rgba(232, 220, 200, 0.15);
}

.resonance-domain {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--antiqued-gold);
    letter-spacing: 0.3em;
    margin-top: 2rem;
    opacity: 0.8;
}

.final-gold-line {
    width: 0;
    height: 1px;
    background: var(--liquid-gold);
    margin: 4rem auto 0;
    opacity: 0;
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.final-gold-line.visible {
    width: 200px;
    opacity: 0.5;
}

/* ========== SCROLL REVEAL ========== */
.reveal-element {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .diagonal-section .section-inner {
        flex-direction: column;
        gap: 2rem;
    }

    .signal-content {
        flex: none;
    }

    .city-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .hero-title,
    .resonance-title {
        font-size: clamp(4rem, 20vw, 8rem);
    }

    .section-heading-elastic {
        font-size: clamp(1.8rem, 5vw, 3rem);
        letter-spacing: 0.3em;
    }

    .section-inner {
        padding: 4rem 1.5rem;
    }
}
