/* ── Desktop Layout Overrides ── */

/* Desktop: flex wrapper with sidebar + content */
body.device-desktop #desktop-layout {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Let #app fill remaining space but stay readable */
body.device-desktop #desktop-layout > #app {
    flex: 1;
    min-width: 0;
    max-width: 780px;
    margin: 0 auto;
}

/* Keep 2-column grids on desktop (sidebar takes the extra space) */
body.device-desktop .subject-grid {
    grid-template-columns: repeat(2, 1fr);
}
body.device-desktop .topic-grid {
    grid-template-columns: repeat(2, 1fr);
}
body.device-desktop .other-projects-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* Mobile: no sidebar, block layout */
body.device-mobile #desktop-layout {
    display: block;
}
body.device-mobile #p56-sidebar {
    display: none;
}

/* Hide floating toggle on desktop */
body.device-desktop .p56-mobile-toggle {
    display: none;
}

/* Existing media queries at 560px/600px/480px remain untouched.
   They still fire for narrow desktop windows. Override 3-col
   back to 1-col at narrow widths even on desktop. */
@media (max-width: 800px) {
    /* At narrow widths, 2-col is already the default — no override needed */
}
@media (max-width: 560px) {
    body.device-desktop .subject-grid {
        grid-template-columns: 1fr;
    }
    body.device-desktop .topic-grid {
        grid-template-columns: 1fr;
    }
    body.device-desktop .other-projects-grid {
        grid-template-columns: 1fr;
    }
    body.device-desktop #desktop-layout {
        flex-direction: column;
    }
    body.device-desktop #p56-sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        max-height: none;
    }
}
