.ew360-gallery,
.ew360-gallery * ,
.ew360-gallery-widget,
.ew360-gallery-widget * ,
.ew360-gallery-modal,
.ew360-gallery-modal * {
    box-sizing: border-box;
}

.ew360-gallery {
    display: grid;
    grid-template-columns: repeat(var(--ew360-gallery-columns, 3), minmax(0, 1fr));
    gap: clamp(14px, 2vw, 24px);
    width: 100%;
}

.ew360-gallery__item {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: #f4f5f7;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.ew360-gallery__button,
.ew360-gallery-widget__button {
    appearance: none;
    display: block;
    width: 100%;
    border: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    font: inherit;
    text-align: left;
}

.ew360-gallery__button:focus-visible,
.ew360-gallery-widget__button:focus-visible,
.ew360-gallery-modal__close:focus-visible,
.ew360-gallery-widget__view-all:focus-visible {
    outline: 3px solid rgba(33, 117, 255, 0.55);
    outline-offset: 3px;
}

.ew360-gallery__image {
    display: block;
    width: 100%;
    aspect-ratio: 1.35 / 1;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.ew360-gallery__button:hover .ew360-gallery__image {
    transform: scale(1.055);
}

.ew360-gallery__overlay {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    min-height: 48%;
    padding: 20px;
    color: #fff;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.72) 100%);
}

.ew360-gallery__title {
    display: block;
    min-width: 0;
    font-size: clamp(16px, 1.4vw, 20px);
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.32);
}

.ew360-gallery__zoom {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #161616;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.25s ease, background 0.25s ease;
}

.ew360-gallery__button:hover .ew360-gallery__zoom {
    transform: translateY(-2px) scale(1.04);
    background: #ffffff;
}

.ew360-gallery__zoom-icon {
    display: block;
    width: 20px;
    height: 20px;
}

.ew360-gallery-empty {
    padding: 18px;
    border: 1px dashed rgba(0, 0, 0, 0.16);
    border-radius: 14px;
    color: #666;
    background: #fafafa;
}

.ew360-gallery-widget {
    width: 100%;
}

.ew360-gallery-widget__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ew360-gallery-widget__button {
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.ew360-gallery-widget__image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ew360-gallery-widget__button:hover .ew360-gallery-widget__image {
    transform: scale(1.06);
    opacity: 0.9;
}

.ew360-gallery-widget__view-all {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    min-height: 0;
    margin-top: 12px;
    padding: 0 0 3px;
    border-radius: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ew360-gallery-widget__view-all::after {
    content: "→";
    font-size: 14px;
    line-height: 1;
    transition: transform 0.25s ease;
}

.ew360-gallery-widget__view-all:hover {
    color: inherit;
    opacity: 0.78;
    transform: translateY(-1px);
}

.ew360-gallery-widget__view-all:hover::after {
    transform: translateX(2px);
}

.ew360-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 3vw, 34px);
}

.ew360-gallery-modal.is-open {
    display: flex;
}

.ew360-gallery-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 9, 18, 0.82);
    backdrop-filter: blur(8px);
}

.ew360-gallery-modal__dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    width: min(1120px, 100%);
    max-height: min(86vh, 860px);
    overflow: hidden;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

.ew360-gallery-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 30px;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.ew360-gallery-modal__media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    background: #080b12;
}

.ew360-gallery-modal__image {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 86vh;
    object-fit: contain;
}

.ew360-gallery-modal__content {
    overflow: auto;
    padding: clamp(24px, 3vw, 42px);
    color: #1f2937;
}

.ew360-gallery-modal__title {
    margin: 0 0 14px;
    color: #111827;
    font-size: clamp(22px, 2.2vw, 34px);
    font-weight: 800;
    line-height: 1.15;
}

.ew360-gallery-modal__description {
    color: #374151;
    font-size: 16px;
    line-height: 1.72;
}

.ew360-gallery-modal__description p {
    margin: 0 0 1em;
}

.ew360-gallery-modal__description p:last-child {
    margin-bottom: 0;
}

.ew360-gallery-modal__description a {
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.ew360-gallery-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .ew360-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ew360-gallery-modal__dialog {
        grid-template-columns: 1fr;
        max-height: 90vh;
    }

    .ew360-gallery-modal__media {
        min-height: 240px;
        max-height: 52vh;
    }

    .ew360-gallery-modal__content {
        max-height: 38vh;
    }
}

@media (max-width: 560px) {
    .ew360-gallery {
        grid-template-columns: 1fr;
    }

    .ew360-gallery__overlay {
        padding: 16px;
    }

    .ew360-gallery-modal {
        padding: 10px;
    }

    .ew360-gallery-modal__dialog {
        border-radius: 18px;
    }

    .ew360-gallery-modal__close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
    }
}
