/* ============================================
   chloe.cx — Styles
   HUD-overlay generative art command center
   ============================================ */

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

:root {
    --bg-primary: #0A0B12;
    --bg-elevated: #12131F;
    --neon-green: #00FFB2;
    --neon-magenta: #FF00E5;
    --neon-cyan: #00D4FF;
    --text-primary: #E0E4F0;
    --text-dimmed: #6B7394;
    --boot-green: #39FF85;
    --glow-white: rgba(255, 255, 255, 0.15);

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --hud-top-height: 36px;
    --hud-left-width: 48px;
    --hud-bottom-height: 28px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Grid Overlay --- */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        repeating-linear-gradient(0deg, rgba(0, 255, 178, 0.04) 0px, rgba(0, 255, 178, 0.04) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(90deg, rgba(0, 255, 178, 0.04) 0px, rgba(0, 255, 178, 0.04) 1px, transparent 1px, transparent 40px);
}

/* --- Top HUD Bar --- */
#hud-top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--hud-top-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--neon-green);
    box-shadow: 0 1px 8px rgba(0, 255, 178, 0.3);
    display: flex;
    align-items: center;
    padding: 0 16px 0 calc(var(--hud-left-width) + 16px);
    gap: 8px;
    z-index: 1000;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dimmed);
}

#hud-top .hud-segment {
    white-space: nowrap;
}

#hud-top #hud-system {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 178, 0.6), 0 0 30px rgba(0, 255, 178, 0.2);
}

#hud-top #hud-module {
    color: var(--text-primary);
}

#hud-top .hud-divider {
    color: var(--text-dimmed);
    opacity: 0.5;
}

.hud-mobile-info {
    display: none;
}

/* --- Left Telemetry Rail --- */
#hud-left {
    position: fixed;
    top: var(--hud-top-height);
    left: 0;
    width: var(--hud-left-width);
    height: calc(100vh - var(--hud-top-height) - var(--hud-bottom-height));
    background: rgba(10, 11, 18, 0.85);
    border-right: 1px solid rgba(0, 255, 178, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    gap: 12px;
    overflow: hidden;
}

.rotated-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 178, 0.6), 0 0 30px rgba(0, 255, 178, 0.2);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    white-space: nowrap;
    max-height: 120px;
    overflow: hidden;
}

#scroll-progress-track {
    width: 4px;
    flex: 1;
    max-height: 200px;
    background: rgba(0, 255, 178, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

#scroll-progress-fill {
    width: 100%;
    height: 0%;
    background: var(--neon-green);
    box-shadow: 0 0 8px rgba(0, 255, 178, 0.6);
    border-radius: 2px;
    transition: height 0.1s ease-out;
}

#telemetry-readouts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 8px;
}

.readout-label {
    color: var(--text-dimmed);
    font-size: 7px;
    letter-spacing: 0.1em;
}

.readout-value {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
    font-size: 9px;
}

/* HUD Decorative Elements */
.hud-deco.crosshair {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--neon-green);
    opacity: 0.4;
    text-shadow: 0 0 6px rgba(0, 255, 178, 0.4);
}

.hud-deco.radar {
    opacity: 0.5;
}

.hud-deco.radar .radar-sweep {
    transform-origin: 15px 15px;
    animation: radarSweep 3s linear infinite;
}

@keyframes radarSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hud-deco.mini-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 20px;
}

.mini-bar {
    width: 4px;
    background: var(--neon-green);
    opacity: 0.4;
    border-radius: 1px;
    transition: height 0.3s ease-out;
}

/* --- Bottom Process Log --- */
#hud-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--hud-bottom-height);
    background: var(--bg-primary);
    border-top: 1px solid rgba(0, 255, 178, 0.15);
    display: flex;
    align-items: center;
    padding: 0 16px 0 calc(var(--hud-left-width) + 16px);
    z-index: 1000;
    overflow: hidden;
}

#process-log {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--boot-green);
    text-shadow: 0 0 8px rgba(57, 255, 133, 0.4);
    white-space: nowrap;
    animation: scrollLog 20s linear infinite;
}

@keyframes scrollLog {
    0%, 20% { transform: translateX(0); }
    80%, 100% { transform: translateX(-50%); }
}

/* --- Main Content --- */
#content {
    margin-left: var(--hud-left-width);
    padding-top: var(--hud-top-height);
    padding-bottom: var(--hud-bottom-height);
}

/* --- Module Sections --- */
.module {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.module-inner {
    position: relative;
    width: 70vw;
    max-width: 1200px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.module-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- Module Titles --- */
.module-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 4rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(224, 228, 240, 0.3);
    position: relative;
    z-index: 10;
    margin-bottom: 2rem;
}

.module-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--stagger-delay, 0ms);
}

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

/* --- Boot Terminal --- */
#boot-terminal {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 2;
    color: var(--boot-green);
    text-shadow: 0 0 10px rgba(57, 255, 133, 0.6), 0 0 30px rgba(57, 255, 133, 0.2);
    max-width: 600px;
    width: 100%;
}

