/* xity.quest -- Y2K Chrome Urban Exploration Portal */

:root {
    --void-asphalt: #0F0C18;
    --chrome-smoke: #1E1A2E;
    --tarnished-silver: #2D2841;
    --electric-lilac: #B388FF;
    --molten-chrome: #C0C0C0;
    --neon-tangerine: #FF6D3F;
    --plasma-pink: #FF3CAC;
    --bright-frost: #E8E4F0;
    --haze-grey: #8A8498;
}

/* ============================
   RESET & BASE
   ============================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--void-asphalt);
    color: var(--bright-frost);
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================
   CHROME TEXT GRADIENT
   ============================ */

@keyframes chrome-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.chrome-text {
    background: linear-gradient(135deg, #C0C0C0 0%, #E8E4F0 25%, #8A8498 50%, #C0C0C0 75%, #E8E4F0 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: chrome-shift 4s ease-in-out infinite;
    transition: animation-duration 0.3s ease;
}

.chrome-text:hover {
    animation-duration: 2s;
    text-shadow: 0 0 20px rgba(179, 136, 255, 0.3);
    filter: drop-shadow(0 0 20px rgba(179, 136, 255, 0.3));
}

/* ============================
   GRID OVERLAY
   ============================ */

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(179, 136, 255, 0.02) 0px, rgba(179, 136, 255, 0.02) 1px, transparent 1px, transparent 80px),
        repeating-linear-gradient(90deg, rgba(179, 136, 255, 0.02) 0px, rgba(179, 136, 255, 0.02) 1px, transparent 1px, transparent 80px);
    background-attachment: fixed;
    pointer-events: none;
    z-index: 0;
}

/* ============================
   FLOATING GLYPHS
   ============================ */

@keyframes glyph-drift {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.floating-glyphs {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.glyph {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 3rem;
    color: var(--haze-grey);
    opacity: 0.04;
    animation: glyph-drift 10s ease-in-out infinite alternate;
}

/* ============================
   DISTRICT SECTIONS
   ============================ */

.district {
    position: sticky;
    top: 0;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.4);
}

.district:nth-child(1) { z-index: 7; }
.district:nth-child(2) { z-index: 6; margin-top: -40px; }
.district:nth-child(3) { z-index: 5; margin-top: -40px; }
.district:nth-child(4) { z-index: 4; margin-top: -40px; }
.district:nth-child(5) { z-index: 3; margin-top: -40px; }
.district:nth-child(6) { z-index: 2; margin-top: -40px; }
.district:nth-child(7) { z-index: 1; margin-top: -40px; }

/* ============================
   SIGNAL LOCK (District 0)
   ============================ */

.district-signal-lock {
    background-color: var(--void-asphalt);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

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

@keyframes letter-solidify {
    0% {
        opacity: 0;
        filter: blur(8px);
        transform: translateY(10px) scaleY(0.8);
    }
    60% {
        opacity: 0.7;
        filter: blur(2px);
        transform: translateY(-2px) scaleY(1.02);
    }
    100% {
        opacity: 1;
        filter: blur(0px);
        transform: translateY(0) scaleY(1);
    }
}

.signal-lock-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    display: inline-block;
}

.signal-lock-title .letter {
    display: inline-block;
    background: linear-gradient(135deg, #C0C0C0 0%, #E8E4F0 25%, #8A8498 50%, #C0C0C0 75%, #E8E4F0 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: chrome-shift 4s ease-in-out infinite, letter-solidify 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--delay, 0s);
    opacity: 0;
}

.signal-lock-title .letter:nth-child(1) { animation-delay: 0s, 0s; }
.signal-lock-title .letter:nth-child(2) { animation-delay: 0s, 0.24s; }
.signal-lock-title .letter:nth-child(3) { animation-delay: 0s, 0.48s; }
.signal-lock-title .letter:nth-child(4) { animation-delay: 0s, 0.72s; }
.signal-lock-title .letter:nth-child(5) { animation-delay: 0s, 0.96s; }
.signal-lock-title .letter:nth-child(6) { animation-delay: 0s, 1.2s; }
.signal-lock-title .letter:nth-child(7) { animation-delay: 0s, 1.44s; }
.signal-lock-title .letter:nth-child(8) { animation-delay: 0s, 1.68s; }
.signal-lock-title .letter:nth-child(9) { animation-delay: 0s, 1.92s; }
.signal-lock-title .letter:nth-child(10) { animation-delay: 0s, 2.16s; }

.signal-lock-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--bright-frost);
    margin-top: 1.5rem;
    opacity: 0;
    animation: fade-in 0.8s ease forwards;
    animation-delay: 3s;
    letter-spacing: 0.04em;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   DISTRICT CONTENT
   ============================ */

.district-neon {
    background-color: var(--chrome-smoke);
}

.district-chrome-market {
    background-color: var(--void-asphalt);
}

.district-void-transit {
    background-color: #161229;
}

.district-plasma-gardens {
    background-color: var(--chrome-smoke);
}

.district-archive {
    background-color: #120F1F;
}

.district-content {
    width: 100%;
    padding: 0 8vw;
    z-index: 2;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4rem;
}

.district-header {
    flex: 0 0 auto;
    padding-top: 12vh;
    align-self: flex-start;
}

.district-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    /* Scroll animation - initial state */
    transform: translateX(-60px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}

.district.in-view .district-name {
    transform: translateX(0);
    opacity: 1;
}

.district-code {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--electric-lilac);
    display: block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    transition: width 1s steps(30, end);
}

