/* ============================================================================
   NewsBK — чистая дизайн-система (ребилд фронта с нуля, июнь 2026)
   Светлое спортивное медиа. Один источник правды — токены в :root ниже.
   Структура файла:
     1. Токены (цвета, типографика, отступы, радиусы, тени)
     2. База / reset
     3. Типографика
     4. Лэйаут (контейнер, сетки)
     5. Компоненты (шапка, подвал, карточка, герой, лента, бейджи, кнопки)
     6. Адаптив
   Чтобы поменять весь облик — правьте токены в п.1.
   ============================================================================ */

/* ───────────────────────── 1. ТОКЕНЫ ───────────────────────── */
:root {
  /* Цвета */
  --bg:        #f6f7f9;   /* фон страницы */
  --surface:   #ffffff;   /* карточки/панели */
  --surface-2: #f1f3f6;   /* вторичные плашки (чипы, инпуты) */
  --ink:       #15171c;   /* основной текст */
  --ink-2:     #41454d;   /* вторичный текст (лиды) */
  --muted:     #6b7280;   /* приглушённый (мета, даты) */
  --line:      #e5e7eb;   /* границы */
  --accent:    #d72638;   /* акцент — брендовый красный */
  --accent-ink:#b51f2e;   /* акцент hover/нажатие */

  /* Акценты видов спорта (тонкая полоска на карточке) */
  --football:   #1f9d55;
  --hockey:     #2f6fed;
  --basketball: #e8730c;
  --tennis:     #b7920a;
  --fight:      #d72638;
  --other:      #6b7280;

  /* Типографика — умеренные кегли, как в живых ньюсрумах (не лендинговые плакаты) */
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-display: clamp(23px, 2.3vw, 32px);
  --fs-h1:      clamp(22px, 2.1vw, 29px);
  --fs-h2:      19px;
  --fs-h3:      16px;
  --fs-body:    16px;
  --fs-sm:      14px;
  --fs-xs:      12.5px;

  /* Отступы (шаг 4px) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Радиусы и тени */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow:    0 6px 22px rgba(16, 18, 22, 0.06);
  --shadow-lg: 0 12px 38px rgba(16, 18, 22, 0.10);

  --container: 1200px;
}

/* ───────────────────────── 2. БАЗА / RESET ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* страховка от горизонтального скролла на узких экранах */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Видимый фокус клавиатуры (WCAG 2.4.7) — был погашен на инпутах */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ───────────────────────── 3. ТИПОГРАФИКА ───────────────────────── */
/* Фикс переполнения grid/flex: гибкие дети по умолчанию min-width:auto и не
   сжимаются ниже контента, из-за чего длинный текст распирает раскладку. */
.hero__body, .card__body, .feed__item, .feed__item > span,
.fixture, .fixture > div, .panel, .list-layout > *, .home-split > *, .lead-grid > *, .sec-grid > * { min-width: 0; }
h1, h2, h3, .card__title, .hero__title, .feed__title, .fixture__teams { overflow-wrap: break-word; }

.muted { color: var(--muted); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
}
.lead { color: var(--ink-2); font-size: var(--fs-body); line-height: 1.6; }

/* ───────────────────────── 4. ЛЭЙАУТ ───────────────────────── */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--s5); }
.section { margin-top: var(--s7); }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s5);
}
.section__head h2 { font-size: var(--fs-h2); }
.section__head a { font-size: var(--fs-sm); font-weight: 700; color: var(--accent); }

/* Сетка карточек */
.grid { display: grid; gap: var(--s5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ───────────────────────── 5. КОМПОНЕНТЫ ───────────────────────── */

/* — Шапка — */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.masthead__row {
  display: flex; align-items: center; gap: var(--s6);
  height: 64px;
}
.brand { display: flex; flex-direction: column; line-height: 1; font-weight: 800; }
.brand b { font-size: 20px; letter-spacing: -0.03em; }
.brand small { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 6px; }
.nav { display: flex; gap: var(--s5); margin-left: var(--s4); }
.nav a { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.nav a:hover, .nav a.is-active { color: var(--accent); }
.masthead__search { margin-left: auto; }
.search {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; min-width: 240px;
}
.search input { border: none; background: none; outline: none; font-size: var(--fs-sm); width: 100%; color: var(--ink); }

/* — Кнопки — */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 700;
}
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-ink); color: #fff; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* — Бейджи / чипы — */
.badge {
  display: inline-block; font-size: var(--fs-xs); font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
}
.badge--accent { background: var(--accent); color: #fff; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* — Карточка новости —
   Ключевое: визуал ВСЕГДА. Есть реальное фото (сущность или матчевый кадр из
   курируемого пула) → .card__media с img, нет → фирменная SVG-обложка (.cover).
   object-position 50% 28% — фокус кропа чуть выше центра, чтобы у портретов
   не резало головы, а у матчевых кадров не терялось действие. */
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card__media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }

/* Фирменная обложка (инлайн-SVG): заполняет медиа-слот как фото */
.cover { display: block; width: 100%; height: 100%; }
.card__body { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); }
.card__cat { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--cat, var(--muted)); }
.card__cat::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--cat, var(--muted)); }
.card__title { font-size: var(--fs-h3); font-weight: 700; letter-spacing: -0.01em; }
.card:hover .card__title { color: var(--accent); }
.card__meta { font-size: var(--fs-xs); color: var(--muted); margin-top: auto; }
/* Сервисная текст-карточка (архив и т.п.) — акцентная полоска вместо медиа */
.card--text { border-left: 3px solid var(--cat, var(--line)); }

