/* =========================================================
   МЕРИДИАН — обжарочная мастерская
   style.css — токены, база, каркас, компоненты
   ========================================================= */

/* ---------- 1. Токены ---------- */
:root {
  /* Палитра — светлая тема */
  --paper:        #FBF9F6;
  --paper-2:      #F4F0EA;
  --paper-3:      #EBE5DC;
  --surface:      #FFFFFF;
  --ink:          #1A1614;
  --ink-2:        #4A423C;
  --ink-3:        #7C736B;
  --line:         #E2DCD2;
  --line-2:       #D2C9BC;

  --accent:       #9C4A26;   /* обжаренная медь */
  --accent-hi:    #B85B31;
  --accent-lo:    #7C3A1C;
  --accent-soft:  #F6EAE2;

  --green:        #2F4A3C;   /* чай */
  --green-soft:   #E6EDE7;
  --gold:         #B8860B;
  --danger:       #A3271F;
  --danger-soft:  #FBEAE8;
  --success:      #2E6B45;
  --success-soft: #E6F1EA;

  /* Типографика */
  --font-title: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-text:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:  ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  /* Размеры */
  --wrap: 1280px;
  --gap: 24px;
  --pad-x: clamp(16px, 4vw, 40px);
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Тени */
  --sh-1: 0 1px 2px rgba(26,22,20,.05), 0 2px 6px rgba(26,22,20,.04);
  --sh-2: 0 2px 6px rgba(26,22,20,.06), 0 10px 24px rgba(26,22,20,.07);
  --sh-3: 0 8px 24px rgba(26,22,20,.10), 0 24px 60px rgba(26,22,20,.12);
  --sh-focus: 0 0 0 3px rgba(156,74,38,.28);

  /* Прочее */
  --header-h: 72px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --t-fast: .16s var(--ease);
  --t: .28s var(--ease);
}

html[data-theme="dark"] {
  --paper:        #14110F;
  --paper-2:      #1C1815;
  --paper-3:      #262019;
  --surface:      #1B1714;
  --ink:          #F2ECE4;
  --ink-2:        #C6BCB1;
  --ink-3:        #948A80;
  --line:         #322A24;
  --line-2:       #453B32;

  --accent:       #D97A48;
  --accent-hi:    #E88F5D;
  --accent-lo:    #B75F32;
  --accent-soft:  #2A1E17;

  --green:        #7FA98F;
  --green-soft:   #1D2621;
  --gold:         #D5A93F;
  --danger:       #E27C72;
  --danger-soft:  #2C1917;
  --success:      #74B48F;
  --success-soft: #172420;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 8px rgba(0,0,0,.45);
  --sh-3: 0 12px 40px rgba(0,0,0,.55);
  --sh-focus: 0 0 0 3px rgba(217,122,72,.35);
}

