/* ================================================================
   ByteSide.io — OS shell styles
   Chrome only: wallpaper, menubar, windows, dock, palette, notifs.
   App-specific styles live in apps/*.css (created as needed).
   All values come from tokens.css (`--byte-*` prefix).
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: var(--byte-font-ui);
    color: var(--byte-text);
    background: var(--byte-bg);
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    cursor: default;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

/* Backdrop-filter fallback for browsers that don't support it */
@supports not (backdrop-filter: blur(10px)) {
    .menubar, .dock, .window, .palette { background: var(--byte-surface) !important; }
}

/* ================================================================
   NOSCRIPT
   ================================================================ */
.noscript-banner {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px;
    overflow-y: auto;
    background: var(--byte-bg);
    color: var(--byte-text);
    font-family: var(--byte-font-mono);
    font-size: 14px;
    line-height: 1.55;
    text-align: center;
}
.noscript-banner p { max-width: 560px; margin: 0; }
.noscript-banner hr { width: 100%; max-width: 240px; border: 0; border-top: 1px solid var(--byte-border-subtle, rgba(255,255,255,0.12)); margin: 4px 0; }
.noscript-banner strong { color: var(--byte-primary); }

/* ================================================================
   WALLPAPER + HELLO
   ================================================================ */
.wallpaper {
    position: fixed;
    inset: 0;
    z-index: var(--byte-z-wallpaper);
    background:
        radial-gradient(ellipse 90% 70% at 30% 20%, rgba(253,125,0,0.10), transparent 55%),
        radial-gradient(ellipse 80% 60% at 80% 80%, rgba(1,83,81,0.18), transparent 55%),
        linear-gradient(180deg, var(--byte-ink-950) 0%, var(--byte-bg-2) 40%, var(--byte-bg) 100%);
}
.wallpaper__grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(ellipse at 50% 50%, black 20%, transparent 75%);
}
.wallpaper__vignette {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
}
.wallpaper__animated {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
}
.wallpaper__clock {
    position: absolute;
    bottom: calc(var(--byte-dock-h) + 48px);
    right: 48px;
    text-align: right;
    pointer-events: none;
    opacity: 0;
}
.wallpaper__clock.is-visible { opacity: 1; }

.wallpaper__clock-time {
    font-family: var(--byte-font-ui);
    font-size: 56px;
    font-weight: 200;
    line-height: 1;
    letter-spacing: -0.03em;
    color: rgba(232, 238, 241, 0.12);
    text-shadow:
        0 0 30px rgba(253, 125, 0, 0.08),
        0 0 80px rgba(253, 125, 0, 0.04);
    font-variant-numeric: tabular-nums;
}

.wallpaper__clock-date {
    font-family: var(--byte-font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: rgba(232, 238, 241, 0.25);
    margin-top: 8px;
}
.wallpaper__clock-date::before {
    content: '// ';
    color: rgba(253, 125, 0, 0.35);
}

/* ================================================================
   MENU BAR
   ================================================================ */
.menubar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--byte-menubar-h);
    background: linear-gradient(180deg, rgba(12, 24, 30, 0.92), rgba(8, 18, 23, 0.88));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--byte-border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: var(--byte-z-menubar);
    font-size: var(--byte-fs-sm);
    gap: 2px;
}
.menubar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--byte-primary) 30%, var(--byte-accent) 70%, transparent);
    opacity: 0.55;
    pointer-events: none;
}
.menubar__logo {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--byte-font-mono);
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}
.menubar__sep {
    width: 1px;
    height: 14px;
    background: var(--byte-border-strong);
    margin: 0 8px;
    flex-shrink: 0;
}
.menubar__logo::before {
    content: '';
    width: 18px; height: 18px;
    background-image: url('/assets/icons/favicon-96x96.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 6px var(--byte-primary-glow));
}
.menubar__logo-side { color: var(--byte-primary); }
.menubar__logo-dot  { color: var(--byte-primary); font-weight: 700; animation: pulse-dot 2.4s ease-in-out infinite; }
.menubar__logo-io   { color: var(--byte-text-muted); font-weight: 500; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1;    color: var(--byte-primary); }
    50%      { opacity: 0.55; color: var(--byte-primary-hover); }
}
@media (prefers-reduced-motion: reduce) {
    .menubar__logo-dot { animation: none; }
}
.menubar__app, .menubar__menu {
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: 500;
    color: var(--byte-text-muted);
    transition: background var(--byte-t-fast), color var(--byte-t-fast);
}
.menubar__app {
    color: var(--byte-text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--byte-border);
    transform: translateY(1px);
}
.menubar__app i {
    font-size: 14px;
    color: var(--byte-primary);
}
.menubar__app:hover, .menubar__menu:hover { background: rgba(255,255,255,0.06); color: var(--byte-text); }
.menubar__spacer { flex: 1; }
.menubar__tray {
    display: flex; align-items: center; gap: 0;
    color: var(--byte-text-muted);
    font-family: var(--byte-font-mono);
    font-size: var(--byte-fs-sm);
}
.menubar__tray::before {
    content: '';
    width: 1px; height: 14px;
    background: var(--byte-border-strong);
    margin-right: 6px;
}
.tray-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 5px;
    transition: background var(--byte-t-fast);
    position: relative;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
}
.tray-item + .tray-item::before {
    content: '';
    position: absolute;
    left: -1px; top: 50%;
    transform: translateY(-50%);
    width: 1px; height: 12px;
    background: var(--byte-border);
}
.tray-item:hover { background: rgba(255,255,255,0.06); color: var(--byte-text); }
.tray-item:hover + .tray-item::before,
.tray-item:hover::before { opacity: 0; }
.tray-item__icon          { font-size: 14px; transition: color var(--byte-t-fast); }
.tray-item__icon--coffee  { color: var(--byte-coffee); }
.tray-item__icon--offline { color: var(--byte-text-subtle); }
.tray-item__branch        { color: var(--byte-primary); font-weight: 500; }
.tray-clock               { font-variant-numeric: tabular-nums; color: var(--byte-text); font-weight: 500; }

