@charset "utf-8";

/* ==========================================================================
   1. CORE GALLERY LAYOUT
   ========================================================================== */
.container_gallery {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    text-align: center;
    box-sizing: border-box;
}

.gallery-description {
    text-align: center;
    margin: 10px 45px 30px 45px;
    font-style: italic;
    color: #555;
    line-height: 1.6;
}

/* ==========================================================================
   2. FILTER MENU
   ========================================================================== */
.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 45px 25px 45px;
    position: relative;
    z-index: 10;
}

.filter-btn {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    padding: 8px 22px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.filter-btn.active {
    background-color: #AF1101;
    color: #ffffff;
    border-color: #AF1101;
}

/* ==========================================================================
   3. THE GRID
   ========================================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 20px;
    margin: 20px auto 40px auto;
    max-width: 1000px; 
    padding: 0 20px;
}

.gallery-item {
    overflow: hidden;
    border-radius: 12px;
    background-color: #ffffff;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #ddd;
    aspect-ratio: 4 / 3;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px rgba(0,0,0,0.2);
    border: 4px solid #AF1101;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* ==========================================================================
   4. LIGHTBOX
   ========================================================================== */
.lightbox {
    display: none;
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: rgba(0,0,0,0.95);
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    position: relative; 
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    border: 4px solid #fff;
    display: block;
}

#lightbox-caption {
    color: #ffffff !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0;
    margin-top: 15px;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: none;
}

.close-lb {
    position: absolute !important; 
    top: 5px !important; 
    right: -85px !important; 
    color: #ffffff !important;
    font-size: 60px !important;
    font-weight: 200 !important;
    cursor: pointer;
    z-index: 10011;
    line-height: 1;
    transition: color 0.3s ease, transform 0.2s ease;
}

.close-lb:hover {
    color: #AF1101 !important;
    transform: scale(1.1);
}

.lb-download-wrapper {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.lb-dl-button {
    font-family: 'Inter', sans-serif;
    background-color: #AF1101 !important;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 35px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border: none;
    display: inline-block;
    text-decoration: none;
}

.lb-dl-button:hover {
    background-color: #8e0e01 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   5. PAGINATION
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.pag-btn {
    display: inline-block;
    background-color: #f1f1f1;
    color: #333;
    padding: 10px 18px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.pag-btn.active {
    background-color: #AF1101;
    color: #ffffff;
    border-color: #AF1101;
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS (Tablet & Large Mobile)
   ========================================================================== */
@media screen and (max-width: 950px) {
    .main-header {
        padding-bottom: 0 !important;
    }

    .container_gallery h1 {
        margin-top: 0 !important;
        padding-top: 5px !important;
        margin-bottom: 10px !important;
        text-align: left !important;
        padding-left: 45px !important;
    }

    .container_gallery {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
    }

    .gallery-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-gap: 12px !important;
        margin: 20px 0 40px 0 !important;
        width: 100% !important;
        padding-left: 45px !important;
        padding-right: 65px !important;
        box-sizing: border-box !important;
    }

    .gallery-item:hover {
        transform: none !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
        border-color: #ddd !important;
    }
    
    .gallery-item:hover img {
        transform: none !important;
    }

    .pagination {
        margin: 0 !important;
        padding-left: 45px !important;
        padding-right: 20px !important;
        width: 100% !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }

    .gallery-description {
        font-size: clamp(11px, 2.5vw, 15px) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        margin: 10px 0 !important;
        padding-left: 45px !important;
        padding-right: 20px !important;
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .filter-container {
        display: flex !important;
        visibility: visible !important;
        margin-top: 20px !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        justify-content: center !important;
        position: relative; /* Ensures it stays above grid layers */
        z-index: 10;
    }
}

/* ==========================================================================
   7. SMALL MOBILE (450px and below)
   ========================================================================== */
@media screen and (max-width: 450px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
    }

    .gallery-description {
        font-size: 11px !important;
        padding-left: 20px !important;
    }

    .pagination {
        gap: 6px !important;
        justify-content: center !important;
        padding-left: 20px !important;
    }

    .pag-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .pag-btn:first-of-type, 
    .pag-btn:last-of-type {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* ==========================================================================
   8. MOBILE LIGHTBOX 
   ========================================================================== */
@media screen and (max-width: 950px) {
    .lightbox {
        display: none; 
        position: fixed !important;
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        background-color: rgba(0,0,0,0.95);
        z-index: 10000;
        padding: 20px 0 20px 0 !important; 
        text-align: center;
        box-sizing: border-box;
    }

    #lightbox[style*="display: flex"],
    #lightbox[style*="display: block"] {
        display: block !important; 
    }

    .close-lb {
        position: fixed !important; 
        top: 20px !important;
        right: 20px !important;
        left: auto !important;
        margin: 0 !important;
        background: rgba(0,0,0,0.4);
        border-radius: 50%;
        width: 60px;
        height: 60px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 60px !important;
        z-index: 20001 !important;
    }

    .lightbox-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        position: relative;
        min-height: min-content !important;
        padding-top: 75px !important; 
        padding-bottom: 0 !important;
    }

    .lightbox-content img {
        display: block !important;
        width: 90% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 auto 15px auto !important;
        border: 4px solid #ffffff;
        box-sizing: border-box;
    }

    #lightbox-caption {
        display: block !important;
        color: #ffffff !important;
        font-size: .85rem !important;
        padding: 0 45px !important;
        margin: 15px auto !important;
        line-height: 1.4;
        width: auto !important;
    }

    .lb-dl-button {
        display: inline-block !important;
        margin: 0 !important; 
        padding: 14px 28px !important;
        font-size: 14px !important;
    }
}