/* Shop Platform — адаптивные компоненты витрины (один шаблон, темы через tokens.css).
   Прототип для разработки. Не кодовая база приложения. */

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--line-height);
  overflow-x: hidden;              /* страховка; верстка не должна этого требовать */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-spacing);
  text-transform: var(--head-transform);
  margin: 0;
  overflow-wrap: anywhere;         /* длинные слова не вылезают из колонки */
}
h1 { font-size: clamp(30px, 5vw, 56px); line-height: 1.04; }
h2 { font-size: clamp(24px, 3.2vw, 40px); line-height: 1.08; }
h3 { font-size: clamp(18px, 2vw, 24px); line-height: 1.15; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.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; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(28px, 4vw, 56px); }
.muted { color: var(--ink-2); }
.kicker { text-transform: var(--kicker-transform); letter-spacing: var(--kicker-spacing); font-size: 13px; color: var(--ink-2); }

/* ---------- демо-полоса ---------- */
.demo-bar {
  background: var(--panel); color: var(--panel-ink);
  font-size: 13px; text-align: center; padding: 8px 16px;
}
.demo-bar a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 22px;
  border-radius: var(--control-radius);
  border: var(--border-width) solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
  text-transform: var(--label-transform); font-family: var(--label-font);
  transition: transform .15s ease, filter .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--ghost { background: transparent; }
.btn--lg { min-height: var(--control-h-lg); padding: 0 28px; font-size: 17px; }
.btn--sm { min-height: var(--control-h-sm); padding: 0 16px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"] .btn__spin { display: inline-block; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h-sm);
  padding: 0 16px; border-radius: var(--control-radius); border: var(--border-width) solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  text-transform: var(--label-transform); font-family: var(--label-font); }
.pill[aria-pressed="true"], .pill.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pill--count::after { content: attr(data-count); background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 12px; padding: 0 5px; }

/* ---------- шапка ---------- */
.site-head { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: var(--border-width) solid var(--line); }
.head-row { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: var(--head-weight);
  letter-spacing: .01em; font-size: 20px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: var(--control-radius); white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface); }
.head-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--control-radius);
  border: var(--border-width) solid transparent; background: transparent; cursor: pointer; color: var(--ink); position: relative; }
.icon-btn:hover { background: var(--surface); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; display: grid; place-items: center; }
.cart-btn { border: var(--border-width) solid var(--line-strong); background: var(--accent); color: var(--accent-ink);
  width: auto; padding: 0 16px; gap: 8px; min-height: 44px; border-radius: var(--control-radius); }
.burger { display: none; }

/* мобильная шапка */
@media (max-width: 860px) {
  .nav { display: none; }
  .head-tools .label-hide { display: none; }
  .burger { display: inline-grid; }
  .cart-btn .cart-sum { display: none; }
  .brand { max-width: 42vw; }
}

/* выдвижное меню */
.drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel { position: absolute; top: 0; right: 0; height: 100%; width: min(86vw, 360px);
  background: var(--bg); border-left: var(--border-width) solid var(--line); transform: translateX(100%);
  transition: transform .22s ease; display: flex; flex-direction: column; padding: 16px; overflow-y: auto; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer nav { display: flex; flex-direction: column; }
.drawer nav a { padding: 14px 8px; border-bottom: 1px solid var(--line); font-size: 18px; }
.drawer__foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 16px; }

/* ---------- обложка/hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(16px, 3vw, 40px); align-items: center;
  padding-block: clamp(20px, 3vw, 44px); }
.hero__text { display: flex; flex-direction: column; gap: 18px; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
/* кадрирование: фиксированное окно, предмет целиком по центру, ограниченный crop */
.hero__media { border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2);
  aspect-ratio: 16 / 11; display: grid; place-items: center; }
.hero__media img { width: 100%; height: 100%; object-fit: contain; object-position: center; padding: clamp(12px, 3vw, 36px); }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 16px; }
  .hero__media { aspect-ratio: 5 / 4; order: -1; }
  .hero__media img { padding: 16px; }
}

