/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f1ee;
  --text: #14161a;
  --text-muted: #5b5e66;
  --border: #e2e3df;
  --accent: #2b4fd6;
  --accent-hover: #2242bd;
  --accent-contrast: #ffffff;
  --danger: #c8302f;
  --radius-card: 16px;
  --radius-btn: 999px;
  --radius-input: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 22, 26, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 22, 26, 0.16);
  --font: 'Manrope', system-ui, -apple-system, sans-serif;
  --header-h: 72px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d0e11;
    --surface: #17181c;
    --surface-2: #1f2126;
    --text: #f2f3f5;
    --text-muted: #9a9da5;
    --border: #2a2c32;
    --accent: #5c7cf0;
    --accent-hover: #7690f2;
    --accent-contrast: #0d0e11;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #0d0e11;
  --surface: #17181c;
  --surface-2: #1f2126;
  --text: #f2f3f5;
  --text-muted: #9a9da5;
  --border: #2a2c32;
  --accent: #5c7cf0;
  --accent-hover: #7690f2;
  --accent-contrast: #0d0e11;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f1ee;
  --text: #14161a;
  --text-muted: #5b5e66;
  --border: #e2e3df;
  --accent: #2b4fd6;
  --accent-hover: #2242bd;
  --accent-contrast: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 22, 26, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 22, 26, 0.16);
}

* { box-sizing: border-box; }

/* Иконки — локальный спрайт assets/icons.svg вместо шрифта с CDN.
   Размер наследуется от font-size родителя, цвет — через currentColor. */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.135em;
  fill: currentColor;
}
html {
  scroll-behavior: smooth;
  /* Убирает 300-мс ожидание двойного тапа и сам зум по двойному тапу,
     не трогая обычный пинч-зум — его отбирать у пользователя нельзя. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.sprite { display: none; }

.t-right {text-align: right; }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.4rem); margin-bottom: 32px; }
h3 { font-size: 1.05rem; }
p { margin: 0; color: var(--text-muted); }

a { color: inherit; text-decoration: none; }

/* Шапка залипающая — без этого якорь уводит заголовок раздела под неё. */
section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s cubic-bezier(.16,1,.3,1), background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-sm { padding: 9px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { height: 34px; width: 34px; display: block; flex-shrink: 0; }
.brand-word { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--text); }
.footer-brand .brand-mark { height: 40px; width: 40px; }
.nav { display: flex; gap: 28px; }
.nav a { font-weight: 600; font-size: 0.92rem; color: var(--text-muted); transition: color 0.15s; }
.nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-phone { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.9rem; transition: color 0.15s; }
.header-phone:hover { color: var(--accent); }
.header-phone .icon { font-size: 1.1rem; color: var(--accent); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
}

/* Единый фокус-ринг для всего кликабельного: без него по Tab не видно, где ты. */
.btn:focus-visible,
.pill:focus-visible,
.chip:focus-visible,
.qty-btn:focus-visible,
.segmented-btn:focus-visible,
.theme-toggle:focus-visible,
.nav a:focus-visible,
.brand:focus-visible,
.footer-contacts a:focus-visible,
.modal-close:focus-visible,
.modal-back:focus-visible,
.faq summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .header-phone { display: none; }
  /* Меню не прячем: на телефоне это единственный способ прыгнуть к разделам.
     Горизонтальная прокрутка вместо бургера — без JS и лишнего слоя. */
  :root { --header-h: 120px; }   /* шапка стала двухрядной — пересчитываем якоря */
  .header-inner { gap: 12px; flex-wrap: wrap; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    justify-content: space-between;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  /* 12px по вертикали дают ссылке высоту около 44px — минимум для пальца. */
  .nav a { white-space: nowrap; padding: 12px 0; }
  .site-header { height: auto; padding: 10px 0 6px; }
}

/* Пальцем в 33-пиксельную кнопку не попасть — на тач-устройствах увеличиваем. */
@media (hover: none) and (pointer: coarse) {
  .pill, .chip { padding-top: 12px; padding-bottom: 12px; }
  .segmented-btn { padding-top: 13px; padding-bottom: 13px; }
  .theme-toggle { width: 44px; height: 44px; }
  .qty-btn { width: 44px; height: 44px; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 48px 0 40px; }
.hero-grid {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 40px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem);
  margin-bottom: 18px;
}
.hero-sub {
  font-size: 1.05rem;
  max-width: 44ch;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 34px;
  animation: hero-rise 0.7s cubic-bezier(.16,1,.3,1) both;
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-photo::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 72%;
  height: 9%;
  background: radial-gradient(closest-side, rgba(0,0,0,0.35), rgba(0,0,0,0));
  transform: translateX(-50%);
  z-index: 0;
}
/* Фото и посадочное место знака меняются вместе с типом: у прицепа кадр почти
   квадратный, а ниша под номер ниже и шире, чем на легковом бампере. */
.hero-photo-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 560 / 428;
  transition: max-width 0.25s cubic-bezier(.16,1,.3,1);
}
.hero-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 24px 30px rgba(0,0,0,0.25));
}
/* Знак 520 мм на кузове шириной 2126 мм (с зеркалами) — это 24.5% кадра.
   Берём 26%: на глаз пропорция верная, но номер остаётся читаемым.
   min-width страхует мелкие экраны, где 26% превращаются в нечитаемые 80px. */