/* ---------- 2. Сброс и база ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--t), color var(--t);
}
body.no-scroll { overflow: hidden; }

img, svg, video { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1 { font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(24px, 3.4vw, 38px); }
h3 { font-size: clamp(19px, 2.2vw, 24px); }
h4 { font-size: 17px; }
p  { margin: 0 0 1em; }
a  { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
strong, b { font-weight: 650; }
small { font-size: 13px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection { background: var(--accent); color: #fff; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 12px 20px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- 3. Утилиты ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad-x); }
.wrap-narrow { max-width: 880px; }
.section { padding-block: clamp(48px, 7vw, 88px); }
.section-sm { padding-block: clamp(32px, 4.5vw, 56px); }
.stack > * + * { margin-top: var(--sp, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.dim  { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.divider { height: 1px; background: var(--line); border: 0; }
.eyebrow {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 600; color: var(--accent); margin-bottom: 10px;
}
.lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--ink-2); line-height: 1.65; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 28px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--ink-3); max-width: 56ch; }

/* ---------- 4. Кнопки ---------- */
.btn {
  --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px; min-height: 46px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; letter-spacing: .01em;
  text-align: center; white-space: nowrap; user-select: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-accent  { --btn-bg: var(--accent); --btn-fg: #fff; }
.btn-accent:hover { --btn-bg: var(--accent-hi); }
.btn-ghost   { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-2); }
.btn-ghost:hover { --btn-bd: var(--ink); box-shadow: none; }
.btn-soft    { --btn-bg: var(--paper-2); --btn-fg: var(--ink); --btn-bd: var(--line); }
.btn-soft:hover { --btn-bg: var(--paper-3); box-shadow: none; }
.btn-quiet   { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-bd: transparent; padding-inline: 12px; }
.btn-quiet:hover { --btn-fg: var(--ink); box-shadow: none; transform: none; text-decoration: underline; text-underline-offset: 4px; }
.btn-danger  { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: var(--line-2); }
.btn-danger:hover { --btn-bg: var(--danger-soft); --btn-bd: var(--danger); box-shadow: none; }

.btn-lg { padding: 15px 30px; min-height: 54px; font-size: 16px; }
.btn-sm { padding: 8px 15px; min-height: 36px; font-size: 13.5px; }
.btn-block { width: 100%; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; color: var(--accent); font-size: 15px;
}
.link-arrow::after { content: "→"; transition: transform var(--t-fast); }
.link-arrow:hover::after { transform: translateX(4px); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: var(--r-pill);
  color: var(--ink); background: transparent;
  border: 1px solid transparent;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  position: relative; flex: none;
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.is-active { color: var(--accent); }

.count-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  border-radius: var(--r-pill);
  border: 2px solid var(--paper);
  font-variant-numeric: tabular-nums;
}
.count-badge:empty, .count-badge[data-empty="1"] { display: none; }

/* ---------- 5. Формы ---------- */
.field { display: block; margin-bottom: 18px; }
.field-label {
  display: block; font-size: 13.5px; font-weight: 600;
  margin-bottom: 7px; color: var(--ink-2);
}
.field-label .req { color: var(--accent); }

.input, .select, .textarea {
  width: 100%; padding: 12px 14px; min-height: 48px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font-size: 15px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: .8; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--sh-focus);
}
.textarea { min-height: 116px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%237C736B' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  padding-right: 38px; cursor: pointer;
}
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field-error { display: none; color: var(--danger); font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.field.has-error .field-error { display: block; }
.field-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

.check {
  display: flex; align-items: flex-start; gap: 11px;
  cursor: pointer; font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
  padding: 3px 0;
}
.check input { flex: none; width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.check:hover { color: var(--ink); }

.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface); overflow: hidden; height: 44px;
}
.qty button {
  width: 40px; height: 100%; display: grid; place-items: center;
  font-size: 18px; color: var(--ink-2); transition: background-color var(--t-fast);
}
.qty button:hover { background: var(--paper-2); color: var(--ink); }
.qty input {
  width: 44px; height: 100%; text-align: center; border: none; background: none;
  font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px;
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; }

