/* ============================================
   LegalDebug.com — Neon Courtroom Styles
   ============================================ */

/* === CSS Custom Properties === */
:root {
    --deep-bg: #0a0a14;
    --primary-bg: #1a1a2e;
    --leather-warm: #3d2b1f;
    --parchment: #f0e6d3;
    --text-secondary: #d4c9b8;
    --neon-magenta: #ff2d6f;
    --neon-cyan: #00f0ff;
    --neon-lime: #b8ff00;
    --amber-warning: #ffb627;
    --gutter-width: 40px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--deep-bg);
    color: var(--text-secondary);
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
}

/* === Progress Bar === */
#progress-bar {
    position: fixed;
    top: 0;
    left: var(--gutter-width);
    height: 4px;
    width: 0%;
    background: var(--neon-magenta);
    z-index: 1000;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px var(--neon-magenta), 0 0 20px rgba(255, 45, 111, 0.3);
}

/* === Line Number Gutter === */
#line-gutter {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--gutter-width);
    height: 100vh;
    background: var(--primary-bg);
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-right: 1px solid rgba(255, 45, 111, 0.15);
}

.gutter-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #555;
    cursor: pointer;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    user-select: none;
}

.gutter-num.active {
    color: var(--neon-magenta);
    text-shadow: 0 0 6px rgba(255, 45, 111, 0.5);
}

.gutter-num:hover {
    color: var(--neon-cyan);
}

/* === Scan Line Overlay === */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: var(--gutter-width);
    right: 0;
    height: 100vh;
    pointer-events: none;
    z-index: 998;
    overflow: hidden;
}

#scanline-overlay::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--neon-cyan);
    opacity: 0.12;
    animation: scanSweep 8s linear infinite;
    box-shadow: 0 0 15px var(--neon-cyan);
}

@keyframes scanSweep {
    0% { top: -1%; }
    100% { top: 101%; }
}

/* === Static Noise Overlay === */
#noise-overlay {
    position: fixed;
    top: 0;
    left: var(--gutter-width);
    right: 0;
    height: 100vh;
    pointer-events: none;
    z-index: 997;
    opacity: 0.03;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.03) 2px,
            rgba(255,255,255,0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(0,240,255,0.02) 3px,
            rgba(0,240,255,0.02) 6px
        ),
        linear-gradient(
            135deg,
            rgba(255,45,111,0.02) 25%,
            transparent 25%,
            transparent 50%,
            rgba(184,255,0,0.02) 50%,
            rgba(184,255,0,0.02) 75%,
            transparent 75%
        );
    background-size: 4px 4px, 6px 6px, 8px 8px;
    animation: noiseShift 80ms steps(4) infinite;
}

@keyframes noiseShift {
    0% { background-position: 0 0, 0 0, 0 0; }
    25% { background-position: 3px 1px, -2px 3px, 1px -1px; }
    50% { background-position: -1px -2px, 1px -1px, -3px 2px; }
    75% { background-position: 2px 3px, -3px 2px, 2px -3px; }
    100% { background-position: 0 0, 0 0, 0 0; }
}

/* === Scroll Container === */
#scroll-container {
    display: flex;
    width: fit-content;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    margin-left: var(--gutter-width);
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

#scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === Panel Base === */
.panel {
    min-width: calc(100vw - var(--gutter-width));
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-content {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    z-index: 2;
}

/* === Leather Texture (applied to dark panels) === */
.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle 1px at 10px 10px, rgba(61,43,31,0.08) 1px, transparent 1px),
        radial-gradient(circle 1px at 25px 25px, rgba(61,43,31,0.06) 1px, transparent 1px),
        radial-gradient(circle 1px at 5px 30px, rgba(61,43,31,0.07) 1px, transparent 1px);
    background-size: 30px 30px, 40px 40px, 35px 35px;
    z-index: 1;
    pointer-events: none;
}

/* === Panel 1: Boot Sequence === */
.panel-boot {
    background: var(--deep-bg);
}

.boot-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#boot-terminal {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: var(--neon-lime);
    max-width: 600px;
    width: 100%;
    line-height: 2;
}

.boot-line {
    opacity: 0;
    animation: bootLineAppear 0.1s ease forwards;
    white-space: nowrap;
    overflow: hidden;
}

.boot-line.warning {
    color: var(--amber-warning);
}

