/*
Theme Name: KinoMod
Description: Тёмная тема каталога кино. Без jQuery, без Bootstrap, дизайн-система на CSS-токенах.
Version:     0.1.0
Requires PHP: 8.0
Text Domain: kinomod
*/

/* ============================================================
   KinoMod — дизайн-система (прототипы 03–10)
   Все значения в CSS-переменных. Ни одного магического числа
   в компонентах ниже этого файла.
   ============================================================ */

:root {
  /* ---------- Поверхности ---------- */
  --bg:            #0d1117;
  --bg-alt:        #11161f;
  --surface:       #161b26;
  --surface-2:     #1c2333;
  --surface-hover: #232c3e;
  --border:        #232b3a;
  --border-strong: #33405a;

  /* ---------- Текст ---------- */
  --text:           #e9edf5;
  --text-secondary: #9aa6bf;
  --text-muted:     #6b7689;
  --text-inverse:   #0d1117;

  /* ---------- Акценты ---------- */
  --accent:        #4a8cff;
  --accent-hover:  #6ea0ff;
  --accent-subtle: rgb(74 140 255 / 0.12);
  --rating-good:   #2ecc71;
  --rating-mid:    #f5a623;
  --rating-low:    #ef5350;
  --rating-blue:   #4a8cff;
  --imdb:          #ffc107;

  /* ---------- Типографика ---------- */
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs:  0.75rem;    /* 12 */
  --fs-sm:  0.8125rem;  /* 13 */
  --fs-md:  0.875rem;   /* 14 — базовый */
  --fs-base:0.9375rem;  /* 15 */
  --fs-lg:  1rem;       /* 16 */
  --fs-xl:  1.125rem;
  --fs-2xl: 1.375rem;
  --fs-3xl: 1.75rem;
  --fs-4xl: 2.25rem;
  --fs-5xl: 3rem;

  --lh-tight: 1.15;
  --lh-normal: 1.5;
  --lh-loose: 1.7;

  /* ---------- Отступы (шаг 4) ---------- */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* ---------- Радиусы ---------- */
  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* ---------- Тени ---------- */
  --sh-xs: 0 1px 2px rgb(0 0 0 / 0.28);
  --sh-sm: 0 2px 6px rgb(0 0 0 / 0.32);
  --sh-md: 0 6px 18px rgb(0 0 0 / 0.38);
  --sh-lg: 0 16px 40px rgb(0 0 0 / 0.5);
  --sh-accent: 0 4px 16px rgb(74 140 255 / 0.28);

  /* ---------- Раскладка ---------- */
  --container: 1360px;
  --gutter: 24px;
  --header-h: 60px;
  --card-min: 180px;
  --poster-ratio: 2 / 3;
  --still-ratio: 16 / 9;

  /* ---------- Движение ---------- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;

  /* ---------- Фокус ---------- */
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* ============================================================
   Сброс
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-6));
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  background: var(--bg);
  color: var(--text-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'ss01';
}

h1, h2, h3, h4 { color: var(--text); margin: 0; font-weight: 600; line-height: var(--lh-tight); }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-xs);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