/* ---------- сетки/карточки ---------- */
.grid { display: grid; gap: clamp(12px, 2vw, 20px); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid--tiles { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }

.card { background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--card-radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(var(--lift)); box-shadow: var(--shadow); }
.card__media { aspect-ratio: 4 / 5; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.card__media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.card__noimg { color: var(--ink-2); font-size: 13px; display: grid; gap: 6px; justify-items: center; text-align: center; padding: 16px; }
.card__badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.card__body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__title { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.card__meta { color: var(--ink-2); font-size: 13px; }
.card__price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.price { font-weight: 600; font-size: 18px; white-space: nowrap; }
.price--old { color: var(--ink-2); text-decoration: line-through; font-size: 14px; font-weight: 400; }
.card__foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.card__add { flex: 1; }

.badge-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--control-radius);
  font-size: 12px; font-weight: 600; background: var(--promo); color: var(--promo-ink); white-space: nowrap; }
.badge-tag--out { background: var(--ink); color: var(--bg); }
.badge-tag--ok { background: var(--selected-bg); color: var(--ink); }
.badge-tag .ic { width: 12px; height: 12px; }

/* ---------- панель фильтров ---------- */
.filterbar { display: flex; align-items: center; gap: 10px; padding-block: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.filterbar__spacer { flex: 1; }
.filter-toggle { margin-left: auto; }
@media (max-width: 760px) {
  .filterbar { gap: 8px; }
  .chips { flex: 1 1 100%; order: 2; }
  .filter-toggle { order: 1; margin-left: auto; }
  .sort-select { order: 1; }
}

/* лист фильтров: справа на desktop, снизу на телефоне */
.sheet { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.sheet.is-open { visibility: visible; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.sheet.is-open .sheet__scrim { opacity: 1; }
.sheet__panel { position: absolute; background: var(--bg); display: flex; flex-direction: column;
  transition: transform .24s ease; border: var(--border-width) solid var(--line); }
.sheet__panel { top: 0; right: 0; height: 100%; width: min(92vw, 400px); transform: translateX(100%); border-radius: var(--card-radius) 0 0 var(--card-radius); }
.sheet.is-open .sheet__panel { transform: none; }
@media (max-width: 640px) {
  .sheet__panel { top: auto; bottom: 0; right: 0; left: 0; width: auto; height: min(82vh, 640px);
    transform: translateY(100%); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.sheet__body { padding: 8px 16px 16px; overflow-y: auto; flex: 1; }
.sheet__foot { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.sheet__foot .btn { flex: 1; }
.fgroup { border-bottom: 1px solid var(--line); }
.fgroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 2px; font-weight: 600; }
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary::after { content: "+"; color: var(--ink-2); font-size: 20px; }
.fgroup[open] > summary::after { content: "–"; }
.fgroup__body { padding: 2px 2px 14px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- чек/радио ---------- */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.opt { display: flex; align-items: flex-start; gap: 12px; border: var(--border-width) solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; background: var(--surface); }
.opt input { margin-top: 3px; accent-color: var(--accent); }
.opt.is-selected { background: var(--selected-bg); box-shadow: var(--selected-ring); }
.opt__main { display: flex; flex-direction: column; gap: 2px; }
.opt__price { margin-left: auto; font-weight: 600; white-space: nowrap; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; color: var(--ink-2); text-transform: var(--kicker-transform); letter-spacing: var(--kicker-spacing); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h); padding: 0 14px; font: inherit;
  background: var(--surface); color: var(--ink);
  border: var(--border-width) solid var(--line); border-radius: var(--radius-sm);
}
.textarea { min-height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--warn); }
.field__err { color: var(--warn); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.field__err::before { content: "!"; width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0 16px; }

/* шаг количества */
.stepper { display: inline-flex; align-items: center; border: var(--border-width) solid var(--line-strong); border-radius: var(--control-radius); overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface); font-size: 18px; cursor: pointer; color: var(--ink); }
.stepper button[disabled] { opacity: .4; cursor: not-allowed; }
.stepper output { min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- табы ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: var(--border-width) solid var(--line); padding-bottom: 2px; }
.tab { padding: 10px 16px; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--ink-2);
  border-radius: var(--control-radius) var(--control-radius) 0 0; }
.tab[aria-selected="true"] { color: var(--ink); background: var(--surface); font-weight: 600; }
.tabpanel[hidden] { display: none; }

/* ---------- корзина/итоги ---------- */
.layout-2col { display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(16px, 3vw, 32px); align-items: start; }
@media (max-width: 900px) { .layout-2col { grid-template-columns: 1fr; } }
.summary { background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--card-radius); padding: 18px; position: sticky; top: 80px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0 0 12px; }
.summary dt { color: var(--ink-2); } .summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summary .total { font-size: 20px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 10px; }
.cart-item { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cart-item__media { width: 76px; aspect-ratio: 4/5; background: var(--surface-2); border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center; }
.cart-item__media img { object-fit: contain; padding: 6px; }
.cart-item__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cart-item__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cart-item__remove { background: none; border: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font: inherit; }
@media (max-width: 440px) {
  .cart-item { grid-template-columns: 60px 1fr; }
  .cart-item__media { width: 60px; }
  .cart-item__price-col { grid-column: 2; }
}

/* ---------- состояния: загрузка/ошибка/пусто ---------- */
.state { text-align: center; padding: clamp(32px, 6vw, 72px) 16px; display: grid; gap: 14px; justify-items: center; }
.state__ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: var(--border-width) solid var(--line); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-card { height: 300px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: var(--border-width) solid var(--line); background: var(--surface); }
.notice__ic { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.notice--warn { border-color: var(--warn); } .notice--warn .notice__ic { background: var(--warn); color: #fff; }
.notice--ok { border-color: var(--ok); } .notice--ok .notice__ic { background: var(--ok); color: #fff; }
.notice--info .notice__ic { background: var(--ink); color: var(--bg); }

/* тост */
.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--panel); color: var(--panel-ink); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }

/* диалог */
.dialog { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; padding: 16px; }
.dialog.is-open { display: grid; }
.dialog__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.dialog__box { position: relative; background: var(--bg); border: var(--border-width) solid var(--line); border-radius: var(--card-radius); padding: 22px; width: min(92vw, 440px); display: grid; gap: 14px; }

/* ---------- футер + авторство Alab ---------- */
.site-foot { background: var(--bg); border-top: var(--border-width) solid var(--line); margin-top: clamp(32px, 5vw, 64px); }
.foot-top { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding-block: 32px; }
.foot-cols { display: flex; gap: clamp(24px, 5vw, 72px); flex-wrap: wrap; }
.foot-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-logo { font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(28px, 6vw, 56px); letter-spacing: var(--head-spacing); }
.foot-bottom { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; padding-block: 18px; border-top: 1px solid var(--line); }
.foot-legal { display: flex; gap: 16px 20px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; }
.alab-credit { margin-left: auto; order: 2; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.alab-credit span { font-size: 12px; color: var(--ink-2); }
.alab-credit img { width: 100px; height: auto; object-fit: contain; }
@media (max-width: 768px) {
  .foot-top { grid-template-columns: 1fr; }
  .foot-bottom { justify-content: center; }
  .foot-legal { order: 1; justify-content: center; width: 100%; }
  .alab-credit { order: 2; margin: 16px auto 0; }
}

/* ---------- утилиты ---------- */
.stack { display: grid; gap: clamp(28px, 4vw, 48px); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.proto-note { background: var(--promo); color: var(--promo-ink); font-size: 13px; padding: 6px 12px; border-radius: var(--control-radius); display: inline-flex; gap: 6px; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--ink-2); padding-block: 14px; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- переключатель оформления (отдельно от навигации покупателя) ---------- */
.theme-switch { position: fixed; right: 16px; bottom: 16px; z-index: 55; }
.theme-fab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: var(--border-width) solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.theme-fab__txt {}
.theme-panel { position: absolute; right: 0; bottom: 56px; width: min(92vw, 320px); background: var(--bg);
  border: var(--border-width) solid var(--line); border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 16px; }
.theme-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.theme-opts { display: grid; gap: 8px; }
.theme-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; cursor: pointer;
  border: var(--border-width) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; }
.theme-opt[aria-checked="true"] { box-shadow: var(--selected-ring); border-color: var(--ink); }
.theme-opt__txt { display: flex; flex-direction: column; } .theme-opt__txt small { font-size: 12px; }
.theme-opt__sw { width: 34px; height: 34px; border-radius: 8px; flex: none; border: 1px solid rgba(0,0,0,.12); }
.theme-sw-vyhodnye { background: linear-gradient(135deg, #E3E8DC 0 50%, #C2452B 50% 100%); }
.theme-sw-galereya { background: linear-gradient(135deg, #FAFAF8 0 50%, #2E3BFF 50% 100%); }
.theme-sw-ulitsa   { background: linear-gradient(135deg, #E8E8E3 0 50%, #D4FF3D 50% 100%); }
@media (max-width: 520px) {
  .theme-switch { right: 12px; bottom: 12px; }
  .theme-fab__txt { display: none; }               /* на телефоне не занимает большую полосу */
  .theme-fab { width: 48px; height: 48px; padding: 0; justify-content: center; }
}

/* ---------- товар ---------- */
.product { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(16px, 3vw, 44px); align-items: start; }
@media (max-width: 760px) { .product { grid-template-columns: 1fr; } }
.gallery { display: grid; gap: 10px; }
.gallery__main { aspect-ratio: 4/5; background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--card-radius); display: grid; place-items: center; overflow: hidden; }
.gallery__main img { object-fit: contain; padding: clamp(16px, 4vw, 48px); }
.gallery__thumbs { display: flex; gap: 8px; }
.thumb { width: 64px; aspect-ratio: 4/5; border: var(--border-width) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; cursor: pointer; }
.thumb img { object-fit: contain; padding: 6px; }
.thumb.is-active { box-shadow: var(--selected-ring); }
.product__info { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.sizes { display: flex; gap: 8px; flex-wrap: wrap; }
.size { min-width: 48px; height: 44px; display: inline-grid; place-items: center; cursor: pointer;
  border: var(--border-width) solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface); font: inherit; }
.size[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

/* ---------- комплект ---------- */
.bundle-groups { display: grid; gap: 16px; }
.bundle-group { border: var(--border-width) solid var(--line); border-radius: var(--card-radius); padding: 14px; background: var(--surface); }
.bundle-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px,100%),1fr)); gap: 10px; margin-top: 10px; }
.bundle-opt { display: flex; align-items: center; gap: 10px; border: var(--border-width) solid var(--line); border-radius: var(--radius-sm); padding: 10px; cursor: pointer; background: var(--bg); }
.bundle-opt.is-selected { box-shadow: var(--selected-ring); border-color: var(--ink); background: var(--selected-bg); }
.bundle-opt img { width: 44px; aspect-ratio: 4/5; object-fit: contain; }

/* ---------- оплата/результат ---------- */
.pay { max-width: 560px; margin: 0 auto; text-align: center; display: grid; gap: 18px; padding-block: clamp(24px,5vw,56px); }
.pay__card { background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--card-radius); padding: 22px; display: grid; gap: 14px; }
.pay__status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; justify-content: center; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot--wait { background: var(--promo); } .status-dot--ok { background: var(--ok); } .status-dot--bad { background: var(--warn); }

/* ---------- кабинет/заказы ---------- */
.order-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px; border: var(--border-width) solid var(--line); border-radius: var(--card-radius); background: var(--surface); }
.order-row + .order-row { margin-top: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.bonus-box { background: var(--promo); color: var(--promo-ink); border-radius: var(--card-radius); padding: 20px; }
.bonus-amount { font-family: var(--font-head); font-size: clamp(32px,6vw,48px); font-weight: var(--head-weight); }

/* ---------- журнал/статика ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px,100%),1fr)); gap: clamp(12px,2vw,20px); }
.post { border: var(--border-width) solid var(--line); border-radius: var(--card-radius); overflow: hidden; background: var(--surface); }
.post__media { aspect-ratio: 16/10; background: var(--surface-2); }
.post__body { padding: 16px; display: grid; gap: 8px; }
.prose { max-width: 70ch; } .prose h2 { margin-top: 1.2em; } .prose ul { padding-left: 1.2em; }

/* ---------- 404 ---------- */
.err-page { text-align: center; padding: clamp(48px,10vw,120px) 16px; display: grid; gap: 18px; justify-items: center; }
.err-code { font-family: var(--font-head); font-size: clamp(64px,16vw,160px); line-height: .9; letter-spacing: var(--head-spacing); }

/* ---------- исправления после визуальной проверки ---------- */
[hidden] { display: none !important; }                     /* состояния не должны «просвечивать» */
.pill { white-space: nowrap; }
.pill--count[data-count="0"]::after { display: none; }
@media (max-width: 600px) {
  .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }   /* 2 колонки товаров на телефоне */
  .card__body { padding: 10px 10px 12px; }
  .card__title { font-size: 14px; }
  .price { font-size: 16px; }
  .card__meta { font-size: 12px; }
  .card__foot .btn { padding: 0 10px; font-size: 13px; }
}
/* переключатель оформления — в демо-полосе, отдельно от навигации покупателя, ничего не перекрывает */
.demo-bar { display: flex; align-items: center; justify-content: center; gap: 8px 14px; flex-wrap: wrap; }
.demo-bar .t-long { display: inline; } .demo-bar .t-short { display: none; }
@media (max-width: 600px) { .demo-bar .t-long { display: none; } .demo-bar .t-short { display: inline; } .demo-bar { padding: 6px 12px; } }
.theme-trigger { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: inherit; border: 1px solid currentColor;
  border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.theme-switch { position: static; }
.theme-panel { position: fixed; top: 48px; right: 16px; bottom: auto; z-index: 70; }
@media (max-width: 600px) { .theme-panel { left: 12px; right: 12px; width: auto; top: 40px; } }
@media (max-width: 560px) {
  .order-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .order-row > :first-child { grid-column: 1 / -1; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
}
/* v2: миниатюры в переключателе дизайна; блокировка во время отправки заказа */
.theme-opt__thumb { width: 96px; height: 60px; object-fit: cover; object-position: top left; border-radius: 6px; flex: none; border: 1px solid rgba(0,0,0,.15); background: #fff; }
html[data-busy] .theme-opt { opacity: .55; cursor: not-allowed; }
@media (max-width: 380px) { .theme-opt__thumb { width: 72px; height: 45px; } }
.notice--bad { border-color: var(--warn); } .notice--bad .notice__ic { background: var(--warn); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; min-height: 24px; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.stepper__note { display: block; font-size: 12px; color: var(--ink-2); margin-top: 4px; max-width: 32ch; }
/* v2-fix: длинное название магазина — многоточие на тексте (flex-контейнер его не даёт); кнопка корзины не переносится */
.brand [data-brand] { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cart-btn { display: inline-flex; align-items: center; white-space: nowrap; flex: none; }
:root[data-theme="ulitsa"] .brand::after { content: "DEMO"; font: 600 10px/1 'JetBrains Mono', monospace; letter-spacing: .06em; background: #0D0D0D; color: #D4FF3D; padding: 3px 5px; flex: none; }
@media (max-width: 420px) { :root[data-theme="ulitsa"] .brand::after { display: none; } }
.foot-logo { overflow-wrap: anywhere; }
/* v2-fix: узкие телефоны (≤400px) — кабинет уходит в меню (там он есть), шапке остаётся место под название */
@media (max-width: 400px) {
  .head-tools { gap: 4px; }
  .head-tools .head-acc { display: none; }
  .brand { font-size: 18px; max-width: none; flex: 1 1 auto; min-width: 0; }
  .cart-btn { padding: 0 12px; }
}
/* v2-fix: контраст ошибок — текст и рамка темнее, знак «!» читаемый на фоне предупреждения */
.field--error .input, .field--error .select, .field--error .textarea, .input[aria-invalid="true"] { border-color: var(--warn-ink); }
.field__err { color: var(--warn-ink); }
.field__err::before, .notice--warn .notice__ic, .notice--bad .notice__ic { color: var(--warn-on); }
@media (max-width: 420px) { .tabs .tab { padding-inline: 12px; font-size: 15px; } }
@media (max-width: 380px) { .tabs .tab { padding-inline: 8px; } }
