/* ============================================= */
/* lowest.dev — Styles                           */
/* ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --wet-asphalt: #0D0D12;
    --concrete-dust: #2A2A30;
    --oxidized-pipe: #4A4438;
    --monsoon-fog: #8A8A7E;
    --neon-magenta: #FF2D7B;
    --neon-cyan: #00E5CC;
    --signal-amber: #FFB627;
    --puddle-reflection: #1A1A3D;
}

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

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

body {
    background-color: var(--wet-asphalt);
    color: var(--monsoon-fog);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    cursor: crosshair;
    overflow-x: hidden;
    position: relative;
}

/* --- Scan-line overlay on entire page --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
}

/* --- Typography --- */
.heading-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--monsoon-fog);
    margin-bottom: 1rem;
}

.heading-text.sub {
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
}

.body-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--monsoon-fog);
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
}

.amber-text {
    color: var(--signal-amber);
}

/* --- Neon Glow Effects --- */
.neon-magenta-glow {
    color: var(--neon-magenta);
    text-shadow:
        0 0 20px rgba(255, 45, 123, 0.4),
        0 0 60px rgba(255, 45, 123, 0.15);
}

.neon-cyan-glow {
    color: var(--neon-cyan);
    text-shadow:
        0 0 20px rgba(0, 229, 204, 0.4),
        0 0 60px rgba(0, 229, 204, 0.15);
}

/* --- Depth Counter (Fixed) --- */
#depth-counter {
    position: fixed;
    bottom: 24px;
    right: 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--monsoon-fog);
    z-index: 1000;
    transition: text-shadow 0.2s ease, color 0.2s ease;
    pointer-events: none;
}

#depth-counter.pulse {
    color: var(--neon-cyan);
    text-shadow: 0 0 12px rgba(0, 229, 204, 0.5);
}

/* ============================================= */
/* STREET LEVEL                                  */
/* ============================================= */
#street-level {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15vh;
    overflow: hidden;
}

/* Rain-puddle background */
#street-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1200ms ease;
    z-index: 0;
    /* Simulated rain-puddle photograph via gradient layers */
    background:
        /* Puddle Reflection overlay (multiply simulation) */
        linear-gradient(180deg,
            rgba(26, 26, 61, 0.7) 0%,
            rgba(13, 13, 18, 0.5) 30%,
            rgba(26, 26, 61, 0.6) 50%,
            rgba(13, 13, 18, 0.8) 100%
        ),
        /* Neon reflections in puddles */
        radial-gradient(ellipse at 30% 60%, rgba(255, 45, 123, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 40%, rgba(0, 229, 204, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 70%, rgba(255, 182, 39, 0.08) 0%, transparent 35%),
        /* Rain-streaked texture */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 30px,
            rgba(255, 255, 255, 0.01) 30px,
            rgba(255, 255, 255, 0.01) 31px
        ),
        /* Base dark */
        linear-gradient(180deg, var(--wet-asphalt) 0%, var(--puddle-reflection) 100%);
    /* Scan-line artifact */
    background-size: cover;
    filter: blur(1px) saturate(0.2);
}

#street-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
}

#street-bg.visible {
    opacity: 1;
}

/* Title Container */
#title-container {
    position: relative;
    z-index: 2;
    text-align: center;
}

#site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--neon-magenta);
    text-shadow:
        0 0 20px rgba(255, 45, 123, 0.4),
        0 0 60px rgba(255, 45, 123, 0.15);
    min-height: 1.2em;
    /* Puddle reflection effect: text reflected below */
    position: relative;
}

#site-title::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    transform: scaleY(-1);
    opacity: 0.15;
    filter: blur(3px);
    color: var(--neon-magenta);
    text-shadow:
        0 0 30px rgba(255, 45, 123, 0.3),
        0 0 80px rgba(255, 45, 123, 0.1);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 80%);
    pointer-events: none;
}

#coordinates {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 800ms ease;
}

#coordinates.visible {
    opacity: 1;
}

/* ============================================= */
/* THRESHOLD TRANSITIONS                         */
/* ============================================= */
.threshold {
    position: relative;
    width: 100%;
    padding: 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}

.threshold-line {
    width: 0;
    height: 1px;
    background-color: var(--oxidized-pipe);
    transition: width 800ms ease;
    position: relative;
}

.threshold-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--neon-magenta);
    box-shadow: 0 0 12px rgba(255, 45, 123, 0.5);
    opacity: 0;
    transition: opacity 400ms ease 400ms;
}

.threshold.active .threshold-line {
    width: 80%;
}

.threshold.active .threshold-line::before {
    opacity: 1;
}

.threshold-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--monsoon-fog);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 600ms ease 600ms, transform 600ms ease 600ms;
}

.threshold.active .threshold-label {
    opacity: 0.6;
    transform: translateY(0);
}

/* ============================================= */
/* CONTENT LEVELS (Basement, Sub-Basement, etc)  */
/* ============================================= */
.level {
    position: relative;
    width: 100%;
    padding: 80px 20px;
    overflow: hidden;
}

#basement-level {
    padding-top: 40px;
}

#sub-basement-level {
    padding-top: 40px;
}

#foundation-level {
    padding-top: 40px;
    padding-bottom: 40px;
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
    padding: 30px;
    margin-bottom: 60px;
    max-width: 900px;
}

.content-block .heading-text {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
}

/* --- Flow Entry Animations --- */
.flow-entry {
    opacity: 0;
    transition: opacity 400ms ease, transform 400ms ease;
}

.flow-entry[data-flow="left"] {
    transform: translateX(-30px);
}

