/*
 * MZ Project Gallery Block
 * Frontend styles
 * Max content width: 1200px
 * Brand colors: blue + green from the provided logo
 */

.mz-project-gallery-section,
.mz-project-gallery-section * {
    box-sizing: border-box;
}

.mz-project-gallery-section {
    --mzpg-blue: #302ee6;
    --mzpg-blue-dark: #171659;
    --mzpg-green: #2fba4a;
    --mzpg-green-dark: #168333;
    --mzpg-ink: #111827;
    --mzpg-muted: #667085;
    --mzpg-line: rgba(17, 24, 39, 0.11);
    --mzpg-card: #ffffff;
    --mzpg-soft: #f6f8ff;
    --mzpg-shadow: 0 22px 70px rgba(16, 24, 40, 0.12);

    width: 100%;
    direction: rtl;
    color: var(--mzpg-ink);
    /*background:
        radial-gradient(circle at 12% 10%, rgba(48, 46, 230, 0.06), transparent 28%),
        radial-gradient(circle at 86% 18%, rgba(47, 186, 74, 0.05), transparent 26%),
        linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);*/
}
.mz_service-template-default .mzpg__container{
	margin: 0 auto;
    padding: unset;
    border: unset;
    border-radius: unset;
    background: unset;
    box-shadow: unset;
    backdrop-filter: unset;
}
.mzpg__container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(20px, 2.2vw, 34px);
    border: 1px solid rgba(17, 24, 39, 0.06);
    border-radius: clamp(22px, 2.6vw, 34px);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--mzpg-shadow);
    backdrop-filter: blur(10px);
}

/* Slider is intentionally kept as a clean element without external card/background. */
.mz-project-gallery-section--slider {
    padding: 0 16px;
    background: transparent;
}

.mz-project-gallery-section--slider .mzpg__container {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.mzpg__header {
    margin-inline-start: auto;
    margin-bottom: clamp(22px, 3vw, 34px);
    text-align: right;
}

.mz-project-gallery-section--slider .mzpg__header {
    margin-bottom: clamp(18px, 2.4vw, 28px);
}

.mzpg__title {
    margin: 0;
    color: var(--mzpg-blue-dark);
    font-size: clamp(28px, 4vw, 37px);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.04em;
}

.mzpg__description {
    max-width: 760px;
    margin: 12px 0 0;
    color: var(--mzpg-muted);
    font-size: clamp(15px, 1.45vw, 18px);
    line-height: 1.9;
}

.mzpg__media {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    min-height: 120px;
    padding: 0;
    cursor: zoom-in;
    border: 0;
    border-radius: 18px;
    background: #e8ecf4;
    box-shadow: 0 12px 34px rgba(17, 24, 39, 0.10);
    appearance: none;
}

.mzpg__media img,
.mzpg-slider__slide img,
.mzpg-slider__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mzpg__media img {
    transition: transform 0.55s ease, filter 0.55s ease;
}

.mzpg__media:hover img,
.mzpg__media:focus-visible img {
    transform: scale(1.055);
    filter: saturate(1.08) contrast(1.03);
}

.mzpg__media:focus-visible,
.mzpg-slider__arrow:focus-visible,
.mzpg-slider__dot:focus-visible,
.mzpg-slider__thumb:focus-visible,
.mzpg-lightbox__button:focus-visible,
.mzpg-lightbox__close:focus-visible {
    outline: 3px solid rgba(47, 186, 74, 0.45);
    outline-offset: 3px;
}

.mzpg__media-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 48%, rgba(9, 12, 24, 0.42) 100%),
        linear-gradient(135deg, rgba(48, 46, 230, 0.12), rgba(47, 186, 74, 0.08));
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.mzpg__media:hover .mzpg__media-shade,
.mzpg__media:focus-visible .mzpg__media-shade {
    opacity: 1;
}

.mzpg__media-icon {
    position: absolute;
    inset-inline-start: 14px;
    bottom: 14px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    background: linear-gradient(135deg, var(--mzpg-blue), var(--mzpg-green));
    box-shadow: 0 12px 24px rgba(48, 46, 230, 0.28);
    opacity: 0;
    transform: translateY(10px) scale(0.92);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.mzpg__media:hover .mzpg__media-icon,
.mzpg__media:focus-visible .mzpg__media-icon {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mzpg__image-placeholder {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--mzpg-muted);
}

/* Style 1: Adaptive Gallery, max 12 images */
.mzpg-gallery-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: clamp(84px, 9vw, 128px);
    grid-auto-flow: dense;
    gap: clamp(10px, 1.4vw, 16px);
}

