/* DB FIX — витрина. Мобильный первым: трафик у такого магазина почти весь с телефона. */
:root {
  --bg: #f4f6f9;
  --card: #fff;
  --ink: #0d1420;
  --ink-2: #3d4757;
  --muted: #77839a;
  --line: #e6eaf1;
  --line-2: #eef1f6;
  --brand: #0f1e36;
  --brand-2: #1b3660;
  --accent: #1a5cff;
  --accent-dark: #0f45d1;
  --ok: #0f9d58;
  --ok-bg: #e8f6ee;
  --warn: #b45c00;
  --warn-bg: #fdf1de;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --sh-1: 0 1px 2px rgba(13, 20, 32, .05);
  --sh-2: 0 2px 4px rgba(13, 20, 32, .05), 0 10px 24px -8px rgba(13, 20, 32, .10);
  --sh-3: 0 4px 8px rgba(13, 20, 32, .06), 0 18px 36px -12px rgba(13, 20, 32, .16);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: 74px;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
svg { display: block; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 14px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── шапка ── */
header {
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 20px -10px rgba(13, 20, 32, .5);
}
.head { display: flex; align-items: center; gap: 12px; height: 58px; }
.logo {
  font-weight: 800; font-size: 18px; letter-spacing: .04em;
  display: flex; gap: 5px; align-items: center;
}
.logo span {
  background: var(--accent); border-radius: 7px; padding: 2px 7px;
  box-shadow: 0 4px 12px -4px rgba(26, 92, 255, .9);
}
.tagline {
  font-size: 12.5px; color: #a9bad5; margin-left: 14px; letter-spacing: .01em;
  border-left: 1px solid rgba(255, 255, 255, .16); padding-left: 14px;
}
@media (max-width: 640px) { .tagline { display: none; } }
.cart-btn {
  margin-left: auto; background: rgba(255, 255, 255, .11); border: 1px solid rgba(255, 255, 255, .1);
  color: #fff; border-radius: var(--r-sm); padding: 9px 13px; font-weight: 600; font-size: 14px;
  position: relative; transition: background .15s ease;
}
.cart-btn:hover { background: rgba(255, 255, 255, .18); }
.cart-btn b {
  position: absolute; top: -7px; right: -7px; background: var(--accent); color: #fff;
  border-radius: 20px; font-size: 11px; font-weight: 700; padding: 2px 6px;
  border: 2px solid var(--brand-2);
}
.searchbar { padding-bottom: 13px; position: relative; }
.searchbar svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: #8ea1c0; pointer-events: none;
}
.searchbar input {
  width: 100%; border: 1px solid rgba(255, 255, 255, .09); border-radius: var(--r-sm);
  padding: 11px 13px 11px 37px; font: inherit; font-size: 14.5px;
  background: rgba(255, 255, 255, .1); color: #fff; transition: background .15s ease;
}
.searchbar input:hover, .searchbar input:focus { background: rgba(255, 255, 255, .16); outline: none; }
.searchbar input::placeholder { color: #93a5c2; }
.searchbar input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* ── плашки ── */
.notice {
  background: var(--warn-bg); border: 1px solid #f0dcbb; color: #6b4a05;
  border-radius: var(--r); padding: 13px 15px; margin: 14px 0; font-size: 14px;
  display: flex; gap: 11px; align-items: flex-start;
}
.notice .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; opacity: .75; }
.notice.blue { background: #eaf1ff; border-color: #d0dfff; color: #16376f; }
.notice b { display: block; margin-bottom: 2px; }

/* ── главная ── */
.hero {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); padding: 22px 20px; margin: 14px 0;
}
.hero h1 {
  margin: 0 0 8px; font-size: 25px; line-height: 1.2;
  letter-spacing: -.02em; font-weight: 800;
}
.hero p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 11px; margin: 12px 0; }
.cat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-1); padding: 13px 14px; font-weight: 650; font-size: 14.5px;
  display: flex; gap: 11px; align-items: center;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.cat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: #d4dcea; }
