/* =========================================================
   Фотогалерея новини
   ========================================================= */

.news-media-column {
    min-width: 0;
    margin-bottom: 24px;
}

.news-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 10px;
}

.news-gallery__viewport {
    position: relative;
    width: 100%;
    height: 520px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: #eef1f6;
    box-shadow: 0 4px 14px rgba(20, 32, 55, 0.1);
    outline: none;
    touch-action: pan-y;
    user-select: none;
}

.news-gallery__viewport:focus-visible {
    box-shadow:
        0 0 0 3px rgba(43, 126, 255, 0.28),
        0 4px 14px rgba(20, 32, 55, 0.1);
}

.news-gallery__slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.news-gallery__slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.news-gallery__open {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.news-gallery__open:focus-visible {
    outline: 3px solid rgba(43, 126, 255, 0.55);
    outline-offset: -3px;
}

.news-gallery__slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    user-select: none;
}

.news-gallery__zoom-hint {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 4;
    padding: 5px 10px;
    border-radius: 14px;
    color: #ffffff;
    background: rgba(15, 25, 42, 0.68);
    font-size: 12px;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 0.2s ease;
}

.news-gallery__open:hover .news-gallery__zoom-hint,
.news-gallery__open:focus-visible .news-gallery__zoom-hint {
    opacity: 1;
}
.news-gallery__arrow {
    position: absolute;
    top: 50%;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: rgba(15, 25, 42, 0.65);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.news-gallery__arrow:hover {
    background: rgba(15, 25, 42, 0.9);
}

.news-gallery__arrow:active {
    transform: translateY(-50%) scale(0.94);
}

.news-gallery__arrow:focus-visible {
    outline: 3px solid rgba(43, 126, 255, 0.55);
    outline-offset: 2px;
}

.news-gallery__arrow--prev {
    left: 12px;
}

.news-gallery__arrow--next {
    right: 12px;
}

.news-gallery__counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 6;
    min-width: 54px;
    padding: 5px 10px;
    border-radius: 14px;
    color: #ffffff;
    background: rgba(15, 25, 42, 0.68);
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    pointer-events: none;
}

.news-gallery__counter span {
    color: inherit;
    font-size: inherit;
}

.news-gallery__thumbs {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 2px 1px 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

.news-gallery__thumb {
    flex: 0 0 74px;
    width: 74px;
    height: 60px;
    padding: 3px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #eef1f6;
    cursor: pointer;
    opacity: 0.72;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.news-gallery__thumb:hover,
.news-gallery__thumb:focus-visible {
    opacity: 1;
}

.news-gallery__thumb:focus-visible {
    outline: 2px solid rgba(43, 126, 255, 0.45);
    outline-offset: 1px;
}

.news-gallery__thumb.is-active {
    border-color: #2b7eff;
    opacity: 1;
}

.news-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
}

.news-gallery__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 260px;
    margin-bottom: 10px;
    padding: 20px;
    border-radius: 8px;
    color: #6c757d;
    background: #eef1f6;
    text-align: center;
}

.news-publication-date {
    display: block;
    margin-top: 7px;
    color: #6c757d;
    font-size: 13px;
}

/* =========================================================
   Повноекранний перегляд
   ========================================================= */

body.news-lightbox-open {
    overflow: hidden;
}

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

.news-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.news-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.news-lightbox__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(4, 8, 16, 0.94);
    cursor: default;
}

.news-lightbox__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.news-lightbox__toolbar {
    position: absolute;
    top: 14px;
    right: 14px;
    left: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    pointer-events: none;
}

.news-lightbox__counter,
.news-lightbox__zoom-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 40px;
    padding: 7px 11px;
    border-radius: 20px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 14px;
    line-height: 1;
    pointer-events: auto;
}

.news-lightbox__counter span,
.news-lightbox__zoom-value span {
    color: inherit;
    font-size: inherit;
}

.news-lightbox__button,
.news-lightbox__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.news-lightbox__button:hover,
.news-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.news-lightbox__button:focus-visible,
.news-lightbox__nav:focus-visible {
    outline: 3px solid rgba(112, 161, 255, 0.8);
    outline-offset: 2px;
}

.news-lightbox__button:disabled {
    opacity: 0.35;
    cursor: default;
}

.news-lightbox__close {
    margin-left: 8px;
    font-size: 29px;
}

.news-lightbox__viewport {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 76px 86px 44px;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
}

.news-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    cursor: zoom-in;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center;
    transition: transform 0.12s ease-out;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.news-lightbox__viewport.is-zoomed .news-lightbox__image {
    cursor: grab;
    transition: none;
}

.news-lightbox__viewport.is-zoomed:active .news-lightbox__image {
    cursor: grabbing;
}

.news-lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 32px;
    transform: translateY(-50%);
}

.news-lightbox__nav--prev {
    left: 18px;
}

.news-lightbox__nav--next {
    right: 18px;
}

/* =========================================================
   Адаптивність
   ========================================================= */

@media (max-width: 991.98px) {
    .news-gallery__viewport {
        height: 460px;
    }
}

@media (max-width: 767.98px) {
    .newspage h1 {
        font-size: 24px;
        line-height: 1.25;
    }

    .news-gallery__viewport {
        height: clamp(320px, 115vw, 480px);
    }

    .news-gallery__arrow {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .news-gallery__arrow--prev {
        left: 8px;
    }

    .news-gallery__arrow--next {
        right: 8px;
    }

    .news-gallery__counter {
        right: 8px;
        bottom: 8px;
    }

    .news-gallery__zoom-hint {
        display: none;
    }

    .news-gallery__thumb {
        flex-basis: 66px;
        width: 66px;
        height: 54px;
    }

    .news-lightbox__toolbar {
        top: 8px;
        right: 8px;
        left: 8px;
        gap: 5px;
    }

    .news-lightbox__counter,
    .news-lightbox__zoom-value {
        min-width: 50px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .news-lightbox__button {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .news-lightbox__close {
        margin-left: 2px;
        font-size: 26px;
    }

    .news-lightbox__viewport {
        padding: 62px 12px 32px;
    }

    .news-lightbox__nav {
        top: auto;
        bottom: 14px;
        width: 46px;
        height: 46px;
        font-size: 27px;
        transform: none;
    }

    .news-lightbox__nav--prev {
        left: calc(50% - 56px);
    }

    .news-lightbox__nav--next {
        right: calc(50% - 56px);
    }
}

@media (max-width: 430px) {
    .news-lightbox__zoom-value {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-gallery__slide,
    .news-gallery__arrow,
    .news-gallery__thumb,
    .news-gallery__zoom-hint,
    .news-lightbox,
    .news-lightbox__button,
    .news-lightbox__nav,
    .news-lightbox__image {
        transition: none;
    }

    .news-gallery__thumbs {
        scroll-behavior: auto;
    }
}
