/* Детальная новости: обложка, галерея, лайтбокс.
   Дополняет styles.css, ничего в нём не переопределяет силой.
   Палитра le30: #d32226, #122c94, #242424, #a19fa2, #fbf9fa. */

/* ── Обложка ─────────────────────────────────────────────────────────── */

.news-cover {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 1.75rem;
    background: linear-gradient(135deg, #f8f9ff 0%, #fdf6f6 100%);
    border-bottom: 1px solid #f0eef1;
}

.news-cover__link {
    position: relative;
    display: block;
    max-width: 100%;
    border-radius: 16px;
    overflow: hidden;
    line-height: 0;
}

.news-cover__img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Широкий кадр можно тянуть по ширине карточки. */
.news-cover--wide .news-cover__link {
    width: 100%;
}

.news-cover--wide .news-cover__img {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
}

/* Квадрат, портрет, логотип - ограничиваем по высоте и центрируем. */
.news-cover--compact .news-cover__img {
    max-height: 360px;
}

/* ── Галерея ─────────────────────────────────────────────────────────── */

/* Карточка статьи на всю ширину контейнера; текст держим читаемой мерой. */
.news-detail .blog-article__layout--single {
    max-width: none;
}

.news-detail .blog-article__content {
    max-width: 980px;
    margin-inline: auto;
    padding: 2.25rem 1.75rem;
    font-size: 1.02rem;
}

/* Галерея и подвал лежали вплотную к краям карточки - у них не было
   горизонтальных отступов, в отличие от .blog-article__content. */
.news-gallery-block {
    margin-top: 0;
    padding: 2.25rem 1.75rem 0;
    border-top: 1px solid #f0eef1;
}

.news-detail .news-detail__footer {
    margin-top: 2.25rem;
    padding: 1.75rem;
    border-top: 1px solid #f0eef1;
}

.news-gallery-block__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.news-gallery-block__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #242424;
}

.news-gallery-block__count {
    color: #a19fa2;
    font-size: .9rem;
    white-space: nowrap;
}

/* Сетка из styles.css оставлена как есть; тут только уточнения. */

.news-gallery {
    /* styles.css ставит margin-top: 2.5rem, но блок теперь имеет свой padding */
    margin-top: 0;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.news-gallery--single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 820px;
    margin-inline: auto;
}

.news-gallery__item {
    margin: 0;
    aspect-ratio: auto;
    border-radius: 0;
    overflow: visible;
}

.news-gallery__link {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    overflow: hidden;
    background: #f0eef1;
}

.news-gallery--single .news-gallery__link {
    aspect-ratio: 16 / 10;
}

.news-gallery__link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}

.news-gallery__link:hover img,
.news-gallery__link:focus-visible img {
    transform: scale(1.045);
}

.news-gallery__caption {
    margin: .6rem .15rem 0;
    color: #a19fa2;
    font-size: .85rem;
    line-height: 1.45;
}

/* Значок лупы поверх изображения */

.news-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(36, 36, 36, .55) center / 18px 18px no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5M11 8v6M8 11h6'/%3E%3C/svg%3E");
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.news-gallery__link:hover .news-zoom,
.news-gallery__link:focus-visible .news-zoom,
.news-cover__link:hover .news-zoom,
.news-cover__link:focus-visible .news-zoom {
    opacity: 1;
    transform: translateY(0);
}

/* ── Лайтбокс ────────────────────────────────────────────────────────── */

body.lb-open {
    overflow: hidden;
}

.lb {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s ease;
}

/* Авторское display:flex перебивает браузерное [hidden]{display:none},
   поэтому скрытие задаём явно. Без этого закрытый оверлей остаётся поверх
   страницы: прозрачный, но перехватывает все клики и держит курсор zoom-out. */
.lb[hidden] {
    display: none;
}

/* Вторая страховка на время анимации закрытия. */
.lb:not(.is-visible) {
    pointer-events: none;
}

.lb.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.lb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 22, .92);
    cursor: zoom-out;
}

.lb__stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: min(1200px, 92vw);
    max-height: 88vh;
    margin: 0;
    pointer-events: none;
}

.lb__img {
    max-width: min(1200px, 92vw);
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    opacity: 0;
    transform: scale(.985);
    transition: opacity .25s ease, transform .25s ease;
}

.lb__img.is-ready {
    opacity: 1;
    transform: none;
}

.lb__caption {
    max-width: 780px;
    color: #e8e8ec;
    font-size: .95rem;
    line-height: 1.5;
    text-align: center;
}

.lb__counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: .35rem .85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.lb__close,
.lb__nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background-color .18s ease, transform .18s ease;
}

.lb__close:hover,
.lb__nav:hover {
    background: #d32226;
}

.lb__close:focus-visible,
.lb__nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.lb__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
}

.lb__nav {
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
}

.lb__nav--prev { left: 16px; }
.lb__nav--next { right: 16px; }

.lb__nav:active {
    transform: scale(.94);
}

.lb__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lb-spin .8s linear infinite;
}

@keyframes lb-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .news-cover {
        padding: 1rem;
    }

    .news-cover--wide .news-cover__img {
        max-height: 260px;
    }

    .news-cover--compact .news-cover__img {
        max-height: 240px;
    }

    .news-detail .blog-article__content {
        padding: 1.5rem 1.15rem;
    }

    .news-gallery-block {
        padding: 1.5rem 1.15rem 0;
    }

    .news-detail .news-detail__footer {
        padding: 1.25rem 1.15rem;
    }

    .news-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }

    .news-cover {
        border-radius: 14px;
    }

    .lb__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .lb__nav {
        width: 42px;
        height: 42px;
        margin-top: -21px;
    }

    .lb__nav--prev { left: 6px; }
    .lb__nav--next { right: 6px; }

    .lb__img {
        max-height: 68vh;
    }

    .news-zoom {
        opacity: 1;
        transform: none;
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lb,
    .lb__img,
    .news-zoom,
    .news-gallery__link img {
        transition: none;
    }

    .lb__spinner {
        animation-duration: 2s;
    }
}
