/* =========================================
   npc.quest — styles.css
   Vaporwave pastoral · Chrome metropolis
   ========================================= */

/* --- CSS Custom Properties --- */
:root {
    --chrome-sky: #C0C0D0;
    --rose-horizon: #E8507A;
    --deep-chrome: #1A1028;
    --mercurial: #8E8EA0;
    --plasma-gold: #D4A853;
    --cloud-white: #F0EFF4;
    --neon-blush: #FF6B9D;
    --abyssal: #0D0818;
    --scroll-progress: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: var(--deep-chrome);
    background: var(--chrome-sky);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- HERO SECTION (The Skyline) --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #C0C0D0 0%, #E8507A 35%, #D4A853 55%, #1A1028 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Rain overlay */
.rain-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        transparent,
        transparent 98%,
        rgba(192,192,208,0.15) 98%,
        rgba(192,192,208,0.15) 100%
    );
    background-size: 3px 160px;
    animation: rain-fall 2.5s linear infinite;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

@keyframes rain-fall {
    from { background-position: 0 -160px; }
    to { background-position: 0 160px; }
}

/* Chrome reflections background */
.chrome-reflections {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            transparent 47px,
            rgba(192,192,208,0.06) 47px,
            rgba(192,192,208,0.06) 48px,
            transparent 48px,
            transparent 123px,
            rgba(240,239,244,0.04) 123px,
            rgba(240,239,244,0.04) 125px,
            transparent 125px,
            transparent 201px,
            rgba(192,192,208,0.08) 201px,
            rgba(192,192,208,0.08) 202px
        );
    pointer-events: none;
    z-index: 0;
}

/* Hero Title — Kinetic Typography */
.hero-title {
    position: relative;
    z-index: 2;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 100;
    font-size: clamp(5rem, 14vw, 12rem);
    letter-spacing: 0.15em;
    color: var(--cloud-white);
    text-shadow: 0 0 60px rgba(232,80,122,0.3), 0 0 120px rgba(212,168,83,0.15);
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    animation: assemble 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               breathe 6s ease-in-out 2.2s infinite;
    animation-delay: calc(0.2s + var(--i) * 0.18s), calc(2.2s + var(--i) * 0.05s);
}

/* Each character starts from a unique scattered position */
.hero-title .char:nth-child(1) { --tx: -40vw; --ty: -30vh; --tr: -45deg; }
.hero-title .char:nth-child(2) { --tx: 35vw; --ty: 25vh; --tr: 30deg; }
.hero-title .char:nth-child(3) { --tx: -20vw; --ty: 40vh; --tr: -60deg; }
.hero-title .char:nth-child(4) { --tx: 50vw; --ty: -20vh; --tr: 90deg; }
.hero-title .char:nth-child(5) { --tx: -45vw; --ty: -35vh; --tr: 25deg; }
.hero-title .char:nth-child(6) { --tx: 30vw; --ty: 45vh; --tr: -35deg; }
.hero-title .char:nth-child(7) { --tx: -35vw; --ty: 20vh; --tr: 50deg; }
.hero-title .char:nth-child(8) { --tx: 25vw; --ty: -40vh; --tr: -70deg; }
.hero-title .char:nth-child(9) { --tx: -15vw; --ty: -45vh; --tr: 40deg; }

@keyframes assemble {
    0% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(var(--tr));
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

/* Hero subtitle */
.hero-subtitle {
    position: relative;
    z-index: 2;
    margin-top: 2rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    line-height: 1.85;
    color: rgba(240,239,244,0.7);
    text-align: center;
    max-width: 40ch;
    opacity: 0;
    animation: fade-in 2s ease 2.5s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* --- NEON SIGNS --- */
.neon-sign {
    position: absolute;
    z-index: 3;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--neon-blush);
    text-shadow:
        0 0 7px rgba(255,107,157,0.8),
        0 0 20px rgba(255,107,157,0.5),
        0 0 40px rgba(232,80,122,0.3),
        0 0 80px rgba(232,80,122,0.15);
    opacity: 0.7;
    animation: neon-flicker 4s ease-in-out infinite alternate;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 0.7; }
    30% { opacity: 0.5; }
    50% { opacity: 0.75; }
    70% { opacity: 0.6; }
}