.boot-line.error {
    color: var(--neon-magenta);
}

@keyframes bootLineAppear {
    to { opacity: 1; }
}

.cursor-blink {
    animation: cursorBlink 0.7s steps(1) infinite;
    color: var(--neon-lime);
    font-family: 'Space Mono', monospace;
}

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

#boot-title {
    font-family: 'Bungee Shade', cursive;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: var(--neon-magenta);
    text-align: center;
    line-height: 1.1;
    margin-top: 2rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#boot-title.title-hidden {
    opacity: 0;
    transform: scale(1.1);
}

#boot-title.title-visible {
    opacity: 1;
    transform: scale(1);
    animation: screenShake 0.3s ease-out;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0) scale(1); }
    10% { transform: translate(-3px, 2px) scale(1); }
    20% { transform: translate(3px, -2px) scale(1); }
    30% { transform: translate(-2px, -1px) scale(1); }
    40% { transform: translate(2px, 1px) scale(1); }
    50% { transform: translate(-1px, -2px) scale(1); }
    60% { transform: translate(1px, 2px) scale(1); }
    70% { transform: translate(-2px, 1px) scale(1); }
    80% { transform: translate(2px, -1px) scale(1); }
    90% { transform: translate(-1px, 1px) scale(1); }
}

/* === Panel Type: Evidence === */
.panel-evidence {
    background: var(--primary-bg);
}

.evidence-layout {
    flex-direction: row;
    align-items: center;
    padding: 4rem 5%;
    gap: 4%;
}

.evidence-left {
    flex: 0 0 55%;
    max-width: 52ch;
}

.evidence-right {
    flex: 0 0 38%;
}

/* === Section Headings === */
.section-heading {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 2rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--parchment);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.err-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.75em;
    color: var(--neon-magenta);
    display: inline-block;
    padding: 0.15em 0.4em;
    border: 1px solid var(--neon-magenta);
    margin-right: 0.5em;
    animation: errPulse 3s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes errPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,45,111,0.3); }
    50% { box-shadow: 0 0 12px rgba(255,45,111,0.6); }
}

/* === Body Text === */
.body-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    max-width: 52ch;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
}

/* === Code Block === */
.code-block {
    background: rgba(10, 10, 20, 0.7);
    border-left: 3px solid var(--neon-magenta);
    padding: 1.5rem;
    border-radius: 2px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.code-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle 1px at 8px 8px, rgba(61,43,31,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.code-line {
    line-height: 2;
    white-space: nowrap;
    position: relative;
}

.line-num {
    display: inline-block;
    width: 3em;
    color: #666;
    user-select: none;
    text-align: right;
    padding-right: 1em;
}

.code-keyword {
    color: var(--neon-cyan);
    font-weight: 700;
}

.code-section {
    color: var(--neon-magenta);
}

.code-text {
    color: var(--parchment);
}

.code-highlight {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    padding: 0 0.2em;
}

.code-bug {
    color: var(--neon-magenta);
    text-decoration: line-through;
    text-decoration-color: var(--neon-magenta);
    background: rgba(255, 45, 111, 0.1);
    padding: 0 0.2em;
}

.code-comment {
    color: #666;
    font-style: italic;
}

/* === Panel Type: Cross-Examination === */
.panel-cross {
    background: var(--deep-bg);
}

.cross-layout {
    flex-direction: column;
    justify-content: center;
    padding: 4rem 8%;
    gap: 1.5rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 700px;
}

.chat-bubble {
    padding: 1.2rem 1.5rem;
    border-radius: 3px;
    position: relative;
    max-width: 85%;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    pointer-events: none;
}

.chat-question {
    align-self: flex-start;
    background: rgba(26, 26, 46, 0.8);
    border-left: 2px solid var(--neon-cyan);
}

.chat-question::before {
    border-color: rgba(0, 240, 255, 0.15);
    animation: glitchBorder 4s ease-in-out infinite;
}

.chat-answer {
    align-self: flex-end;
    background: rgba(26, 26, 46, 0.8);
    border-right: 2px solid var(--neon-magenta);
}

.chat-answer::before {
    border-color: rgba(255, 45, 111, 0.15);
    animation: glitchBorder 4s ease-in-out infinite 2s;
}

@keyframes glitchBorder {
    0%, 100% { clip-path: inset(0); }
    48% { clip-path: inset(0); }
    49% { clip-path: inset(10% 0 70% 0); }
    50% { clip-path: inset(30% 0 40% 0); }
    51% { clip-path: inset(0); }
}

.chat-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    display: block;
}

.chat-question .chat-label {
    color: var(--neon-cyan);
}

.chat-answer .chat-label {
    color: var(--neon-magenta);
}

.chat-bubble p {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* === Panel Type: Exhibit === */
.panel-exhibit {
    background: var(--primary-bg);
}

.exhibit-layout {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    gap: 2rem;
}

.exhibit-icon {
    width: clamp(180px, 25vw, 300px);
    height: clamp(180px, 25vw, 300px);
}

.exhibit-icon svg {
    width: 100%;
    height: 100%;
}

.scales-svg .scales-beam {
    transform-origin: 100px 55px;
    animation: scalesTilt 6s ease-in-out infinite;
}

@keyframes scalesTilt {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.gavel-svg {
    animation: gavelFloat 4s ease-in-out infinite;
}

@keyframes gavelFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.exhibit-label {
    text-align: center;
}

.exhibit-text {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 42ch;
    margin-top: 0.5rem;
    line-height: 1.7;
}

.scanlines-horizontal {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 240, 255, 0.02) 3px,
        rgba(0, 240, 255, 0.02) 4px
    );
}

/* === Panel Type: Closing === */
.panel-closing {
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--deep-bg) 100%);
}