/* Сегментированный переключатель */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: var(--r-pill); border: 1px solid var(--line); }
.seg button {
  padding: 7px 15px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
  color: var(--ink-3); transition: all var(--t-fast); white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* Чипы выбора (вес, помол, фильтры) */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-lo); font-weight: 650;
}
html[data-theme="dark"] .chip.is-active, html[data-theme="dark"] .chip[aria-pressed="true"] { color: var(--accent-hi); }
.chip .chip-x { font-size: 15px; line-height: 1; opacity: .6; }
.chip .chip-note { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.chip:disabled { opacity: .4; text-decoration: line-through; pointer-events: none; }

/* ---------- 6. Значки, рейтинг ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  background: var(--paper-3); color: var(--ink-2); white-space: nowrap;
}
.badge-new    { background: var(--green); color: #fff; }
.badge-hit    { background: var(--ink); color: var(--paper); }
.badge-sale   { background: var(--danger); color: #fff; }
.badge-lot    { background: var(--gold); color: #fff; }
.badge-soft   { background: var(--accent-soft); color: var(--accent-lo); }
html[data-theme="dark"] .badge-soft { color: var(--accent-hi); }
.badge-out    { background: var(--paper-3); color: var(--ink-3); }

.stars { display: inline-flex; align-items: center; gap: 2px; color: var(--gold); flex: none; }
.stars svg { width: 14px; height: 14px; }
.stars.stars-lg svg { width: 18px; height: 18px; }
.rating-row { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); }

/* ---------- 7. Карточка товара ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(14px, 1.8vw, 26px);
}
.product-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.card.is-out { opacity: .72; }

.card-media {
  position: relative; display: block;
  aspect-ratio: 1 / 1; background: var(--paper-2);
  overflow: hidden;
}
.card-media svg { width: 100%; height: 100%; transition: transform .5s var(--ease); }
.card:hover .card-media svg { transform: scale(1.05); }

.card-flags { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; z-index: 2; }
.card-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; opacity: 0; transform: translateX(6px); transition: all var(--t); }
.card:hover .card-tools, .card:focus-within .card-tools { opacity: 1; transform: none; }
.card-tools .icon-btn {
  width: 36px; height: 36px; background: var(--surface);
  border-color: var(--line); box-shadow: var(--sh-1);
}
.card-tools .icon-btn svg { width: 17px; height: 17px; }
.card-tools .icon-btn:hover { background: var(--ink); color: var(--paper); }
.card-tools .icon-btn.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.card-quick {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  opacity: 0; transform: translateY(8px); transition: all var(--t);
}
.card:hover .card-quick, .card:focus-within .card-quick { opacity: 1; transform: none; }
@media (hover: none) {
  .card-tools { opacity: 1; transform: none; }
  .card-quick { display: none; }
}

.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.card-kicker {
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.card-title {
  font-family: var(--font-title); font-size: 17.5px; font-weight: 600;
  line-height: 1.25; margin: 0; letter-spacing: -.01em;
}
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-notes { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now { font-size: 19px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price-old { font-size: 13.5px; color: var(--ink-3); text-decoration: line-through; }
.price-unit { font-size: 12px; color: var(--ink-3); }
.card-add {
  width: 42px; height: 42px; border-radius: var(--r-pill);
  display: grid; place-items: center; flex: none;
  background: var(--ink); color: var(--paper); position: relative; z-index: 2;
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.card-add:hover { background: var(--accent); transform: scale(1.06); }
.card-add svg { width: 19px; height: 19px; }

/* Список вместо сетки */
.product-grid.as-list { grid-template-columns: 1fr; gap: 14px; }
.product-grid.as-list .card { flex-direction: row; align-items: stretch; }
.product-grid.as-list .card-media { width: 190px; flex: none; aspect-ratio: 1/1; }
.product-grid.as-list .card-body { padding: 18px 20px; }
.product-grid.as-list .card-quick { display: none; }
@media (max-width: 640px) {
  .product-grid.as-list .card-media { width: 118px; }
  .product-grid.as-list .card-body { padding: 12px 14px; }
}

/* Скелетоны */
.skeleton {
  background: linear-gradient(100deg, var(--paper-2) 30%, var(--paper-3) 45%, var(--paper-2) 60%);
  background-size: 260% 100%;
  animation: shimmer 1.15s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -160% 0; } }
.sk-card { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.sk-card .sk-img { aspect-ratio: 1/1; border-radius: 0; }
.sk-card .sk-lines { padding: 16px; display: grid; gap: 9px; }
.sk-line { height: 11px; }

/* ---------- 8. Шапка ---------- */
.topbar {
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; letter-spacing: .02em;
}
html[data-theme="dark"] .topbar { background: var(--paper-3); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; }
.topbar-ticker { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.topbar-ticker svg { width: 16px; height: 16px; flex: none; }
.topbar-ticker span { opacity: .85; }
.topbar-links { display: flex; gap: 20px; }
.topbar-links a { opacity: .8; transition: opacity var(--t-fast); }
.topbar-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 860px) { .topbar-links { display: none; } .topbar-inner { justify-content: center; } }

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.site-header.is-stuck { border-bottom-color: var(--line); box-shadow: 0 4px 20px rgba(26,22,20,.05); }
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--paper); } }

.header-inner { display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); min-height: var(--header-h); }

