﻿/* =========================
   ISSUE GRID (Responsive)
========================= */

.issue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 10px;
}

/* Larger cards on bigger screens */
@media (min-width: 768px) {
    .issue-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

.issue-card {
    cursor: pointer;
    text-align: center;
    transition: transform .2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Disable hover zoom on mobile */
@media (hover: hover) {
    .issue-card:hover {
        transform: scale(1.05);
    }
}

.issue-card canvas {
    width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 4px 10px rgba(0,0,0,.2);
    border-radius: 6px;
}


/* =========================
   MODAL
========================= */

#flipModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    overflow: hidden; /* keep background from scrolling */
    z-index: 9999;
    padding: 10px;
}

/* Prevent background scroll ONLY */
body.modal-open {
    overflow: hidden;
}


/* =========================
   BOOK CONTAINER
========================= */

#book {
    width: 95vw;
    max-width: 1100px;
    height: 90vh;
    max-height: 95vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Allow touch gestures inside */
    touch-action: pan-y pinch-zoom;
    /* Allow scrolling inside book on mobile */
    overflow: auto;
}

/* IMPORTANT: Remove forced width scaling */
.page canvas {
    max-width: 100%;
    height: auto;
    display: block;
}


/* =========================
   SMALL MOBILE OPTIMIZATION
========================= */

@media (max-width: 480px) {

    #book {
        width: 100vw;
        height: 92vh;
    }

    .issue-grid {
        gap: 12px;
    }

    /* =========================
   MOBILE SCROLL MODE
========================= */

    #book.scroll-mode {
        display: block;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px 0;
        touch-action: pan-y pinch-zoom;
    }

    .mobile-page {
        width: 100%;
        height: auto;
        margin-bottom: 20px;
        display: block;
    }
}
