/* Level Parts — каталог запчастей. Визуальная система: см. DESIGN.md
   ---------------------------------------------------------------------------
   Сцена: мастер у поднятой машины при дневном свете, телефон в руке, сверяет
   номер на снятой детали с номером на экране. Отсюда светлый чистый фон,
   крупные цифры, моноширинные номера и плотные строки вместо карточек.

   Зелёный означает «есть на складе» — это главный довод магазина, поэтому
   цвет марки и цвет состояния совпадают. Больше ничего зелёным не красим. */

:root {
  color-scheme: light;

  --bg:            oklch(1 0 0);
  --surface:       oklch(0.978 0.004 148);
  --surface-2:     oklch(0.962 0.006 148);
  --line:          oklch(0.906 0.006 148);
  --line-strong:   oklch(0.845 0.008 148);

  --ink:           oklch(0.24 0.014 148);
  --ink-2:         oklch(0.42 0.014 148);
  --muted:         oklch(0.53 0.013 148);

  --brand:         oklch(0.47 0.115 148);
  --brand-hover:   oklch(0.41 0.115 148);
  --brand-weak:    oklch(0.945 0.035 148);
  --brand-weak-ink:oklch(0.37 0.10 148);

  --order:         oklch(0.50 0.115 65);
  --order-weak:    oklch(0.958 0.03 75);
  --alert:         oklch(0.50 0.17 27);

  --on-brand:      oklch(1 0 0);

  --t-xs:    0.75rem;
  --t-sm:    0.8125rem;
  --t-base:  0.9375rem;
  --t-md:    1.0625rem;
  --t-lg:    1.25rem;
  --t-xl:    1.5rem;
  --t-2xl:   1.875rem;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --r:    4px;
  --r-lg: 8px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Roboto Mono", monospace;

  --wrap: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-sticky: 100;
  --z-dropdown: 200;
  --z-toast: 300;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:            oklch(0.17 0.008 148);
    --surface:       oklch(0.215 0.010 148);
    --surface-2:     oklch(0.255 0.012 148);
    --line:          oklch(0.315 0.012 148);
    --line-strong:   oklch(0.40 0.014 148);
    --ink:           oklch(0.95 0.008 148);
    --ink-2:         oklch(0.82 0.010 148);
    --muted:         oklch(0.70 0.012 148);
    --brand:         oklch(0.78 0.115 148);
    --brand-hover:   oklch(0.86 0.10 148);
    --brand-weak:    oklch(0.30 0.045 148);
    --brand-weak-ink:oklch(0.86 0.09 148);
    --order:         oklch(0.80 0.11 72);
    --order-weak:    oklch(0.30 0.04 72);
    --alert:         oklch(0.72 0.15 27);
    --on-brand:      oklch(0.17 0.02 148);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-base)/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r);
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-4); }

.skip {
  position: absolute; left: -9999px;
  background: var(--brand); color: var(--on-brand);
  padding: var(--s-2) var(--s-4); border-radius: var(--r);
}
.skip:focus { left: var(--s-4); top: var(--s-2); z-index: var(--z-toast); }

/* ------------------------------------------------------------------- шапка */

.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top__row {
  display: flex; align-items: center; gap: var(--s-5);
  min-height: 64px; flex-wrap: wrap; padding: var(--s-3) 0;
}

.logo { display: flex; align-items: baseline; gap: var(--s-2); text-decoration: none; color: var(--ink); }
.logo b { font-size: var(--t-md); font-weight: 700; letter-spacing: -0.01em; }
.logo span { color: var(--muted); font-size: var(--t-sm); }