.mzpg-gallery-layout__item {
    grid-column: span 4;
    grid-row: span 2;
    min-height: 0;
}

.mzpg-gallery-layout__item img {
    height: 100%;
}

.mzpg-gallery-layout--count-1 .mzpg-gallery-layout__item {
    grid-column: span 12;
    grid-row: span 4;
}

.mzpg-gallery-layout--count-2 .mzpg-gallery-layout__item {
    grid-column: span 6;
    grid-row: span 3;
}

.mzpg-gallery-layout--count-3 .mzpg-gallery-layout__item {
    grid-column: span 4;
    grid-row: span 3;
}

.mzpg-gallery-layout--count-4 .mzpg-gallery-layout__item {
    grid-column: span 6;
    grid-row: span 3;
}

.mzpg-gallery-layout--count-5 .mzpg-gallery-layout__item:nth-child(-n+2),
.mzpg-gallery-layout--count-7 .mzpg-gallery-layout__item:nth-child(-n+2),
.mzpg-gallery-layout--count-8 .mzpg-gallery-layout__item:nth-child(-n+2) {
    grid-column: span 6;
    grid-row: span 3;
}

.mzpg-gallery-layout--count-10 .mzpg-gallery-layout__item:nth-child(-n+4),
.mzpg-gallery-layout--count-11 .mzpg-gallery-layout__item:nth-child(-n+4) {
    grid-column: span 3;
    grid-row: span 2;
}

.mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(1),
.mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(6),
.mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(11) {
    grid-column: span 6;
}

/* Style 2: Slider */
.mzpg-slider {
    position: relative;
}

.mzpg-slider__viewport {
    position: relative;
    overflow: hidden;
    min-height: clamp(360px, 50vw, 610px);
    border: 1px solid rgba(48, 46, 230, 0.12);
    border-radius: clamp(20px, 2.4vw, 30px);
    background: #0f172a;
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.16);
}

.mzpg-slider__viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(90deg, rgba(10, 16, 36, 0.12), transparent 34%, rgba(10, 16, 36, 0.22)),
        linear-gradient(0deg, rgba(10, 16, 36, 0.28), transparent 35%);
    pointer-events: none;
}

.mzpg-slider__slide {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    transform: scale(1.015);
    transition: opacity 0.7s ease, transform 1.2s ease;
    pointer-events: none;
}

.mzpg-slider__slide.is-active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.mzpg-slider__arrow {
    position: absolute;
    z-index: 4;
    top: 50%;
    display: grid;
    width: clamp(44px, 5vw, 58px);
    height: clamp(44px, 5vw, 58px);
    place-items: center;
    padding: 0;
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    font-size: 42px;
    line-height: 1;
    background: linear-gradient(135deg, var(--mzpg-blue), #2220be);
    box-shadow: 0 14px 28px rgba(48, 46, 230, 0.32);
    transform: translateY(-50%);
    transition: transform 0.25s ease, background 0.25s ease;
}

.mzpg-slider__arrow:hover {
    background: linear-gradient(135deg, var(--mzpg-green), var(--mzpg-blue));
    transform: translateY(-50%) scale(1.06);
}

.mzpg-slider__arrow--prev {
    inset-inline-start: 16px;
}

.mzpg-slider__arrow--next {
    inset-inline-end: 16px;
}

.mzpg-slider__dots {
    position: absolute;
    z-index: 4;
    right: 50%;
    bottom: 22px;
    display: flex;
    gap: 9px;
    align-items: center;
    justify-content: center;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(8, 12, 26, 0.38);
    backdrop-filter: blur(10px);
    transform: translateX(50%);
}

.mzpg-slider__dot {
    width: 9px;
    height: 9px;
    padding: 0;
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    transition: width 0.25s ease, background 0.25s ease;
}

.mzpg-slider__dot.is-active {
    width: 28px;
    background: var(--mzpg-green);
}

.mzpg-slider__thumbs {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(8px, 1.2vw, 14px);
    margin-top: 16px;
}

.mzpg-slider__thumb {
    overflow: hidden;
    height: clamp(62px, 7vw, 84px);
    padding: 0;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 13px;
    background: #e8ecf4;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
    opacity: 0.74;
    transition: opacity 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.mzpg-slider__thumb:hover,
.mzpg-slider__thumb.is-active {
    opacity: 1;
    border-color: var(--mzpg-blue);
    transform: translateY(-2px);
}

/* Style 3: Grid with lightbox, max 16 images */
.mzpg-grid-layout {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(10px, 1.4vw, 16px);
}

.mzpg-grid-layout__item {
    aspect-ratio: 4 / 3;
}

.mzpg-grid-layout__hint {
    margin: 18px 0 0;
    color: var(--mzpg-muted);
    font-size: 14px;
    line-height: 1.7;
    text-align: center;
}

/* Lightbox */
.mzpg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 14, 28, 0.78);
    backdrop-filter: blur(8px);
}

