/* ============ Загрузочный экран ============ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: var(--bg);
  transition: opacity 320ms ease, visibility 320ms ease;
}
#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-logo {
  height: 40px;
  width: auto;
  animation: loaderPulse 1.6s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}
.loader-bar {
  width: 120px;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.loader-fill {
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 99px;
  animation: loaderSlide 1s ease-in-out infinite;
}
@keyframes loaderSlide {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}

/* ============ Шрифт Benzin ============ */
@font-face {
  font-family: 'Benzin';
  src: url('./public/fonts/Benzin-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Benzin';
  src: url('./public/fonts/Benzin-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Benzin';
  src: url('./public/fonts/Benzin-Semibold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Benzin';
  src: url('./public/fonts/Benzin-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Benzin';
  src: url('./public/fonts/Benzin-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}

/* ============ D3 · базовая дизайн-система ============ */
:root {
  --radius: 8px;
  --radius-lg: 12px;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e7e7ea;
  --border-strong: #d4d4d8;

  --text: #111113;
  --text-muted: #6b6b73;
  --text-soft: #9a9aa3;

  --accent: #1e66f5;
  --accent-hover: #1957d6;
  --accent-soft: #e8f0fe;

  --shadow-sm: 0 1px 2px rgba(17, 17, 19, .04);
  --shadow-md: 0 4px 16px rgba(17, 17, 19, .06);
  --shadow-lg: 0 12px 40px rgba(17, 17, 19, .08);

  --t: 140ms cubic-bezier(.2,.6,.2,1);

  --container: 1200px;
  --gutter: 24px;
}

/* ============ Тёмная тема ============ */
[data-theme="dark"] {
  --bg: #0f0f11;
  --surface: #1a1a1e;
  --surface-2: #242428;
  --border: #2e2e34;
  --border-strong: #42424a;

  --text: #f0f0f2;
  --text-muted: #9a9aa3;
  --text-soft: #6b6b73;

  --accent: #4d8af0;
  --accent-hover: #6699f5;
  --accent-soft: rgba(77, 138, 240, .18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

[data-theme="dark"] .site-header {
  background: rgba(15, 15, 17, .88);
}

/* Логотипы: светлый / тёмный */
.logo-dark { display: none !important; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: block !important; }

/* Переключатель темы */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Подложки под логотипы брендов в тёмной теме */
[data-theme="dark"] .brand-card .brand-logo {
  background: rgba(255, 255, 255, .92);
  border-radius: 6px;
  padding: 4px 8px;
  object-position: center;
}
[data-theme="dark"] .video-card .vc-brand-logo {
  background: rgba(255, 255, 255, .92);
  border-radius: 4px;
  padding: 2px;
}

/* Кнопка-гамбургер (видна только на мобиле) */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Мобильные секции оверлея — скрыты на десктопе */
.mobile-nav-logo,
.mobile-nav-search { display: none; }

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
}

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ============ Шапка ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(250, 250, 250, .85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo { display: inline-flex; align-items: center; height: 50px; flex-shrink: 0; }
.logo img { height: 100%; width: auto; }

.desktop-nav { display: flex; gap: 4px; flex: 1; }

/* Мобильное меню: скрыто по умолчанию */
.header-nav { display: none; }
.nav-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: 'Benzin', sans-serif;
  font-weight: 400;
  transition: background var(--t), color var(--t);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link--active { font-weight: 600; color: var(--text); }
.nav-link--active:hover { background: var(--surface-2); }
.nav-link--soon {
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
  opacity: .55;
}

/* Поиск */
.header-search {
  position: relative;
  flex-shrink: 0;
}
.header-search input {
  height: 36px;
  width: 220px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), width var(--t);
}
.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
  width: 280px;
}
.header-search input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
/* Результаты поиска */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 100;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  transition: background var(--t);
  cursor: pointer;
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item + .search-result-item { border-top: 1px solid var(--border); }
.sri-thumb {
  width: 56px; height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}
.sri-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.sri-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}
.sri-empty {
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ============ Main ============ */
main.container { flex: 1; padding-top: 32px; padding-bottom: 64px; }

/* ============ Заголовок страницы ============ */
.page-title {
  font-family: 'Benzin', sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0;
  margin: 8px 0 8px;
}
.page-subtitle { color: var(--text-muted); margin: 0 0 28px; font-size: 16px; }

/* ============ Табы фильтра ============ */
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
  margin-bottom: 28px;
}
.tab {
  border: none;
  background: transparent;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--t);
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============ Сетка марок ============ */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  column-gap: 12px;
}

.brand-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  min-height: 96px;
  margin-bottom: 12px;
}
.brand-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.brand-card.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.brand-card .brand-logo {
  display: block;
  height: 40px;
  width: 120px;
  object-fit: contain;
  object-position: left center;
  filter: var(--brand-logo-filter, none);
}
.brand-card .brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-card .brand-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============ Инлайн-раскрытие бренда ============ */
.brand-expansion {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
  padding: 0;
  /* Анимация */
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  margin-bottom: 12px;
  transition: height 260ms ease, opacity 200ms ease, transform 200ms ease,
              border-top-width 260ms ease, border-bottom-width 260ms ease,
              margin-bottom 260ms ease;
}
.brand-expansion.is-open {
  opacity: 1;
  transform: translateY(0);
}
.brand-expansion__inner {
  padding: 20px 24px;
}
.brand-expansion__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.brand-expansion__logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}
.brand-expansion__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-expansion__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.brand-exp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
  color: var(--text);
  min-width: 180px;
}
.brand-exp-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.brand-exp-thumb {
  width: 72px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-exp-thumb--ph {
  background: var(--border);
}
.brand-exp-info .m-name { font-weight: 600; font-size: 14px; }
.brand-exp-info .m-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============ Дата-группы ============ */
.date-section { margin-top: 32px; }
.date-section:first-of-type { margin-top: 0; }

.date-year {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.date-month {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 18px 0 8px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all var(--t);
}
.video-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.video-card .vc-brand { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.video-card .vc-brand-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.video-card .vc-title { font-size: 15px; font-weight: 600; color: var(--text); }
.video-card .vc-meta { font-size: 13px; color: var(--text-muted); }

/* ============ Хлебные крошки ============ */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-soft); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ============ Превью видео (страница обзора) ============ */
.previews {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 720px) {
  .previews { grid-template-columns: 1fr; }
}

.preview {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--t), box-shadow var(--t);
}
.preview:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t), filter var(--t);
}
.preview:hover img { transform: scale(1.03); filter: brightness(.7); }