.boot-line {
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.boot-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.boot-prefix {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.boot-line[data-delay="3400"] .boot-prefix {
    color: var(--neon-magenta);
    text-shadow: 0 0 10px rgba(255, 0, 229, 0.6);
}

#boot-cursor {
    display: inline-block;
    color: var(--neon-green);
    animation: blink 0.8s step-end infinite;
    text-shadow: 0 0 10px rgba(0, 255, 178, 0.8);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Floating Panels --- */
.floating-panel {
    background: rgba(18, 19, 31, 0.9);
    border: 1px solid var(--neon-green);
    box-shadow: 0 0 8px rgba(0, 255, 178, 0.3), inset 0 0 8px rgba(0, 255, 178, 0.1);
    padding: 20px 24px;
    position: relative;
    z-index: 10;
    max-width: 52ch;
    margin: 1rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: var(--stagger-delay, 0ms);
}

.floating-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

.floating-panel p {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-primary);
    margin-top: 0.75rem;
}

.code-comment {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Kinetic Text --- */
.kinetic-text {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--neon-magenta);
    text-shadow: 0 0 10px rgba(255, 0, 229, 0.6), 0 0 30px rgba(255, 0, 229, 0.2);
    position: relative;
    z-index: 10;
    margin-top: 2rem;
    letter-spacing: 0.05em;
}

.kinetic-text .char {
    display: inline-block;
    transition: none;
}

/* --- Corner Brackets --- */
.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 10;
    pointer-events: none;
}

.corner-bracket::before,
.corner-bracket::after {
    content: '';
    position: absolute;
    background: var(--neon-green);
    opacity: 0.3;
}

.corner-bracket.top-left { top: 20px; left: 20px; }
.corner-bracket.top-left::before { width: 20px; height: 1px; top: 0; left: 0; }
.corner-bracket.top-left::after { width: 1px; height: 20px; top: 0; left: 0; }

.corner-bracket.top-right { top: 20px; right: 20px; }
.corner-bracket.top-right::before { width: 20px; height: 1px; top: 0; right: 0; }
.corner-bracket.top-right::after { width: 1px; height: 20px; top: 0; right: 0; }

.corner-bracket.bottom-left { bottom: 20px; left: 20px; }
.corner-bracket.bottom-left::before { width: 20px; height: 1px; bottom: 0; left: 0; }
.corner-bracket.bottom-left::after { width: 1px; height: 20px; bottom: 0; left: 0; }

.corner-bracket.bottom-right { bottom: 20px; right: 20px; }
.corner-bracket.bottom-right::before { width: 20px; height: 1px; bottom: 0; right: 0; }
.corner-bracket.bottom-right::after { width: 1px; height: 20px; bottom: 0; right: 0; }

/* --- Mandala --- */
#mandala-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2rem;
}

#canvas-mandala {
    width: 300px;
    height: 300px;
    border-radius: 50%;
}

.mandala-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 178, 0.6);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 1rem;
}

/* --- Wave annotations positioning --- */
#wave-annotation-1 {
    align-self: flex-start;
}

#wave-annotation-2 {
    align-self: flex-end;
}

#particle-info-1 {
    align-self: flex-start;
}

#particle-info-2 {
    align-self: flex-end;
}

#geometry-info-1 {
    align-self: flex-start;
}

#geometry-info-2 {
    align-self: flex-end;
}

#synthesis-info-1 {
    align-self: center;
}

/* --- Responsive (below 768px) --- */
@media (max-width: 768px) {
    :root {
        --hud-left-width: 0px;
    }

    #hud-left {
        display: none;
    }

    #hud-top {
        padding-left: 16px;
        font-size: 9px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .hud-mobile-info {
        display: inline;
        color: var(--text-dimmed);
        font-family: var(--font-mono);
        font-size: 9px;
    }

    #content {
        margin-left: 0;
    }

    .module-inner {
        width: 90vw;
    }

    #hud-bottom {
        padding-left: 16px;
    }

    #process-log {
        font-size: 9px;
    }

    #boot-terminal {
        font-size: 12px;
        padding: 0 16px;
    }

    .floating-panel {
        padding: 14px 16px;
    }

    #canvas-mandala {
        width: 200px;
        height: 200px;
    }
}

/* --- Canvas positioning for each module --- */
#module-waveforms .module-canvas,
#module-particles .module-canvas,
#module-geometry .module-canvas,
#module-synthesis .module-canvas {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    z-index: 0;
}

/* --- Stagger animation utility --- */
.stagger-enter {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    transition-delay: var(--stagger-delay, 0ms);
}

.stagger-enter.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Selection color --- */
::selection {
    background: rgba(0, 255, 178, 0.3);
    color: var(--text-primary);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 178, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 178, 0.5);
}