::selection { background: var(--accent); color: var(--text-inverse); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Раскладка
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--sp-16); }
.section--tight { padding-block: var(--sp-10); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.section-head h2 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
.section-head__sub { color: var(--text-muted); font-size: var(--fs-md); margin-top: var(--sp-2); }
.section-head__link {
  color: var(--text-muted);
  font-size: var(--fs-md);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.section-head__link:hover { color: var(--accent); }

/* ============================================================
   Кнопки
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--sh-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-secondary); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-muted); }
.btn--sm { padding: 6px 12px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

/* ============================================================
   Шапка
   ============================================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(13 17 23 / 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  height: var(--header-h);
}
.logo {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo b { color: var(--accent); font-weight: 700; }

.nav { display: flex; gap: var(--sp-5); list-style: none; margin: 0; padding: 0; }
.nav a {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  font-weight: 500;
  padding-block: var(--sp-2);
  position: relative;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.nav a:hover::after, .nav a[aria-current]::after { transform: scaleX(1); }

.header__tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.searchbox { position: relative; }
.searchbox input {
  width: 240px;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  transition: border-color var(--dur) var(--ease), width var(--dur) var(--ease);
}
.searchbox input::placeholder { color: var(--text-muted); }
.searchbox input:focus { border-color: var(--accent); width: 280px; outline: none; box-shadow: none; }
.searchbox__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.burger { display: none; }

/* ============================================================
   Карточка фильма (новая система)
   ============================================================ */

.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
  gap: var(--sp-8) var(--sp-5);
}
.film-grid--dense { --card-min: 150px; }
.film-grid--wide { --card-min: 260px; }

.mc { min-width: 0; }
.mc__link { display: block; color: inherit; }
.mc__poster {
  position: relative;
  aspect-ratio: var(--poster-ratio);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.mc__poster img,
.mc__poster .poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
.mc__link:hover .mc__poster { transform: translateY(-4px); box-shadow: var(--sh-md); }
.mc__link:hover .mc__poster img,
.mc__link:hover .mc__poster .poster { transform: scale(1.05); }

.mc__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--dur) var(--ease);
}
.mc__link:hover .mc__title { color: var(--accent); }
.mc__meta {
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.mc__meta .dot { opacity: 0.5; }

.mc__rating {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  min-width: 34px;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  backdrop-filter: blur(4px);
  z-index: 2;
}
.mc__rating--good,
.mc__rating--is-good { background: rgb(46 204 113 / 0.14); color: var(--rating-good); }
.mc__rating--mid,
.mc__rating--is-mid  { background: rgb(245 166 35 / 0.16); color: var(--rating-mid); }
.mc__rating--low,
.mc__rating--is-low  { background: rgb(239 83 80 / 0.16);  color: var(--rating-low); }
.mc__rating--none,
.mc__rating--is-none { background: rgb(107 118 137 / 0.5); color: var(--text-secondary); }


.mc__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0;
  background: rgb(13 17 23 / 0.35);
  transition: opacity var(--dur) var(--ease);
  z-index: 2;
}
.mc__link:hover .mc__play { opacity: 1; }

