/* ==========================================================================
   SILICON OS 95 — os-shell.css
   Desktop background, icons, boot screen, wallpaper, context menu
   ========================================================================== */

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

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: var(--os-void);
    font-family: var(--os-font-body);
    color: var(--os-text);
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Desktop Container ────────────────────────────────────────────────── */
#os-desktop {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.6s ease;
    padding-bottom: var(--os-taskbar-h);
}
#os-desktop.os-ready { opacity: 1; }

/* ── Wallpaper & Grid ─────────────────────────────────────────────────── */
#os-wallpaper {
    position: absolute; inset: 0; z-index: 0;
    background: radial-gradient(ellipse at 20% 30%, rgba(157,0,255,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 70%, rgba(0,188,212,0.07) 0%, transparent 55%),
                var(--os-void);
}

#os-grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(0,188,212,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,188,212,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: grid-pulse 8s ease-in-out infinite;
}
@keyframes grid-pulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1.0; }
}

#os-scanlines {
    position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
}

/* ── Boot Screen ──────────────────────────────────────────────────────── */
#os-boot-screen {
    position: absolute; inset: 0; z-index: 9999;
    background: var(--os-void);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    transition: opacity 0.8s ease;
}
#os-boot-screen.os-boot-done {
    opacity: 0; pointer-events: none;
}

.os-boot-logo {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    animation: boot-flicker 0.1s ease 0s 3;
}
@keyframes boot-flicker {
    0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}
.os-boot-logo__icon {
    font-size: 4rem; color: var(--os-cyan);
    filter: drop-shadow(0 0 20px var(--os-cyan-glow));
    animation: icon-glow 2s ease-in-out infinite alternate;
}
@keyframes icon-glow {
    from { filter: drop-shadow(0 0 12px var(--os-cyan-glow)); }
    to   { filter: drop-shadow(0 0 30px var(--os-cyan-glow)) drop-shadow(0 0 60px var(--os-purple-glow)); }
}
.os-boot-logo__name {
    font-family: var(--os-font-system);
    font-size: 1.8rem; font-weight: 900;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--os-text);
    text-shadow: 0 0 20px var(--os-cyan-glow);
}
.os-boot-logo__sub {
    font-family: var(--os-font-body);
    font-size: 0.78rem; color: var(--os-text-dim);
    letter-spacing: 0.08em;
}

.os-boot-bar {
    width: 280px; height: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,188,212,0.25);
    border-radius: 3px; overflow: hidden;
}
.os-boot-bar__fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--os-purple), var(--os-cyan));
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px var(--os-cyan-glow);
}

.os-boot-status {
    font-family: var(--os-font-system);
    font-size: 0.65rem; letter-spacing: 0.1em;
    color: #ffffff; text-transform: uppercase;
    text-shadow: 0 0 10px var(--os-cyan-glow);
    min-height: 1.2em;
}

/* ── Desktop Icons ────────────────────────────────────────────────────── */
#os-icons {
    position: absolute;
    top: 16px; left: 16px;
    display: grid;
    grid-template-columns: 88px;
    grid-auto-rows: 88px;
    gap: 8px;
    z-index: 10;
}

.os-icon {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px;
    width: 88px; height: 88px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--os-transition);
    padding: 8px 4px;
    color: var(--os-text);
}
.os-icon:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}
.os-icon:focus-visible {
    outline: 2px solid var(--os-cyan);
    outline-offset: 2px;
}
.os-icon.os-icon--selected {
    background: rgba(0,188,212,0.12);
    border-color: rgba(0,188,212,0.35);
}

.os-icon__glyph {
    font-size: 2rem; line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.15));
    transition: filter 0.25s ease, transform 0.2s ease;
}
.os-icon:hover .os-icon__glyph {
    filter: drop-shadow(0 0 16px rgba(255,255,255,0.4));
    transform: scale(1.1);
}

/* Per-color icon glow */
.os-icon[data-color="purple"]:hover .os-icon__glyph { filter: drop-shadow(0 0 16px var(--os-purple-glow)); }
.os-icon[data-color="magenta"]:hover .os-icon__glyph { filter: drop-shadow(0 0 16px var(--os-magenta-glow)); }
.os-icon[data-color="cyan"]:hover   .os-icon__glyph { filter: drop-shadow(0 0 16px var(--os-cyan-glow)); }

.os-icon__label {
    font-family: var(--os-font-body);
    font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
    /* Double shadow: hard drop for legibility + subtle glow */
    text-shadow:
        0 1px 0 rgba(0,0,0,1),
        0 2px 8px rgba(0,0,0,0.9),
        0 0 16px rgba(0,0,0,0.8);
}

/* ── Right-Click Context Menu ─────────────────────────────────────────── */
#os-context-menu {
    position: fixed; z-index: 99990;
    min-width: 200px;
    display: none;
}
#os-context-menu.os-ctx-open { display: block; }

.os-win95-menu {
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    padding: 2px;
}

.os-ctx-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 6px 12px;
    font-family: 'MS Sans Serif', Tahoma, sans-serif;
    font-size: 11px;
    color: #000;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.os-ctx-item:hover {
    background: #000080;
    color: #ffffff;
}
.os-ctx-divider {
    height: 1px;
    background: #808080;
    margin: 2px 4px;
    border-bottom: 1px solid #ffffff;
}

