/* ============================================
   FNAF 1-2 Security Camera Theme
   Authentic FNAF aesthetic: dark grays, white
   text, amber accents, desaturated camera look
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=Press+Start+2P&family=Share+Tech+Mono&display=swap');

:root {
    /* FNAF Authentic Color Palette */
    --bg-darkest: #050505;
    --bg-dark: #0c0c0c;
    --bg-medium: #141414;
    --bg-panel: #0e0e0e;
    --bg-card: #111111;
    --bg-card-hover: #181818;

    /* Grays — the core FNAF look */
    --gray-100: #e0e0e0;
    --gray-200: #b0b0b0;
    --gray-300: #888888;
    --gray-400: #555555;
    --gray-500: #333333;
    --gray-600: #222222;
    --gray-700: #1a1a1a;

    /* Warm amber (pizzeria lighting) */
    --amber: #d4a24a;
    --amber-dim: #a07830;
    --amber-dark: #604820;
    --amber-glow: rgba(212, 162, 74, 0.15);
    --amber-bright: #e8b84a;

    /* Alert red (REC, warnings) */
    --red-alert: #cc2222;
    --red-dim: #882222;
    --red-glow: rgba(204, 34, 34, 0.25);

    /* Text colors */
    --text-primary: #c8c8c8;
    --text-secondary: #888888;
    --text-dim: #555555;
    --text-bright: #e8e8e8;

    /* Borders */
    --border-color: #222222;
    --border-light: #2a2a2a;
    --border-amber: rgba(212, 162, 74, 0.25);

    /* Fonts */
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-pixel: 'Press Start 2P', monospace;
    --font-vhs: 'VT323', monospace;
    --font-news: 'Times New Roman', Times, serif;

    /* Layout */
    --cam-bar-height: 40px;
    --map-height: 220px;
}

/* ---- Base ---- */
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000000;
    color: var(--text-primary);
    font-family: var(--font-mono);
    cursor: default;
    user-select: none;
}

/* ============================================
   SPA STATE MANAGEMENT & VIEWS
   ============================================ */

/* Hide everything by default, controlled by body classes */
.intro-screen,
.office-view,
.camera-system {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

body.state-intro .intro-screen {
    display: flex;
}

body.state-office .office-view {
    display: block;
}

body.state-cameras .office-view {
    display: block;
}

/* Office stays behind cameras */
body.state-cameras .camera-system {
    display: block;
}

/* ──── 1. INTRO SCREEN (NEWSPAPER) ──── */
.intro-screen {
    background: radial-gradient(circle at center, #666, #111);
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.intro-screen__newspaper {
    background: #e8e6df;
    color: #1a1a1a;
    padding: 30px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    font-family: var(--font-news);
    position: relative;
    transform: rotate(-1deg);
}

.newspaper-header {
    border-bottom: 4px solid #1a1a1a;
    border-top: 1px solid #1a1a1a;
    padding: 10px 0;
    text-align: center;
    margin-bottom: 15px;
}

.newspaper-header h1 {
    font-size: 50px;
    font-weight: 900;
    letter-spacing: 2px;
    margin: 5px 0;
}

.newspaper-blurb {
    font-size: 11px;
    color: #444;
    font-family: var(--font-mono);
    text-transform: uppercase;
    opacity: 0.6;
}

.intro-screen__newspaper h2 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
}

.newspaper-content {
    display: flex;
    gap: 20px;
}

.newspaper-img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.2) sepia(0.2);
    border: 2px solid #1a1a1a;
}

.newspaper-text {
    flex: 1;
    font-size: 18px;
    line-height: 1.4;
}

.newspaper-job {
    font-weight: bold;
    font-size: 22px;
    margin-bottom: 15px;
}

.newspaper-desc {
    margin-bottom: 15px;
}

.newspaper-warning {
    font-style: italic;
    font-weight: bold;
    margin-bottom: 15px;
}

.newspaper-pay {
    text-align: right;
    font-weight: bold;
    font-size: 20px;
    border-top: 2px dashed #1a1a1a;
    padding-top: 10px;
}

.intro-screen__start-btn {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--red-dim);
    color: white;
    border: 2px solid var(--red-alert);
    padding: 10px 20px;
    font-family: var(--font-pixel);
    font-size: 10px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 0 10px var(--red-glow);
    transition: all 0.2s;
}

.intro-screen__start-btn:hover {
    background: var(--red-alert);
    box-shadow: 0 0 20px var(--red-alert);
    transform: translateX(-50%) scale(1.05);
}

