.theme-image-gallery {
    margin: 1.75rem 0 2.25rem;
    max-width: 100%;
}

.theme-image-gallery__header {
    margin-bottom: 1.25rem;
}

.theme-image-gallery__eyebrow {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--tg-theme-primary, #f7a400);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.theme-image-gallery__title,
.ck-content .theme-image-gallery__title {
    margin: 0;
    color: var(--tg-heading-color, #14176c);
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    line-height: 1.3;
}

.theme-image-gallery__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.theme-image-gallery__item {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 4 / 3;
    background: #0e104b;
    box-shadow: 0 8px 24px rgba(20, 23, 108, 0.08);
}

.theme-image-gallery__link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.theme-image-gallery__media,
.theme-image-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
}

.theme-image-gallery__media {
    position: absolute;
    inset: 0;
}

.theme-image-gallery__item img {
    object-fit: cover;
    transform: scale(1);
    transition: transform 0.45s ease;
}

.theme-image-gallery__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(14, 16, 75, 0) 42%, rgba(14, 16, 75, 0.78) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.theme-image-gallery__zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    color: #fff;
    background: var(--tg-theme-primary, #f7a400);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(247, 164, 0, 0.35);
    transform: translate(-50%, calc(-50% + 8px));
    transition: transform 0.3s ease;
}

.theme-image-gallery__zoom svg {
    width: 22px;
    height: 22px;
}

.theme-image-gallery__caption {
    width: 100%;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.theme-image-gallery__item:hover img,
.theme-image-gallery__item:focus-within img {
    transform: scale(1.08);
}

.theme-image-gallery__item:hover .theme-image-gallery__overlay,
.theme-image-gallery__item:focus-within .theme-image-gallery__overlay {
    opacity: 1;
}

.theme-image-gallery__item:hover .theme-image-gallery__zoom,
.theme-image-gallery__item:focus-within .theme-image-gallery__zoom {
    transform: translate(-50%, -50%);
}

.ck-content .theme-image-gallery,
.ck-content .theme-image-gallery p,
.project__details-content .theme-image-gallery {
    margin-left: 0;
    margin-right: 0;
}

.ck-content .theme-image-gallery img,
.project__details-content .theme-image-gallery img {
    margin: 0;
    max-width: none;
    height: 100%;
    border-radius: 0;
}

.mfp-bg {
    background: #0e104b;
    opacity: 0.92;
}

.mfp-title {
    color: #fff;
    padding-right: 36px;
}

@media (min-width: 576px) {
    .theme-image-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .theme-image-gallery__grid[data-count="1"] {
        grid-template-columns: 1fr;
    }

    .theme-image-gallery__grid[data-count="1"] .theme-image-gallery__item {
        aspect-ratio: 16 / 9;
        max-height: 460px;
    }
}

@media (min-width: 992px) {
    .theme-image-gallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }

    .theme-image-gallery__grid--mosaic .theme-image-gallery__item:first-child {
        grid-column: 1 / span 2;
        grid-row: 1 / span 2;
        aspect-ratio: auto;
        min-height: 100%;
    }
}

.col-70 .theme-image-gallery__grid,
.project__details-content .theme-image-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.col-70 .theme-image-gallery__grid[data-count="1"],
.project__details-content .theme-image-gallery__grid[data-count="1"] {
    grid-template-columns: 1fr;
}

@media (min-width: 992px) {
    .col-70 .theme-image-gallery__grid--mosaic .theme-image-gallery__item:first-child,
    .project__details-content .theme-image-gallery__grid--mosaic .theme-image-gallery__item:first-child {
        grid-column: 1 / span 2;
        grid-row: auto;
        aspect-ratio: 16 / 9;
        max-height: 360px;
    }
}

@media (hover: none) {
    .theme-image-gallery__overlay {
        opacity: 1;
        background: linear-gradient(180deg, rgba(14, 16, 75, 0) 58%, rgba(14, 16, 75, 0.72) 100%);
    }

    .theme-image-gallery__zoom {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .theme-image-gallery__item {
        aspect-ratio: 16 / 10;
    }

    .col-70 .theme-image-gallery__grid,
    .project__details-content .theme-image-gallery__grid {
        grid-template-columns: 1fr;
    }
}
