/* --- Global & Gallery --- */
/* The main page structure comes from style.css */

/* --- The Grid --- */
.grid-container { 
    display: grid; 
    /* Thumbnail width: min 120px, max 1fr */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 15px; 
    width: 100%;
    padding-top: 10px;
}

.comic-card { 
    position: relative; 
    cursor: pointer; 
    transition: transform 0.2s, box-shadow 0.2s; 
    /* ORANGE BORDER - Hugs the image */
    border: 2px solid #ff9900; 
    border-radius: 0; 
    /* Transparent background to remove black bars */
    background-color: transparent; 
    /* Ensures div shrinks to fit image */
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
}

.comic-card:hover { 
    transform: scale(1.05); 
    box-shadow: 0 0 15px #ff9900; 
    z-index: 10;
}

/* Image styling - Critical for removing gaps */
.img-container {
    line-height: 0; /* Removes phantom space below images */
    width: 100%;
}

.img-container img { 
    width: 100%; 
    height: auto; /* Maintains natural aspect ratio */
    display: block; 
}

/* --- Metadata (Only visible on hover) --- */
.card-text { 
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /* Gradient background for better readability */
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 80%, transparent 100%);
    color: white;
    padding: 10px 5px 5px 5px;
    text-align: center;
    
    /* Hidden by default */
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.2s ease-in-out;
    pointer-events: none; 
}

/* Show on Hover */
.comic-card:hover .card-text {
    opacity: 1;
    transform: translateY(0);
}

.card-text h4 { 
    margin: 0; 
    font-size: 12px; 
    font-weight: bold;
    color: #ff9900;
    text-shadow: 1px 1px 0 #000;
    font-family: Arial, sans-serif;
}

.card-text p { 
    margin: 2px 0 0 0; 
    font-size: 11px; 
    color: #fff; 
    font-family: Arial, sans-serif;
}

/* --- Reader Modal --- */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; top: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); 
    justify-content: center; align-items: center; 
}

.modal-content { 
    position: relative; 
    width: 95vw; height: 95vh; 
    display: flex; justify-content: center; align-items: center; 
    pointer-events: none; 
}

.close-button {
    position: fixed; top: 20px; right: 20px;
    background: #ff4b4b; color: white; border-radius: 50px;
    padding: 10px 25px; cursor: pointer; border: 2px solid white;
    z-index: 20001; 
    pointer-events: auto;
    font-family: Arial, sans-serif;
    font-weight: bold;
}

/* --- Navigation Arrows --- */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4b4b !important;
    color: white;
    border: 3px solid white;
    border-radius: 50%;
    width: 60px; height: 60px;
    font-size: 24px;
    cursor: pointer;
    z-index: 20000; 
    display: flex; justify-content: center; align-items: center;
    pointer-events: auto !important; 
    opacity: 0.8 !important;
    transition: opacity 0.2s, transform 0.2s;
}

.nav-arrow:hover {
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow.left { left: 20px; }
.nav-arrow.right { right: 20px; }

/* --- Image Wrapper --- */
#flipbook-wrapper {
    position: relative;
    width: 100%; height: 100%;
    z-index: 10001; 
    display: flex; justify-content: center; align-items: center;
    pointer-events: auto;
}