/* ═══════════════════════════════════════════════
   BELLUCCI | LAYOUT — WIP Fixes
   UA: monochrome, bellucci-enhanced site style
   ═══════════════════════════════════════════════ */

/* ══════════════════════════════════
   UI LAYER
══════════════════════════════════ */
.ui-layer {
    position: fixed;
    inset: 0;
    z-index: 20;
    padding: 32px 48px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    /* FIX: Prevent header from blocking clicks below */
}

/* ── BRAND ── */
.brand {
    pointer-events: auto;
    transition: color 0.3s;
}

.brand-name {
    font-family: var(--font-display);
    font-size: clamp(18px, 2.2vw, 26px);
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    position: relative;
    /* needed for chroma pseudo-elements */
    transition: font-variation-settings 0.4s;
}

.brand-name:hover {
    font-variation-settings: 'wght' 400;
    color: rgba(255, 255, 255, 0.7);
}

/* Chroma clones — font props must match exactly for pixel-perfect channel split */
.brand-name::before,
.brand-name::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: inherit;
    letter-spacing: inherit;
    text-transform: uppercase;
    white-space: nowrap;
    display: block;
}

.brand-sub {
    font-family: var(--font-tech);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.35);
    display: block;
    text-transform: uppercase;
    position: relative;
    /* needed for chroma pseudo-elements */
}

/* Chroma aberration pseudo-channels */
.brand-sub::before,
.brand-sub::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.brand-sub.glitch-active::before {
    opacity: 0.7;
    color: #ff003c;
    transform: translate(-2px, 0);
    mix-blend-mode: screen;
    clip-path: polygon(0 15%, 100% 15%, 100% 55%, 0 55%);
}

.brand-sub.glitch-active::after {
    opacity: 0.7;
    color: #00fff9;
    transform: translate(2px, 0);
    mix-blend-mode: screen;
    clip-path: polygon(0 55%, 100% 55%, 100% 90%, 0 90%);
}

/* ── SYS STATUS — increased legibility to 60%+ ── */
.sys-status {
    text-align: right;
    font-family: var(--font-tech);
    font-size: 11px;
    /* FIX: Increased from 9px */
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.6);
    /* ← was 0.3, now 0.6 */
    line-height: 2;
    transition: filter 0.3s;
    pointer-events: auto;
}

.sys-status:hover {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
    /* CRT glow */
}

.status-live {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.blink {
    animation: blink 2s infinite;
}

/* Sound toggle — top right of header */
#sound-toggle {
    pointer-events: auto;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 1px;
    font-family: var(--font-tech);
    font-size: 10px;
    /* FIX: Increased from 9px */
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    transition: color 0.3s, border-color 0.3s;
    cursor: none;
    margin-left: 20px;
    display: block;
    text-align: right;
    margin-top: 4px;
}

#sound-toggle:hover {
    color: rgba(255, 255, 255, 0.7);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* ── FOOTER ── */
.ui-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
}

.ui-footer-label {
    font-family: var(--font-tech);
    font-size: 10px;
    /* FIX: Increased from 9px */
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.6);
    /* ← was 0.3 */
    transition: color 0.3s;
}

.ui-footer-label:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ── PROFILE TRIGGER ── */
#profile-trigger {
    pointer-events: auto;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 2px;
    font-family: var(--font-tech);
    font-size: 11px;
    letter-spacing: 0.25em;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    transition: color 0.3s, border-color 0.3s;
    cursor: none;
    /* Magnetic — JS adds transform */
    display: inline-block;
}

#profile-trigger:hover {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

/* ══════════════════════════════════
   SECURITY CAMERA
══════════════════════════════════ */
.security-camera {
    position: absolute;
    top: 50vh;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(300px, 60vw, 900px);
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.95);
    pointer-events: none;
    overflow: visible !important;
    /* Allow outside UI */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    z-index: 10;
    /* GSAP parallax moves this */
    will-change: transform;
}

.security-camera::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.07),
            rgba(0, 0, 0, 0.07) 1px,
            transparent 1px,
            transparent 2px);
    pointer-events: none;
    z-index: 3;
}

#surveillance-feed {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: grayscale(100%) contrast(1.05);
}

.cam-ui {
    position: absolute;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-tech);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
    z-index: 12;
}

/* Specific positioning for top/bottom UI bars */
.cam-ui:nth-of-type(2) {
    top: -25px;
}



.rec-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #FF2A2A;
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 4px #FF2A2A;
    animation: blink 1s infinite;
}