/* --- WIRE DIVIDER --- */
.wire-divider {
    position: relative;
    width: 100%;
    height: 80px;
    background: transparent;
    overflow: hidden;
}

.wire-divider svg {
    width: 100%;
    height: 100%;
}

.wire-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease;
}

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

/* --- THE DESCENT (Narrative Scroll Zone) --- */
.descent {
    position: relative;
    width: 100%;
    min-height: 300vh;
    background: linear-gradient(180deg, var(--deep-chrome) 0%, #15102a 30%, #120e24 60%, var(--abyssal) 100%);
    overflow: hidden;
    padding: 10vh 0;
}

/* Chrome Panel Glass */
.chrome-panel {
    position: absolute;
    width: clamp(280px, 35vw, 420px);
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, rgba(192,192,208,0.12), rgba(142,142,160,0.06));
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(192,192,208,0.2);
    box-shadow: 0 8px 32px rgba(13,8,24,0.3), inset 0 1px 0 rgba(240,239,244,0.1);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 1s ease, transform 1s ease;
}

.chrome-panel.visible {
    opacity: 1;
}

.panel-story {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    line-height: 1.85;
    color: var(--cloud-white);
}

.panel-story em {
    font-weight: 400;
    font-style: italic;
    color: var(--rose-horizon);
}

.panel-label {
    display: block;
    margin-top: 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--mercurial);
}

/* --- THE STREET LEVEL --- */
.street-level {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--abyssal) 0%, #080512 50%, var(--abyssal) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10vh 2rem;
}

/* Thought Bubbles */
.thought-bubble {
    position: absolute;
    bottom: -60px;
    left: var(--x);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(192,192,208,0.15), rgba(142,142,160,0.08));
    border: 1px solid rgba(192,192,208,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(240,239,244,0.5);
    animation: float-up 15s linear var(--delay) infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes float-up {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
        transform: translateY(-10vh) scale(1);
    }
    80% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-110vh) scale(0.3);
        opacity: 0;
    }
}

/* Street Quote — Kinetic type */
.street-quote {
    position: relative;
    z-index: 2;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.05em;
    color: var(--cloud-white);
    text-align: center;
    max-width: 18ch;
    line-height: 1.3;
    margin-bottom: 6vh;
}

.quote-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.quote-char.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Input Pool */
.input-pool {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.input-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--mercurial);
    margin-bottom: 1rem;
}

.npc-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--cloud-white);
    background: transparent;
    border: 1px solid rgba(192,192,208,0.25);
    border-radius: 0;
    outline: none;
    box-shadow: 0 0 30px rgba(232,80,122,0.05), inset 0 0 20px rgba(13,8,24,0.3);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.npc-input::placeholder {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(142,142,160,0.5);
}

.npc-input:focus {
    border-color: var(--rose-horizon);
    box-shadow: 0 0 40px rgba(232,80,122,0.15), inset 0 0 20px rgba(13,8,24,0.3);
}

/* Response bubbles */
.responses {
    position: relative;
    width: 100%;
    min-height: 100px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.response-bubble {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.1rem;
    color: rgba(240,239,244,0.6);
    white-space: nowrap;
    animation: dissolve-up 4s ease forwards;
    pointer-events: none;
}

@keyframes dissolve-up {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-120px);
    }
}

/* --- THE HORIZON (Closing) --- */
.horizon {
    position: relative;
    width: 100%;
    height: 50vh;
    background: var(--abyssal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.horizon-line {
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4A853, #E8507A, #D4A853, transparent);
    animation: horizon-pulse 4s ease-in-out infinite;
    margin-bottom: 3rem;
}

@keyframes horizon-pulse {
    0%, 100% { opacity: 0.4; transform: scaleX(0.9); }
    50% { opacity: 1; transform: scaleX(1); }
}

.horizon-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 100;
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    color: rgba(192,192,208,0.4);
}

/* --- Counter-animate utility --- */
.counter-animate {
    will-change: transform;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .chrome-panel {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        width: calc(100% - 2rem);
        margin: 2rem auto;
        transform: rotate(0deg) !important;
    }

    .descent {
        min-height: auto;
        display: flex;
        flex-direction: column;
        padding: 5vh 1rem;
    }

    .neon-sign {
        display: none;
    }
}