.cat .ic {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(150deg, #eaf0ff, #dde7ff);
  color: var(--accent); display: grid; place-items: center;
  font-size: 16px; font-weight: 800; letter-spacing: -.01em;
}
.cat span { flex: 1; min-width: 0; line-height: 1.25; }
.cat i { font-style: normal; color: var(--muted); font-weight: 500; font-size: 13px; }

h2.sec {
  font-size: 18px; margin: 24px 0 12px; letter-spacing: -.015em; font-weight: 750;
  display: flex; align-items: baseline; gap: 8px;
}
h2.sec i { font-style: normal; color: var(--muted); font-weight: 500; font-size: 14px; }

/* ── карточки товара ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-1); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: #d4dcea; }
.card:active { transform: translateY(-1px); }

/* Фото нет почти у всего каталога, поэтому плейсхолдер должен выглядеть
   намеренно, а не как дыра в вёрстке: штриховка, артикул, честная подпись. */
.ph {
  aspect-ratio: 1; display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(122, 140, 170, .05) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #f7f9fc 0%, #e9eef6 100%);
}
.ph img { width: 100%; height: 100%; object-fit: contain; }
.ph .noimg { text-align: center; padding: 12px; display: grid; gap: 7px; justify-items: center; }
.ph .noimg .ic {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .85);
  color: #93a2ba; display: grid; place-items: center; box-shadow: var(--sh-1);
}
.ph .noimg .ic svg { width: 17px; height: 17px; }
.ph .noimg b {
  font: 600 12.5px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #6d7d95; letter-spacing: .04em;
}
.ph .noimg u { text-decoration: none; font-size: 11px; color: #97a4ba; }

.card-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-name { font-weight: 600; font-size: 14px; line-height: 1.32; color: var(--ink); }
.price {
  font-size: 19px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin-top: auto;
}
.price s { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 7px; }

.stock {
  font-size: 12px; font-weight: 600; color: #0b7a44; background: var(--ok-bg);
  border-radius: 20px; padding: 3px 9px 3px 7px; display: inline-flex; align-items: center;
  gap: 5px; align-self: flex-start;
}
.stock::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.stock.order { color: var(--warn); background: var(--warn-bg); }
.stock.order::before { background: #dd8a1a; }

.btn {
  border: 0; border-radius: var(--r-sm); padding: 12px 16px; font-weight: 700; font-size: 15px;
  background: var(--accent); color: #fff; width: 100%; text-align: center; display: block;
  box-shadow: 0 4px 14px -6px rgba(26, 92, 255, .8);
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--accent-dark); box-shadow: 0 6px 18px -6px rgba(26, 92, 255, .9); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 8px -4px rgba(26, 92, 255, .8); }
.btn.ghost { background: #eef1f6; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: #e4e9f1; }
.btn.tg { background: #2aa3dd; box-shadow: 0 4px 14px -6px rgba(42, 163, 221, .9); }
.btn.tg:hover { background: #1f8fc6; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ── карточка товара ── */
.detail {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); overflow: hidden; margin: 14px 0;
}
.detail .ph { aspect-ratio: 4/3; }
/* Пока фото нет, отдавать ему половину экрана незачем — оно ничего не сообщает */
.detail .ph.empty { aspect-ratio: 5/2; }
.detail .ph .noimg .ic { width: 46px; height: 46px; }
.detail .ph .noimg .ic svg { width: 22px; height: 22px; }
.detail .ph .noimg b { font-size: 16px; }
.detail-body { padding: 18px; }
.detail h1 { font-size: 21px; margin: 0 0 5px; line-height: 1.25; letter-spacing: -.02em; }
.sku { color: var(--muted); font-size: 13px; }
.detail .price { font-size: 30px; margin: 14px 0 8px; }
.detail .descr { margin: 14px 0 0; color: var(--ink-2); }
.specs { width: 100%; border-collapse: collapse; margin: 16px 0 0; font-size: 14px; }
.specs td { padding: 10px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.specs tr:last-child td { border-bottom: 0; }
.specs td:first-child { color: var(--muted); width: 46%; }
.specs td:last-child { font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions > * { flex: 1 1 165px; }

/* ── корзина и форма ── */
.row {
  display: flex; gap: 13px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1);
  padding: 11px 13px; margin-bottom: 10px;
}
.row .ph { width: 66px; height: 66px; aspect-ratio: auto; border-radius: var(--r-sm); flex: none; }
/* В миниатюре 66×66 подпись плейсхолдера не помещается и лезет на название товара */
.row .ph .noimg { padding: 4px; gap: 0; }
.row .ph .noimg .ic, .row .ph .noimg u { display: none; }
.row .ph .noimg b { font-size: 10px; line-height: 1.2; word-break: break-all; }
.row .g { flex: 1; min-width: 0; }
.row .card-name { margin-bottom: 3px; }
.row .price { font-size: 16px; margin: 0; }
.qty { display: flex; align-items: center; gap: 4px; background: #f2f5f9; border-radius: var(--r-sm); padding: 3px; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.qty button {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: #fff;
  color: var(--ink); font-size: 17px; line-height: 1; box-shadow: var(--sh-1);
  transition: background .12s ease;
}
.qty button:hover { background: #e9eef6; }
.total {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 20px; font-weight: 800; margin: 18px 0; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.total span:first-child { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
form.order {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); padding: 18px; margin: 14px 0;
}
form.order label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
form.order input, form.order textarea, form.order select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 13px;
  font: inherit; margin-top: 6px; color: var(--ink); background: #fbfcfe;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
form.order input:focus, form.order textarea:focus, form.order select:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 92, 255, .12);
}
form.order textarea { min-height: 80px; resize: vertical; }
form.order .hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.err {
  color: #a81f1f; background: #fdecec; border: 1px solid #f5cfcf;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 12px;
}

/* ── информационные страницы ── */
.info {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); padding: 20px; margin: 14px 0;
}
.info h1 { font-size: 21px; margin: 0 0 12px; letter-spacing: -.02em; }
.info h2 { font-size: 16px; margin: 20px 0 8px; }
.info p { margin: 0 0 10px; white-space: pre-wrap; color: var(--ink-2); }
.info a.btn { margin-top: 6px; }
.todo {
  border: 1px dashed #d3b98d; background: #fffaf1; color: #6b4a05;
  border-radius: var(--r-sm); padding: 13px 14px; font-size: 14px;
}

/* ── нижняя навигация ── */
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  z-index: 30; border-top: 1px solid var(--line); display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a {
  flex: 1; display: grid; justify-items: center; gap: 3px; padding: 9px 4px 10px;
  font-size: 11px; font-weight: 500; color: var(--muted); transition: color .15s ease;
}
nav.bottom a svg { width: 21px; height: 21px; stroke-width: 1.7; }
nav.bottom a.on { color: var(--accent); font-weight: 650; }
footer { color: var(--muted); font-size: 12.5px; padding: 22px 0 12px; text-align: center; }
footer a { color: var(--ink-2); }
footer a:hover { color: var(--accent); }