.top__right { margin-left: auto; display: flex; align-items: center; gap: var(--s-5); }
.top__phone {
  font-size: var(--t-md); font-weight: 700; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.top__phone:hover { color: var(--brand); }
.top__where { color: var(--muted); font-size: var(--t-sm); }

/* ---------------------------------------------------------------- навигация */

.nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.nav ul {
  display: flex; flex-wrap: wrap; gap: var(--s-1);
  list-style: none; margin: 0; padding: 0;
}
.nav a {
  display: block; padding: var(--s-3) var(--s-3);
  color: var(--ink-2); font-size: var(--t-base); font-weight: 500;
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.nav a[aria-current] { color: var(--brand); border-bottom-color: var(--brand); }

/* ------------------------------------------------------------ поиск по номеру */

.finder { position: relative; }
.finder__row { display: flex; gap: var(--s-2); }
.finder input {
  flex: 1; min-width: 0;
  padding: var(--s-3) var(--s-4);
  font: 500 var(--t-md)/1.3 var(--mono);
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: border-color .15s var(--ease);
}
.finder input::placeholder { color: var(--muted); font-family: var(--sans); font-weight: 400; }
.finder input:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: -1px; }

.finder__out {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: var(--z-dropdown);
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: 0 8px 24px oklch(0.24 0.014 148 / .12);
  max-height: 60vh; overflow-y: auto;
}
.finder__out:empty { display: none; }
.finder__hit {
  display: flex; align-items: baseline; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.finder__hit:last-child { border-bottom: 0; }
.finder__hit:hover, .finder__hit:focus { background: var(--surface-2); }
.finder__hit b { font: 600 var(--t-base) var(--mono); }
.finder__hit span { color: var(--muted); font-size: var(--t-sm); flex: 1; }
.finder__hit i { font-style: normal; font-weight: 600; white-space: nowrap; }
.finder__via {
  display: inline-block; margin-top: 3px;
  font-size: var(--t-xs); font-style: normal; color: var(--brand-weak-ink);
  background: var(--brand-weak); padding: 1px 7px; border-radius: var(--r);
}
.finder__none { padding: var(--s-4); color: var(--muted); font-size: var(--t-sm); }

/* -------------------------------------------------------------- хлебные крошки */

.crumbs { font-size: var(--t-sm); color: var(--muted); padding: var(--s-4) 0 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs i { font-style: normal; margin: 0 var(--s-2); opacity: .55; }

/* --------------------------------------------------------------- заголовок */

.head { padding: var(--s-5) 0 var(--s-5); }
.head h1 { font-size: var(--t-2xl); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s-3); font-weight: 700; }
.head p { margin: 0; color: var(--ink-2); max-width: 70ch; }

/* факты строкой, а не плашками со статистикой */
.meta {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  margin: var(--s-4) 0 0; padding: 0; list-style: none;
  font-size: var(--t-sm); color: var(--muted);
}
.meta li { display: flex; align-items: baseline; gap: 6px; }
.meta b { color: var(--ink); font-weight: 600; font-size: var(--t-base); }

/* -------------------------------------------------------------- прайс-лист */

.list { margin: var(--s-5) 0; }
.list__head {
  display: flex; align-items: baseline; gap: var(--s-3);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--line-strong);
}
.list__head h2 { margin: 0; font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.01em; }
.list__head span { color: var(--muted); font-size: var(--t-sm); }

.part {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--line);
  transition: background .15s var(--ease);
}
.part:hover { background: var(--surface); }

.part__img {
  width: 88px; height: 88px; object-fit: cover;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.part__img--none {
  display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: var(--t-xs); padding: var(--s-2);
}

.part__name { margin: 0 0 var(--s-2); font-size: var(--t-md); font-weight: 600; line-height: 1.35; }
.part__name a { color: var(--ink); text-decoration: none; }
.part__name a:hover { color: var(--brand); text-decoration: underline; }

.num {
  font: 600 var(--t-sm)/1.4 var(--mono);
  background: var(--surface-2); color: var(--ink);
  padding: 2px 7px; border-radius: var(--r); white-space: nowrap;
}

.part__fit { color: var(--muted); font-size: var(--t-sm); margin: 0; }
.part__fit .num { margin-right: var(--s-2); }

.cross { margin: var(--s-2) 0 0; font-size: var(--t-sm); color: var(--muted); }
.cross b { font-weight: 600; color: var(--ink-2); }
.cross code {
  font: 500 var(--t-sm) var(--mono); color: var(--ink-2);
  white-space: nowrap; margin-right: 6px;
}

.part__buy { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); }
.price { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; line-height: 1.1; }

.state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-sm); font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state--stock { color: var(--brand-weak-ink); background: var(--brand-weak); }
.state--order { color: var(--order); background: var(--order-weak); }

/* --------------------------------------------------------------- действия */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 var(--s-4);
  font: 600 var(--t-base) var(--sans); text-decoration: none;
  border: 1px solid transparent; border-radius: var(--r); cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
/* Кнопки чернильные, не зелёные. Зелёный в каталоге означает «есть на складе»;
   шесть зелёных кнопок в списке спорили с метками наличия, и состояние
   переставало читаться как состояние. */
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--ink-2); color: var(--bg); }
.btn--primary:active { background: var(--ink-2); transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink-2); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn--sm { min-height: 36px; font-size: var(--t-sm); padding: 0 var(--s-3); }

/* ------------------------------------------------------------------- текст */

.prose { max-width: 72ch; }
.prose h2 { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.01em; margin: var(--s-7) 0 var(--s-3); }
.prose h3 { font-size: var(--t-md); font-weight: 600; margin: var(--s-5) 0 var(--s-2); }
.prose p { margin: 0 0 var(--s-3); color: var(--ink-2); }
.prose ul { margin: 0 0 var(--s-4); padding-left: var(--s-5); color: var(--ink-2); }
.prose li { margin: 0 0 var(--s-1); }

