/* =========================================
   КІНОПОРТАЛ — Сторінка "Новини"
   MOBILE-FIRST, DARK THEME
   Оновлено: 2025-10-24
========================================= */

:root{
  --bg: #0f172a;
  --card: #0b1223;
  --text: #e5e7eb;
  --text-strong: #f3f4f6;
  --muted: #9ca3af;
  --muted-2: #cbd5e1;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --danger: #ef4444;
  --border: rgba(255,255,255,.08);
  --border-2: rgba(255,255,255,.12);
  --shadow: 0 10px 22px rgba(0,0,0,.35);
  --radius: 14px;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body{ height: 100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Базові лінки/фокус */
a{ color: inherit; }
a:focus-visible,
button:focus-visible{
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Контейнер */
.container{
  width: min(1200px, 100%);
  margin-inline: auto;
  padding-inline: clamp(12px, 4vw, 24px);
  padding-block: 20px;
}

/* Шапка сторінки */
.news-page{ padding: 10px 0 28px; }
.news-page__head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom: 14px;
}
.news-page__head h1{
  margin:0;
  font-size: clamp(20px, 4.2vw, 28px);
  color: var(--text-strong);
}
.news-page__actions .btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: 12px;
  text-decoration:none; font-weight:700;
  border:1px solid var(--border);
  background: var(--brand); color:#fff;
  transition: background .2s ease, transform .08s ease-in-out;
  box-shadow: var(--shadow);
}
.news-page__actions .btn:hover{ background: var(--brand-hover); }
.news-page__actions .btn:active{ transform: scale(.98); }

/* Алерти */
.alert{
  padding: 12px 14px; border-radius: 12px; margin: 10px 0 16px; font-weight: 600;
  border:1px solid var(--border);
}
.alert--success{ background: rgba(34,197,94,.12); color:#86efac; }
.alert--error{ background: rgba(239,68,68,.12); color:#fca5a5; }

/* Список новин (поелементно) */
.news-list{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Елемент новини */
.news-item{
  display:grid;
  grid-template-columns: 1fr; /* mobile: стек */
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

/* Медіа-блок із стабільною висотою */
.news-item__media{
  width:100%;
  background:#0a0f1d;
  border-radius: 10px;
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  aspect-ratio: 16/9; /* запобігає зсувам верстки */
}
.news-item__image{
  width:100%; height:100%;
  object-fit: contain !important; /* показуємо всю картинку без кропу */
  background:#0a0f1d;
  cursor: zoom-in;
}
.news-item__placeholder{
  color:#94a3b8; font-weight:700; font-size: 13px; text-transform: uppercase;
}

/* Текстова частина */
.news-item__body{ display:flex; flex-direction:column; gap:8px; }
.news-item__title{
  margin:0;
  font-size: clamp(16px, 3.8vw, 20px);
  line-height:1.3;
  color: var(--text-strong);
  word-break: break-word;
  overflow-wrap:anywhere;
}
.news-item__title a{ color: inherit; text-decoration:none; }
.news-item__title a:hover{ text-decoration: underline; }

.news-item__meta{
  margin:0; color: var(--muted); font-size: clamp(12px, 3.2vw, 14px);
}
.news-item__text{
  margin: 4px 0 0;
  color: var(--muted-2);
  line-height: 1.6;
  font-size: clamp(14px, 3.4vw, 15px);
}

/* Відео */
.news-item__video video{
  margin-top: 10px; width: 100%; height: auto; border-radius: 10px; outline: none; border: 1px solid var(--border);
}

/* Дії (видалення) */
.news-item__actions{
  display:flex; align-items:flex-start; justify-content:flex-start; gap:8px;
}
.link--danger{
  display:inline-flex; align-items:center; justify-content:center;
  min-height: 40px; padding: 8px 12px;
  border-radius: 10px;
  color:#fff; background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  text-decoration:none; font-weight:700;
  transition: background .2s ease, transform .08s ease-in-out;
}
.link--danger:hover{ background: rgba(239,68,68,.25); }
.link--danger:active{ transform: scale(.98); }

/* Розкладка на більших екранах */
@media (min-width: 760px){
  .news-item{
    grid-template-columns: 260px 1fr auto; /* медіа | контент | дії */
    align-items: start;
    gap: 16px;
    padding: 14px;
  }
  .news-item__media{ aspect-ratio: 16/10; }
  .news-item__actions{ justify-content:flex-end; }
}

/* Пагінація — горизонтальна прокрутка на мобілках */
.pagination{
  margin: 22px 0 0;
  display:flex; justify-content:center; align-items:center; gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-inline: 6px;
}
.pagination::-webkit-scrollbar{ display:none; }

.pagination__page,
.pagination__nav,
.pagination__dots{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 42px; height: 42px; padding: 0 12px;
  border-radius: 12px;
  text-decoration:none; font-weight:700;
  border:1px solid var(--border-2);
  background: rgba(255,255,255,.04);
  color: var(--text);
  transition: background .18s ease, transform .12s ease;
  scroll-snap-align: center;
}
.pagination__page:hover,
.pagination__nav:hover{ background: rgba(255,255,255,.08); transform: translateY(-1px); }
.pagination__page.is-active,
.pagination__page[aria-current="page"]{
  background: var(--brand);
  border-color: var(--brand);
}
.pagination__nav.is-disabled{ opacity:.5; pointer-events:none; }
.pagination__dots{
  background: transparent; border-color: transparent; box-shadow:none; color: var(--muted);
}

/* Модальне зображення */
.modal{
  position: fixed; inset: 0; display:none; align-items:center; justify-content:center;
  background: rgba(2,6,23,.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 1000;
  padding: 16px;
}
.modal__image{
  max-width: 94vw; max-height: 90vh;
  object-fit: contain; border-radius: 12px;
  background:#000; border:1px solid var(--border);
}
.modal__close{
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
  font-size: 32px; line-height: 1; color:#fff; cursor: pointer;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--border-2);
  border-radius: 12px; padding: 4px 10px;
}

/* Дрібні покращення продуктивності та доступності */
.news-item__image{ content-visibility: auto; contain: paint; image-rendering: auto; }
@media (prefers-reduced-motion: reduce){
  .news-item, .link--danger, .pagination__page, .pagination__nav{ transition: none; }
}