/* ──── 2. OFFICE VIEW ──── */
.office-view {
    z-index: 100;
}

.office-view__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://upload.wikimedia.org/wikipedia/en/2/25/Five_Nights_at_Freddy%27s_Office.png');
    background-size: cover;
    background-position: center;
    filter: brightness(0.6) contrast(1.2);
    z-index: 1;
}

/* Desk Monitor showing About Info */
.office-view__monitor {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 450px;
    background: #080808;
    border: 20px solid #111;
    border-radius: 10px;
    border-bottom-width: 40px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(255, 255, 255, 0.05);
    z-index: 2;
}

.office-view__monitor::after {
    content: 'TMT-9000';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #333;
    font-family: var(--font-pixel);
    font-size: 8px;
    letter-spacing: 2px;
}

.office-view__monitor-screen {
    width: 100%;
    height: 100%;
    background: url('../assets/bg/office.jpg') center/cover;
    background-color: rgba(5, 5, 5, 0.85);
    background-blend-mode: overlay;
    overflow: hidden;
    position: relative;
    padding: 20px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 1);
}

.office-about {
    color: var(--gray-200);
    font-size: 14px;
    line-height: 1.6;
}

/* Camera Flip Button Area (Hover bottom of screen) */
.office-view__cam-flip-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    /* Large hover area at bottom */
    z-index: 1500;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    cursor: pointer;
}

.office-view__cam-flip-btn {
    width: 400px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.office-view__cam-flip-btn::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.office-view__cam-flip-area:hover .office-view__cam-flip-btn {
    background: rgba(255, 255, 255, 0.2);
    height: 40px;
}

/* ──── 3. CAMERA SYSTEM OVERLAYS & ANIMATIONS ──── */
.camera-system {
    z-index: 800;
    /* Above office, below CRT overlay */
    transform: translateY(100%);
    /* Hidden by default */
    transition: transform 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}

/* When active, slide up */
body.state-cameras .camera-system {
    transform: translateY(0);
}

.camera-system__flip-down {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.camera-system__flip-down:hover {
    background: rgba(255, 255, 255, 0.2);
    height: 50px;
    color: white;
}

/* ---- Monitor Container ---- */
.monitor {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-darkest);
    overflow: hidden;
}

/* ---- CRT Overlay Effects ---- */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.crt-overlay .scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(to bottom,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.12) 2px,
            rgba(0, 0, 0, 0.12) 4px);
    animation: scanline-pulse 4s ease-in-out infinite;
    z-index: 1001;
}

.crt-overlay .vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center,
            transparent 50%,
            rgba(0, 0, 0, 0.35) 80%,
            rgba(0, 0, 0, 0.7) 100%);
    z-index: 1002;
}

.crt-overlay .static-noise {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    opacity: 0.05;
    animation: grain 0.5s steps(6) infinite;
    z-index: 1003;
}

.crt-overlay .tracking-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.02);
    animation: vhs-tracking 8s linear infinite;
    z-index: 1004;
}

/* Camera switch flash */
.camera-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darkest);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
}

.camera-flash.active {
    animation: camera-switch 0.4s ease-out forwards;
}

/* ---- Top Camera Bar ---- */
.cam-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--cam-bar-height);
    background: rgba(5, 5, 5, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 900;
    font-family: var(--font-vhs);
    font-size: 18px;
}

.cam-bar__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cam-bar__logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--gray-500);
    object-fit: cover;
}

.cam-bar__username {
    color: var(--gray-200);
    letter-spacing: 2px;
    font-size: 18px;
}

.cam-bar__center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cam-bar__cam-id {
    color: var(--text-bright);
    font-size: 24px;
    letter-spacing: 4px;
}

.cam-bar__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cam-bar__rec {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--red-alert);
    font-size: 14px;
    letter-spacing: 2px;
}

.cam-bar__rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red-alert);
    box-shadow: 0 0 4px var(--red-glow);
    animation: rec-blink 1s step-end infinite;
}

.cam-bar__time {
    color: var(--gray-300);
    font-size: 18px;
    letter-spacing: 1px;
}

