/* ==========================================================================
   Wim OS — responsive behaviour
   The desktop metaphor survives on phones: icons, taskbar and windows stay,
   windows simply stop floating and fill the screen.
   ========================================================================== */

/* Tablets / small laptops */
@media (max-width: 900px) {
    .explorer-sidebar {
        width: 124px;
    }

    .sysinfo-layout,
    .welcome-body,
    .about-layout {
        gap: 12px;
    }
}

@media (max-width: 700px) {
    :root {
        --taskbar-height: 40px;
        --desktop-icon-width: 68px;
    }

    /* Windows become near-fullscreen sheets; dragging is disabled in JS. */
    .retro-window {
        top: 6px !important;
        left: 6px !important;
        width: calc(100vw - 12px) !important;
        height: calc(100dvh - var(--taskbar-height) - 12px) !important;
        max-width: none;
        max-height: none;
    }

    .window-titlebar {
        height: 26px;
    }

    .window-control {
        width: 22px;
        height: 20px;
    }

    .window-resize {
        display: none;
    }

    .desktop-icons {
        grid-auto-flow: row;
        grid-template-rows: none;
        grid-template-columns: repeat(auto-fill, var(--desktop-icon-width));
        justify-content: space-evenly;
        gap: 2px 0;
    }

    .start-button {
        height: 30px;
    }

    .task-buttons {
        height: 30px;
    }

    .task-button {
        flex: 1 1 0;
        height: 28px;
    }

    .task-button__label {
        display: none;
    }

    .tray {
        height: 30px;
    }

    .taskbar-separator {
        display: none;
    }

    .start-menu {
        width: min(260px, calc(100vw - 12px));
        max-height: calc(100dvh - var(--taskbar-height) - 10px);
        overflow: auto;
    }

    .start-menu__item {
        padding: 9px 12px 9px 8px;
    }

    /* Stacked forms and split layouts */
    .form-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .welcome-body,
    .about-layout,
    .sysinfo-layout {
        flex-direction: column;
    }

    .welcome-portrait {
        width: 100%;
        max-width: 220px;
        align-self: center;
    }

    .about-portrait {
        width: 118px;
    }

    .sysinfo-visual {
        width: 100%;
    }

    .component-list {
        columns: 1;
    }

    .explorer-body {
        flex-direction: column;
    }

    .explorer-sidebar {
        width: 100%;
        max-height: 108px;
        padding: 8px;
    }

    .explorer-sidebar section {
        margin-bottom: 8px;
    }

    .file-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Comfortable tap targets */
    .retro-button,
    .toolbar-button,
    .tab {
        min-height: 30px;
    }

    .desktop-icon {
        padding: 6px 2px;
    }
}

@media (max-width: 420px) {
    .file-grid {
        grid-template-columns: 1fr;
    }

    .window-menu {
        overflow-x: auto;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .boot-screen {
        font-size: 12px;
        padding: 24px 20px;
    }
}

/* Short viewports (landscape phones) */
@media (max-height: 480px) {
    .start-menu {
        max-height: calc(100dvh - var(--taskbar-height) - 6px);
        overflow: auto;
    }
}
