/* =====================================================
   BENGAL BOOK OF RECORDS — GALLERY SECTION
   Equal-Sized Images + Responsive Grid + Lightbox
===================================================== */

.bbr-gallery-section {
    position: relative;
    overflow: hidden;
    padding: 95px 0 80px;
    background: #f8f6ef;
    color: #101722;
}

.bbr-gallery-section *,
.bbr-lightbox * {
    box-sizing: border-box;
}

/* =====================================================
   SECTION HEADING
===================================================== */

.bbr-gallery-heading {
    max-width: 720px;
    margin: 0 auto 38px;
    text-align: center;
}

.bbr-gallery-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-bottom: 19px;
    color: #a97d25;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.2px;
    text-transform: uppercase;
}

.bbr-gallery-eyebrow span {
    display: inline-block;
    width: 25px;
    height: 1px;
    background: #c69b3c;
}

.bbr-gallery-heading h2 {
    margin: 0 0 15px;
    color: #071426;
    font-family: var(--font-heading, "Playfair Display", serif);
    font-size: clamp(34px, 4vw, 47px);
    font-weight: 600;
    line-height: 1.25;
}

.bbr-gallery-heading h2 em {
    color: #b18734;
    font-weight: 500;
}

.bbr-gallery-heading>p {
    max-width: 610px;
    margin: 0 auto;
    color: #697382;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 14px;
    line-height: 1.9;
}

/* =====================================================
   GALLERY CATEGORY FILTERS
===================================================== */

.bbr-gallery-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 36px;
}

.bbr-gallery-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 19px;
    border: 1px solid #ded9ca;
    border-radius: 30px;
    outline: none;
    background: transparent;
    color: #606a78;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.bbr-gallery-filter:hover,
.bbr-gallery-filter.active {
    border-color: #071426;
    background: #071426;
    color: #f1d58b;
}

.bbr-gallery-filter:focus-visible {
    outline: 2px solid #c69b3c;
    outline-offset: 3px;
}

/* =====================================================
   GALLERY GRID
   All images have identical dimensions
===================================================== */

.bbr-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.bbr-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(169, 125, 37, 0.2);
    border-radius: 9px;
    background: #e7e2d5;
    color: #fff;
    text-align: left;
    cursor: zoom-in;
    isolation: isolate;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Override any previous large or wide tile styles */

.bbr-gallery-item.gallery-large,
.bbr-gallery-item.gallery-wide {
    grid-row: auto;
    grid-column: auto;
}

.bbr-gallery-item[hidden] {
    display: none !important;
}

.bbr-gallery-item:hover {
    border-color: #c69b3c;
    box-shadow: 0 12px 28px rgba(7, 20, 38, 0.13);
}

.bbr-gallery-item:focus-visible {
    outline: 3px solid #c69b3c;
    outline-offset: 4px;
}

/* Gallery image */

.bbr-gallery-item>img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    object-position: center;
    transition:
        transform 0.65s cubic-bezier(0.2, 0.65, 0.3, 1);
}

.bbr-gallery-item:hover>img {
    transform: scale(1.06);
}

/* =====================================================
   IMAGE OVERLAY
===================================================== */

.bbr-gallery-image-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 23px 20px;
    background: linear-gradient(to top,
            rgba(3, 9, 20, 0.94) 0%,
            rgba(3, 9, 20, 0.65) 24%,
            rgba(3, 9, 20, 0.2) 53%,
            rgba(3, 9, 20, 0.02) 100%);
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.bbr-gallery-item:hover .bbr-gallery-image-overlay {
    opacity: 1;
}

/* Caption */