.district.in-view .district-code {
    width: 100%;
}

.district-body {
    flex: 0 1 560px;
    align-self: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: 0.4s;
}

.district.in-view .district-body {
    opacity: 1;
    transform: translateY(0);
}

.district-body p {
    max-width: 560px;
    color: var(--bright-frost);
    border-top: 1px solid var(--molten-chrome);
    border-bottom: 1px solid var(--molten-chrome);
    padding: 2rem 0;
    position: relative;
    transition: border-color 0.3s ease;
}

.district-body p::before,
.district-body p::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--molten-chrome);
    transition: background-color 0.3s ease;
}

.district-body p::before { top: 5px; }
.district-body p::after { bottom: 5px; }

.district-body p:hover {
    border-color: var(--electric-lilac);
}

.district-body p:hover::before,
.district-body p:hover::after {
    background-color: var(--electric-lilac);
}

/* ============================
   MAGAZINE SPREAD LAYOUT
   ============================ */

.magazine-spread {
    width: 100%;
    padding: 0 8vw;
    z-index: 2;
    position: relative;
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: 1fr 1fr;
    gap: 1.5rem;
    min-height: 60vh;
    align-content: center;
}

.magazine-left {
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 3rem;
}

.magazine-left .district-name {
    font-size: clamp(2.5rem, 6vw, 5rem);
}

.magazine-left .district-code {
    margin-top: 0.5rem;
}

.magazine-right-top,
.magazine-right-bottom {
    display: flex;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(45, 40, 65, 0.6) 0%, rgba(30, 26, 46, 0.8) 100%);
    border-top: 1px solid var(--molten-chrome);
    border-bottom: 1px solid var(--molten-chrome);
    position: relative;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease, transform 0.8s ease, border-color 0.3s ease;
}

.magazine-right-top { transition-delay: 0.3s; }
.magazine-right-bottom { transition-delay: 0.5s; }

.district.in-view .magazine-right-top,
.district.in-view .magazine-right-bottom {
    opacity: 1;
    transform: translateX(0);
}

.magazine-right-top::before,
.magazine-right-top::after,
.magazine-right-bottom::before,
.magazine-right-bottom::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--molten-chrome);
    transition: background-color 0.3s ease;
}