.flow-entry[data-flow="right"] {
    transform: translateX(30px);
}

.flow-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Block Variants --- */
.block-narrow {
    padding: 20px 24px;
    border-left: 2px solid var(--oxidized-pipe);
}

.block-wide {
    padding: 40px 30px;
}

.block-overlap {
    padding: 20px 24px;
    border-left: 2px solid var(--oxidized-pipe);
    position: relative;
    z-index: 2;
}

.block-center {
    text-align: center;
}

/* --- Junction Boxes --- */
.junction-box {
    width: 32px;
    height: 24px;
    margin-bottom: 16px;
}

.junction-box svg {
    width: 100%;
    height: 100%;
}

/* --- Cable Bundles --- */
.cable-bundle {
    position: absolute;
    top: 0;
    width: 60px;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
    pointer-events: none;
}

.cable-bundle svg {
    width: 100%;
    height: 100%;
}

.cable-left {
    left: 0;
}

.cable-right {
    right: 0;
}

.cable-dense {
    width: 80px;
    opacity: 0.5;
}

/* --- Drip Effects --- */
.drip {
    position: absolute;
    width: 1px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(138, 138, 126, 0.15) 20%,
        rgba(138, 138, 126, 0.08) 80%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

.drip-1 { left: 15%; top: 10%; height: 180px; animation: dripFall 45s linear infinite; }
.drip-2 { left: 78%; top: 5%; height: 220px; animation: dripFall 38s linear infinite 5s; }
.drip-3 { left: 55%; top: 20%; height: 150px; animation: dripFall 52s linear infinite 12s; }
.drip-4 { left: 22%; top: 8%; height: 200px; animation: dripFall 40s linear infinite 3s; }
.drip-5 { left: 85%; top: 15%; height: 170px; animation: dripFall 55s linear infinite 8s; }
.drip-6 { left: 12%; top: 5%; height: 250px; animation: dripFall 35s linear infinite 2s; }
.drip-7 { left: 65%; top: 12%; height: 190px; animation: dripFall 48s linear infinite 7s; }
.drip-8 { left: 90%; top: 8%; height: 160px; animation: dripFall 42s linear infinite 15s; }
.drip-9 { left: 18%; top: 10%; height: 230px; animation: dripFall 50s linear infinite 4s; }
.drip-10 { left: 72%; top: 6%; height: 200px; animation: dripFall 44s linear infinite 10s; }

@keyframes dripFall {
    0% { transform: translateY(-100%); opacity: 0; }
    5% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(400px); opacity: 0; }
}

/* --- Ghost Text (Thai / Khmer watermarks) --- */
.ghost-text {
    position: absolute;
    font-size: 10rem;
    font-weight: 300;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
    color: var(--monsoon-fog);
    user-select: none;
}

.thai-ghost {
    font-family: 'Noto Sans Thai', sans-serif;
    top: 10%;
    right: 5%;
    transform: rotate(-5deg);
}

.khmer-ghost {
    font-family: 'Noto Sans Thai', sans-serif;
    top: 15%;
    left: 3%;
    font-size: 12rem;
    opacity: 0.04;
    transform: rotate(3deg);
}

.thai-ghost-deep {
    font-family: 'Noto Sans Thai', sans-serif;
    top: 20%;
    right: 8%;
    font-size: 8rem;
    opacity: 0.06;
    transform: rotate(-8deg);
}

/* --- Watermark (Sak Yant geometric patterns) --- */
.watermark {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
}

.watermark svg {
    width: 100%;
    height: 100%;
}

#watermark-street {
    width: 50vw;
    height: 50vw;
    max-width: 500px;
    max-height: 500px;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.05;
}

.watermark-basement {
    width: 35vw;
    height: 35vw;
    max-width: 400px;
    max-height: 400px;
    bottom: 5%;
    right: 5%;
}

.watermark-deep {
    width: 60vw;
    height: 60vw;
    max-width: 600px;
    max-height: 600px;
    top: 20%;
    left: -10%;
    opacity: 0.04;
}

.watermark-foundation {
    width: 70vw;
    height: 70vw;
    max-width: 700px;
    max-height: 700px;
    top: 10%;
    right: -15%;
    opacity: 0.035;
}

/* --- Textile Divider (Woven pattern) --- */
.textile-divider {
    width: 100%;
    height: 20px;
    margin: 40px 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        var(--oxidized-pipe) 4px,
        var(--oxidized-pipe) 5px
    ),
    repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        var(--oxidized-pipe) 4px,
        var(--oxidized-pipe) 5px
    );
    opacity: 0.25;
}

/* --- Neon Flicker Animation --- */
@keyframes neonFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.flicker {
    animation: neonFlicker 100ms ease-in-out;
}

/* ============================================= */
/* RESPONSIVE                                    */
/* ============================================= */
@media (max-width: 768px) {
    .content-block {
        margin-left: 5% !important;
        width: 90% !important;
        padding: 20px;
    }

    .cable-bundle {
        display: none;
    }

    .ghost-text {
        font-size: 5rem;
    }

    #watermark-street {
        width: 80vw;
        height: 80vw;
    }

    .watermark-deep,
    .watermark-foundation {
        display: none;
    }

    #street-level {
        padding-bottom: 20vh;
    }
}

@media (max-width: 480px) {
    .content-block .heading-text {
        font-size: clamp(1.4rem, 5vw, 2.5rem);
    }

    .ghost-text {
        font-size: 3rem;
    }

    .textile-divider {
        margin: 20px 0;
        height: 12px;
    }
}