.logo { display: inline-flex; align-items: center; gap: 11px; flex: none; }
.logo-mark { width: 38px; height: 38px; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name {
  font-family: var(--font-title); font-size: 20px; font-weight: 650;
  letter-spacing: .1em; text-transform: uppercase;
}
.logo-sub { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav > li { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 13px; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 550; color: var(--ink-2);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.nav-link:hover { color: var(--ink); background: var(--paper-2); }
.nav-link[aria-current="page"] { color: var(--ink); font-weight: 650; }
.nav-link .caret { width: 10px; height: 10px; transition: transform var(--t-fast); }
.nav > li:hover .nav-link .caret { transform: rotate(180deg); }

/* Мега-меню */
.mega {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translate(-50%, 8px);
  width: min(760px, 88vw); padding: 26px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-3);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: all var(--t);
}
.nav > li:hover .mega, .nav > li:focus-within .mega {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0);
}
.mega h5 {
  font-family: var(--font-text); font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px;
}
.mega li + li { margin-top: 3px; }
.mega a { display: block; padding: 6px 8px; margin-left: -8px; border-radius: var(--r-xs); font-size: 14.5px; color: var(--ink-2); transition: all var(--t-fast); }
.mega a:hover { background: var(--paper-2); color: var(--accent); }
.mega-promo {
  grid-column: span 1; padding: 18px; border-radius: var(--r-md);
  background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px;
}
.mega-promo strong { font-family: var(--font-title); font-size: 17px; }
.mega-promo p { font-size: 13px; color: var(--ink-2); margin: 0; }
@media (max-width: 1080px) { .mega { display: none; } }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.burger { display: none; }
@media (max-width: 1080px) {
  .nav { display: none; }
  .burger { display: inline-grid; }
}
/* На узких экранах эти действия живут в нижней навигации и в меню */
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .logo-mark svg { width: 34px; height: 34px; }
  .logo-name { font-size: 18px; }
  :root { --header-h: 62px; }
}
@media (max-width: 400px) {
  .logo-sub { display: none; }
  .logo { gap: 8px; }
  .logo-name { font-size: 16px; letter-spacing: .06em; }
  .logo-mark svg { width: 30px; height: 30px; }
  .header-tools { gap: 0; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 19px; height: 19px; }
}

/* Мобильное меню */
.mobile-menu {
  position: fixed; inset: 0; z-index: 90;
  background: var(--paper);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .34s var(--ease);
  overflow-y: auto; overscroll-behavior: contain;
}
.mobile-menu.is-open { transform: none; }
.mobile-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--pad-x); border-bottom: 1px solid var(--line); }
.mobile-menu-body { padding: 12px var(--pad-x) 40px; }
.m-group { border-bottom: 1px solid var(--line); }
.m-group > button, .m-group > a {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; font-size: 17px; font-weight: 600; font-family: var(--font-title); text-align: left;
}
.m-group > button .caret, .m-group > a .caret { width: 14px; height: 14px; flex: none; color: var(--ink-3); transition: transform var(--t-fast); }
.m-group .m-sub { display: none; padding: 0 0 14px 12px; }
.m-group.is-open .m-sub { display: block; }
.m-group.is-open > button .caret { transform: rotate(180deg); }
.m-sub a { display: block; padding: 9px 0; color: var(--ink-2); font-size: 15px; }
.m-sub a:hover { color: var(--accent); }
.m-foot { padding-top: 24px; display: grid; gap: 10px; }

/* Поиск */
.search-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: all var(--t);
  padding-top: clamp(60px, 12vh, 130px);
}
.search-overlay.is-open { opacity: 1; visibility: visible; }
.search-panel {
  width: min(720px, calc(100% - 2 * var(--pad-x))); margin-inline: auto;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); overflow: hidden;
  transform: translateY(-14px); transition: transform var(--t);
  max-height: min(70vh, 620px); display: flex; flex-direction: column;
}
.search-overlay.is-open .search-panel { transform: none; }
.search-bar { display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.search-bar svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.search-bar input { flex: 1; border: none; background: none; padding: 18px 0; font-size: 17px; outline: none; }
.search-results { overflow-y: auto; padding: 8px; }
.search-hint { padding: 22px 18px; color: var(--ink-3); font-size: 14px; }
.s-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--r-sm); transition: background-color var(--t-fast); }
.s-item:hover, .s-item.is-cursor { background: var(--paper-2); }
.s-item .s-img { width: 52px; height: 52px; border-radius: var(--r-xs); overflow: hidden; background: var(--paper-2); flex: none; }
.s-item .s-name { font-weight: 600; font-size: 14.5px; }
.s-item .s-meta { font-size: 12.5px; color: var(--ink-3); }
.s-item .s-price { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.s-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 12px 14px; }