/* Заглушка постера */
.poster {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--sp-3);
}
.ph--initials {
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.poster__initials {
  font-size: clamp(0.75rem, 42cqi, 3.5rem);
  font-weight: 600;
  color: rgb(255 255 255 / 0.18);
  letter-spacing: 0.04em;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  text-align: center;
  user-select: none;
  pointer-events: none;
}
.poster--wide { aspect-ratio: var(--still-ratio); }

/* ============================================================
   Карточка персоны
   ============================================================ */

.pc__link { display: block; color: inherit; }
.pc__photo {
  aspect-ratio: var(--poster-ratio);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pc__link:hover .pc__photo { transform: translateY(-3px); box-shadow: var(--sh-md); }
.pc__name {
  margin-top: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.pc__link:hover .pc__name { color: var(--accent); }
.pc__role { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-6) var(--sp-4);
}

/* ============================================================
   Рейтинг-блоки
   ============================================================ */

.rate-block { }
.rate-block__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}
.rate-block__value {
  font-size: var(--fs-4xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}
.rate-block__votes { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-1); }
.rate-bar {
  height: 6px;
  margin-top: var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.rate-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rating-mid), var(--rating-good));
}
.rate-block--imdb .rate-bar__fill { background: linear-gradient(90deg, #b8860b, var(--imdb)); }

/* ============================================================
   Хлебные крошки
   ============================================================ */

.breadcrumbs { font-size: var(--fs-md); margin-bottom: var(--sp-5); }
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.breadcrumbs li { display: flex; align-items: center; gap: var(--sp-2); }
.breadcrumbs li + li::before { content: '/'; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: var(--text); }

/* ============================================================
   Фильтр / фасеты
   ============================================================ */

.facets { display: grid; gap: var(--sp-6); }
.facet__title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.facet__title button {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0;
}
.facet__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); }
.facet__label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 5px 0;
  cursor: pointer;
  font-size: var(--fs-md);
  color: var(--text-secondary);
  border-radius: var(--r-xs);
  transition: color var(--dur) var(--ease);
}
.facet__label:hover { color: var(--text); }
.facet__label input {
  /* кастомные стили — в improve.css */
  flex: none;
}
.facet__name { flex: 1; }
.facet__count { color: var(--text-muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.facet__more { color: var(--accent); font-size: var(--fs-sm); background: none; border: 0; cursor: pointer; padding: var(--sp-2) 0 0; text-align: left; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 8px 5px 12px;
  border-radius: var(--r-full);
  background: var(--accent-subtle);
  border: 1px solid rgb(74 140 255 / 0.28);
  color: var(--text);
  font-size: var(--fs-sm);
}
.chip a { color: var(--text-muted); display: grid; place-items: center; width: 16px; height: 16px; }
.chip a:hover { color: var(--rating-low); }

/* ============================================================
   Сортировка и вид
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-8);
  flex-wrap: wrap;
}
.toolbar__count { color: var(--text-muted); font-size: var(--fs-md); }
.toolbar__count b { color: var(--text); font-weight: 600; }
.toolbar__right { display: flex; align-items: center; gap: var(--sp-3); }

.select {
  appearance: none;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa6bf' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font-size: var(--fs-md);
  cursor: pointer;
}
.select:hover { border-color: var(--border-strong); }

.view-switch { display: flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.view-switch button {
  display: grid;
  place-items: center;
  width: 38px; height: 36px;
  border: 0;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.view-switch button[aria-pressed="true"] { background: var(--surface-hover); color: var(--accent); }
.view-switch button + button { border-left: 1px solid var(--border); }

/* Списокный вид */
.film-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: var(--sp-5);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.film-row:hover { background: var(--surface); }
.film-row__poster { aspect-ratio: var(--poster-ratio); border-radius: var(--r-sm); overflow: hidden; }
.film-row__title { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.film-row__title a { color: var(--text); }
.film-row__title a:hover { color: var(--accent); }
.film-row__meta { color: var(--text-muted); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.film-row__desc { color: var(--text-secondary); font-size: var(--fs-md); line-height: var(--lh-normal); }
.film-row__rating { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); text-align: center; padding-inline-end: var(--sp-3); }

/* ============================================================
   Пагинация
   ============================================================ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-1);
  margin-top: var(--sp-12);
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}
.pagination a:hover { background: var(--surface); color: var(--text); }
.pagination [aria-current] { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.pagination .is-disabled { color: var(--text-muted); opacity: 0.4; pointer-events: none; }

/* ============================================================
   Иконки
   ============================================================ */

.ic { flex: none; }

/* ============================================================
   Скелетоны
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.sk-poster { aspect-ratio: var(--poster-ratio); border-radius: var(--r-md); }
.sk-line { height: 10px; margin-top: var(--sp-3); }
.sk-line--sm { width: 55%; }

/* ============================================================
   Печать
   ============================================================ */

@media print {
  .header, .footer, .pagination, .breadcrumbs, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  h1, h2, h3, a { color: #000; }
  .section { padding-block: 12px; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #555; }
}

/* ============================================================
   Улучшения поверх дизайн-системы
   ============================================================ */

/* ---------- Оригинальный логотип ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
}
.logo img {
  width: 36px;
  height: 36px;
  flex: none;
  display: block;
}
.logo:hover { color: var(--text); }
.logo b { color: var(--accent); font-weight: 700; }

/* ---------- Светлая тема (тёмная остаётся дефолтом) ---------- */
[data-theme="light"] {
  --bg:            #f4f6fa;
  --bg-alt:        #eef1f7;
  --surface:       #ffffff;
  --surface-2:     #f7f8fc;
  --surface-hover: #eef1f7;
  --border:        #dde3ee;
  --border-strong: #c5cedd;

  --text:           #121722;
  --text-secondary: #4a5568;
  --text-muted:     #6b7689;
  --text-inverse:   #ffffff;

  --accent:        #2f6fed;
  --accent-hover:  #1f5ad4;
  --accent-subtle: rgb(47 111 237 / 0.1);

  --sh-xs: 0 1px 2px rgb(18 23 34 / 0.06);
  --sh-sm: 0 2px 6px rgb(18 23 34 / 0.08);
  --sh-md: 0 6px 18px rgb(18 23 34 / 0.1);
  --sh-lg: 0 16px 40px rgb(18 23 34 / 0.12);
  --sh-accent: 0 4px 16px rgb(47 111 237 / 0.2);

  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

[data-theme="light"] .header {
  background: rgb(244 246 250 / 0.9);
}
[data-theme="light"] .mobile-nav {
  background: rgb(255 255 255 / 0.96);
}
[data-theme="light"] .tabs {
  background: rgb(244 246 250 / 0.94);
}
[data-theme="light"] .hero__bg {
  background:
    radial-gradient(900px 500px at 78% 12%, rgb(47 111 237 / 0.12), transparent 65%),
    radial-gradient(700px 420px at 12% 88%, rgb(46 204 113 / 0.06), transparent 60%),
    var(--bg-alt);
}

/* ---------- Переключатель темы ---------- */
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* ---------- Оглавления /years/ /genres/ (из темы) ---------- */
.indexpage { display: grid; gap: var(--sp-8); }
.indexpage__group { display: grid; gap: var(--sp-3); }
.indexpage__title {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.indexpage__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-2);
}
.indexpage__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.indexpage__list a:hover { border-color: var(--accent); color: var(--accent); }
.indexpage__count {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.indexpage__list a:hover .indexpage__count { color: var(--accent); }

.decade-jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
}
.decade-jump a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.decade-jump a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Навбар макетов ---------- */
.mock-bar {
  position: sticky;
  bottom: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  overflow-x: auto;
}
.mock-bar a {
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 600;
}
.mock-bar a:hover,
.mock-bar a[aria-current] { color: var(--accent); }
.mock-bar__label {
  font-weight: 700;
  color: var(--text);
  margin-right: var(--sp-1);
  white-space: nowrap;
}

/* ---------- Каталог: вид list ---------- */
.catalog[data-view="list"] .film-grid { display: none; }
.catalog[data-view="grid"] .film-list { display: none; }
.catalog[data-view="list"] .film-list { display: block; }

/* ---------- Бейдж улучшения ---------- */
.proto-badge {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  max-width: min(420px, calc(100vw - 24px));
}
.proto-badge__num {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-xs);
  flex: none;
}
.proto-badge a { color: var(--accent); white-space: nowrap; }
@media (max-width: 720px) { .proto-badge { display: none; } }

/* ---------- Поиск: расширяется при focus (как на dev.cheapman.ru) ---------- */
.searchbox input:hover {
  border-color: var(--border);
}
.searchbox input:focus,
.searchbox input:focus-visible {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: none !important;
  width: 280px !important;
}

/* Тема правее поиска */
.header__tools > .searchbox { order: 1; }
.header__tools > .theme-toggle { order: 2; }
.header__tools > .burger { order: 3; }

/* ---------- Ссылки «Все …» со SVG-шевроном ---------- */
.section-head__link {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.section-head__link .link-arrow,
.more .link-arrow,
.fsection__head .link-arrow {
  flex: none;
  display: block;
}
.more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

/* ---------- Список фильмов: отступ у рейтинга ---------- */
.film-row {
  padding-inline-end: var(--sp-5);
}
.film-row__rating {
  padding-inline-end: var(--sp-3);
  min-width: 3.25rem;
  justify-self: end;
}

/* ---------- Компактные видео-трейлеры ---------- */
.videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
}
.video-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: #fff;
}
.video-card__bg {
  position: absolute;
  inset: 0;
}
.video-card__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}
.video-card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(13 17 23 / 0.32);
  border: 0;
  color: #fff;
  transition: background var(--dur) var(--ease);
}
.video-card:hover .video-card__play { background: rgb(13 17 23 / 0.18); }
.video-card__play-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.94);
  color: var(--bg);
  box-shadow: var(--sh-md);
  transition: transform var(--dur) var(--ease);
}
.video-card:hover .video-card__play-btn { transform: scale(1.08); }
.video-card__label {
  position: absolute;
  left: var(--sp-3);
  bottom: var(--sp-3);
  z-index: 1;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: rgb(13 17 23 / 0.78);
  backdrop-filter: blur(6px);
  font-size: var(--fs-sm);
  font-weight: 500;
  max-width: calc(100% - 72px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-card__duration {
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-3);
  z-index: 1;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: rgb(13 17 23 / 0.78);
  color: var(--text-secondary);
  font-size: var(--fs-2xs);
  font-variant-numeric: tabular-nums;
}

/* ---------- Rail: маска по краям (не оверлей — иначе режет постеры) ---------- */
.rail-wrap {
  position: relative;
}
.rail-wrap::before,
.rail-wrap::after {
  content: none;
  display: none;
}
.rail-wrap .rail,
.rail {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--gutter, 24px),
    #000 calc(100% - var(--gutter, 24px)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--gutter, 24px),
    #000 calc(100% - var(--gutter, 24px)),
    transparent 100%
  );
}