.cam-bar__settings-btn {
    background: none;
    border: 1px solid var(--gray-600);
    color: var(--gray-300);
    padding: 3px 10px;
    font-family: var(--font-vhs);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cam-bar__settings-btn:hover {
    color: var(--text-bright);
    border-color: var(--gray-400);
}

/* ---- Main Camera Viewport ---- */
/* Full-screen feed, map overlays on bottom */
.cam-viewport {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-600) var(--bg-dark);
    background-size: cover;
    background-position: center;
    background-color: #050505;
    transition: background-image 0s;
}

.cam-feed {
    display: none;
    padding: 30px;
}

.cam-feed::-webkit-scrollbar {
    width: 5px;
}

.cam-feed::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.cam-feed::-webkit-scrollbar-thumb {
    background: var(--gray-600);
}

.cam-feed.active {
    display: block;
    animation: static-burst 0.3s forwards;
}

/* ──── NEW: Content Panel for dark overlay over backgrounds ──── */
.content-panel {
    background: rgba(10, 10, 10, 0.90);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    max-width: 900px;
    margin: 0 auto;
}

/* Camera feed header */
.cam-feed__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.cam-feed__header-id {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--amber);
    letter-spacing: 2px;
}

.cam-feed__header-title {
    font-family: var(--font-vhs);
    font-size: 26px;
    color: var(--text-bright);
    letter-spacing: 3px;
}

.cam-feed__header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
}

/* ============================================
   FNAF CAMERA MAP — Bottom overlay
   Styled like the actual FNAF 1 camera map
   ============================================ */
.cam-map {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 380px;
    height: var(--map-height);
    z-index: 800;
    padding: 12px;
    pointer-events: none;
    /* let clicks through except on buttons */
}

.cam-map__inner {
    position: relative;
    width: 100%;
    height: 100%;
    border: 1px solid var(--gray-600);
    background: rgba(8, 8, 8, 0.88);
    pointer-events: auto;
}

/* Map title */
.cam-map__title {
    position: absolute;
    top: 6px;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--gray-400);
    letter-spacing: 3px;
    text-transform: uppercase;
    pointer-events: none;
}

/* Map grid lines (schematic feel) */
.cam-map__grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.15;
}

.cam-map__grid-line {
    position: absolute;
    background: var(--gray-500);
}

/* Horizontal lines */
.cam-map__grid-line.h1 {
    top: 33%;
    left: 10%;
    width: 80%;
    height: 1px;
}

.cam-map__grid-line.h2 {
    top: 66%;
    left: 10%;
    width: 80%;
    height: 1px;
}

/* Vertical lines */
.cam-map__grid-line.v1 {
    left: 33%;
    top: 10%;
    height: 80%;
    width: 1px;
}

.cam-map__grid-line.v2 {
    left: 66%;
    top: 10%;
    height: 80%;
    width: 1px;
}

/* Connector lines between rooms */
.cam-map__connector {
    position: absolute;
    background: var(--gray-500);
    opacity: 0.3;
}

/* Camera map buttons — positioned on the "floor plan" */
.cam-map-btn {
    position: absolute;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid var(--gray-500);
    color: var(--gray-300);
    font-family: var(--font-vhs);
    font-size: 13px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    z-index: 2;
}

.cam-map-btn:hover {
    color: var(--text-bright);
    border-color: var(--gray-300);
    background: rgba(40, 40, 40, 0.95);
}

.cam-map-btn.active {
    color: #00ff41;
    /* V3 Request: Green text when active */
    border-color: #00ff41;
    background: rgba(0, 40, 10, 0.5);
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
}

.cam-map-btn__id {
    font-size: 11px;
    opacity: 0.6;
    margin-right: 3px;
}

.cam-map-btn.active .cam-map-btn__id {
    opacity: 1;
}

/* Position each camera on the map like a pizzeria floor plan (6 buttons) */
/* Top row */
.cam-map-btn[data-cam="cam-socials"] {
    top: 15%;
    left: 15%;
}

.cam-map-btn[data-cam="cam-projects"] {
    top: 15%;
    right: 15%;
}

/* Middle row */
.cam-map-btn[data-cam="cam-games"] {
    top: 45%;
    left: 15%;
}

.cam-map-btn[data-cam="cam-waifus"] {
    top: 45%;
    right: 15%;
}

/* Bottom row */
.cam-map-btn[data-cam="cam-watching"] {
    bottom: 15%;
    left: 15%;
}

.cam-map-btn[data-cam="cam-stats"] {
    bottom: 15%;
    right: 15%;
}

/* ---- Bottom Info Strip ---- */
.bottom-strip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 380px;
    height: 36px;
    background: rgba(5, 5, 5, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 800;
    font-family: var(--font-vhs);
    font-size: 14px;
}