/* VK iframe занимает весь блок */
.preview iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
  transition: transform var(--t), filter var(--t);
}
.preview.is-vk:hover iframe { transform: scale(1.03); filter: brightness(.7); }

/* Прозрачный оверлей поверх iframe — перехватывает hover и клик */
.vk-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
  border-radius: var(--radius);
}

.preview .play {
  position: absolute;
  top: 50%; left: 50%;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  transform: translate(-50%, -50%);
  transition: transform var(--t);
  box-shadow: var(--shadow-md);
}
.preview:hover .play { transform: translate(-50%, -50%) scale(1.08); }
.preview .play::before {
  content: '';
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent var(--text);
  margin-left: 4px;
}

.preview .pl-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: #fff;
  padding: 5px 5px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none;
}
.preview .pl-badge .pl-badge-logo {
  display: block;
  height: 20px;
  width: auto;
  object-fit: contain;
  transform: none !important;
  filter: none !important;
}

.preview .hover-cta {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  color: #fff;
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t), transform var(--t);
}
.preview:hover .hover-cta { opacity: 1; transform: translateY(0); }
@media (hover: none) {
  .preview .hover-cta { opacity: 1; transform: none; }
}

.preview.is-vk    { --pl: #0077ff; background: linear-gradient(135deg, #0c1a33 0%, #0a3a7a 100%); }
.preview.is-yt    { --pl: #ff0000; }

/* ============ Технарь ============ */
.technr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 28px;
}
.technr-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.technr-chip:hover { background: var(--surface-2); }
.technr-chip.has-logo {
  padding: 2px 6px;
  background: #fff;
  border-color: transparent;
}
.technr-chip.has-logo:hover {
  border-color: var(--border);
}
.technr-chip.has-logo.is-active {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}
.technr-chip-logo {
  display: block;
  height: 28px;
  width: auto;
  object-fit: contain;
}
.technr-tag.is-logo {
  background: transparent;
  padding: 0;
  max-width: 100%;
}
.technr-tag-logo {
  display: block;
  height: auto;
  max-height: 20px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}


.technr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 768px) { .technr-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .technr-grid { grid-template-columns: 1fr; } }