.callout {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); margin: var(--s-5) 0;
}
.callout b { display: block; margin-bottom: var(--s-1); color: var(--ink); }
.callout p { margin: 0 0 var(--s-3); }
.callout > :last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- таблицы */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); margin: var(--s-4) 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--t-base); }
th, td { padding: var(--s-3) var(--s-4); text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--surface); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.mono { font: 500 var(--t-base) var(--mono); white-space: nowrap; }
td.num-col, th.num-col { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ ссылки списком */

.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin: var(--s-4) 0; }
.link {
  background: var(--bg); padding: var(--s-3) var(--s-4); text-decoration: none; color: var(--ink);
  transition: background .15s var(--ease);
}
.link:hover { background: var(--surface); color: var(--ink); }
.link b { display: block; font-weight: 600; font-size: var(--t-base); }
.link span { display: block; font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0; padding: 0; list-style: none; }
.chips a {
  display: block; padding: 6px var(--s-3);
  font: 500 var(--t-sm) var(--mono); color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.chips a:hover { background: var(--surface-2); border-color: var(--line-strong); }

/* ------------------------------------------------------------------ подвал */

.foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: var(--s-8); padding: var(--s-6) 0; font-size: var(--t-sm); color: var(--muted); }
.foot__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-5); }
.foot h3 { font-size: var(--t-sm); font-weight: 600; color: var(--ink); margin: 0 0 var(--s-2); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: var(--s-1); }
.foot a { color: var(--ink-2); }
.foot a:hover { color: var(--brand); }
.foot__legal { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-xs); max-width: 90ch; }

/* -------------------------------------------------------------- узкий экран */

@media (max-width: 720px) {
  :root { --t-2xl: 1.5rem; --t-xl: 1.25rem; }
  .part { grid-template-columns: 64px minmax(0, 1fr); gap: var(--s-3); }
  .part__img { width: 64px; height: 64px; }
  .part__buy {
    grid-column: 2; flex-direction: row; align-items: center;
    justify-content: flex-start; flex-wrap: wrap; gap: var(--s-3);
  }
  /* Телефон с подписью «Москва · отправка по России» в одну строку на 390px
     не помещался и уезжал за край, из-за чего вся страница ползла вбок. */
  .top__right {
    width: 100%; margin-left: 0; flex-wrap: wrap;
    align-items: baseline; gap: var(--s-1) var(--s-3);
  }
  .top__phone { font-size: var(--t-lg); }
  .top__where { order: 2; width: 100%; }
  .list__head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .nav a { padding: var(--s-3) var(--s-2); }
}

/* строка длинных номеров не должна распирать страницу */
.cross, .part__fit, .part__name { overflow-wrap: anywhere; }
body { overflow-x: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .btn--primary:active { transform: none; }
}

@media print {
  .top, .nav, .foot, .btn, .finder { display: none; }
  body { background: #fff; color: #000; }
  .part { break-inside: avoid; }
}

/* ------------------------------------------------------------------ заявка */

.lead { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-3); }
.lead__row { display: flex; gap: var(--s-3); }
.lead__row--two { flex-wrap: wrap; }
.lead__row--two .field { flex: 1 1 200px; }

.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.field span { font-size: var(--t-sm); color: var(--ink-2); font-weight: 500; }
.field input {
  width: 100%; padding: 11px var(--s-3);
  font: 400 var(--t-base) var(--sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: border-color .15s var(--ease);
}
.field input::placeholder { color: var(--muted); }
.field input:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: -1px; }
.field input:user-invalid { border-color: var(--alert); }

/* поле-ловушка для роботов: убрано из потока, но не display:none —
   часть ботов такие поля пропускает */
.lead__trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.lead__foot { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.lead__note { font-size: var(--t-sm); color: var(--muted); }

.lead__msg { margin: 0; font-size: var(--t-base); }
.lead__msg:empty { display: none; }
.lead__msg--ok { color: var(--brand-weak-ink); font-weight: 500; }
.lead__msg--err { color: var(--alert); }

/* каналы связи в шапке */
.chans { display: inline-flex; gap: var(--s-3); align-items: center; }
.chans a {
  font-size: var(--t-sm); font-weight: 500; text-decoration: none;
  color: var(--ink-2); padding: 4px 9px; border: 1px solid var(--line);
  border-radius: 999px; white-space: nowrap;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.chans a:hover { color: var(--brand); border-color: var(--brand); }

/* действия на карточке детали */
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-5) 0 0; }
