
/* ==========================================
   GALLERY PAGE
========================================== */

.gallery-section {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 45px 24px 65px;
    box-sizing: border-box;
}

.gallery-heading {
    margin-bottom: 28px;
    text-align: center;
}

.gallery-heading h2 {
    margin-bottom: 12px;
}

.gallery-heading p {
    line-height: 1.7;
}

/* ==========================================
   GALLERY FILTERS
========================================== */

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 25px 0 32px;
}

.filters button {
    padding: 10px 20px;
    border: 1px solid #dce4ec;
    border-radius: 25px;
    background: #ffffff;
    color: #354052;
    font: inherit;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.filters button:hover,
.filters button.active {
    background: #34495e;
    color: #ffffff;
    border-color: #34495e;
}

.filters button:hover {
    transform: translateY(-2px);
}

/* ==========================================
   RESPONSIVE GALLERY GRID
========================================== */

.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
    width: 100%;
}

/* Gallery Card */

.gallery-item {
    display: flex;
    flex-direction: column;
    align-self: start;
    min-width: 0;
    width: 100%;
    height: auto;
    overflow: hidden;
    text-decoration: none;
    color: #354052;
    background: #ffffff;
    border: 1px solid #dce4ec;
    border-radius: 12px;
    box-sizing: border-box;
    cursor: zoom-in;
    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.gallery-item:hover {
    box-shadow: 0 8px 25px rgba(30, 45, 60, 0.12);
    border-color: #c4a66b;
    transform: translateY(-2px);
}

/* Original Image — Automatic Height, No Cropping */

.gallery .gallery-item img {
    display: block;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center;
    flex: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: #f7f5f0;
}

/* Image Caption */

.gallery-item span {
    display: block;
    width: 100%;
    padding: 13px 14px;
    text-align: center;
    line-height: 1.6;
    font-size: 15px;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

/* Hide Filtered Photos */

.gallery-item[hidden] {
    display: none !important;
}

/* ==========================================
   LIGHTBOX — FULL ORIGINAL IMAGE
========================================== */

#lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px 50px;
    box-sizing: border-box;
    background: rgba(10, 14, 20, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#lightbox.active {
    display: flex;
}

/* Image Fits Available Screen Space */

#lightbox #bigPhoto {
    display: block;
    flex: 0 1 auto;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    max-width: calc(100vw - 190px) !important;
    max-height: calc(100vh - 130px) !important;
    object-fit: contain !important;
    object-position: center;
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
}

/* ==========================================
   PREMIUM PREVIOUS / NEXT ARROWS
========================================== */

#lightbox .lightbox-nav {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    z-index: 2;

    display: flex;
    flex: 0 0 54px;
    align-items: center;
    justify-content: center;

    width: 54px;
    min-width: 54px;
    height: 68px;
    padding: 0;
    margin: 0;

    border: 2px solid #d5b477;
    border-radius: 13px;

    background: #263748;
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
    user-select: none;

    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.30);

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#lightbox .lightbox-nav:hover {
    background: #d5b477;
    color: #1e2b38;
    border-color: #ffffff;
    transform: scale(1.06);
    box-shadow: 0 0 22px rgba(213, 180, 119, 0.35);
}

#lightbox .lightbox-nav:active {
    transform: scale(0.94);
}

#lightbox .lightbox-nav:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

/* ==========================================
   CLOSE BUTTON
========================================== */

#closeBox {
    appearance: none;
    -webkit-appearance: none;

    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

#closeBox:hover {
    background: #d5b477;
    color: #202b38;
    transform: rotate(90deg);
}

#closeBox:focus-visible {
    outline: 2px solid #d5b477;
    outline-offset: 4px;
}

/* ==========================================
   PHOTO COUNTER
========================================== */

#photoCounter {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    letter-spacing: 1.5px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

/* ==========================================
   TABLET
========================================== */

@media (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .gallery-section {
        padding: 35px 18px 50px;
    }

    #lightbox {
        gap: 10px;
        padding: 60px 16px 50px;
    }

    #lightbox #bigPhoto {
        max-width: calc(100vw - 140px) !important;
        max-height: calc(100vh - 120px) !important;
    }

    #lightbox .lightbox-nav {
        flex-basis: 44px;
        width: 44px;
        min-width: 44px;
        height: 58px;
        font-size: 29px;
        border-radius: 11px;
    }
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 560px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .gallery-section {
        padding: 28px 12px 40px;
    }

    .filters {
        gap: 8px;
        margin: 20px 0 24px;
    }

    .filters button {
        padding: 8px 13px;
        font-size: 13px;
    }

    .gallery-item {
        border-radius: 8px;
    }

    .gallery-item span {
        padding: 10px 6px;
        font-size: 13px;
    }

    #lightbox {
        gap: 6px;
        padding: 55px 8px 45px;
    }

    #lightbox #bigPhoto {
        max-width: calc(100vw - 88px) !important;
        max-height: calc(100vh - 110px) !important;
    }

    #lightbox .lightbox-nav {
        flex-basis: 34px;
        width: 34px;
        min-width: 34px;
        height: 48px;
        font-size: 23px;
        border-radius: 9px;
    }

    #closeBox {
        top: 8px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    #photoCounter {
        bottom: 12px;
        font-size: 12px;
    }
}

/* ==========================================
   REDUCED MOTION ACCESSIBILITY
========================================== */

@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .filters button,
    #lightbox .lightbox-nav,
    #closeBox {
        transition: none;
    }
}

/* ==========================================
   GALLERY AUTO ARRANGEMENT FIX
   Compact masonry-style columns
========================================== */

.gallery {
    display: block !important;
    column-count: 3;
    column-gap: 24px;
    width: 100%;
}

/* Each photo card */
.gallery .gallery-item {
    display: inline-flex !important;
    flex-direction: column;
    vertical-align: top;
    width: 100% !important;
    height: auto !important;
    margin: 0 0 24px;
    break-inside: avoid;
    overflow: hidden;
    box-sizing: border-box;
}

/* Automatically fit complete original image */
.gallery .gallery-item img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center;
    flex: none !important;
    margin: 0 !important;
}

/* Keep filtered photos hidden */
.gallery .gallery-item[hidden] {
    display: none !important;
}

/* Tablet */
@media (max-width: 900px) {
    .gallery {
        column-count: 2;
        column-gap: 18px;
    }

    .gallery .gallery-item {
        margin-bottom: 18px;
    }
}

/* Mobile */
@media (max-width: 560px) {
    .gallery {
        column-count: 2;
        column-gap: 12px;
    }

    .gallery .gallery-item {
        margin-bottom: 12px;
        border-radius: 8px;
    }
}