.tray-item[data-tray="coffee"],
.tray-item[href]               { cursor: pointer; }
.tray-item:focus-visible {
    outline: 2px solid var(--byte-primary);
    outline-offset: 1px;
    border-radius: 5px;
}
.tray-item--bumped { animation: tray-bump 320ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes tray-bump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .tray-item--bumped { animation: none; }
}

/* ================================================================
   DESKTOP — windows host
   ================================================================ */
.desktop {
    position: fixed;
    top: var(--byte-menubar-h);
    left: 0; right: 0; bottom: 0;
    z-index: var(--byte-z-desktop);
}

/* ================================================================
   PWA Window Controls Overlay (WCO)
   ----------------------------------------------------------------
   Aktiv NUR wenn voidcore als PWA installiert ist UND der Browser
   WCO supportet (Chrome/Edge 105+). Andere Display-Modes (browser-
   tab, standalone, fullscreen) ignorieren diesen Block.

   Sync-Pflicht: jedes neue interaktive Menubar-Element in
   `lib/shell.php` MUSS hier in der no-drag-Selektorenliste
   ergänzt werden, sonst initiiert Klick darauf einen Window-Drag
   statt zu klicken.
   ================================================================ */

@media (display-mode: window-controls-overlay) {
    /* Drag-Region: die Menubar-Oberfläche (Logo, Sep, Spacer, Bg).
       Mausdown auf nicht-interaktive Bereiche zieht das Fenster. */
    .menubar {
        -webkit-app-region: drag;
        app-region: drag;
        /* Safe-Area: links für macOS Traffic-Lights, rechts für
           Windows Min/Max/Close. env() updates reaktiv on resize.
           Additiv zur existing `padding: 0 12px` (Z. 123) — die 12px
           bleiben als visueller Buffer erhalten.
           Sync-Pflicht: falls Z.123-Padding (`0 12px`) sich ändert,
           hier auch anpassen. */
        padding-left: calc(env(titlebar-area-x, 0px) + 12px);
        padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 12px);
    }

    /* No-Drag: alle interaktiven Children (Klicks/Hover bleiben funktional).
       .menubar__logo absichtlich NICHT in der Liste — non-interactive,
       erbt drag, User kann via Logo-Klick+Ziehen das Fenster bewegen
       (Standard-Native-App-UX). Falls Logo später einen Click-Handler
       bekommt, hier no-drag ergänzen. */
    .menubar__app,
    .menubar__menu,
    .menubar__tray,
    .menubar__tray *,
    #spotlight-btn,
    #sound-btn,
    #sysmon-btn,
    #music-btn {
        -webkit-app-region: no-drag;
        app-region: no-drag;
    }
}

