/* p9.rs - 8-bit Pixel Art Desktop */

:root {
    --boot-blue: #1A1A4A;
    --teal-a: #2A6A6A;
    --teal-b: #286868;
    --window-bg: #F0E8D0;
    --title-bar: #4A7A9A;
    --title-inactive: #8A8A8A;
    --text-primary: #1A1A1A;
    --text-accent: #4ACA4A;
    --text-light: #FAFAFA;
    --border: #3A3A3A;
    --btn-highlight: #F8F4E8;
    --pixel-red: #CA4A4A;
    --pixel-yellow: #CACA4A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    line-height: 1.8;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    background-color: var(--teal-a);
    background-image:
        repeating-conic-gradient(var(--teal-b) 0% 25%, var(--teal-a) 0% 50%) 0 0 / 4px 4px;
    overflow-x: hidden;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M0,0 L0,14 L4,10 L7,15 L9,14 L6,9 L11,9 Z' fill='white' stroke='black' stroke-width='1'/%3E%3C/svg%3E") 0 0, auto;
}

/* Custom scrollbar */
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--teal-b); }
body::-webkit-scrollbar-thumb { background: var(--title-bar); border: 1px solid var(--border); }

/* Boot Overlay */
#boot-overlay {
    position: fixed;
    inset: 0;
    background: var(--boot-blue);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s ease-in, opacity 0.5s ease-in;
}

#boot-overlay.minimize {
    transform: scale(0.01);
    opacity: 0;
}

#boot-overlay.hidden {
    display: none;
}

#boot-screen {
    text-align: center;
    max-width: 640px;
    width: 90%;
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

#boot-title {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--text-light);
    min-height: 3rem;
}

#boot-ready {
    font-size: 0.75rem;
    color: var(--text-accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

#boot-ready.show {
    opacity: 1;
}

.blink-cursor {
    animation: cursor-blink 530ms step-end infinite;
}

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

/* Desktop Grid */
#desktop {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
    max-width: 960px;
    margin: 0 auto;
}

/* Pixel Window */
.pixel-window {
    border: 1px solid var(--border);
    border-top: 2px solid var(--btn-highlight);
    border-left: 2px solid var(--btn-highlight);
    background: var(--window-bg);
    position: relative;
}

.span-2 {
    grid-column: span 2;
}

.span-full {
    grid-column: 1 / -1;
}

.title-bar {
    height: 24px;
    background: var(--title-bar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    border-bottom: 1px solid var(--border);
}

.title-bar.inactive {
    background: var(--title-inactive);
}

.window-title {
    font-size: 0.6rem;
    color: var(--text-light);
    letter-spacing: 0.05em;
}

.window-buttons {
    display: flex;
    gap: 4px;
}

.btn-close, .btn-min, .btn-max {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid var(--border);
}

.btn-close { background: var(--pixel-red); }
.btn-min { background: var(--pixel-yellow); }
.btn-max { background: var(--text-accent); }

.window-content {
    padding: 12px;
    position: relative;
}

.window-content p {
    margin-bottom: 0.8em;
}

.accent-text {
    color: var(--text-accent);
}

/* Scrollbar decoration */
.scrollbar-deco {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: var(--teal-b);
    border-left: 1px solid var(--border);
}

.scrollbar-deco::after {
    content: '';
    display: block;
    width: 6px;
    height: 30px;
    background: var(--title-bar);
    border: 1px solid var(--border);
    margin: 1px;
}

.text-area {
    padding-right: 12px;
}

/* File List */
.file-list {
    list-style: none;
}

.file-list li {
    padding: 4px 0;
    border-bottom: 1px dotted var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
}

.folder-icon {
    display: inline-block;
    width: 16px;
    height: 12px;
    background: var(--pixel-yellow);
    border: 1px solid var(--border);
    border-radius: 0;
    position: relative;
}

.folder-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    width: 8px;
    height: 4px;
    background: var(--pixel-yellow);
    border: 1px solid var(--border);
    border-bottom: none;
}

/* Gallery / Pixel Canvas */
.gallery-content {
    display: flex;
    justify-content: center;
    padding: 8px;
    background: #1A1A1A;
}

#pixel-canvas {
    display: grid;
    grid-template-columns: repeat(32, 8px);
    grid-template-rows: repeat(16, 8px);
    gap: 0;
}

#pixel-canvas .px {
    width: 8px;
    height: 8px;
}

/* Pixel Chart */
.pixel-chart {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 180px;
    padding: 12px 0;
    justify-content: center;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.chart-bar::before {
    content: '';
    display: block;
    width: 24px;
    height: calc(var(--bar-height) * 8px);
    background: var(--text-accent);
    border: 1px solid var(--border);
}

.chart-bar:nth-child(2n)::before {
    background: var(--title-bar);
}

.chart-bar:nth-child(3n)::before {
    background: var(--pixel-yellow);
}

.bar-label {
    font-size: 0.5rem;
    color: var(--text-primary);
}

/* Shutdown */
#shutdown {
    min-height: 70vh;
    background: var(--boot-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin-top: 40px;
}

.dialog {
    max-width: 320px;
    width: 100%;
}

.dialog .window-content {
    text-align: center;
}

.dialog .window-content p {
    font-size: 0.7rem;
    color: var(--text-primary);
}

.shutdown-cursor {
    margin-top: 1em;
    color: var(--text-accent);
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    #desktop {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .span-full {
        grid-column: span 1;
    }

    #pixel-canvas {
        grid-template-columns: repeat(32, 6px);
        grid-template-rows: repeat(16, 6px);
    }

    #pixel-canvas .px {
        width: 6px;
        height: 6px;
    }
}
