/* Romastore — mobile-first. Брендовые цвета меняются в :root. */
:root {
  --bg: #f6f6f4;
  --card: #fff;
  --ink: #141414;
  --muted: #6b6b6b;
  --line: #e7e7e3;
  --accent: #1550e6;
  --accent-ink: #fff;
  --sale: #e5484d;
  --ok: #2f9e44;
  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --top: 64px;
  font-family: Inter, "SF Pro Text", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.45; }
main { flex: 1; width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.85); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.topbar__row { display: flex; align-items: center; gap: 12px; height: var(--top); }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid transparent; border-radius: 999px; padding: 0 14px; height: 42px; transition: border-color .15s, background .15s; }
.search:focus-within { background: #fff; border-color: var(--ink); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: none; width: 100%; min-width: 0; font-size: 16px; /* 16px — чтобы iOS не зумил */ }
.cart-btn { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.cart-btn__label { display: none; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--sale); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
@media (min-width: 720px) {
  .topbar__row { gap: 24px; }
  .search { max-width: 560px; margin: 0 auto; }
  .cart-btn { padding: 0 18px; }
  .cart-btn__label { display: inline; }
  .badge { position: static; background: var(--accent-ink); color: var(--accent); }
}

/* ---------- hero ---------- */
.hero { margin: 16px 0 8px; padding: 28px 22px; border-radius: 24px; background: linear-gradient(135deg, #0b2a6f 0%, #1550e6 60%, #4aa3ff 100%); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 5vw, 40px); letter-spacing: -.03em; line-height: 1.1; }
.hero p { margin: 0; opacity: .75; max-width: 520px; }
@media (min-width: 720px) { .hero { padding: 44px 40px; margin-top: 24px; } }

/* ---------- категории ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; white-space: nowrap; transition: .15s; }
.chip:hover { border-color: var(--ink); }
.chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip small { opacity: .55; margin-left: 4px; }

/* ---------- каталог + фильтры ---------- */
.layout { display: block; }
.toolbar { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.toolbar .count { color: var(--muted); margin-right: auto; font-size: 14px; }
.btn-ghost { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost svg { width: 18px; height: 18px; }
.select { height: 38px; padding: 0 30px 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='3'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 12px center; appearance: none; }

.filters { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .25s ease; }
.filters.is-open { transform: none; }
.filters__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters__head h3 { margin: 0; font-size: 18px; }
.filters__body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; }
.filters__foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.fgroup { border-bottom: 1px solid var(--line); padding: 12px 0; }
.fgroup:last-child { border-bottom: 0; }
.fgroup summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; min-height: 32px; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; }
.fgroup[open] summary::after { content: "–"; }
.fgroup .opts { display: grid; gap: 2px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.opt input { width: 18px; height: 18px; accent-color: var(--ink); }
.opt small { color: var(--muted); margin-left: auto; }
.range { display: flex; gap: 8px; margin-top: 8px; }
.range input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; font-size: 16px; }
.filters-only-mobile { display: inline-flex; }

@media (min-width: 1000px) {
  .layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
  .filters { position: sticky; top: calc(var(--top) + 16px); inset: auto; z-index: 1; transform: none; background: transparent; max-height: calc(100dvh - var(--top) - 32px); }
  .filters__head { border: 0; padding: 0 0 4px; }
  .filters__head .icon-btn, .filters__foot .btn-primary { display: none; }
  .filters__body { padding: 0 4px 0 0; }
  .filters__foot { border: 0; padding: 12px 0 0; }
  .filters-only-mobile { display: none; }
}

/* ---------- сетка товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
@media (hover: hover) { .card:hover { box-shadow: var(--shadow); transform: translateY(-2px); } }
.card__img { aspect-ratio: 1; background: #f0f0ed; position: relative; overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: contain; padding: 8%; transition: transform .3s; mix-blend-mode: multiply; }
@media (hover: hover) { .card:hover .card__img img { transform: scale(1.04); } }
.tag { position: absolute; left: 8px; top: 8px; background: var(--sale); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__name { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card__meta { font-size: 12px; color: var(--muted); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.price b { font-size: 17px; letter-spacing: -.01em; }
.price s { color: var(--muted); font-size: 13px; }
.card .btn-add { margin-top: 4px; }
@media (min-width: 640px) { .card__body { padding: 12px 16px 16px; } .card__name { font-size: 15px; } }

.ph { width: 100%; height: 100%; display: grid; place-items: center; color: #c8c8c2; font-weight: 800; font-size: 42px; letter-spacing: -.04em; background: linear-gradient(135deg, #f0f0ed, #e6e6e1); }

.more { display: flex; justify-content: center; margin: 24px 0 8px; }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; }

/* ---------- кнопки ---------- */
.btn-primary, .btn-add, .btn-sec { height: 44px; border-radius: 12px; border: 0; padding: 0 18px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s, opacity .15s, background .15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-sec { background: var(--bg); }
.btn-add { height: 38px; background: var(--bg); width: 100%; font-size: 14px; }
.btn-add:hover { background: var(--accent); color: #fff; }
.btn-add.in { background: var(--accent); color: #fff; }
.btn-primary:active, .btn-add:active, .btn-sec:active { transform: scale(.97); }
.btn-wide { width: 100%; height: 52px; font-size: 16px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg); font-size: 16px; display: grid; place-items: center; }

/* ---------- карточка товара ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin: 16px 0 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); }
.pdp { display: grid; gap: 20px; }
@media (min-width: 900px) { .pdp { grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; } }
.gallery { background: #fff; border-radius: 20px; overflow: hidden; }
.gallery__main { aspect-ratio: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery__main::-webkit-scrollbar { display: none; }
.gallery__main > * { flex: none; width: 100%; scroll-snap-align: center; }
.gallery__main img { width: 100%; height: 100%; object-fit: contain; padding: 6%; }
.thumbs { display: flex; gap: 8px; padding: 0 12px 12px; overflow-x: auto; }
.thumbs button { flex: none; width: 64px; height: 64px; border-radius: 10px; border: 2px solid transparent; background: var(--bg); padding: 4px; }
.thumbs button.is-on { border-color: var(--ink); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pdp__info h1 { font-size: clamp(22px, 3.2vw, 32px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 8px; }
.pdp__sku { color: var(--muted); font-size: 13px; }
.pdp__buy { background: #fff; border-radius: 20px; padding: 18px; margin: 16px 0; display: grid; gap: 14px; }
.pdp__buy .price b { font-size: 28px; }
.stock { font-size: 13px; color: var(--ok); }
.stock.no { color: var(--muted); }
.qty { display: inline-flex; align-items: center; background: var(--bg); border-radius: 12px; height: 44px; }
.qty button { width: 44px; height: 44px; border: 0; background: none; font-size: 20px; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; }
.buy-row { display: flex; gap: 10px; }
.buy-row .btn-primary { flex: 1; }
.specs { background: #fff; border-radius: 20px; padding: 6px 18px; }
.specs h3 { margin: 12px 0 4px; font-size: 17px; }
.specs dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.specs dt, .specs dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs dt { color: var(--muted); padding-right: 12px; }
.specs dl > :nth-last-child(-n+2) { border-bottom: 0; }
.desc { background: #fff; border-radius: 20px; padding: 6px 18px 16px; margin-top: 16px; white-space: pre-line; }
.desc h3 { margin: 12px 0 4px; font-size: 17px; }
.mobile-buy { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; }
.mobile-buy .btn-primary { flex: 1; }
@media (min-width: 900px) { .mobile-buy { display: none; } }
.has-mobile-buy { padding-bottom: 84px; }
@media (min-width: 900px) { .has-mobile-buy { padding-bottom: 0; } }

/* ---------- мобильная плашка корзины ---------- */
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; height: 54px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 15px; animation: up .25s ease; }
@media (min-width: 720px) { .cart-bar { display: none !important; } }
@keyframes up { from { transform: translateY(120%); } }

/* ---------- drawer: bottom sheet на мобиле, справа на ПК ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; max-height: 92dvh; background: #fff; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.drawer.is-open { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.drawer__head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
.drawer__head h2 { margin: 0; font-size: 20px; }
.drawer__body { overflow-y: auto; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) {
  .drawer { left: auto; top: 0; width: 440px; max-height: none; border-radius: 0; transform: translateX(100%); }
  .drawer__head::before { display: none; }
}
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line__img { width: 64px; height: 64px; border-radius: 12px; background: var(--bg); overflow: hidden; }
.line__img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; mix-blend-mode: multiply; }
.line__img .ph { font-size: 18px; }
.line__name { font-size: 14px; line-height: 1.3; }
.line__price { font-size: 13px; color: var(--muted); margin-top: 2px; }
.line .qty { height: 36px; border-radius: 10px; margin-top: 6px; }
.line .qty button { width: 34px; height: 36px; font-size: 18px; }
.line__sum { font-weight: 700; white-space: nowrap; align-self: start; }
.total { display: flex; justify-content: space-between; font-size: 18px; padding: 16px 0; }
.total b { font-size: 22px; }

.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; background: #fff; outline: 0; transition: border-color .15s; }
.field input:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { min-height: 80px; resize: vertical; }
.hp { position: absolute; left: -9999px; }
.err { color: var(--sale); font-size: 14px; }
.note { font-size: 12px; color: var(--muted); text-align: center; }
.done { text-align: center; padding: 30px 0 10px; }
.done .ic { width: 64px; height: 64px; border-radius: 50%; background: #e9f7ec; color: var(--ok); display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px; }
.done h3 { margin: 0 0 6px; font-size: 22px; }
.done p { color: var(--muted); margin: 0 0 20px; }

/* ---------- прочее ---------- */
.footer { color: var(--muted); font-size: 13px; padding: 32px 0 calc(90px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .footer { padding-bottom: 32px; } }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 720px) { .toast { bottom: 32px; } }
.skeleton { background: linear-gradient(90deg, #ececE8 25%, #f5f5f2 50%, #ececE8 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); aspect-ratio: .72; }
@keyframes sk { to { background-position: -200% 0; } }
body.lock { overflow: hidden; }

/* ---------- VRF-доработки ---------- */
.card__specs { font-size: 12.5px; color: #3a4a6b; background: #eef3ff; border-radius: 8px; padding: 4px 8px; align-self: flex-start; }
.card__specs:empty { display: none; }
.price--req b { font-size: 15px; color: var(--accent); }
.pdp__buy .price--req b { font-size: 22px; }
.mobile-buy .price--req b { font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.total__val { text-align: right; display: grid; }
.total__req { font-size: 12px; color: var(--muted); }
.opt input, .fgroup input[type=checkbox] { accent-color: var(--accent); }
.search:focus-within { border-color: var(--accent); }

/* ---------- мобильный тулбар: счётчик отдельной строкой, фильтры и сортировка — пополам ---------- */
html, body { overflow-x: clip; }
.toolbar { flex-wrap: wrap; }
.toolbar .count { flex-basis: 100%; }
.toolbar .btn-ghost, .toolbar .select { flex: 1 1 0; min-width: 0; justify-content: center; }
.range input { min-width: 0; }
@media (min-width: 1000px) {
  .toolbar { flex-wrap: nowrap; }
  .toolbar .count { flex-basis: auto; }
  .toolbar .select { flex: 0 0 auto; }
}
.chip { display: inline-flex; align-items: center; }
.card__name { -webkit-line-clamp: 3; min-height: 3.9em; }

/* ---------- подсказки адреса ---------- */
.field--addr { position: relative; }
.suggest { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.12); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; font-size: 14px; line-height: 1.3; border-bottom: 1px solid var(--line); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.is-on { background: #eef3ff; }
.hero__phone { display: inline-block; margin-top: 14px; font-weight: 700; font-size: 18px; color: #fff; position: relative; z-index: 1; }