.hero-plate-overlay {
  position: absolute;
  left: 50%;
  top: 77%;
  width: 26%;
  min-width: 118px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
  transform: translate(-50%, -50%);
  z-index: 2;
}
/* Замер ниши на фото прицепа: центр 49.8% / 64%, ширина 31.5% кадра.
   Селектор без привязки к hero — та же накладка работает в превью генератора. */
[data-vehicle="trailer"] .hero-plate-overlay {
  left: 49.8%;
  top: 66%;
  width: 31.5%;
}
.hero-plate-overlay .plate-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;      /* скругление уже нарисовано внутри самого SVG */
  box-shadow: none;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
  .hero-photo { order: -1; padding-bottom: 24px; }
  .hero-photo-frame { max-width: 400px; }
}

/* ==========================================================================
   Trust strip
   ========================================================================== */
.trust-strip { padding: 8px 0 48px; }
.trust-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  font-size: 0.85rem;
  font-weight: 600;
}
.trust-item .icon { font-size: 1.3rem; color: var(--accent); flex-shrink: 0; }
@media (max-width: 860px) {
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Generator
   ========================================================================== */
.generator { padding: 64px 0; background: var(--surface-2); }
.generator-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 48px;
  align-items: start;
}
/* Липким стал правый столбец с параметрами: превью слева выросло (знак, фото,
   сводка, итог) и теперь выше формы, поэтому ехать должна форма. */
.generator-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 24px;
}
.plate-visual { width: 100%; max-width: 420px; }
.plate-svg { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: var(--shadow-md); }
/* Квадратный знак реально уже длинного (290 мм против 520 мм) — показываем
   его в том же масштабе, а не растянутым на всю ширину блока. */
/* Квадратные знаки реально уже длинного (290 и 288 мм против 520), поэтому и
   на фото, и в превью они показываются в том же физическом масштабе,
   а не растянутыми на всю ширину блока. */
.plate-svg[data-shape="square"] { width: 55.5%; margin-inline: auto; }
/* Знак и его габариты — один блок, а не два соседа в общей колонке.
   Иначе между ними встаёт gap: 20px родителя, и подпись приходится тянуть
   обратно отрицательным margin. Теперь отступ такой же, как у figcaption
   под фото: 8px, и подпись центрируется ровно по знаку. */