.technr-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform var(--t), box-shadow var(--t);
}
a.technr-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.technr-card.no-link { opacity: .7; }

.technr-card img:not(.technr-tag-logo) {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: filter var(--t);
}
a.technr-card:hover img:not(.technr-tag-logo) { filter: brightness(.8); }

.technr-card__overlay { display: none; }
.technr-card__info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.technr-card__tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.technr-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.technr-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.technr-card__soon {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ============ Smotra RUN ============ */
.smotra-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}
@media (max-width: 768px) { .smotra-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .smotra-grid { grid-template-columns: 1fr; } }

.smotra-card {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  background: linear-gradient(135deg, #1a0a2e 0%, #2e0057 100%);
  text-decoration: none;
  transition: transform var(--t), box-shadow var(--t);
}
.smotra-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.smotra-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t), filter var(--t);
}
.smotra-card:hover img { transform: scale(1.04); filter: brightness(.6); }

.smotra-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.08) 55%, transparent 100%);
}
.smotra-card__year {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 4px 10px;
  border-radius: 20px;
}
.smotra-card__title {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  padding: 12px 14px 14px;
}

/* ============ Подвал ============ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============ Состояния ============ */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, #ececef 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
#app.page-enter {
  animation: pageEnter 0.22s ease-out both;
}

/* ============ Доступность ============ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

@media (max-width: 600px) {
  :root { --gutter: 16px; }

  /* Шапка: лого слева, гамбургер справа */
  .header-inner { height: 56px; gap: 0; }
  .logo { height: 32px; }
  .nav-toggle { display: flex; width: 36px; height: 36px; padding: 0; flex-shrink: 0; margin-left: auto; }
  .header-search { display: none; }
  .desktop-nav { display: none; }

  /* Полноэкранное меню-оверлей */
  .header-nav {
    display: flex;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    z-index: 49;
    overflow-y: auto;
    padding: 0;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform .25s ease, opacity .2s ease, visibility .25s;
  }
  .header-nav.is-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  /* Логотип внутри оверлея */
  .mobile-nav-logo {
    display: flex;
    align-items: center;
    padding: 28px var(--gutter) 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
  }
  .mobile-nav-logo .logo { height: 40px; }

  /* Пункты меню */
  .nav-link {
    display: flex;
    height: 56px;
    padding: 0 var(--gutter);
    font-size: 18px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }

  /* Поиск внутри оверлея */
  .mobile-nav-search {
    display: block;
    padding: 20px var(--gutter);
    position: relative;
  }
  .mobile-nav-search input {
    width: 100%;
    height: 44px;
    padding: 0 12px 0 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
  }
  .mobile-nav-search input::placeholder { color: var(--text-muted); }
  .mobile-nav-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
  }
  .mobile-nav-search .search-icon {
    position: absolute;
    left: calc(var(--gutter) + 12px);
    top: calc(20px + 22px);
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
  }
  .mobile-nav-search .search-results {
    position: relative;
    width: 100%;
    top: 4px;
    right: auto;
    box-shadow: var(--shadow-md);
  }

  .page-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
