/* Pixel Art Portfolio - Global Theme & Retro Design System */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
    /* Default Theme: PICO-8 Fantasy Console */
    --bg-dark: #0f0f1b;
    --bg-desktop: #1d1b32;
    --win-bg: #2b2b44;
    --win-border-light: #5b5b82;
    --win-border-dark: #12121e;
    --win-titlebar: #433f6b;
    --win-titlebar-active: #5f578f;
    --win-titlebar-text: #ffffff;
    --text-primary: #fff1e8;
    --text-secondary: #c2c3c7;
    --text-muted: #5f574f;
    --accent-primary: #ff004d;
    --accent-secondary: #ffa300;
    --accent-gold: #ffec27;
    --accent-cyan: #29adff;
    --accent-green: #00e436;
    --font-pixel: 'Press Start 2P', monospace, sans-serif;
    --font-terminal: 'VT323', monospace, sans-serif;
}

/* CYBERPUNK THEME */
body.theme-cyberpunk {
    --bg-dark: #0a0915;
    --bg-desktop: #120e2e;
    --win-bg: #1c143d;
    --win-border-light: #00f0ff;
    --win-border-dark: #ff0055;
    --win-titlebar: #ff0055;
    --win-titlebar-active: #00f0ff;
    --win-titlebar-text: #050510;
    --text-primary: #e0f8ff;
    --text-secondary: #00f0ff;
    --text-muted: #625d8a;
    --accent-primary: #ff0077;
    --accent-secondary: #ffe600;
    --accent-gold: #ffe600;
    --accent-cyan: #00f0ff;
    --accent-green: #05ffa1;
}

/* GAME BOY DMG THEME */
body.theme-gameboy {
    --bg-dark: #0f380f;
    --bg-desktop: #306230;
    --win-bg: #8bac0f;
    --win-border-light: #9bbc0f;
    --win-border-dark: #0f380f;
    --win-titlebar: #306230;
    --win-titlebar-active: #0f380f;
    --win-titlebar-text: #9bbc0f;
    --text-primary: #0f380f;
    --text-secondary: #306230;
    --text-muted: #306230;
    --accent-primary: #0f380f;
    --accent-secondary: #306230;
    --accent-gold: #8bac0f;
    --accent-cyan: #306230;
    --accent-green: #0f380f;
}

/* DRACULA MIDNIGHT THEME */
body.theme-dracula {
    --bg-dark: #1e1f29;
    --bg-desktop: #282a36;
    --win-bg: #343746;
    --win-border-light: #6272a4;
    --win-border-dark: #191a21;
    --win-titlebar: #44475a;
    --win-titlebar-active: #bd93f9;
    --win-titlebar-text: #282a36;
    --text-primary: #f8f8f2;
    --text-secondary: #8be9fd;
    --text-muted: #6272a4;
    --accent-primary: #ff79c6;
    --accent-secondary: #ffb86c;
    --accent-gold: #f1fa8c;
    --accent-cyan: #8be9fd;
    --accent-green: #50fa7b;
}

/* BASE RESET & PIXEL RENDERING */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* CUSTOM PIXEL CURSOR */
body, button, a, input, select {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath d='M0,0 L0,12 L3,9 L6,14 L8,13 L5,8 L10,8 Z' fill='%23ffffff' stroke='%23000000' stroke-width='1'/%3E%3C/svg%3E"), auto;
}

button:hover, a:hover, .pixel-clickable:hover {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath d='M5,0 L8,0 L8,5 L11,5 L11,8 L12,8 L12,12 L8,12 L8,15 L4,15 L4,10 L3,10 L3,5 L5,5 Z' fill='%23ffec27' stroke='%23000000' stroke-width='1'/%3E%3C/svg%3E"), pointer;
}

/* RETRO PIXEL BUTTON */
.pixel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--win-bg);
    color: var(--text-primary);
    font-family: var(--font-pixel);
    font-size: 9px;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    outline: none;
    box-shadow: 
        inset -2px -2px 0px 0px var(--win-border-dark),
        inset 2px 2px 0px 0px var(--win-border-light),
        inset -4px -4px 0px 0px rgba(0,0,0,0.4);
    transition: transform 0.05s ease;
}

.pixel-btn:hover {
    filter: brightness(1.15);
}

.pixel-btn:active {
    box-shadow: 
        inset 2px 2px 0px 0px var(--win-border-dark),
        inset -2px -2px 0px 0px var(--win-border-light),
        inset 4px 4px 0px 0px rgba(0,0,0,0.4);
    transform: translate(1px, 1px);
}

.pixel-btn.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.pixel-btn.btn-cyan {
    background: var(--accent-cyan);
    color: #000000;
}

.pixel-btn.btn-gold {
    background: var(--accent-gold);
    color: #000000;
}

/* RETRO BEVELED PANEL / CARD */
.pixel-box {
    background: var(--win-bg);
    box-shadow: 
        inset -2px -2px 0px 0px var(--win-border-dark),
        inset 2px 2px 0px 0px var(--win-border-light),
        0 4px 0 rgba(0,0,0,0.3);
    padding: 12px;
}

/* CRT & SCANLINE OVERLAY */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

#crt-overlay.disabled {
    display: none;
}

/* Subtle scanlines pattern */
#crt-overlay::before {
    content: " ";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.4) 50%
    );
    background-size: 100% 4px;
    z-index: 100000;
}

/* Curved CRT vignette and phosphor glow */
#crt-overlay::after {
    content: " ";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(
        circle at center, 
        rgba(0, 0, 0, 0) 60%, 
        rgba(0, 0, 0, 0.5) 90%, 
        rgba(0, 0, 0, 0.85) 100%
    );
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7);
}

/* PIXEL SPEECH BUBBLE */
.pixel-speech-bubble {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: #12121e;
    padding: 8px 12px;
    min-width: 180px;
    max-width: 260px;
    font-size: 8px;
    line-height: 1.4;
    border: 3px solid #12121e;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 500;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pixel-speech-bubble.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
    pointer-events: none;
}

.pixel-speech-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Speech bubble pixel tail */
.pixel-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: calc(50% - 6px);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid #12121e;
}

.pixel-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: calc(50% - 4px);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #ffffff;
    z-index: 1;
}

/* SCROLLBAR RETRO STYLING */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: var(--win-border-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--win-border-light);
    box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #000;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}