/* ---------- Hero drift (основной вариант главной) ---------- */
.hero--drift {
  position: relative;
  overflow: hidden;
  min-height: min(72vh, 640px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.hero--drift .hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 70% 20%, rgb(74 140 255 / 0.14), transparent 60%),
    radial-gradient(600px 400px at 15% 90%, rgb(46 204 113 / 0.06), transparent 55%),
    var(--bg-alt);
}
.hero--drift .hero__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg-alt) 0%, rgb(17 22 31 / 0.88) 42%, rgb(17 22 31 / 0.35) 72%, transparent 100%),
    linear-gradient(180deg, rgb(13 17 23 / 0.2), rgb(13 17 23 / 0.55));
  pointer-events: none;
  z-index: 1;
}
[data-theme="light"] .hero--drift .hero__scrim {
  background:
    linear-gradient(90deg, var(--bg-alt) 0%, rgb(238 241 247 / 0.92) 42%, rgb(238 241 247 / 0.4) 72%, transparent 100%),
    linear-gradient(180deg, rgb(244 246 250 / 0.15), rgb(244 246 250 / 0.5));
}
.hero--drift > .container {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-block: var(--sp-16) var(--sp-12);
}
.hero--drift .hero__inner {
  max-width: 520px;
  text-align: left;
}
.hero--drift .hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: var(--accent-subtle);
  border: 1px solid rgb(74 140 255 / 0.25);
  color: var(--accent-hover);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: var(--sp-5);
}
.hero--drift .hero__title {
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.hero--drift .hero__title em { font-style: normal; color: var(--accent); }
.hero--drift .hero__lead {
  margin-top: var(--sp-5);
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  line-height: var(--lh-loose);
}
.hero--drift .hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
}
.hero--drift .hero__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--sp-8);
  margin-top: var(--sp-10);
}
.hero--drift .stat__value {
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.hero--drift .stat__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--sp-2);
}