.magazine-right-top::before,
.magazine-right-bottom::before { top: 5px; }
.magazine-right-top::after,
.magazine-right-bottom::after { bottom: 5px; }

.magazine-right-top:hover,
.magazine-right-bottom:hover {
    border-color: var(--electric-lilac);
}

.magazine-right-top:hover::before,
.magazine-right-top:hover::after,
.magazine-right-bottom:hover::before,
.magazine-right-bottom:hover::after {
    background-color: var(--electric-lilac);
}

.magazine-right-top {
    background: linear-gradient(135deg, rgba(45, 40, 65, 0.5) 0%, rgba(30, 26, 46, 0.7) 100%);
}

.magazine-right-bottom {
    background: linear-gradient(135deg, rgba(30, 26, 46, 0.7) 0%, rgba(15, 12, 24, 0.8) 100%);
}

.magazine-right-top p,
.magazine-right-bottom p {
    color: var(--bright-frost);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

/* ============================
   CHROME SPHERES
   ============================ */

.chrome-sphere {
    position: absolute;
    border-radius: 50%;
    z-index: 1;
    transform: scale(0.7);
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease, filter 0.4s ease;
}

.district.in-view .chrome-sphere {
    transform: scale(1);
    opacity: 1;
}

.chrome-sphere:hover {
    filter: blur(2px) brightness(1.2);
    transform: scale(1.05);
}

.sphere-signal {
    width: 280px;
    height: 280px;
    right: 10vw;
    bottom: 15vh;
    background: radial-gradient(circle at 35% 35%, #E8E4F0 0%, #C0C0C0 20%, #B388FF 45%, #8A8498 65%, #2D2841 90%);
}

.sphere-neon {
    width: 320px;
    height: 320px;
    right: 6vw;
    top: 15vh;
    background: radial-gradient(circle at 30% 30%, #E8E4F0 0%, #C0C0C0 18%, #B388FF 40%, #8A8498 60%, #1E1A2E 88%);
}

.sphere-market {
    width: 240px;
    height: 240px;
    left: 5vw;
    bottom: 12vh;
    background: radial-gradient(circle at 35% 30%, #E8E4F0 0%, #C0C0C0 15%, #FF6D3F 42%, #8A8498 62%, #0F0C18 90%);
}

.sphere-transit {
    width: 360px;
    height: 360px;
    left: 8vw;
    bottom: 10vh;
    background: radial-gradient(circle at 32% 32%, #E8E4F0 0%, #C0C0C0 18%, #FF3CAC 44%, #8A8498 65%, #161229 92%);
}

.sphere-gardens {
    width: 300px;
    height: 300px;
    right: 8vw;
    bottom: 15vh;
    background: radial-gradient(circle at 38% 28%, #E8E4F0 0%, #C0C0C0 16%, #FF6D3F 35%, #B388FF 55%, #1E1A2E 88%);
}

.sphere-archive {
    width: 260px;
    height: 260px;
    left: 12vw;
    top: 18vh;
    background: radial-gradient(circle at 30% 35%, #E8E4F0 0%, #8A8498 22%, #C0C0C0 45%, #2D2841 70%, #0F0C18 95%);
}

/* ============================
   SIGNAL LOST (District 6)
   ============================ */

.district-signal-lost {
    background-color: var(--void-asphalt);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1;
}

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

.signal-lost-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    display: inline-block;
}

@keyframes letter-dissolve {
    0% {
        opacity: 1;
        filter: blur(0px);
    }
    70% {
        opacity: 0.3;
        filter: blur(4px);
    }
    100% {
        opacity: 0;
        filter: blur(10px);
    }
}

@keyframes chrome-shift-reverse {
    0% { background-position: 100% 50%; }
    50% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.signal-lost-title .letter-lost {
    display: inline-block;
    background: linear-gradient(135deg, #C0C0C0 0%, #E8E4F0 25%, #8A8498 50%, #C0C0C0 75%, #E8E4F0 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: chrome-shift-reverse 4s ease-in-out infinite;
    opacity: 1;
    transition: opacity 0.6s ease, filter 0.6s ease;
}

.district-signal-lost.in-view .letter-lost {
    animation: chrome-shift-reverse 4s ease-in-out infinite, letter-dissolve 1.5s ease forwards;
}

.district-signal-lost.in-view .letter-lost:nth-child(10) { animation-delay: 0s, 0.3s; }
.district-signal-lost.in-view .letter-lost:nth-child(9) { animation-delay: 0s, 0.45s; }
.district-signal-lost.in-view .letter-lost:nth-child(8) { animation-delay: 0s, 0.6s; }
.district-signal-lost.in-view .letter-lost:nth-child(7) { animation-delay: 0s, 0.75s; }
.district-signal-lost.in-view .letter-lost:nth-child(6) { animation-delay: 0s, 0.9s; }
.district-signal-lost.in-view .letter-lost:nth-child(5) { animation-delay: 0s, 1.05s; }
.district-signal-lost.in-view .letter-lost:nth-child(4) { animation-delay: 0s, 1.2s; }
.district-signal-lost.in-view .letter-lost:nth-child(3) { animation-delay: 0s, 1.35s; }
.district-signal-lost.in-view .letter-lost:nth-child(2) { animation-delay: 0s, 1.5s; }
.district-signal-lost.in-view .letter-lost:nth-child(1) { animation-delay: 0s, 1.65s; }

.signal-lost-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--bright-frost);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease;
    transition-delay: 0.5s;
    letter-spacing: 0.04em;
}

.district-signal-lost.in-view .signal-lost-subtitle {
    opacity: 1;
}

/* ============================
   DISTRICT PROGRESS PIPS
   ============================ */

.district-pips {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 100;
    padding: 16px 0;
}

.pip-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background-color: var(--tarnished-silver);
}

.pip {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--haze-grey);
    position: relative;
    z-index: 1;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

@keyframes pip-pulse {
    0%, 100% {
        box-shadow: 0 0 12px var(--plasma-pink), 0 0 24px rgba(255, 60, 172, 0.3);
    }
    50% {
        box-shadow: 0 0 18px var(--plasma-pink), 0 0 36px rgba(255, 60, 172, 0.5);
    }
}

.pip.active {
    background-color: var(--plasma-pink);
    animation: pip-pulse 1.5s ease-in-out infinite;
}

/* ============================
   TICKER BAR
   ============================ */

.ticker-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(18, 15, 25, 0.85);
    border-top: 1px solid var(--electric-lilac);
    z-index: 200;
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: background 0.3s ease;
}

.ticker-bar:hover {
    background: rgba(18, 15, 25, 0.95);
}

.ticker-bar:hover .ticker-content {
    animation-play-state: paused;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.ticker-content {
    display: flex;
    white-space: nowrap;
    animation: marquee 40s linear infinite;
}

.ticker-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--electric-lilac);
    padding: 0 3rem;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 900px) {
    .district-content {
        flex-direction: column;
        gap: 2rem;
        padding: 0 6vw;
    }

    .district-header {
        padding-top: 8vh;
    }

    .district-body {
        flex: 1 1 auto;
    }

    .magazine-spread {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        padding: 0 6vw;
    }

    .magazine-left {
        grid-row: 1;
        padding-right: 0;
        padding-top: 8vh;
    }

    .chrome-sphere {
        display: none;
    }

    .district-pips {
        display: none;
    }

    .sphere-signal,
    .sphere-neon,
    .sphere-market,
    .sphere-transit,
    .sphere-gardens,
    .sphere-archive {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 600px) {
    .signal-lock-title,
    .signal-lost-title {
        font-size: clamp(2.5rem, 14vw, 5rem);
    }

    .magazine-right-top,
    .magazine-right-bottom {
        padding: 1.5rem;
    }
}