.mzpg-lightbox.is-open {
    display: flex;
}

.mzpg-lightbox__dialog {
    position: relative;
    width: min(1040px, 100%);
    border-radius: 22px;
    background: #101828;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
}

.mzpg-lightbox__image {
    display: block;
    width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: inherit;
}

.mzpg-lightbox__close,
.mzpg-lightbox__button {
    position: absolute;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: rgba(8, 12, 26, 0.72);
    backdrop-filter: blur(10px);
}

.mzpg-lightbox__close {
    top: 14px;
    inset-inline-start: 14px;
    width: 42px;
    height: 42px;
    font-size: 24px;
}

.mzpg-lightbox__button {
    top: 50%;
    width: 50px;
    height: 50px;
    font-size: 38px;
	line-height:38px;
    transform: translateY(-50%);
}

.mzpg-lightbox__button--prev {
    inset-inline-start: 14px;
}

.mzpg-lightbox__button--next {
    inset-inline-end: 14px;
}

.mzpg-lightbox__counter {
    position: absolute;
    inset-inline-end: 16px;
    bottom: 16px;
    padding: 8px 13px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 14px;
    background: rgba(8, 12, 26, 0.72);
    backdrop-filter: blur(10px);
}

@media (max-width: 980px) {
    .mzpg-gallery-layout {
        grid-auto-rows: 100px;
    }

    .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-2 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-3 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-4 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-5 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-7 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-8 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-10 .mzpg-gallery-layout__item:nth-child(-n+4),
    .mzpg-gallery-layout--count-11 .mzpg-gallery-layout__item:nth-child(-n+4),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(1),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(6),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(11) {
        grid-column: span 6;
        grid-row: span 2;
    }

    .mzpg-gallery-layout--count-1 .mzpg-gallery-layout__item {
        grid-column: span 12;
        grid-row: span 4;
    }

    .mzpg-grid-layout {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mzpg-slider__thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .mz-project-gallery-section {
        padding: 28px 12px;
    }

    .mz-project-gallery-section--slider {
        padding: 0 12px;
    }

    .mzpg__container {
        padding: 14px;
        border-radius: 22px;
    }

    .mz-project-gallery-section--slider .mzpg__container {
        padding: 0;
        border-radius: 0;
    }

    .mzpg__header {
        margin-bottom: 18px;
    }

    .mzpg-gallery-layout,
    .mzpg-grid-layout {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .mzpg-gallery-layout__item,
    .mzpg-grid-layout__item,
    .mzpg-gallery-layout--count-1 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-2 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-3 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-4 .mzpg-gallery-layout__item,
    .mzpg-gallery-layout--count-5 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-7 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-8 .mzpg-gallery-layout__item:nth-child(-n+2),
    .mzpg-gallery-layout--count-10 .mzpg-gallery-layout__item:nth-child(-n+4),
    .mzpg-gallery-layout--count-11 .mzpg-gallery-layout__item:nth-child(-n+4),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(1),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(6),
    .mzpg-gallery-layout--count-12 .mzpg-gallery-layout__item:nth-child(11) {
        grid-column: auto;
        grid-row: auto;
        aspect-ratio: 4 / 3;
    }

    .mzpg-slider__viewport {
        min-height: 300px;
    }

    .mzpg-slider__arrow {
        width: 40px;
        height: 40px;
        font-size: 32px;
    }

    .mzpg-slider__arrow--prev {
        inset-inline-start: 10px;
    }

    .mzpg-slider__arrow--next {
        inset-inline-end: 10px;
    }

    .mzpg-slider__thumbs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mzpg-lightbox__button {
        width: 42px;
        height: 42px;
        font-size: 30px;
    }
}