/* Corner decorations */
.cam-corners {
    position: absolute;
    inset: 8px;
    pointer-events: none;
    z-index: 2;
}

.corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: rgba(255, 255, 255, 0.25);
    border-style: solid;
}

.corner.tl {
    top: 0;
    left: 0;
    border-width: 1px 0 0 1px;
}

.corner.tr {
    top: 0;
    right: 0;
    border-width: 1px 1px 0 0;
}

.corner.bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 1px 1px;
}

.corner.br {
    bottom: 0;
    right: 0;
    border-width: 0 1px 1px 0;
}

.cam-timestamp {
    font-family: var(--font-tech);
    letter-spacing: 0.15em;
}

/* ══════════════════════════════════
   CHARACTER GRID — left side, vert center
══════════════════════════════════ */
.grid-container {
    position: fixed;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 10px;
    pointer-events: auto;
    z-index: 30;
    transform-origin: left center;
    will-change: transform, opacity;
}

/* Grid status label */
#grid-status {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-tech);
    font-size: 8px;
    letter-spacing: 0.35em;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
    text-transform: uppercase;
}

/* ══════════════════════════════════
   PROJECT VIEW — dossier
══════════════════════════════════ */
#project-view {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 50%;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    /* Dossier full-screen state managed by JS */
}

#project-view.active {
    opacity: 1;
    pointer-events: auto;
}

/* ══════════════════════════════════
   EXIT BUTTON
══════════════════════════════════ */
#exit-btn {
    position: fixed;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: none;
    color: rgba(255, 255, 255, 0.35);
    padding: 0;
    padding-bottom: 2px;
    font-family: var(--font-tech);
    font-size: 11px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    cursor: none;
}

#exit-btn:hover {
    color: rgba(255, 255, 255, 0.75);
    border-bottom-color: rgba(255, 255, 255, 0.55);
}

#exit-btn.show {
    opacity: 1;
    pointer-events: auto;
}

/* ══════════════════════════════════
   GRADE vignette
══════════════════════════════════ */
.grade {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 25%, rgba(0, 0, 0, 0.82) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 30%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.75) 0%, transparent 35%);
}

/* ══════════════════════════════════
   RESPONSIVE - FIXES START HERE
══════════════════════════════════ */
@media (max-width: 768px) {

    /* Camera: REMOVED FIXED POSITIONING. Now stacks naturally. */
    .security-camera {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        margin-top: 10px;
        order: 1;
        /* Ensure order in flex container */
    }

    /* HUD terminal: ENABLED on mobile, adapted layout */
    #hud-terminal-container {
        display: flex;
        /* FIX: Was none */
        position: relative;
        bottom: auto;
        left: auto;
        width: 100%;
        max-width: none;
        padding: 10px 0;
        order: 2;
        /* Below camera */
    }

    /* Grid: below camera with gap, no absolute positioning magic */
    .grid-container {
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        transform: none;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin: 20px 0;
        order: 3;
        /* Below terminal */
    }

    /* Ensure tiles don't get too small or weird */
    .char-tile {
        width: 80px;
        height: 80px;
    }

    /* Project view: full-width overlay */
    #project-view {
        left: 0;
        padding: 28px 24px;
        background: rgba(0, 0, 0, 0.95);
        /* More opaque */
    }

    /* Header: tighter padding */
    .ui-layer {
        padding: 16px 20px;
    }

    /* Footer: pull up so it doesn't fight the grid */
    .ui-footer {
        padding-bottom: 12px;
        position: relative;
        /* Let it flow if needed, but ui-layer is fixed.. wait. */
        /* ui-layer is fixed 0,0,0,0. It sits ON TOP of scrollable content. */
        /* If we want app-container to scroll, we need ui-layer to NOT block clicks in the middle, which it doesn't (pointer-events: none). */
        /* But the footer buttons need to be accessible. */
    }
}

@media (max-width: 1100px) and (min-width: 769px) {
    .grid-container {
        scale: 0.85;
    }
}

/* Fallback */
.grid-container.force-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}