/* ── Taskbar ──────────────────────────────────────────────────────────── */
#os-taskbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--os-taskbar-h);
    z-index: 9000;
    display: flex; align-items: center; gap: 4px;
    padding: 0 6px;
    background: rgba(5,5,8,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,188,212,0.2);
    box-shadow: 0 -4px 30px rgba(0,0,0,0.6);
}

/* Start button — Win95 style with neon twist */
#os-start-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    height: 38px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0a0a14 100%);
    border-top: 2px solid rgba(255,255,255,0.3);
    border-left: 2px solid rgba(255,255,255,0.3);
    border-right: 2px solid rgba(0,0,0,0.5);
    border-bottom: 2px solid rgba(0,0,0,0.5);
    cursor: pointer;
    color: #ffffff;
    font-family: var(--os-font-system);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: var(--os-transition);
    white-space: nowrap;
    flex-shrink: 0;
}
#os-start-btn:hover, #os-start-btn[aria-expanded="true"] {
    background: var(--os-cyan);
    color: var(--os-void);
    box-shadow: 0 0 12px var(--os-cyan-glow);
}
#os-start-btn:active {
    border-top-color: rgba(0,0,0,0.5);
    border-left-color: rgba(0,0,0,0.5);
    border-right-color: rgba(255,255,255,0.3);
    border-bottom-color: rgba(255,255,255,0.3);
}
.os-start-btn__icon { font-size: 1.1rem; }
.os-start-btn__label { font-size: 0.78rem; font-weight: 900; letter-spacing: 0.08em; }

/* Start menu */
#os-start-menu {
    position: absolute; bottom: var(--os-taskbar-h); left: 0;
    width: 220px;
    display: none;
    z-index: 99999;
}
#os-start-menu.os-open { display: block; }

.os-start-menu__header {
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 10px;
    background: linear-gradient(180deg, var(--os-purple) 0%, #1a006b 100%);
    border-bottom: 2px solid #404040;
}
.os-start-menu__header-title {
    font-family: var(--os-font-system);
    font-size: 0.8rem; font-weight: 900;
    color: #fff; letter-spacing: 0.08em;
}
.os-start-menu__header-sub {
    font-size: 0.65rem; color: rgba(255,255,255,0.7);
    letter-spacing: 0.04em;
}
.os-start-menu__body { padding: 2px; }

/* Taskbar window list */
#os-taskbar-windows {
    display: flex; align-items: center; gap: 3px;
    flex: 1; overflow: hidden;
    padding: 0 4px;
}

.os-taskbar-btn {
    display: flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    max-width: 180px; min-width: 90px;
    background: rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.15);
    border-left: 1px solid rgba(255,255,255,0.15);
    border-right: 1px solid rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    cursor: pointer;
    color: #d4e8ec;          /* bright enough to read on near-black taskbar */
    font-family: var(--os-font-body);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: var(--os-transition);
    border-radius: 3px;
}
.os-taskbar-btn:hover { background: rgba(255,255,255,0.10); color: #ffffff; }
.os-taskbar-btn.os-taskbar-btn--active {
    background: rgba(0,188,212,0.15);
    border-color: rgba(0,188,212,0.4);
    color: #00ddf5;   /* brighter cyan for active state */
    font-weight: 700;
}
.os-taskbar-btn__icon { font-size: 0.85rem; flex-shrink: 0; }
.os-taskbar-btn__label { overflow: hidden; text-overflow: ellipsis; }

/* System Tray */
#os-system-tray {
    display: flex; align-items: center; gap: 8px;
    padding: 0 8px 0 4px;
    border-left: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    margin-left: auto;
}

#os-audio-tray {
    display: flex; align-items: center; gap: 5px;
    max-width: 180px; overflow: hidden;
    cursor: pointer;
}
.os-tray-play {
    font-size: 0.75rem; color: var(--os-cyan);
    flex-shrink: 0;
    transition: color 0.2s ease;
}
.os-tray-track {
    font-family: var(--os-font-system);
    font-size: 0.65rem; letter-spacing: 0.06em;
    color: #c8d8da;   /* was rgba(226,232,240,0.55) — too dim to read */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-transform: uppercase;
    max-width: 150px;
}

.os-tray-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.1); flex-shrink: 0; }

.os-clock {
    font-family: var(--os-font-system);
    font-size: 0.78rem; letter-spacing: 0.08em;
    font-weight: 700;
    color: #ffffff;   /* full white — the clock must always be readable */
    white-space: nowrap; flex-shrink: 0;
    cursor: default;
    text-shadow: 0 0 8px rgba(0,188,212,0.4);
}

/* ── Loading Spinner ──────────────────────────────────────────────────── */
.os-spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(0,188,212,0.15);
    border-top-color: var(--os-cyan);
    border-radius: 50%;
    animation: os-spin 0.8s linear infinite;
}
@keyframes os-spin { to { transform: rotate(360deg); } }

/* ── Neon scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; background: var(--os-void); }
::-webkit-scrollbar-track { background: var(--os-deep); }
::-webkit-scrollbar-thumb {
    background: var(--os-cyan);
    border-radius: 4px;
    border: 1px solid var(--os-void);
}
::-webkit-scrollbar-thumb:hover { background: var(--os-purple); }