/* ---------- 9. Мини-корзина (drawer) ---------- */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 98;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  opacity: 0; visibility: hidden; transition: all var(--t);
}
.drawer-scrim.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 99;
  width: min(430px, 100%); background: var(--paper);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .34s var(--ease);
  box-shadow: var(--sh-3);
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 20px; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); }

.mini-line { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mini-line:last-child { border-bottom: none; }
.mini-img { width: 76px; height: 76px; flex: none; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-2); }
.mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.mini-opts { font-size: 12.5px; color: var(--ink-3); }
.mini-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.mini-qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-pill); height: 32px; }
.mini-qty button { width: 30px; height: 100%; display: grid; place-items: center; color: var(--ink-2); }
.mini-qty button:hover { color: var(--accent); }
.mini-qty span { min-width: 24px; text-align: center; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-del { color: var(--ink-3); font-size: 12.5px; }
.mini-del:hover { color: var(--danger); text-decoration: underline; }

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state svg { width: 74px; height: 74px; margin: 0 auto 18px; color: var(--line-2); }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--ink-3); max-width: 38ch; margin-inline: auto; }

/* Прогресс до бесплатной доставки */
.ship-progress { padding: 12px 0 16px; }
.ship-progress .bar { height: 6px; border-radius: var(--r-pill); background: var(--paper-3); overflow: hidden; margin-top: 8px; }
.ship-progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }
.ship-progress p { margin: 0; font-size: 13px; color: var(--ink-2); }

/* ---------- 10. Модалки ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--ink) 50%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: var(--pad-x);
  opacity: 0; visibility: hidden; transition: all var(--t);
  overflow-y: auto;
}
.modal-scrim.is-open { opacity: 1; visibility: visible; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 48px);
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); overflow: hidden;
  display: flex; flex-direction: column;
  transform: scale(.96) translateY(10px); transition: transform var(--t);
}
.modal-wide { width: min(940px, 100%); }
.modal-scrim.is-open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 21px; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 18px 24px; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface); }
@media (max-width: 560px) {
  .modal-scrim { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}

/* ---------- 11. Тосты ---------- */
.toasts {
  position: fixed; z-index: 120; right: 20px; bottom: 20px;
  display: flex; flex-direction: column-reverse; gap: 10px;
  width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-3);
  animation: toast-in .3s var(--ease);
}
.toast.is-hiding { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(24px); } }
.toast-ico { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.toast-ok  .toast-ico { color: var(--success); }
.toast-err .toast-ico { color: var(--danger); }
.toast-info .toast-ico { color: var(--accent); }
.toast-txt { flex: 1; font-size: 14px; line-height: 1.45; }
.toast-txt b { display: block; font-weight: 650; margin-bottom: 2px; }
.toast-act { font-size: 13px; font-weight: 650; color: var(--accent); white-space: nowrap; }
.toast-act:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .toasts { right: 12px; left: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); width: auto; }
}