.panel-closing::before {
    background:
        radial-gradient(circle 1px at 10px 10px, rgba(61,43,31,0.12) 1px, transparent 1px),
        radial-gradient(circle 1px at 25px 25px, rgba(61,43,31,0.1) 1px, transparent 1px);
    background-size: 30px 30px, 40px 40px;
}

.closing-layout {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4rem;
    gap: 1.5rem;
}

.closing-title {
    font-family: 'Bungee Shade', cursive;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--parchment);
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.closing-subtitle {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 48ch;
    font-size: 1.1rem;
    line-height: 1.8;
}

.closing-cta {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 1rem;
}

.closing-cursor {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    color: var(--neon-lime);
    animation: cursorBlink 0.7s steps(1) infinite;
}

/* === City Skyline === */
.skyline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15%;
    z-index: 3;
    pointer-events: none;
}

.skyline-1 {
    background:
        /* Building 1 */
        linear-gradient(to top, rgba(0,240,255,0.15) 0%, rgba(0,240,255,0.15) 100%) no-repeat 5% bottom / 4% 60%,
        /* Building 2 */
        linear-gradient(to top, rgba(0,240,255,0.12) 0%, rgba(0,240,255,0.12) 100%) no-repeat 12% bottom / 6% 80%,
        /* Building 3 */
        linear-gradient(to top, rgba(0,240,255,0.18) 0%, rgba(0,240,255,0.18) 100%) no-repeat 20% bottom / 3% 45%,
        /* Building 4 */
        linear-gradient(to top, rgba(0,240,255,0.14) 0%, rgba(0,240,255,0.14) 100%) no-repeat 28% bottom / 5% 90%,
        /* Building 5 */
        linear-gradient(to top, rgba(0,240,255,0.1) 0%, rgba(0,240,255,0.1) 100%) no-repeat 36% bottom / 7% 50%,
        /* Building 6 */
        linear-gradient(to top, rgba(0,240,255,0.16) 0%, rgba(0,240,255,0.16) 100%) no-repeat 46% bottom / 4% 70%,
        /* Building 7 */
        linear-gradient(to top, rgba(0,240,255,0.11) 0%, rgba(0,240,255,0.11) 100%) no-repeat 54% bottom / 8% 55%,
        /* Building 8 */
        linear-gradient(to top, rgba(0,240,255,0.17) 0%, rgba(0,240,255,0.17) 100%) no-repeat 65% bottom / 3% 85%,
        /* Building 9 */
        linear-gradient(to top, rgba(0,240,255,0.13) 0%, rgba(0,240,255,0.13) 100%) no-repeat 72% bottom / 6% 40%,
        /* Building 10 */
        linear-gradient(to top, rgba(0,240,255,0.15) 0%, rgba(0,240,255,0.15) 100%) no-repeat 82% bottom / 5% 65%,
        /* Building 11 */
        linear-gradient(to top, rgba(0,240,255,0.12) 0%, rgba(0,240,255,0.12) 100%) no-repeat 90% bottom / 4% 75%;
    /* Windows */
    animation: skylineGlitch 6s steps(1) infinite;
}

