/* ================================================================
   DESKTOP ICONS — draggable shortcuts living on the desktop layer.
   Rendered by modules/desktop-icons.js, persisted via persistence.js.

   Visual: transparent (no tile chrome) — just the boxicon glyph + a
   label below. Drop-shadow on the glyph + text-shadow on the label
   keep both readable on any wallpaper. Selection paints a subtle
   highlight on the whole button + an orange pill on the label.
   ================================================================ */

.desktop-icons {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    z-index: var(--byte-z-desktop);
    pointer-events: none;
}

.desktop-icon {
    position: absolute;
    width: 100px;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.desktop-icon__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 4px;
    background: transparent;
    border: 0;
    border-radius: var(--byte-r-md);
    color: inherit;
    font: inherit;
    cursor: grab;
    touch-action: none;
    transition: background var(--byte-t-fast),
                box-shadow var(--byte-t-fast);
}

.desktop-icon__tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    color: var(--byte-primary);
    font-size: 48px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
    transition: transform var(--byte-t-fast),
                filter var(--byte-t-fast);
}

.desktop-icon__tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.desktop-icon__label {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--byte-r-sm);
    font-family: var(--byte-font-mono);
    font-size: var(--byte-fs-xs);
    line-height: 1.3;
    color: var(--byte-text);
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75),
                 0 0 6px rgba(0, 0, 0, 0.45);
    transition: background var(--byte-t-fast),
                color var(--byte-t-fast),
                text-shadow var(--byte-t-fast);
}

/* Hover */
.desktop-icon__btn:hover .desktop-icon__tile {
    transform: scale(1.06);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

/* Focus (keyboard) */
.desktop-icon__btn:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px var(--byte-primary-glow);
}

/* Selected (single-click) */
.desktop-icon__btn[data-selected="true"] {
    background: rgba(255, 255, 255, 0.06);
}
.desktop-icon__btn[data-selected="true"] .desktop-icon__label {
    background: var(--byte-primary);
    color: var(--byte-bg);
    text-shadow: none;
}

/* Active mouse-down */
.desktop-icon__btn:active .desktop-icon__tile {
    transform: scale(0.95);
}

/* Touch-primary devices (tablets >767px slip past the mobile rule):
   hide icons because dragging a 56px glyph by finger is unusable, and
   the dock + palette already cover app-launching on touch. */
@media (hover: none) and (pointer: coarse) {
    .desktop-icons { display: none; }
}

/* Dragging — no transition lag, grabbing cursor, lifted glyph */
.desktop-icon.is-dragging {
    z-index: 5;
}
.desktop-icon.is-dragging .desktop-icon__btn {
    cursor: grabbing;
    background: transparent;
    box-shadow: none;
}
.desktop-icon.is-dragging .desktop-icon__tile {
    transform: scale(1.1);
    transition: none;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6));
}
.desktop-icon.is-dragging .desktop-icon__label {
    opacity: 0.85;
}