.drift {
  position: absolute;
  inset: -40px -20px;
  pointer-events: none;
  z-index: 0;
}
.drift__card {
  position: absolute;
  width: clamp(100px, 11vw, 150px);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-md);
  opacity: 0.55;
  will-change: transform;
  animation: drift-float var(--dur, 18s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.drift__card .ph {
  aspect-ratio: 2 / 3;
  width: 100%;
  background: var(--surface-2);
}
.drift__card .ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.drift__card .rating {
  position: absolute;
  top: 6px; left: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgb(46 204 113 / 0.2);
  color: var(--rating-good);
  font-size: 0.7rem;
  font-weight: 800;
  backdrop-filter: blur(4px);
}
@keyframes drift-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(var(--rot, -6deg)); }
  50% { transform: translate3d(var(--dx, 12px), var(--dy, -28px), 0) rotate(calc(var(--rot, -6deg) + 3deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .drift__card { animation: none; }
}
@media (max-width: 760px) {
  .drift__card:nth-child(n+5) { display: none; }
  .hero--drift .hero__scrim {
    background:
      linear-gradient(180deg, var(--bg-alt) 35%, rgb(17 22 31 / 0.7) 70%, rgb(17 22 31 / 0.85));
  }
  [data-theme="light"] .hero--drift .hero__scrim {
    background:
      linear-gradient(180deg, var(--bg-alt) 35%, rgb(238 241 247 / 0.75) 70%, rgb(238 241 247 / 0.92));
  }
}

/* ---------- Кастомные чекбоксы (без ::after на input) ---------- */
.facet__label input[type="checkbox"],
.facet__label input[type="radio"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  flex: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  vertical-align: middle;
}
.facet__label input[type="radio"] { border-radius: 50%; }
.facet__label input[type="checkbox"]:checked,
.facet__label input[type="radio"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.facet__label input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.5'/%3E%3C/svg%3E");
}
.facet__label input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3.5' fill='%23fff'/%3E%3C/svg%3E");
}
.facet__label input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.fsection__head a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  color: var(--accent);
  font-weight: 600;
  font-size: var(--fs-md);
}
.cast-more { display: none; }
.cast-more.is-open { display: grid; }
.cast-more__btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.cast-more__btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------- Hero banner (двухчастный, как kinomod.ru) ---------- */
.banner-slider {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}
.banner-slider__track {
  display: flex;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.banner-wrap {
  flex: 0 0 100%;
  display: flex;
  align-items: stretch;
  min-height: 420px;
  height: clamp(360px, 48vw, 500px);
  border-radius: 12px;
  overflow: hidden;
  background: #211813;
  box-shadow: 0 5px 10px rgb(0 0 0 / 0.3);
}
.banner-wrap__left {
  flex: 0 0 45%;
  max-width: 45%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 28px 56px 48px;
  position: relative;
  z-index: 2;
  text-align: left;
}
.banner-wrap__title {
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}
.banner-wrap__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.banner-wrap__tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid rgb(221 221 221 / 0.55);
  border-radius: 4px;
  color: #ddd;
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.banner-wrap__lead {
  margin: 16px 0 0;
  max-width: 36ch;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: rgb(255 255 255 / 0.88);
}
.banner-wrap__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  min-width: 200px;
  padding: 0 22px;
  height: 44px;
  border-radius: 4px;
  background: #132977;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  align-self: flex-start;
}
.banner-wrap__cta:hover { background: #1a3699; color: #fff; }
.banner-wrap__right {
  flex: 0 0 55%;
  max-width: 55%;
  position: relative;
  background: #1a1512 center / cover no-repeat;
}
.banner-wrap__right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 55%;
  background: linear-gradient(to right, #211813 0%, rgb(33 24 19 / 0.7) 40%, transparent 100%);
  pointer-events: none;
}
.banner-slider__dots {
  position: absolute;
  left: 0; right: 0;
  bottom: 14px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.banner-slider__dot {
  pointer-events: auto;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.55);
  cursor: pointer;
}
.banner-slider__dot.is-active { background: #132977; }
.banner-slider__nav {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.banner-slider__btn {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.18);
  background: rgb(0 0 0 / 0.4);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.banner-slider__btn:hover { background: rgb(0 0 0 / 0.6); }
.banner-slider__btn--prev { left: 12px; }
.banner-slider__btn--next { right: 12px; }
@media (max-width: 860px) {
  .banner-wrap {
    flex-direction: column-reverse;
    height: auto;
    min-height: 0;
  }
  .banner-wrap__left,
  .banner-wrap__right {
    flex: none;
    max-width: none;
    width: 100%;
  }
  .banner-wrap__right {
    aspect-ratio: 16 / 9;
    min-height: 200px;
  }
  .banner-wrap__right::after {
    inset: auto 0 0 0;
    width: 100%;
    height: 55%;
    background: linear-gradient(to top, #211813, transparent);
  }
  .banner-wrap__left { padding: 24px 22px 52px; }
  .banner-wrap__title { font-size: clamp(1.5rem, 7vw, 2rem); }
  .banner-slider__btn { display: none; }
}

/* ---------- Hero float posters: реальные изображения ---------- */
.hero-float__card img,
.hero-river__card img,
.drift__card img,
.river__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Постеры с реальными jpg ---------- */
.poster {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  padding: 0;
}
.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.film-poster__img .poster,
.mc__poster .poster,
.pc__photo .poster {
  width: 100%;
  height: 100%;
}