.bottom-strip__left {
    display: flex;
    gap: 16px;
    color: var(--gray-400);
}

.bottom-strip__stat-label {
    color: var(--gray-500);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 4px;
}

.bottom-strip__stat-value {
    color: var(--gray-200);
}

.bottom-strip__center {
    color: var(--gray-500);
    font-size: 12px;
    letter-spacing: 1px;
}

.bottom-strip__right {
    color: var(--gray-500);
    font-size: 12px;
}

/* ──── Power Meter System (V3) ──── */
.power-usage-bars {
    display: flex;
    gap: 2px;
    height: 14px;
}

.power-bar {
    width: 8px;
    height: 100%;
    background: var(--gray-600);
}

/* Standard Green */
.power-bar.active:nth-child(1),
.power-bar.active:nth-child(2) {
    background: #00ff41;
    box-shadow: 0 0 4px #00ff41;
}

/* Warning Yellow */
.power-bar.active:nth-child(3),
.power-bar.active:nth-child(4) {
    background: #ffff00;
    box-shadow: 0 0 4px #ffff00;
}

/* Danger Red */
.power-bar.active:nth-child(5) {
    background: var(--red-alert);
    box-shadow: 0 0 4px var(--red-glow);
}

/* ──── Easter Egg Animations ──── */
@keyframes skeleton-run-right {
    0% {
        transform: translateX(-200px) scaleX(1);
        display: block;
    }

    100% {
        transform: translateX(110vw) scaleX(1);
        display: block;
    }
}

@keyframes skeleton-run-left {
    0% {
        transform: translateX(110vw) scaleX(-1);
        display: block;
    }

    100% {
        transform: translateX(-200px) scaleX(-1);
        display: block;
    }
}

.skeleton-running-right {
    animation: skeleton-run-right 5s linear forwards;
}

.skeleton-running-left {
    animation: skeleton-run-left 5s linear forwards;
}

/* ---- Settings Panel ---- */
.settings-panel {
    position: fixed;
    top: var(--cam-bar-height);
    right: 20px;
    width: 260px;
    background: rgba(10, 10, 10, 0.96);
    border: 1px solid var(--gray-600);
    border-top: none;
    padding: 14px;
    z-index: 850;
    transform: translateY(-110%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.settings-panel.open {
    transform: translateY(0);
}

.settings-panel__title {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--amber);
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.settings-panel__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.settings-panel__label {
    font-family: var(--font-vhs);
    font-size: 16px;
    color: var(--gray-300);
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 36px;
    height: 18px;
    background: var(--bg-dark);
    border: 1px solid var(--gray-600);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle.active {
    background: var(--amber-dark);
    border-color: var(--amber-dim);
}

.toggle__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--gray-400);
    transition: all 0.2s;
}

.toggle.active .toggle__knob {
    left: 20px;
    background: var(--amber);
}

/* ---- Utility Classes ---- */
.text-amber {
    color: var(--amber);
}

.text-red {
    color: var(--red-alert);
}

.text-dim {
    color: var(--gray-400);
}

.text-bright {
    color: var(--text-bright);
}

.font-pixel {
    font-family: var(--font-pixel);
}

.font-vhs {
    font-family: var(--font-vhs);
}

.font-mono {
    font-family: var(--font-mono);
}

body.no-scroll {
    overflow: hidden;
}

::selection {
    background: var(--amber-dark);
    color: var(--amber-bright);
}

:focus-visible {
    outline: 1px solid var(--gray-400);
    outline-offset: 2px;
}

/* ──── Power Blackout Animation ──── */
body.power-blackout {
    animation: power-out-tv 5s forwards;
}

body.power-blackout::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../assets/bg/static-crash.gif') center/cover;
    z-index: 99999;
    opacity: 0;
    animation: static-flash 5s forwards;
    pointer-events: none;
}

@keyframes power-out-tv {
    0% {
        filter: brightness(1) contrast(1);
    }

    5% {
        filter: brightness(5) contrast(2) grayscale(100%);
    }

    10% {
        filter: brightness(0);
    }

    100% {
        filter: brightness(0);
    }
}

@keyframes static-flash {
    0% {
        opacity: 0;
    }

    2% {
        opacity: 0.8;
    }

    8% {
        opacity: 1;
    }

    10% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

/* Remove old sidebar styles — no longer used */
.cam-sidebar {
    display: none;
}