/* ===== GRID SYSTEM ===== */
/* Unified grid component for all library views */

/* ===== BASE GRID ===== */
.ds-grid,
.modal-grid {
    display: grid;
    /* Mobile: 3 columns */
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-small);
    padding: var(--spacing-small);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    align-items: start;
    
    /* Sizing */
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    
    /* Grid behavior */
    grid-auto-rows: min-content;
    flex-shrink: 0;
    
    /* Scrolling */
    scroll-behavior: smooth;
    touch-action: pan-y;
    will-change: scroll-position;
}

/* Grid dragging state - no cursor changes */
.ds-grid.dragging,
.modal-grid.dragging {
    user-select: none;
}

/* ===== GRID VARIANTS ===== */
.ds-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ds-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.ds-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Menu grid (3x3) */
.menu-grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-small);
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    align-items: start;
    justify-items: center;
}

/* ===== RESPONSIVE ===== */
/* Always 3 columns minimum - no 2-column breakpoint */
/* On very small screens, just reduce spacing */
@media (max-width: 375px) {
    .ds-grid,
    .modal-grid {
        gap: var(--spacing-xs);
        padding: var(--spacing-xs);
    }
}

@media (min-width: 400px) {
    .ds-grid,
    .modal-grid {
        gap: var(--spacing-medium);
        padding: var(--spacing-medium);
    }
}

/* Modal grids stay at 3 columns since modals are capped at 400px */
/* Removed 768px and 1024px breakpoints - not needed with 400px max modal width */