.bbr-gallery-image-caption {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.bbr-gallery-image-caption small {
    display: block;
    color: #e7c777;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
    line-height: 1.5;
    text-transform: uppercase;
}

.bbr-gallery-image-caption strong {
    display: block;
    color: #fff;
    font-family: var(--font-heading, "Playfair Display", serif);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Zoom icon */

.bbr-gallery-zoom {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 39px;
    border: 1px solid rgba(241, 213, 139, 0.65);
    border-radius: 50%;
    background: rgba(7, 20, 38, 0.65);
    color: #f1d58b;
    font-size: 13px;
    transition:
        background 0.3s ease,
        color 0.3s ease,
        transform 0.3s ease;
}

.bbr-gallery-item:hover .bbr-gallery-zoom {
    transform: translateY(-2px);
    background: #f1d58b;
    color: #071426;
}

/* Empty state */

.bbr-gallery-empty {
    padding: 30px 15px;
    color: #697382;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
}

.bbr-gallery-empty[hidden] {
    display: none !important;
}

/* =====================================================
   GALLERY FOOTER ORNAMENT
===================================================== */

.bbr-gallery-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 42px;
}

.bbr-gallery-footer-line {
    flex-shrink: 0;
    width: 45px;
    height: 1px;
    background: #c69b3c;
}

.bbr-gallery-footer p {
    margin: 0;
    color: #697382;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 12px;
    line-height: 1.8;
    text-align: center;
}

.bbr-gallery-footer strong {
    color: #071426;
    font-weight: 700;
}

/* =====================================================
   LIGHTBOX OVERLAY
===================================================== */

.bbr-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: 70px 90px 65px;
    overflow: hidden;
    background: rgba(2, 7, 16, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.bbr-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Close button and navigation */

.bbr-lightbox-close,
.bbr-lightbox-nav {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(214, 178, 94, 0.35);
    outline: none;
    background: rgba(13, 35, 64, 0.85);
    color: #f1d58b;
    cursor: pointer;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease;
}

.bbr-lightbox-close:hover,
.bbr-lightbox-nav:hover {
    border-color: #f1d58b;
    background: #f1d58b;
    color: #071426;
}

.bbr-lightbox-close:focus-visible,
.bbr-lightbox-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* Close button */

.bbr-lightbox-close {
    top: 25px;
    right: 28px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 20px;
}

/* Previous and next buttons */

.bbr-lightbox-nav {
    top: 50%;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 17px;
    transform: translateY(-50%);
}

.bbr-lightbox-prev {
    left: 25px;
}

.bbr-lightbox-next {
    right: 25px;
}

/* =====================================================
   LIGHTBOX IMAGE AND CONTENT
===================================================== */

.bbr-lightbox-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
}

.bbr-lightbox-image-wrap {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 100px;
    overflow: hidden;
}

.bbr-lightbox-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px);
    margin: 0;
    object-fit: contain;
    border: 1px solid rgba(214, 178, 94, 0.22);
    border-radius: 4px;
    box-shadow: 0 20px 65px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bbr-lightbox-image.is-loaded {
    opacity: 1;
}

/* Image loading spinner */

.bbr-lightbox-loading {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e7c777;
    font-size: 28px;
    pointer-events: none;
}

.bbr-lightbox-loading[hidden] {
    display: none !important;
}

.bbr-lightbox-loading i {
    animation: bbr-gallery-spin 1s linear infinite;
}

@keyframes bbr-gallery-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Caption and counter */

.bbr-lightbox-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 0;
    padding-top: 20px;
    color: #f8f6ef;
}

