/* =========================
   NEWS POST (CARD)
   ========================= */
.news-post {
    hyphens: auto;
    margin: 0 0 28px;
    padding: 18px 18px 16px;

    background: #f6fbf6;
    border: 1px solid rgba(15, 90, 32, 0.14);
    border-radius: 18px;
}

/* =========================
   TITLE
   ========================= */
.news-post .news-title {
    margin: 6px 0 14px;

    color: #0f5a20;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.15;
}

/* =========================
   TEXT
   ========================= */
.news-post .news-text {
    font-size: 16px;
    line-height: 1.65;
    color: #1f1f1f;
}

.news-post .news-text p {
    margin: 10px 0;
    text-align: justify;
    text-justify: inter-word;
}

.news-post .news-text strong {
    font-weight: 800;
}

/* =========================
   GALLERY (DEFAULT = GRID)
   ========================= */
.news-post .news-gallery {
    /* БАЗОВО — grid, чтобы 1-6 фото выглядели аккуратно */
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;

    width: 100%;
    margin: 14px 0 16px;
}

/* карточка фото */
.news-post .news-gallery a {
    display: block;
    width: 100%;

    border-radius: 14px;
    overflow: hidden;

    background: rgba(15, 90, 32, 0.035);
    border: 1px solid rgba(15, 90, 32, 0.12);

    cursor: zoom-in;

    transform: translateZ(0);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.news-post .news-gallery a:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 90, 32, 0.2);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.news-post .news-gallery a:active {
    transform: translateY(0);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.1);
}

/* изображение */
.news-post .news-gallery img {
    display: block;
    width: 100%;
    height: auto;
}

/* =========================
   AUTO SIZE for 1–3 photos
   JS добавляет классы: n1 / n2 / n3
   ========================= */
.news-post .news-gallery.n1 {
    grid-template-columns: 1fr;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.news-post .news-gallery.n2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.news-post .news-gallery.n3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================
   MASONRY MODE (7+ photos)
   JS добавляет класс: masonry
   ========================= */
.news-post .news-gallery.masonry {
    display: block;
    /* важно: columns работают с block */
    column-count: 4;
    column-gap: 10px;

    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* элементы в masonry должны быть inline-block и не разрываться */
.news-post .news-gallery.masonry a {
    display: inline-block;
    width: 100%;
    margin: 0 0 10px;

    break-inside: avoid;
}

/* =========================
   OPTIONAL SEPARATOR
   ========================= */
.news-post .news-separator {
    margin: 14px 0 0;
    border: 0;
    height: 1px;
    background: rgba(15, 90, 32, 0.12);
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 1100px) {
    .news-post .news-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .news-post .news-gallery.masonry {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .news-post .news-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .news-post .news-gallery.masonry {
        column-count: 2;
    }

    /* чтобы n2/n3 не ломали в узких экранах */
    .news-post .news-gallery.n2,
    .news-post .news-gallery.n3 {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 520px) {
    .news-post {
        padding: 14px 14px 12px;
    }

    .news-post .news-title {
        font-size: 24px;
    }

    .news-post .news-gallery {
        grid-template-columns: 1fr;
    }

    .news-post .news-gallery.masonry {
        column-count: 1;
    }
}

/* =========================
   LIGHTBOX (overlay)
   ========================= */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 9999;
    cursor: zoom-out;
    padding: 24px;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 92vw;
    max-height: 92vh;

    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);

    cursor: default;
}