.preview-pane-plate {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Габариты под знаком: снимают вопрос «влезет ли в мою рамку»,
   особенно для квадратного варианта. */
.preview-size {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Тот же знак на автомобиле — чтобы не возвращаться скроллом в шапку. */
.preview-vehicle { margin: 0; width: 100%; }
.preview-vehicle-frame {
  position: relative;
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
}
/* .preview-vehicle-frame[data-vehicle="trailer"] { max-width: 230px; aspect-ratio: 654 / 666; } */
.preview-vehicle-frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Кадр здесь втрое меньше — страховочная min-width от hero сделала бы знак
   вдвое шире ниши. Пропорция важнее читаемости: рядом есть крупный знак. */
.preview-vehicle-frame .hero-plate-overlay { min-width: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55)); }
.preview-vehicle figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Сводка сборки. */
.preview-summary {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 0.85rem;
}
.preview-summary > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.preview-summary dt { color: var(--text-muted); flex-shrink: 0; }
.preview-summary dd { margin: 0; font-weight: 600; text-align: right; }

.generator-total { width: 100%; border-top: 1px solid var(--border); padding-top: 14px; }
.generator-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.generator-total-row strong {
  font-size: 1.7rem;
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.generator-total-calc {
  margin-top: 2px;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.generator-form { display: flex; flex-direction: column; gap: 20px; }

/* Липнет только когда форма реально помещается в экран: иначе её низ с кнопкой
   заказа окажется под сгибом и туда будет не доскроллить. */
@media (min-width: 901px) and (min-height: 760px) {
  .generator-form {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
  }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: 0.9rem; }
.field-row { display: flex; gap: 14px; }
.field-region { max-width: 130px; }
label { font-weight: 700; font-size: 0.9rem; }

input[type="text"], input:not([type]), input[type="tel"], input[type="number"] {
  font-family: var(--font);
}
.field input {
  font-family: var(--font);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--text-muted); opacity: 0.6; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field input.is-invalid { border-color: var(--danger); }
/* Строка под полем ввода. В покое пуста — формат показывает placeholder.
   Занимает место только когда есть что сказать: про недопустимую букву. */
.field-hint {
  margin: -2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.field-hint:empty { display: none; }
.field-hint.is-warning { color: var(--danger); }

/* Флаг РФ внутри поля региона — как на самом знаке. Поле уже, чем поле
   номера, поэтому флаг прижимаем вправо, а тексту оставляем место справа
   через padding, иначе трёхзначный регион на него наедет. */
.field-region { position: relative; }
.field-region input { padding-right: 44px; }
.field-region .region-flag {
  position: absolute;
  right: 12px;
  /* Отсчёт от низа: сверху над полем стоит <label> переменной высоты. */
  bottom: 17px;
  width: 24px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid var(--border);
  pointer-events: none;
}
.field-error { font-size: 0.8rem; color: var(--danger); min-height: 1.1em; margin: 0; }

.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 4px;
  gap: 4px;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented-btn:hover:not(.is-active) { background: var(--surface-2); color: var(--text); }
.segmented-btn.is-active { background: var(--accent); color: #fff; }
.segmented-btn:disabled { color: var(--text-muted); opacity: 0.5; cursor: not-allowed; }
.segmented-btn:disabled:hover { background: transparent; }

.pill-group, .chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
/* «Квадратный» — чекбокс, а не исполнение, поэтому живёт рядом с radiogroup,
   а не внутри него: иначе скринридер объявит его как радиокнопку. */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Исполнения и опции стоят в одном ряду и обязаны быть одной высоты.
   Раньше высоту задавал контент: у .pill это строка текста с line-height
   кнопки (около 1.2), у .chip — чекбокс 18px внутри inline-flex, и разница
   в несколько пикселей была заметна. Теперь высота задана обоим явно,
   а содержимое центрируется внутри — контент на неё больше не влияет. */
.pill, .chip {
  --control-h: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: var(--control-h);
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pill { color: var(--text); }
.pill:hover { border-color: var(--accent); }
.pill.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }

.chip {
  gap: 8px;
  /* Слева уже, чем справа: чекбокс визуально тяжелее текста. */
  padding-left: 12px;
  color: var(--text-muted);
}
.chip:hover { border-color: var(--accent); }
.chip.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text); }
.chip input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  margin: 0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  display: block;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  transition: border-color 0.15s, background-color 0.15s;
}
.chip:hover input { border-color: var(--accent); }
.chip input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
.chip input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field-row--end { align-items: center; justify-content: space-between; margin-top: 4px; }

/* Счётчик: дорожка задаёт фон целиком, кнопки — «таблетки» поверх неё.
   Раньше фон красили сами кнопки и поле, и на скруглениях вылезал стык. */
.qty-stepper {
  --qty-size: 40px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: inset 0 1px 2px rgba(20, 22, 26, 0.05);
}
.qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--qty-size);
  height: var(--qty-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s cubic-bezier(.16,1,.3,1), box-shadow 0.15s;
}
.qty-btn:hover:not(:disabled) { background: var(--accent); color: #fff; box-shadow: var(--shadow-md); }
.qty-btn:active:not(:disabled) { transform: scale(0.9); box-shadow: none; }
.qty-btn:disabled {
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  opacity: 0.45;
  cursor: not-allowed;
}
/* Поле только показывает число: снимаем нативную отрисовку number-инпута,
   иначе в WebKit остаются стрелки и своя подложка. */
.qty-stepper input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  width: 46px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;   /* 1 и 10 одной ширины — ряд не «дёргается» */
  color: var(--text);
  pointer-events: none;
  transition: transform 0.18s cubic-bezier(.16,1,.3,1);
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper.is-bumped input { transform: scale(1.22); }

.qty-stepper--sm { --qty-size: 32px; padding: 3px; }
.qty-stepper--sm .qty-btn { font-size: 1rem; }
.qty-stepper--sm input { width: 38px; font-size: 0.95rem; }

/* Вкладки превью нужны только там, где обе картинки сразу не помещаются. */
.preview-tabs { display: none; }

@media (max-width: 900px) {
  .generator-grid { grid-template-columns: 1fr; }
  /* Сначала форма, потом результат: на узком экране человек сперва вводит
     номер, а превью логично видеть под тем, что он заполнил. */
  .generator-form { order: 1; }
  .generator-preview { order: 2; }

  /* «Железка» — сам знак, «Примерка» — он же на машине. Раньше вторая
     картинка на телефоне просто пряталась, и чтобы увидеть номер на месте,
     надо было прокрутить экран обратно до шапки. */
  .preview-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .preview-tab {
    padding: 10px 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .preview-tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

  .generator-preview[data-pane="plate"] .preview-vehicle { display: none; }
  .generator-preview[data-pane="fit"] .preview-pane-plate { display: none; }
  /* Сводка и «Итого» относятся к обеим вкладкам — остаются на месте. */
}

/* ==========================================================================
   Catalog
   ========================================================================== */
.catalog { padding: 72px 0; }
.catalog-note { margin: -20px 0 28px; font-size: 0.92rem; }
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(.16,1,.3,1), transform 0.5s cubic-bezier(.16,1,.3,1), box-shadow 0.2s, border-color 0.2s;
}
.card.is-visible { opacity: 1; transform: translateY(0); }
.card:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card-image { padding: 24px 24px 8px; background: var(--surface-2); }
.card-image .plate-svg { border-radius: 6px; box-shadow: var(--shadow-sm); }
.card-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body p { font-size: 0.85rem; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; }
.card-footer strong { font-size: 1.05rem; font-weight: 800; }

@media (max-width: 980px) { .catalog-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .catalog-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Steps
   ========================================================================== */
.steps { padding: 72px 0; background: var(--surface-2); }
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.steps-list li { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
/* Пунктир рисует каждый шаг до следующего, поэтому у последнего его нет.
   Одна общая линия на весь ряд тянулась за край сетки мимо последнего маркера. */
.steps-list li::after {
  content: '';
  position: absolute;
  top: 21px;
  left: 52px;
  right: -20px;
  border-top: 2px dashed var(--border);
  z-index: -1;
}
.steps-list li:last-child::after { content: none; }
.step-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.step-marker .icon { font-size: 1.3rem; color: var(--accent); }
.steps-list h3 { font-size: 1rem; }
.steps-list p { font-size: 0.85rem; }

@media (max-width: 900px) {
  /* Иконка слева, текст справа: маркер занимает обе строки, заголовок центрируем
     по его высоте — так значок стоит вровень с заголовком, а не с абзацем. */
  .steps-list { grid-template-columns: 1fr; gap: 24px; }
  .steps-list li {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-areas: "marker title" "marker text";
    column-gap: 16px;
    row-gap: 4px;
    align-items: start;
  }
  .steps-list .step-marker { grid-area: marker; }
  .steps-list h3 {
    grid-area: title;
    display: flex;
    align-items: center;
    min-height: 44px;
  }
  .steps-list p { grid-area: text; }
  .steps-list li::after {
    top: 52px; bottom: -16px; left: 21px; right: auto;
    border-top: none; border-left: 2px dashed var(--border);
  }
}

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq { padding: 72px 0 48px; }
.faq-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list summary {
  cursor: pointer;
  padding: 20px 4px;
  font-weight: 700;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: color 0.15s;
}
.faq-list summary:hover { color: var(--accent); }
.faq-list details[open] summary { padding-bottom: 8px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list p { margin: 0 4px; padding-bottom: 20px; font-size: 0.94rem; }

/* ------------------------------------------------- Telegram Mini App (app.html)
   Никаких копий компонентов: те же .generator, .catalog и модалка, что и на
   сайте. Здесь только снимается «страничная» обвязка — секции ведут себя как
   экраны приложения, а не как блоки лендинга. */
.is-miniapp .miniapp-main { padding-top: 0; }
.is-miniapp .generator,
.is-miniapp .catalog { padding: 16px 0; }
.is-miniapp .container { padding-left: 14px; padding-right: 14px; }
/* Заголовок приложения виден в шапке самого Telegram — дублировать незачем. */
.is-miniapp .generator > .container > h2 { display: none; }
.is-miniapp .catalog h2 { font-size: 1.15rem; margin-bottom: 4px; }
/* В окне мессенджера всегда узко: карточка превью только съедала бы поля. */
.is-miniapp .generator-preview { border: none; background: none; padding: 0; }
/* Отступ снизу — под системную полосу жестов на телефоне. */
.is-miniapp .catalog { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }

/* Локальный блок про Самару */
.geo { padding: 24px 0 72px; }
.geo-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.geo-text p { margin: 0 0 14px; font-size: 0.96rem; line-height: 1.65; color: var(--text-muted); }
.geo-text p:last-child { margin-bottom: 0; }
.geo-text strong { color: var(--text); }
.geo-areas {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.geo-areas h3 { margin: 0 0 12px; font-size: 1rem; }
.geo-areas ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.geo-areas li { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.geo-note { margin: 16px 0 0; font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .geo-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { padding: 48px 0; border-top: 1px solid var(--border); }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-brand { display: flex; gap: 12px; max-width: 335px; }
.footer-brand p { font-size: 0.82rem; }
.footer-contacts { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-contacts a { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 0.88rem; transition: color 0.15s; }
.footer-contacts a:hover { color: var(--accent); }
.footer-contacts i { color: var(--accent); font-size: 1.1rem; }
.footer-copy { width: 100%; display:flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; border-top: 1px solid var(--border); padding-top: 20px; }
.footer-copy a:hover { color: var(--accent); }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.5);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.is-open { opacity: 1; }

.modal-sheet {
  position: fixed;
  z-index: 91;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-handle { display: none; }

/* Desktop: right-side panel */
@media (min-width: 641px) {
  .modal-sheet {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    height: 100%;
    border-radius: 0;
    padding: 32px 32px 28px;
    box-shadow: -20px 0 60px rgba(20, 22, 26, 0.16);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(.16,1,.3,1);
  }
  .modal-sheet.is-open { transform: translateX(0); }
}

/* Mobile: bottom sheet */
@media (max-width: 640px) {
  .modal-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 90vh;
    /* dvh учитывает панели браузера, vh — нет. Во встроенном браузере Telegram
       нижняя часть шторки с кнопкой «Оформить» уезжала под панель приложения. */
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
    padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(.16,1,.3,1);
    touch-action: none;
  }
  .modal-sheet.is-open { transform: translateY(0); }
  .modal-sheet.is-dragging { transition: none; }
  .modal-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: 6px auto 14px;
  }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
/* Кружок оставляем 34 px — крупнее он спорит с заголовком, — но зону нажатия
   расширяем до 44 px, ниже этого пальцем стабильно не попасть. */
@media (hover: none) and (pointer: coarse) {
  .modal-close::after { content: ''; position: absolute; inset: -5px; }
}

.modal-scroll { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; }

.modal-step h3 { margin-bottom: 18px; padding-right: 34px; }
.order-summary { display: flex; flex-direction: column; gap: 18px; margin-bottom: 22px; }
.order-summary .plate-visual { max-width: 100%; }
.order-details { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.order-details > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.order-details dt { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }
.order-details dd { margin: 0; font-weight: 700; font-size: 0.92rem; }
#modalTotal { color: var(--accent); font-size: 1.15rem; }

.modal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}
.modal-back:hover { color: var(--text); }

#orderForm { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;   /* уведомление не должно перехватывать клики по странице */
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 13px 18px;
  font-size: 0.87rem;
  font-weight: 600;
  text-align: left;
  animation: toast-in 0.25s cubic-bezier(.16,1,.3,1) both;
}
.toast.is-leaving { animation: toast-out 0.2s ease forwards; }
.toast .icon { font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
.toast--success .icon { color: #1b9c5a; }
.toast--error .icon { color: var(--danger); }
.toast--info .icon { color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.98); } }

@media (max-width: 640px) {
  .toast-stack { max-width: calc(100vw - 24px); top: calc(var(--header-h) + 10px); }
  .footer-copy { flex-direction: column; gap: 10px; align-items: flex-start; }
  .footer-copy .t-right { text-align: left; }
}

/* ==========================================================================
   Согласие на обработку ПД и правовые ссылки
   ========================================================================== */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
  cursor: pointer;
}
.consent input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface) no-repeat center / 13px 13px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.consent:hover input { border-color: var(--accent); }
.consent input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
.consent input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.consent a:hover { text-decoration: none; }
.consent.is-invalid input { border-color: var(--danger); }

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 0.85rem;
}
.footer-legal a { color: var(--text-muted); transition: color 0.15s; }
.footer-legal a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Ловушка для ботов: не видна людям и не попадает в поток фокуса. */
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Пока грузится шрифт номера — скелет вместо мигающего запасного шрифта. */
.fonts-loading .plate-visual {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  border-radius: 8px;
  animation: plate-skeleton 1.2s ease-in-out infinite;
  min-height: 48px;
}
.fonts-loading .plate-visual > * { visibility: hidden; }
@keyframes plate-skeleton { to { background-position: -300% 0; } }

/* Карточка витрины, совпадающая с текущей сборкой в генераторе. */
.card { position: relative; }
.card.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-md);
}
.card.is-picked .card-image { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
.card.is-picked::before {
  content: 'Ваша сборка';
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 5px 11px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  animation: pick-in 0.22s cubic-bezier(.16,1,.3,1) both;
}
@keyframes pick-in { from { opacity: 0; transform: translateY(-4px) scale(0.92); } }

/* Экран подтверждения заявки. */
.modal-done { text-align: center; }
.modal-done-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: color-mix(in srgb, #1b9c5a 14%, transparent);
  color: #1b9c5a;
  font-size: 1.9rem;
}
.modal-done h3 { margin-bottom: 8px; }
.modal-done p { font-size: 0.92rem; }
.modal-done strong { color: var(--text); font-variant-numeric: tabular-nums; }
.modal-done-plate { margin: 22px auto; max-width: 300px; }

/* Количество: счётчик и «комплект» — одно решение, поэтому в одной строке. */
.qty-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.modal-done-ref { font-size: 0.92rem; }
.modal-done-ref strong { letter-spacing: 0.06em; }