.bbr-lightbox-caption {
    min-width: 0;
    color: #f8f6ef;
    font-family: var(--font-heading, "Playfair Display", serif);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.bbr-lightbox-counter {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 2px;
    color: #aeb7c4;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.bbr-lightbox-current {
    color: #e7c777;
    font-weight: 700;
}

.bbr-lightbox-counter-divider {
    padding: 0 7px;
    color: #657184;
}

/* Keyboard hint */

.bbr-lightbox-hint {
    position: absolute;
    right: 0;
    bottom: 22px;
    left: 0;
    color: #7f8b9c;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 10px;
    letter-spacing: 0.4px;
    line-height: 1.6;
    text-align: center;
    pointer-events: none;
}

.bbr-lightbox-hint i {
    margin-right: 6px;
    color: #c69b3c;
}

/* =====================================================
   TABLET RESPONSIVE
===================================================== */

@media (max-width: 991px) {
    .bbr-gallery-section {
        padding: 75px 0 65px;
    }

    .bbr-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .bbr-lightbox {
        padding-right: 65px;
        padding-left: 65px;
    }

    .bbr-lightbox-prev {
        left: 10px;
    }

    .bbr-lightbox-next {
        right: 10px;
    }
}

/* =====================================================
   MOBILE RESPONSIVE
===================================================== */

@media (max-width: 575px) {
    .bbr-gallery-section {
        padding: 60px 0;
    }

    .bbr-gallery-heading {
        margin-bottom: 27px;
    }

    .bbr-gallery-heading h2 {
        font-size: 33px;
    }

    .bbr-gallery-heading>p {
        font-size: 13px;
        line-height: 1.85;
    }

    .bbr-gallery-eyebrow {
        gap: 7px;
        font-size: 9px;
        letter-spacing: 1.4px;
    }

    .bbr-gallery-eyebrow span {
        width: 17px;
    }

    /* Scrollable filter row */

    .bbr-gallery-filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
        margin-bottom: 23px;
        padding: 3px 2px 10px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .bbr-gallery-filter {
        flex-shrink: 0;
        padding: 10px 15px;
        font-size: 11px;
    }

    /* Two equal-sized image columns */

    .bbr-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .bbr-gallery-item {
        aspect-ratio: 4 / 3;
        border-radius: 7px;
    }

    /* Overlay */

    .bbr-gallery-image-overlay {
        gap: 7px;
        padding: 13px 11px;
    }

    .bbr-gallery-image-caption {
        gap: 5px;
    }

    .bbr-gallery-image-caption small {
        font-size: 7px;
        letter-spacing: 1px;
    }

    .bbr-gallery-image-caption strong {
        font-size: 13px;
        line-height: 1.35;
    }

    .bbr-gallery-zoom {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    /* Footer */

    .bbr-gallery-footer {
        gap: 10px;
        margin-top: 30px;
    }

    .bbr-gallery-footer-line {
        width: 18px;
    }

    .bbr-gallery-footer p {
        font-size: 11px;
    }

    /* Mobile lightbox */

    .bbr-lightbox {
        padding: 65px 12px 65px;
    }

    .bbr-lightbox-close {
        top: 12px;
        right: 12px;
        width: 39px;
        height: 39px;
        font-size: 17px;
    }

    .bbr-lightbox-nav {
        top: auto;
        bottom: 12px;
        width: 42px;
        height: 42px;
        font-size: 14px;
        transform: none;
    }

    .bbr-lightbox-prev {
        left: 15px;
    }

    .bbr-lightbox-next {
        right: 15px;
    }

    .bbr-lightbox-content {
        justify-content: center;
    }

    .bbr-lightbox-image-wrap {
        flex: 0 1 auto;
        min-height: 0;
    }

    .bbr-lightbox-image {
        max-width: 100%;
        max-height: calc(100vh - 185px);
        max-height: calc(100dvh - 185px);
    }

    .bbr-lightbox-info {
        gap: 10px;
        padding: 13px 3px 0;
    }

    .bbr-lightbox-caption {
        font-size: 14px;
    }

    .bbr-lightbox-counter {
        font-size: 11px;
    }

    .bbr-lightbox-hint {
        bottom: 25px;
        font-size: 9px;
    }
}

/* =====================================================
   SMALL MOBILE SCREENS
===================================================== */

@media (max-width: 360px) {
    .bbr-gallery-heading h2 {
        font-size: 29px;
    }

    .bbr-gallery-grid {
        gap: 8px;
    }

    .bbr-gallery-image-overlay {
        padding: 10px 8px;
    }

    .bbr-gallery-image-caption strong {
        font-size: 11px;
    }

    .bbr-gallery-image-caption small {
        font-size: 6px;
        letter-spacing: 0.7px;
    }

    .bbr-gallery-zoom {
        width: 26px;
        height: 26px;
        font-size: 9px;
    }
}

/* =====================================================
   REDUCED MOTION ACCESSIBILITY
===================================================== */

@media (prefers-reduced-motion: reduce) {

    .bbr-gallery-item,
    .bbr-gallery-item>img,
    .bbr-gallery-image-overlay,
    .bbr-gallery-zoom,
    .bbr-gallery-filter,
    .bbr-lightbox,
    .bbr-lightbox-image,
    .bbr-lightbox-close,
    .bbr-lightbox-nav {
        transition: none !important;
    }

    .bbr-lightbox-loading i {
        animation: none !important;
    }
}

/* View Gallery Button */
.bbr-gallery-view-all {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.bbr-gallery-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 13px 26px;
    border: 1px solid var(--gold-400, #c69b3c);
    border-radius: 4px;
    background: var(--navy-900, #071426);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all .3s ease;
}

.bbr-gallery-view-btn:hover {
    background: var(--gold-300, #d6b25e);
    border-color: var(--gold-300, #d6b25e);
    color: var(--navy-950, #030914);
}

.bbr-gallery-view-btn i {
    transition: transform .3s ease;
}

.bbr-gallery-view-btn:hover i {
    transform: translateX(4px);
}

/* =========================================
   GALLERY NAME, CATEGORY & YEAR
========================================= */

.bbr-gallery-image-caption {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.bbr-gallery-name {
    display: block;
    width: 100%;
    color: #fff;
    font-family: var(--font-heading, "Playfair Display", serif);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.bbr-gallery-category {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid rgba(231, 199, 119, 0.4);
    border-radius: 3px;
    background: rgba(198, 155, 60, 0.13);
    color: #e7c777;
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.8px;
    line-height: 1.4;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.bbr-gallery-year {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body, "DM Sans", sans-serif);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.2px;
    line-height: 1.5;
}

/* =========================================
   MOBILE RESPONSIVE
========================================= */

@media (max-width: 575px) {
    .bbr-gallery-image-caption {
        gap: 4px;
    }

    .bbr-gallery-name {
        font-size: 13px;
        line-height: 1.3;
    }

    .bbr-gallery-category {
        padding: 3px 5px;
        font-size: 7px;
        letter-spacing: 0.4px;
    }

    .bbr-gallery-year {
        font-size: 9px;
        letter-spacing: 0.8px;
    }
}

@media (max-width: 360px) {
    .bbr-gallery-name {
        font-size: 11px;
    }

    .bbr-gallery-category {
        padding: 3px 4px;
        font-size: 6px;
    }

    .bbr-gallery-year {
        font-size: 8px;
    }
}