/* — Лид-кластер: герой (фото сверху) + колонка мини-лидов справа — */
.lead-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s5); align-items: stretch; }
.lead-side { display: flex; flex-direction: column; }

.hero {
  display: flex; flex-direction: column-reverse; /* media в DOM ниже body → визуально сверху */
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow);
}
.hero__media { display: block; background: var(--surface-2); aspect-ratio: 16 / 9; max-height: 480px; width: 100%; }
.hero__media img, .hero__media .cover { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.hero__body { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); }
.hero__title { font-size: var(--fs-display); line-height: 1.18; }
.hero__title a:hover { color: var(--accent); }
.hero__meta { font-size: var(--fs-xs); color: var(--muted); }

/* Мини-лид (строка в колонке справа от героя).
   flex:1 — строки делят высоту колонки поровну и она всегда заполнена
   вровень с героем, без пустот при любой его высоте. */
.mini {
  flex: 1;
  display: grid; grid-template-columns: 104px 1fr; gap: var(--s3);
  align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--line);
}
.mini:last-child { border-bottom: none; }
.mini__thumb {
  width: 104px; height: 68px; border-radius: var(--r-sm);
  object-fit: cover; object-position: 50% 28%;
  background: var(--surface-2); display: block; overflow: hidden;
}
.mini__title { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.mini:hover .mini__title { color: var(--accent); }
.mini__meta { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }

/* — Секция вида спорта: цветной маркер + асимметричная пара карточка/строки — */
.section__head--cat h2 { display: flex; align-items: center; gap: 10px; }
.section__head--cat h2::before {
  content: ""; width: 10px; height: 22px; border-radius: 3px;
  background: var(--cat, var(--accent)); flex: none;
}
.sec-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s5); align-items: stretch; }
.sec-list { display: flex; flex-direction: column; justify-content: space-between; }
.sec-row {
  display: flex; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) 0; border-bottom: 1px solid var(--line);
}
.sec-row:first-child { padding-top: 0; }
.sec-row:last-child { border-bottom: none; padding-bottom: 0; }
.sec-row__title { font-size: 15px; font-weight: 700; line-height: 1.4; }
.sec-row:hover .sec-row__title { color: var(--accent); }
.sec-row__meta { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; padding-top: 3px; }

/* — Лента-список (компактные строки) — */
.feed { display: flex; flex-direction: column; }
.feed__item {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s4);
  align-items: center; padding: var(--s4) 0; border-bottom: 1px solid var(--line);
}
.feed__item:last-child { border-bottom: none; }
.feed__thumb { width: 96px; height: 64px; border-radius: var(--r-sm); object-fit: cover; object-position: 50% 28%; background: var(--surface-2); }
.feed__no { width: 32px; text-align: center; font-weight: 800; color: var(--muted); font-size: var(--fs-sm); }
.feed__title { font-size: var(--fs-sm); font-weight: 700; }
.feed__title:hover { color: var(--accent); }
.feed__meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

/* — Боковая панель — */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); }
.panel__title { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink); margin-bottom: var(--s4); }

/* — Рекламные слоты (Мелбет, 18+; маркировка вшита в креативы) —
   Заметность без вреда чтению: хедер-лейдерборд под шапкой, сайдбар-тауэр в
   колонке, кэтфиш — липкий баннер у низа (закрывается, помнит закрытие).
   Пропорции слотов = пропорциям креатива на каждом брейкпоинте → object-fit:
   cover не режет вшитую маркировку. */
.site-ad { margin: 0 auto; }
.site-ad a, .catfish-ad a { display: block; }
.site-ad img, .catfish-ad img { width: 100%; height: 100%; object-fit: cover; }

.site-ad--header { margin-top: var(--s5); }
.site-ad--header a {
  max-width: 1140px; margin: 0 auto; aspect-ratio: 1140 / 120; overflow: hidden;
  background: #0b0c0f; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
}
.site-ad--rail a {
  max-width: 300px; margin: 0 auto; aspect-ratio: 300 / 600; overflow: hidden;
  background: #0b0c0f; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
}

