/* ==========================================================================
   Wim OS — desktop shell
   Boot screen, wallpaper, desktop icons, taskbar, tray, start menu.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Boot sequence
   -------------------------------------------------------------------------- */

.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px min(8vw, 80px);
    background: #000;
    color: #c8c8c8;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
}

.boot-screen[hidden] {
    display: none !important;
}

.boot-logo {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #d8d8d8;
}

.boot-logo small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: normal;
    letter-spacing: 1px;
    color: #6f6f6f;
}

.boot-log {
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: 46ch;
}

.boot-log li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    opacity: 0;
}

.boot-log li.is-shown {
    opacity: 1;
}

.boot-log .boot-ok {
    color: #4ade4a;
}

.boot-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    margin-left: 2px;
    background: #c8c8c8;
    vertical-align: text-bottom;
    animation: blink 1s steps(1) infinite;
}

.boot-skip {
    position: absolute;
    right: 20px;
    bottom: 18px;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Desktop + wallpaper
   -------------------------------------------------------------------------- */

.desktop {
    position: fixed;
    inset: 0 0 var(--taskbar-height) 0;
    /* `clip` (not `hidden`) so the desktop never becomes a scroll container:
       focusing a control inside a hidden-overflow box scrolls it and would
       drag the whole UI out of place. */
    overflow: hidden;
    overflow: clip;
    background: var(--desktop-bg);
}

/* Original XP-flavoured wallpaper: sky gradient, soft clouds, green hill. */
.desktop[data-wallpaper="hills"] {
    background:
        radial-gradient(120% 60% at 20% 92%, rgba(255, 255, 255, 0.16) 0 40%, transparent 60%),
        linear-gradient(to bottom, #2b5c9b 0%, #4a86c8 34%, #7fb6e2 58%, #b9dcf2 68%, #b9dcf2 100%);
}

.desktop[data-wallpaper="hills"]::before {
    /* the hill */
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: -14%;
    height: 48%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: linear-gradient(to bottom, #7cb342 0%, #5d9a30 45%, #3f7a1f 100%);
    box-shadow: inset 0 6px 22px rgba(255, 255, 255, 0.28);
}

.desktop[data-wallpaper="hills"]::after {
    /* three soft clouds, painted with radial gradients only */
    content: "";
    position: absolute;
    inset: 0 0 40% 0;
    pointer-events: none;
    background:
        radial-gradient(40px 22px at 18% 22%, rgba(255, 255, 255, 0.85), transparent 70%),
        radial-gradient(64px 30px at 24% 26%, rgba(255, 255, 255, 0.7), transparent 70%),
        radial-gradient(52px 26px at 72% 14%, rgba(255, 255, 255, 0.72), transparent 70%),
        radial-gradient(38px 20px at 66% 17%, rgba(255, 255, 255, 0.6), transparent 70%),
        radial-gradient(48px 24px at 88% 34%, rgba(255, 255, 255, 0.5), transparent 70%);
}

.desktop[data-wallpaper="teal"] {
    background: #008080;
}

.desktop[data-wallpaper="night"] {
    background:
        radial-gradient(90% 60% at 50% 110%, #14204a 0%, transparent 70%),
        linear-gradient(to bottom, #05070f 0%, #0b1330 60%, #101a3d 100%);
}

.desktop[data-wallpaper="night"]::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* faint star field */
    background-image:
        radial-gradient(1px 1px at 12% 18%, #fff, transparent),
        radial-gradient(1px 1px at 34% 42%, #cfe0ff, transparent),
        radial-gradient(1px 1px at 58% 12%, #fff, transparent),
        radial-gradient(1px 1px at 78% 33%, #b9c9ff, transparent),
        radial-gradient(1px 1px at 88% 9%, #fff, transparent),
        radial-gradient(1px 1px at 46% 24%, #fff, transparent);
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Desktop icons
   -------------------------------------------------------------------------- */

.desktop-icons {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--desktop-icon-width));
    grid-auto-rows: 82px;
    grid-auto-flow: column;
    justify-content: start;
    align-content: start;
    gap: 4px;
    padding: 8px 6px;
    /* Keep the flow to one visible column-height, the rest wraps into a new column */
    grid-template-rows: repeat(auto-fill, 82px);
    max-height: 100%;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: var(--desktop-icon-width);
    padding: 4px 2px;
    background: none;
    border: 1px dotted transparent;
    color: var(--desktop-icon-label);
    font-size: 12px;
    text-align: center;
    cursor: default;
    user-select: none;
}

.desktop-icon .icon-glyph {
    width: 32px;
    height: 32px;
    flex: none;
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.45));
}

.desktop-icon .icon-label {
    padding: 1px 3px;
    line-height: 1.25;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.85);
    word-break: break-word;
}

.desktop-icon.is-selected .icon-label {
    background: var(--selection);
    color: var(--selection-text);
    text-shadow: none;
}

.desktop-icon.is-selected .icon-glyph {
    /* classic blue selection wash over the bitmap */
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.45)) brightness(0.75) sepia(1) hue-rotate(190deg) saturate(3);
}

.desktop-icon:focus-visible {
    outline: none;
    border-color: var(--win-light);
}

/* --------------------------------------------------------------------------
   Taskbar
   -------------------------------------------------------------------------- */

.taskbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 4px;
    height: var(--taskbar-height);
    padding: 2px 3px;
    background: var(--win-face);
    border-top: 2px solid var(--win-light);
}

.start-button {
    min-width: 0;
    gap: 4px;
    padding: 2px 8px 2px 5px;
    font-weight: bold;
    height: 26px;
}

.start-button .icon-glyph {
    width: 18px;
    height: 18px;
}

.taskbar-separator {
    width: 2px;
    height: 22px;
    flex: none;
    border-left: 1px solid var(--win-shadow);
    border-right: 1px solid var(--win-light);
}

.task-buttons {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1 1 auto;
    min-width: 0;
    height: 26px;
    overflow: hidden;
}

.task-button {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 0 1 160px;
    min-width: 40px;
    height: 24px;
    padding: 2px 7px;
    justify-content: flex-start;
    text-align: left;
    font-size: 12px;
}

.task-button .icon-glyph {
    width: 16px;
    height: 16px;
    flex: none;
}

.task-button .task-button__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-button.is-active {
    border-top-color: var(--win-shadow);
    border-left-color: var(--win-shadow);
    border-right-color: var(--win-light);
    border-bottom-color: var(--win-light);
    box-shadow: none;
    font-weight: bold;
    background:
        repeating-conic-gradient(var(--win-light) 0 25%, var(--win-face) 0 50%) 0 0 / 2px 2px;
}

/* --------------------------------------------------------------------------
   System tray
   -------------------------------------------------------------------------- */

.tray {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 26px;
    padding: 0 6px 0 4px;
    border-top: 2px solid var(--win-shadow);
    border-left: 2px solid var(--win-shadow);
    border-right: 2px solid var(--win-light);
    border-bottom: 2px solid var(--win-light);
}

.tray-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    min-width: 0;
    min-height: 0;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
}

.tray-icon .icon-glyph {
    width: 16px;
    height: 16px;
}

.tray-lang {
    min-width: 26px;
    min-height: 20px;
    padding: 1px 4px;
    font-size: 11px;
    font-weight: bold;
    box-shadow: none;
}

.tray-clock {
    min-width: 44px;
    padding: 0 2px;
    font-size: 12px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    cursor: default;
}

/* --------------------------------------------------------------------------
   Start menu
   -------------------------------------------------------------------------- */

.start-menu {
    position: fixed;
    left: 2px;
    bottom: var(--taskbar-height);
    z-index: 4100;
    display: flex;
    width: 236px;
    padding: 2px;
    background: var(--win-face);
    border-top: 2px solid var(--win-light);
    border-left: 2px solid var(--win-light);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    box-shadow: 1px 0 0 var(--win-dark-shadow);
}

.start-menu[hidden] {
    display: none !important;
}

/* The vertical branding gutter down the left edge. */
.start-menu__banner {
    flex: none;
    width: 26px;
    background: linear-gradient(to top, var(--title-active-end), var(--title-active-start));
    color: #fff;
}

.start-menu__banner span {
    display: block;
    padding: 10px 0;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 2px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
}

.start-menu__list {
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}

.start-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px 6px 8px;
    background: none;
    border: 0;
    color: var(--text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.start-menu__item .icon-glyph {
    width: 24px;
    height: 24px;
    flex: none;
}

.start-menu__item:hover,
.start-menu__item:focus-visible {
    background: var(--selection);
    color: var(--selection-text);
    outline: none;
}

.start-menu__item[disabled] {
    color: var(--text-disabled);
    cursor: default;
}

.start-menu__sep {
    height: 2px;
    margin: 3px 2px;
    border-top: 1px solid var(--win-shadow);
    border-bottom: 1px solid var(--win-light);
}
