.ib-gallery-intro {
    max-width: 720px;
    margin: 20px auto 0;
    line-height: 1.8;
}

.ib-gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 22px;
}

.ib-gallery-item {
    position: relative;
    grid-column: span 4;
    height: 330px;
    margin: 0;
    overflow: hidden;
    border-radius: 18px;
    background: #e9f3ed;
    box-shadow: 0 15px 35px rgba(4, 42, 47, 0.09);
}

.ib-gallery-item.wide {
    grid-column: span 8;
}

.ib-gallery-item.tall {
    height: 450px;
}

.ib-gallery-link,
.ib-gallery-link img {
    display: block;
    width: 100%;
    height: 100%;
}

.ib-gallery-link img {
    object-fit: cover;
    transform: scale(1.001);
    transition: opacity 0.4s ease, transform 0.65s ease;
}

.ib-gallery-item.is-loading::before {
    content: "";
    position: absolute;
    z-index: 2;
    inset: 0;
    background: linear-gradient(105deg, #e6efe9 20%, #f7faf8 40%, #e6efe9 60%);
    background-size: 220% 100%;
    animation: ib-gallery-shimmer 1.4s linear infinite;
}

.ib-gallery-item.is-loading img {
    opacity: 0;
}

.ib-gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 28px;
    color: #fff;
    background: linear-gradient(180deg, transparent 30%, rgba(4, 42, 47, 0.88) 100%);
    transition: background 0.35s ease;
}

.ib-gallery-overlay strong {
    max-width: calc(100% - 60px);
    color: #fff;
    font-family: var(--title-font);
    font-size: 24px;
    line-height: 1.2;
}

.ib-gallery-category {
    margin-bottom: 8px;
    color: #70df94;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ib-gallery-overlay i {
    position: absolute;
    right: 25px;
    bottom: 27px;
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: var(--title-color);
    background: var(--theme-color);
    transform: translateY(12px);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.ib-gallery-link:hover img,
.ib-gallery-link:focus-visible img {
    transform: scale(1.07);
}

.ib-gallery-link:hover .ib-gallery-overlay i,
.ib-gallery-link:focus-visible .ib-gallery-overlay i {
    transform: translateY(0);
    opacity: 1;
}

.ib-gallery-link:focus-visible {
    outline: 3px solid var(--theme-color);
    outline-offset: -3px;
}

.ib-gallery-lightbox.mfp-bg {
    background: #021b21;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ib-gallery-lightbox.mfp-bg.mfp-ready {
    opacity: 0.94;
}

.ib-gallery-lightbox.mfp-bg.mfp-removing {
    opacity: 0;
}

.ib-gallery-lightbox .mfp-content {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ib-gallery-lightbox.mfp-ready .mfp-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ib-gallery-lightbox.mfp-removing .mfp-content {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
}

.ib-gallery-lightbox .mfp-figure::after {
    border-radius: 12px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.ib-gallery-lightbox .mfp-img {
    border-radius: 12px;
}

.ib-lightbox-caption {
    padding-top: 14px;
    color: #fff;
    font: 600 18px var(--title-font);
}

.ib-lightbox-caption span {
    display: block;
    margin-top: 4px;
    color: #70df94;
    font: 600 11px var(--body-font);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ib-gallery-lightbox .mfp-counter {
    top: auto;
    bottom: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.ib-gallery-lightbox .mfp-arrow::before,
.ib-gallery-lightbox .mfp-arrow::after {
    border: 0;
}

.ib-gallery-lightbox .mfp-arrow {
    width: 62px;
    height: 62px;
    margin-top: -31px;
    border-radius: 50%;
    background: var(--theme-color);
    opacity: 1;
}

.ib-gallery-lightbox .mfp-arrow::after {
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    color: #fff;
    font-family: "Font Awesome 6 Pro";
    font-size: 22px;
    line-height: 62px;
}

.ib-gallery-lightbox .mfp-arrow-left::after {
    content: "\f060";
}

.ib-gallery-lightbox .mfp-arrow-right::after {
    content: "\f061";
}

.ib-gallery-lightbox .mfp-close {
    top: -44px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-size: 30px;
    opacity: 1;
}

@keyframes ib-gallery-shimmer {
    to { background-position-x: -220%; }
}

@media (max-width: 991px) {
    .ib-gallery-item,
    .ib-gallery-item.wide {
        grid-column: span 6;
        height: 340px;
    }
}

@media (max-width: 575px) {
    .ib-gallery-grid { gap: 14px; }
    .ib-gallery-item,
    .ib-gallery-item.wide,
    .ib-gallery-item.tall {
        grid-column: 1 / -1;
        height: 320px;
    }
    .ib-gallery-overlay { padding: 22px; }
    .ib-gallery-overlay strong { font-size: 21px; }
    .ib-gallery-overlay i { opacity: 1; transform: none; }
    .ib-gallery-lightbox .mfp-arrow { transform: scale(0.75); }
}

@media (prefers-reduced-motion: reduce) {
    .ib-gallery-item.is-loading::before { animation: none; }
    .ib-gallery-link img,
    .ib-gallery-overlay i,
    .ib-gallery-lightbox .mfp-content { transition: none; }
}