.catfish-ad {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom)); z-index: 60;
  width: min(1000px, calc(100% - 24px));
}
.catfish-ad a {
  aspect-ratio: 1000 / 120; overflow: hidden; background: #0b0c0f;
  border: 1px solid rgba(16, 18, 22, 0.2); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.catfish-ad__close {
  position: absolute; top: -10px; right: -10px; display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0; font-size: 13px; line-height: 1; color: #fff;
  background: rgba(16, 18, 22, 0.92); border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}
.catfish-ad__close:hover { background: rgba(16, 18, 22, 1); }
/* запас под липкий баннер, чтобы он не перекрывал выходные данные в подвале */
body.has-catfish-ad { padding-bottom: 160px; }

/* — Подвал — */
.footer { margin-top: var(--s8); background: #14161b; color: rgba(255, 255, 255, 0.78); }
.footer a { color: rgba(255, 255, 255, 0.78); }
.footer a:hover { color: #fff; }
.footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s5); padding: var(--s7) 0 var(--s5); border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.footer__brand b { color: #fff; font-size: 18px; }
.footer__brand p { color: rgba(255, 255, 255, 0.55); max-width: 320px; margin-top: var(--s2); font-size: var(--fs-sm); }
.footer nav { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-content: flex-start; }
.footer nav a { font-size: var(--fs-sm); }
.footer__legal { padding: var(--s5) 0 var(--s7); font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.6); display: grid; gap: var(--s2); }
.footer__legal strong { color: #fff; }

/* — Страница статьи — */
.article { max-width: 760px; } /* в list-layout колонка и так ~760px, центрирование не нужно */
.article__title { font-size: var(--fs-h1); margin: var(--s3) 0; }
.article__meta { display: flex; flex-wrap: wrap; gap: var(--s4); color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--s5); }
.article__figure { margin: 0 0 var(--s5); }
.article__figure img { width: 100%; max-height: 460px; object-fit: cover; object-position: 50% 25%; border-radius: var(--r-lg); }
.article__figure .cover { border-radius: var(--r-lg); height: auto; }
.article__credit { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s2); }
.article__body { font-size: 17px; line-height: 1.75; color: var(--ink-2); }
.article__body p { margin: 0 0 var(--s4); }
.article__tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s6); }
.article__source { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); }
.article__source a { color: var(--accent); font-weight: 600; }
.share { display: flex; gap: var(--s3); margin-top: var(--s4); }
.share a { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }

/* — Обсуждение — */
.discuss { max-width: 760px; margin: var(--s7) auto 0; }
.reactions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s5); }
.reactions button { display: inline-flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.reactions button:hover { border-color: var(--accent); color: var(--accent); }
.comment-form { display: flex; flex-direction: column; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); }
.comment-form input, .comment-form textarea { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; font: inherit; color: var(--ink); }
.comment-form textarea { min-height: 92px; resize: vertical; }
.comment-form .hp-field { display: none; }
.comment-form button[type="submit"] { align-self: flex-start; background: var(--accent); color: #fff; border: none; border-radius: var(--r-sm); padding: 10px 18px; min-height: 44px; font-size: var(--fs-sm); font-weight: 700; }
.comment-form button[type="submit"]:hover { background: var(--accent-ink); }
/* каналы трансляции под строкой матча в афише */
.fixture__channels { display: flex; flex-wrap: wrap; gap: var(--s2); margin: calc(var(--s2) * -1) 0 var(--s3); }
.comment-list { margin-top: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.comment-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4); }
.comment-item__head { font-weight: 700; font-size: var(--fs-sm); margin-bottom: 4px; }
.comment-item p { color: var(--ink-2); font-size: var(--fs-sm); }

/* — Страница-список (/news, категории) — */
.pagehead { margin-bottom: var(--s6); }
.pagehead h1 { font-size: var(--fs-h1); margin: var(--s2) 0 var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s6); }
.list-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--s7); align-items: start; }
.home-split { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s7); align-items: start; }
.pager { display: flex; gap: var(--s3); justify-content: center; margin-top: var(--s7); }
.pager a, .pager span { padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; background: var(--surface); }
.pager .is-current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* — Матчи (/scores) — */
.fixtures { display: flex; flex-direction: column; gap: var(--s3); }
.fixtures__day { font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin: var(--s5) 0 var(--s3); }
.fixtures__day:first-child { margin-top: 0; }
.fixture { display: grid; grid-template-columns: 1fr auto; gap: var(--s4); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4) var(--s5); }
.fixture__league { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 3px; }
.fixture__teams { font-weight: 700; font-size: var(--fs-body); }
.fixture__state { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.fixture__score { font-weight: 800; font-size: var(--fs-h3); }
.fixture__time { font-weight: 700; color: var(--ink-2); }

/* ───────────────────────── 6. АДАПТИВ ───────────────────────── */
@media (max-width: 1000px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  /* двухколоночные раскладки (контент + сайдбар) → одна колонка */
  .list-layout, .home-split, .lead-grid, .sec-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 720px) {
  .container { padding: 0 var(--s4); }
  .nav, .masthead__search { display: none; }
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .footer__top { flex-direction: column; }
  .section__head { flex-wrap: wrap; gap: var(--s2); }
}
/* Рекламные слоты на мобайле: <picture> отдаёт креативы 320×100 — слоты под них */
@media (max-width: 760px) {
  .site-ad--header a { max-width: 320px; aspect-ratio: 320 / 100; }
  .catfish-ad { width: calc(100% - 16px); }
  .catfish-ad a { aspect-ratio: 320 / 100; }
  body.has-catfish-ad { padding-bottom: 120px; }
}
