/*html, body { max-width: 100%; overflow-x: hidden; }*/
.news-x {
    grid-area: news-x;
    border: 1px solid var(--dark-blue);
    border-radius: 12px;
}

.news-y {
    grid-area: news-y;
    border: 1px solid var(--dark-blue);
    border-radius: 12px;
}


/* контейнер стрічки */
.news-strip {
    display: flex !important;
    align-items: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* не даємо сторінці розпливатись по X */
    box-sizing: border-box;
    overflow: hidden;
}

/* ВІКНО: має звужуватись і бути єдиним scroll-контейнером */
.ns-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    -ms-overflow-style: none; /* IE/Edge */
    scrollbar-width: none; /* Firefox */
    touch-action: pan-y; /* вертикальний свайп скролить сторінку */
    cursor: grab;
}

.ns-viewport.dragging {
    cursor: grabbing;
}

.ns-viewport ul li {
    list-style-image: none !important;
}

/* доріжка з картками — одна лінія, ширину визначає контент */
.ns-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px;
    padding: 0;
    margin: 10px;
    list-style: none;
    will-change: transform;
    align-items: stretch;
}

/* самі картки (мінімум для адекватного вигляду) */
.ns-track > li {
    min-width: 0;
}

.ns-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    text-transform: none !important;
    text-decoration: none !important;
}

.ns-card:hover {
    text-decoration: underline !important;
}

.ns-img-wrap {
    position: relative;
    height: 160px;
    flex: 0 0 auto;
    overflow: hidden;
}

.ns-img-wrap > img:first-child {
    height: 100%;
    width: 100%;
    object-fit: cover;
    display: block;
}

.ns-img-wrap .article_cancelled {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 130px;
    pointer-events: none;
}

.ns-body {
    flex: 1 1 auto;
    min-height: 0; /* важливо для кліпінгу всередині flex */
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.ns-title {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 24px;
    color: var(--dark-blue);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* зроби 3, якщо треба більше рядків */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ns-meta {
    max-height: 60px;
    color: var(--text-grey);
    font-size: 14px;
    line-height: 20px;
    text-align: justify;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* number of lines to show */
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.ns-footer {
    display: flex;
    height: 32px;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.ns-date {
    font-size: 14px;
    font-weight: 300;
    font-family: var(--fonts-light);
    line-height: 20px;
    color: var(--light-grey);
    margin-top: 14px;
    margin-bottom: 24px;
    line-height: 20px !important;
}

.ns-button {
    border-radius: 2px;
    background-color: var(--main-white);
    padding: 6px 16px;
    font-size: 12px !important;
    line-height: 20px !important;
}

.ns-button a {
    text-decoration: none !important;
    color: var(--dark-blue);
    font-size: 12px !important;
    line-height: 20px !important;
    text-transform: none !important;
    z-index: 1;
}

/* скелетон */
.ns-skeleton {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.ns-skeleton[hidden] {
    display: none !important;
}

/* ховаємо невидимі картки лише коли IO готовий */
.news-strip.io-ready .ns-track > li:not(.is-visible) .ns-card {
    visibility: hidden;
    opacity: 0;
    transition: opacity .18s ease;
}

/* --- Вертикальний режим --- */
.news-strip[data-orient="y"] {
    flex-direction: column;
    align-items: stretch
}

.news-strip[data-orient="y"] .ns-viewport {
    width: 100%;
    height: 100%;
    max-height: 100%; /* вкладеш у grid-рядок, він задасть висоту */
    overflow-x: hidden;
    overflow-y: auto; /* скролимо по вертикалі */
}

.news-strip[data-orient="y"] .ns-track {
    flex-direction: column; /* головне */
}

.news-strip[data-orient="y"] .ns-track > li {
    min-width: auto;
    min-height: 0
}

/* Фіксована висота/ширина карток (підбери свої) */
.news-strip:not([data-orient="y"]) .ns-card {
    height: 360px;
    width: auto
}

.news-strip[data-orient="y"] .ns-card {
    height: var(--ns-card-h, 320px); /* буде переписано з JS, якщо data-card-size заданий */
}

.news-strip[data-orient="y"] .ns-card .ns-img-wrap > img:first-child {
    height: 100%;
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.6fr; /* приклад: 2 широкі колонки + вузька під вертикаль */
    grid-auto-rows: auto;
    gap: 20px;
    align-items: start;
}

/* сам елемент-стрічка — звичайний grid item */
.news-strip {
    position: relative;
    width: 100%;
}

.ns-arrow {
    font-size: 0;
    /* скидаємо дефолтні стилі браузера */
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    padding: 0;

    /* мінімалістична кнопка */
    position: absolute;
    z-index: 5;
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .95);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    font: 600 16px/1 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    cursor: pointer;
    user-select: none;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}

.ns-arrow::before {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.12 12l6.18-6.18L12.89 4.4 5.29 12l7.6 7.6 1.41-1.42L8.12 12z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.12 12l6.18-6.18L12.89 4.4 5.29 12l7.6 7.6 1.41-1.42L8.12 12z'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: rotate(0deg); /* базово ← */
}

/* напрямки */
.news-strip:not([data-orient="y"]) .ns-next::before {
    transform: rotate(180deg);
}

/* → */
.news-strip[data-orient="y"] .ns-prev::before {
    transform: rotate(90deg);
}

/* ↑ */
.news-strip[data-orient="y"] .ns-next::before {
    transform: rotate(-90deg);
}

/* ↓ */

.ns-arrow:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    background: #fff;
}

.ns-arrow:active {
    transform: scale(.96);
}

.ns-arrow[disabled] {
    opacity: .35;
    cursor: default;
    box-shadow: none;
}

/* символи стрілок однакові (використовуємо текст у кнопці або можна через ::before) */
.ns-arrow::selection {
    background: transparent;
}

/* ---- Позиції для горизонтальних (X) ---- */
.news-strip:not([data-orient="y"]) .ns-prev {
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.news-strip:not([data-orient="y"]) .ns-next {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* ---- Позиції для вертикальних (Y) ---- */
.news-strip[data-orient="y"] .ns-prev {
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.news-strip[data-orient="y"] .ns-next {
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

/* щоб стрілки не «стриба́ли» над картками з тінями */
.news-strip .ns-viewport {
    position: relative;
}

.ns-track li {
    margin: 5px !important;
}