/* ---------- 12. Табы, аккордеон ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 13px 18px; font-size: 15px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 26px; }
.tab-panel[hidden] { display: none; }

.acc-item { border-bottom: 1px solid var(--line); }
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0; text-align: left; font-weight: 600; font-size: 16px;
}
.acc-head .caret { width: 14px; height: 14px; flex: none; color: var(--ink-3); transition: transform var(--t); }
.acc-item.is-open .acc-head .caret { transform: rotate(180deg); }
.acc-body { display: none; padding: 0 0 20px; color: var(--ink-2); max-width: 72ch; }
.acc-item.is-open .acc-body { display: block; }

/* ---------- 13. Хлебные крошки, пагинация ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); padding: 18px 0; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs span[aria-current] { color: var(--ink-2); }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.pager button {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: all var(--t-fast);
}
.pager button:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.pager button[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager button:disabled { opacity: .35; pointer-events: none; }

/* ---------- 14. Подвал ---------- */
.site-footer {
  margin-top: clamp(60px, 8vw, 110px);
  background: var(--ink); color: #D9D1C8;
  padding-top: clamp(46px, 6vw, 76px);
}
html[data-theme="dark"] .site-footer { background: var(--paper-2); border-top: 1px solid var(--line); }
.site-footer h4 {
  color: #fff; font-family: var(--font-text); font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 16px; font-weight: 600;
}
html[data-theme="dark"] .site-footer h4 { color: var(--ink); }
.site-footer a { color: #B9B0A6; transition: color var(--t-fast); }
.site-footer a:hover { color: #fff; }
html[data-theme="dark"] .site-footer a:hover { color: var(--ink); }
.footer-grid {
  display: grid; gap: 36px;
  grid-template-columns: 1.6fr repeat(3, 1fr) 1.4fr;
  padding-bottom: 46px;
}
.footer-grid li + li { margin-top: 9px; }
.footer-grid ul { font-size: 14.5px; }
.footer-brand p { font-size: 14px; color: #A79E94; max-width: 34ch; margin: 16px 0 20px; }
.footer-brand .logo-name, .footer-brand .logo-sub { color: #fff; }
html[data-theme="dark"] .footer-brand .logo-name { color: var(--ink); }
.socials { display: flex; gap: 10px; }
.socials a {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  transition: all var(--t-fast);
}
.socials a:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); }
.socials svg { width: 17px; height: 17px; }
.newsletter { display: flex; gap: 8px; margin-top: 14px; }
.newsletter input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16);
  color: #fff; font-size: 14px;
}
.newsletter input::placeholder { color: #8D857C; }
.newsletter input:focus { outline: none; border-color: var(--accent); }
.newsletter button { --btn-bg: var(--accent); --btn-fg: #fff; padding-inline: 20px; min-height: 46px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.11);
  padding: 22px 0 calc(22px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: #8D857C;
}
.pay-icons { display: flex; gap: 8px; align-items: center; opacity: .75; }
.pay-icons svg { height: 22px; width: auto; }
@media (max-width: 1080px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } .footer-brand, .footer-sub { grid-column: span 3; } }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } .footer-brand, .footer-sub { grid-column: span 2; } }

/* ---------- 15. Нижняя навигация (мобайл) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: none; background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { display: flex; }
.tabbar li { flex: 1; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; font-size: 10.5px; color: var(--ink-3); position: relative;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .count-badge { top: 2px; right: 50%; margin-right: -22px; border-color: var(--paper); }
@media (max-width: 720px) {
  .tabbar { display: block; }
  body { padding-bottom: 62px; }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

/* ---------- 16. Прочие мелочи ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  width: 46px; height: 46px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-2); color: var(--ink);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all var(--t);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 720px) { .to-top { bottom: calc(74px + env(safe-area-inset-bottom)); right: 14px; } }

.cookie-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 110;
  max-width: 640px; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 18px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  transform: translateY(140%); transition: transform .4s var(--ease);
}
.cookie-bar.is-open { transform: none; }
.cookie-bar p { margin: 0; font-size: 13.5px; color: var(--ink-2); flex: 1 1 260px; }
@media (max-width: 720px) { .cookie-bar { bottom: calc(70px + env(safe-area-inset-bottom)); } }

.notice {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: var(--r-md); font-size: 14px; line-height: 1.5;
  background: var(--paper-2); border: 1px solid var(--line);
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--ink-3); }
.notice-info { background: var(--accent-soft); border-color: transparent; }
.notice-info svg { color: var(--accent); }
.notice-ok { background: var(--success-soft); border-color: transparent; }
.notice-ok svg { color: var(--success); }
.notice-warn { background: var(--danger-soft); border-color: transparent; }
.notice-warn svg { color: var(--danger); }

.demo-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.demo-flag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Печать */
@media print {
  .site-header, .site-footer, .tabbar, .to-top, .toasts, .cookie-bar, .drawer, .drawer-scrim { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
}