/* ══════════════════════════════════
   INTERACTIVE TERMINAL
══════════════════════════════════ */
#hud-terminal-container {
    position: fixed;
    bottom: 30px;
    left: 48px;
    width: 380px;
    max-width: 80vw;
    font-family: var(--font-tech);
    font-size: 10px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.6);
    z-index: 50;
    pointer-events: none;
    /* Container passes clicks */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#hud-terminal-content {
    max-height: 150px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.terminal-line {
    display: flex;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.terminal-input-line {
    display: flex;
    align-items: center;
    pointer-events: auto;
    /* Input is clickable */
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 2px;
    margin-top: 4px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

.prompt {
    color: var(--accent-color, #fff);
    margin-right: 8px;
    font-weight: bold;
}

#terminal-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-tech);
    font-size: 10px;
    letter-spacing: 0.05em;
    width: 100%;
    outline: none;
    text-transform: uppercase;
    caret-color: var(--accent-color, #fff);
}

#terminal-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════
   PART 3: LAYOUT REFACTOR (Sidebar / Main Tabs)
═══════════════════════════════════════════════ */

/* ── APP CONTAINER ── */
/* ── APP CONTAINER ── */
#app-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 80px 48px 40px 48px;
    /* Header/Footer spacing */
    box-sizing: border-box;
    display: flex;
    gap: 24px;
    z-index: 10;
    pointer-events: none;
    overflow: hidden;
    /* Prevent outer scroll */
}

/* ── SIDEBAR (GRID) ── */
/* ── SIDEBAR (GRID) ── */
#sidebar-left {
    width: auto;
    /* Auto width to fit grid */
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    /* Balanced padding */
    padding-top: 10px;
    overflow: hidden;
    /* No scrollbar */
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* FIX: Force full height to allow centering */
    min-height: 0;
    /* FIX: Prevent flex overflow */
    justify-content: flex-start;
    /* Header Top */
    /* Remove gap to let margin:auto handle spacing */
    gap: 0;
}

.sidebar-header {
    font-family: var(--font-tech);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 0;
    /* Margin handled by grid spacing */
    flex-shrink: 0;
    /* Never shrink header */
}

/* Spacer removed */

#grid {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    display: grid;
    /* CSS Grid */
    grid-template-columns: repeat(3, 100px);
    /* 3 Columns */
    gap: 12px;
    width: fit-content;
    /* FIX: Robust vertical centering */
    margin: auto;
    /* Center columns horizontally */
    transform-origin: center center !important;

    /* Center tiles within cells */
    justify-items: center;
    /* Center tiles within cells */
}

#grid .char-tile {
    margin: 0 !important;
}

/* ── MAIN CONTENT (TABS + VIEW) ── */
#main-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.4);
    /* Darker bg for main area */
}

/* TABS HEADER */
.main-tabs {
    flex-shrink: 0;
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    /* FIX: Remove padding to let buttons touch edges */
    gap: 0;
    /* FIX: Remove gap, use button padding */
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn {
    background: none;
    border: none;
    font-family: var(--font-tech);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color 0.3s, background 0.3s, text-shadow 0.3s;
    padding: 0 32px;
    /* FIX: Large lateral padding */
    height: 100%;
    /* FIX: Full height clickable area */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    /* Separator */
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
    /* Visual feedback */
}

.tab-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    /* Overlap border */
    left: 0;
    width: 100%;
    height: 2px;
    /* Thicker active line */
    background: #fff;
    box-shadow: 0 0 10px #fff;
}

/* VIEW PANELS */
.view-panel {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    display: none;
    /* Hidden by default */
}

.view-panel.active {
    display: flex;
    /* Show when active */
    flex-direction: column;
}

/* ── CAMERA VIEW ── */
#view-camera {
    /* Center the camera content */
    background: rgba(0, 0, 0, 0.2);
}

.security-camera {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    transform: none !important;
    border: none !important;
    background: transparent !important;
}

#surveillance-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the area */
}

/* ── TERMINAL VIEW (Full Screen Style) ── */
#view-terminal {
    background: #000;
}

#hud-terminal-container {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: none !important;
    flex-grow: 1;
    padding: 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
}

#hud-terminal-content {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    /* Typography tweaks for large terminal feeling */
    font-size: 12px;
    line-height: 1.8;
}

.terminal-line {
    margin-bottom: 4px;
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 768px) {
    #app-container {
        position: fixed;
        flex-direction: column;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 40px;
        /* footer space */
        gap: 0;
        overflow-y: auto;
        /* Allow scrolling within container */
        pointer-events: auto;
        /* Enable clicks */
        padding: 10px;
    }

    #sidebar-left {
        width: 100%;
        max-width: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 10px;
        order: 3;
        /* Grid at bottom */
    }

    #grid {
        justify-content: center;
    }

    #main-content {
        width: 100%;
        height: auto;
        min-height: 50vh;
        order: 1;
        /* Main content first */
        margin-bottom: 20px;
    }
}