/* JAC Parts — витрина в Telegram. Минимализм: монохром, много воздуха, один синий акцент — только у главной кнопки.
   Светлая или тёмная схема — как у клиента в Telegram (data-scheme ставит app.js). */

@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap;
  src: url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap;
  src: url(fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap;
  src: url(fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap;
  src: url(fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap;
  src: url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap;
  src: url(fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #ffffff;
  --surface: #f4f4f4;
  --surface-press: #e9e9e9;
  --text: #171a20;
  --text-2: #5c5e62;
  --text-3: #8e8f91;
  --line: #e2e3e3;
  --accent: #3e6ae1;
  --accent-press: #3457b1;
  --on-accent: #ffffff;
  --ok: #1f8f4e;
  --wait: #c26b0a;
  --bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-scheme="dark"] {
  --bg: #171a20;
  --surface: #23262d;
  --surface-press: #2c3038;
  --text: #f4f4f4;
  --text-2: #a7a9ac;
  --text-3: #7c7f84;
  --line: #30333a;
  --accent: #4b77ef;
  --accent-press: #6a8ff5;
  --ok: #4cc27f;
  --wait: #f0a243;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; padding-bottom: calc(72px + var(--bottom)); }
body.with-footer { padding-bottom: calc(144px + var(--bottom)); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { display: block; }
[hidden] { display: none !important; }

#app { max-width: 640px; margin: 0 auto; padding: 0 20px; }

/* ---------- главный экран: автомобиль клиента по центру ---------- */
.hero { padding: 44px 0 28px; text-align: center; }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.12; font-weight: 500; letter-spacing: -.01em; }
.hero p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }

.page-title { padding: 28px 0 20px; }
.page-title h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 500; letter-spacing: -.01em; }
.page-title p { margin: 6px 0 0; color: var(--text-2); }

.search { position: sticky; top: 0; z-index: 5; margin: 0 -20px; padding: 10px 20px; background: var(--bg); }
.search label { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 4px; background: var(--surface); }
.search svg { flex: none; width: 18px; height: 18px; color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.search input::placeholder { color: var(--text-3); }
.search .clear { border: 0; background: none; padding: 4px 2px; color: var(--text-2); font-size: 14px; }

.section { margin: 32px 0 14px; font-size: 20px; font-weight: 500; letter-spacing: -.005em; }
.section small { display: block; margin-top: 2px; color: var(--text-2); font-size: 14px; font-weight: 400; letter-spacing: 0; }

/* ---------- категории: светло-серые плитки ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 10px; }
.tile { display: flex; flex-direction: column; align-self: start; padding: 0; border: 0; background: none; text-align: left; }
.tile .shot { aspect-ratio: 4 / 3; }
.tile .label { margin-top: 10px; font-weight: 500; line-height: 1.3; }
.tile .count { color: var(--text-2); font-size: 13px; }

.shot { display: grid; place-items: center; border-radius: 4px; background: var(--surface); overflow: hidden; color: var(--text-3); }
.shot svg { width: 34%; height: 34%; stroke-width: 1.1px; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.tile:active .shot, .product:active .shot { background: var(--surface-press); }

/* ---------- детали: сетка как в интернет-магазине ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 10px; }
.product { display: flex; flex-direction: column; align-items: flex-start; align-self: start; padding: 0; border: 0;
  background: none; text-align: left; min-width: 0; }
.product .shot, .tile .shot { width: 100%; }
.product .shot { aspect-ratio: 1 / 1; }
.product .pname { margin-top: 10px; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.product .pnum { margin-top: 2px; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.product .pprice { margin-top: 6px; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--text-2); font-size: 12px; }
.status::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.status.stock::before { background: var(--ok); }
.status.preorder::before { background: var(--wait); }

.more { margin-top: 28px; }

/* ---------- карточка детали ---------- */
.part-shot { margin: 16px -20px 0; border-radius: 0; aspect-ratio: 4 / 3; }
.part-shot svg { width: 28%; height: 28%; stroke-width: .9px; }
.part-shot img { object-fit: contain; }
.part-head { padding: 24px 0 4px; }
.part-head h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 500; letter-spacing: -.01em; }
.part-head .sub { margin-top: 6px; color: var(--text-2); }
.part-head .price { margin-top: 14px; font-size: 20px; font-variant-numeric: tabular-nums; }
.part-head .num { margin-top: 4px; color: var(--text-3); font-size: 13px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.part-desc { margin: 18px 0 0; color: var(--text-2); }
.lead { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }

/* выбор дилера — рамки, выбранная обведена синим */
.options { display: grid; gap: 10px; }
.option { display: block; width: 100%; padding: 14px 16px; border: 0; border-radius: 4px; background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line); text-align: left; }
.option[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.option .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.option .oname { font-weight: 500; }
.option .oprice { flex: none; font-variant-numeric: tabular-nums; }
.option .oaddr { margin-top: 2px; color: var(--text-2); font-size: 13px; }
.option .ometa { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.option .olinks { display: flex; gap: 18px; margin-top: 10px; }
.option .olinks a { color: var(--text); font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--text-3); }

/* ---------- главная кнопка снизу ---------- */
#footer { position: fixed; left: 0; right: 0; bottom: calc(60px + var(--bottom)); z-index: 20; padding: 12px 20px;
  background: var(--bg); border-top: 1px solid var(--line); }
#footer:empty { display: none; }
#footer > * { display: block; max-width: 600px; margin: 0 auto; }
.cta { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; padding: 0 16px; border: 0;
  border-radius: 4px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 500; }
.cta:active { background: var(--accent-press); }
.cta[disabled] { opacity: .4; }
.cta.ghost { background: var(--surface); color: var(--text); }
.cta.ghost:active { background: var(--surface-press); }

/* ---------- корзина ---------- */
.lines { border-top: 1px solid var(--line); }
.line { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.line .shot { width: 76px; height: 76px; }
.line .shot svg { stroke-width: 1.3px; }
.line .lname { font-weight: 500; line-height: 1.3; }
.line .lnum { color: var(--text-3); font-size: 12px; letter-spacing: .02em; }
.line .where { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.line .warn { margin-top: 4px; color: var(--wait); font-size: 13px; }
.line .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.line .lprice { font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; height: 32px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.qty button { width: 34px; height: 32px; border: 0; background: none; font-size: 17px; line-height: 1; }
.qty button[disabled] { color: var(--text-3); }
.qty span { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.summary { padding: 18px 0 0; }
.summary .sline { display: flex; justify-content: space-between; color: var(--text-2); }
.summary .stotal { display: flex; justify-content: space-between; margin-top: 8px; font-size: 17px; font-weight: 500;
  font-variant-numeric: tabular-nums; }
.summary .note { margin: 10px 0 0; color: var(--text-2); font-size: 13px; }

/* ---------- заказы ---------- */
.orders { border-top: 1px solid var(--line); }
.order { padding: 20px 0; border-bottom: 1px solid var(--line); }
.order .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.order .num { font-size: 17px; font-weight: 500; }
.order .total { font-variant-numeric: tabular-nums; }
.order .when { margin-top: 2px; color: var(--text-3); font-size: 13px; }
.order .what { margin-top: 8px; color: var(--text-2); font-size: 14px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 16px; }
.track i { height: 2px; background: var(--line); }
.track i.done { background: var(--text); }
.track i.next { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }
.order .now { margin-top: 8px; font-size: 14px; }
.order .pickup { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.order .pickup b { display: block; color: var(--text); font-weight: 500; font-size: 14px; }
.order .pickup a { display: inline-block; margin-top: 6px; margin-right: 18px; color: var(--text); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--text-3); }

/* ---------- пусто, ошибка, спасибо ---------- */
.empty { padding: 96px 8px 24px; text-align: center; }
.empty h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.2; font-weight: 500; letter-spacing: -.01em; }
.empty p { margin: 0 auto 28px; max-width: 28em; color: var(--text-2); }
.empty .cta { max-width: 300px; margin: 0 auto; }
.empty .nums { margin: 0 0 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.inline-empty { padding: 48px 8px 8px; }

.skeleton { height: 160px; border-radius: 4px; background: var(--surface); margin-top: 24px; }

/* ---------- вкладки ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(4px + var(--bottom)); background: var(--bg); border-top: 1px solid var(--line); }
#tabs button { display: grid; justify-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; color: var(--text-3);
  font-size: 11px; font-weight: 500; position: relative; }
#tabs button svg { width: 23px; height: 23px; stroke-width: 1.5px; }
#tabs button[aria-current="page"] { color: var(--text); }
#tabs .badge { position: absolute; top: 1px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 17px; text-align: center; }

#toast { position: fixed; left: 50%; bottom: calc(140px + var(--bottom)); z-index: 40; transform: translateX(-50%);
  max-width: calc(100% - 40px); padding: 10px 16px; border-radius: 4px; background: var(--text); color: var(--bg);
  font-size: 14px; text-align: center; }
#toast:not([hidden]) { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