.skyline-2 {
    background:
        linear-gradient(to top, rgba(0,240,255,0.12) 0%, rgba(0,240,255,0.12) 100%) no-repeat 3% bottom / 5% 70%,
        linear-gradient(to top, rgba(0,240,255,0.16) 0%, rgba(0,240,255,0.16) 100%) no-repeat 11% bottom / 3% 55%,
        linear-gradient(to top, rgba(0,240,255,0.1) 0%, rgba(0,240,255,0.1) 100%) no-repeat 18% bottom / 7% 85%,
        linear-gradient(to top, rgba(0,240,255,0.14) 0%, rgba(0,240,255,0.14) 100%) no-repeat 28% bottom / 4% 40%,
        linear-gradient(to top, rgba(0,240,255,0.18) 0%, rgba(0,240,255,0.18) 100%) no-repeat 35% bottom / 6% 65%,
        linear-gradient(to top, rgba(0,240,255,0.11) 0%, rgba(0,240,255,0.11) 100%) no-repeat 45% bottom / 5% 90%,
        linear-gradient(to top, rgba(0,240,255,0.15) 0%, rgba(0,240,255,0.15) 100%) no-repeat 55% bottom / 3% 50%,
        linear-gradient(to top, rgba(0,240,255,0.13) 0%, rgba(0,240,255,0.13) 100%) no-repeat 63% bottom / 8% 75%,
        linear-gradient(to top, rgba(0,240,255,0.17) 0%, rgba(0,240,255,0.17) 100%) no-repeat 75% bottom / 4% 60%,
        linear-gradient(to top, rgba(0,240,255,0.12) 0%, rgba(0,240,255,0.12) 100%) no-repeat 85% bottom / 6% 80%,
        linear-gradient(to top, rgba(0,240,255,0.14) 0%, rgba(0,240,255,0.14) 100%) no-repeat 94% bottom / 3% 45%;
    animation: skylineGlitch 6s steps(1) infinite 3s;
}

@keyframes skylineGlitch {
    0%, 100% { filter: none; }
    47% { filter: none; }
    48% { filter: hue-rotate(180deg); transform: translateY(-3px); }
    49% { filter: none; transform: translateY(0); }
    73% { filter: none; }
    74% { filter: hue-rotate(90deg) brightness(1.3); transform: translateY(2px); }
    75% { filter: none; transform: translateY(0); }
}

/* === RGB Split Hover Effect === */
.rgb-split:hover,
.section-heading:hover,
.closing-title:hover {
    text-shadow:
        -2px 0 var(--neon-magenta),
        2px 0 var(--neon-cyan);
    transition: text-shadow 0.2s ease;
}

.section-heading,
.closing-title {
    text-shadow: 0 0 transparent;
    transition: text-shadow 0.2s ease;
}

/* === Glitch Intensity Escalation === */
#panel-2 #scanline-overlay::before {
    opacity: 0.18;
}

.panel-cross .chat-bubble {
    animation: subtleGlitch 5s steps(1) infinite;
}

@keyframes subtleGlitch {
    0%, 100% { transform: translateX(0); }
    49% { transform: translateX(0); }
    49.5% { transform: translateX(2px); }
    50% { transform: translateX(-1px); }
    50.5% { transform: translateX(0); }
}

/* === Responsive adjustments === */
@media (max-width: 768px) {
    :root {
        --gutter-width: 30px;
    }

    .evidence-layout {
        flex-direction: column;
        padding: 2rem 5%;
        gap: 2rem;
        overflow-y: auto;
    }

    .evidence-left,
    .evidence-right {
        flex: none;
        width: 100%;
    }

    .cross-layout {
        padding: 2rem 5%;
    }

    .chat-bubble {
        max-width: 95%;
    }

    #boot-title {
        font-size: clamp(2.5rem, 10vw, 5rem);
    }

    .gutter-num {
        font-size: 0.55rem;
    }
}

@media (max-width: 480px) {
    :root {
        --gutter-width: 25px;
    }

    .section-heading {
        font-size: clamp(1rem, 5vw, 1.5rem);
    }

    .code-block {
        font-size: 0.75rem;
    }
}
