/* ANIUMDISH · редакция «Витрина» · страницы товара (/tovar/<id>/), категории (/kategoriya/<slug>/)
   и доверия (/dostavka-i-oplata/, /kontakty/ - с 30.09.2026, pages/doverie.md).
   Раскладка - design-system/aniumdish-site/pages/tovar.md и kategoriya.md; токены - в styles.css. */

/* ---------- хлебные крошки ---------- */
.kroshki ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; padding: 0; font-size: 14px; line-height: 1.45; color: var(--fg-muted); }
.kroshki li { display: flex; align-items: center; min-width: 0; }
.kroshki li + li::before { content: "›"; margin: 0 8px; color: var(--fg-muted); }
.kroshki a { display: inline-flex; align-items: center; min-height: 48px; color: var(--link); text-decoration: none; }
.kroshki a:hover { text-decoration: underline; }
.kroshki [aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kroshki li:last-child { flex: 1 1 0; }

/* ---------- товар: раскладка ---------- */
.tovar-page { padding-bottom: var(--s2); }
.tovar { display: grid; gap: var(--s4); grid-template-areas: "gal" "buy" "more"; }
.tovar-gal { grid-area: gal; min-width: 0; }
.tovar-buy { grid-area: buy; min-width: 0; }
.tovar-more { grid-area: more; min-width: 0; }
@media (min-width: 768px) and (max-width: 1023px) {
  .tovar { max-width: 640px; margin-inline: auto; }
}
@media (min-width: 1024px) {
  .tovar { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); grid-template-areas: "gal buy" "more buy"; column-gap: var(--s6); row-gap: var(--s5); align-items: start; }
}
@media (min-width: 1024px) and (min-height: 760px) {
  .tovar-buy { position: sticky; top: calc(var(--hdr) + var(--s4)); }
}

/* ---------- галерея ---------- */
.gal { position: relative; }
.gal-track {
  display: flex; overflow-x: auto; overflow-y: hidden; aspect-ratio: 3 / 4; border-radius: var(--r-card); background: var(--surface);
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.gal-track::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .gal-track { aspect-ratio: 1 / 1; } }
@media (prefers-reduced-motion: no-preference) { .gal-track { scroll-behavior: smooth; } }
/* телефон боком: фото не выше экрана, иначе цена и кнопка уезжают на третий экран */
@media (orientation: landscape) and (max-height: 540px) { .gal-track { aspect-ratio: auto; height: calc(100vh - 150px); } }
.gal-slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; scroll-snap-stop: always; }
.gal-slide picture, .gal-slide img { width: 100%; height: 100%; }
.gal-slide img { object-fit: contain; }
.gal-btn {
  position: absolute; top: 50%; z-index: 1; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  margin-top: -24px; padding: 0; border: 0; border-radius: 50%; background: var(--bg); color: var(--fg); box-shadow: var(--shadow-2);
  cursor: pointer; transition: background-color .2s ease;
}
.gal-btn:hover, .gal-btn:active { background: var(--surface-2); }
.gal-btn svg { width: 22px; height: 22px; }
.gal-prev { left: 12px; }
.gal-next { right: 12px; }
.gal-in { position: relative; }
.gal-dots { display: flex; justify-content: center; gap: 8px; min-height: 8px; margin-top: 12px; }
.gal-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background-color .2s ease; }
.gal-dots i.on { background: var(--fg); }
.gal-count {
  position: absolute; right: 12px; bottom: 12px; padding: 4px 12px; border-radius: var(--r-chip);
  background: var(--bg); color: var(--fg); font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-1);
}
.gal-thumbs { display: none; }
@media (min-width: 768px) {
  .gal-thumbs { display: flex; gap: 8px; margin-top: 12px; padding: 4px 2px; overflow-x: auto; scrollbar-width: thin; }
  .gal-dots { display: none; }
}
.gal-thumb {
  flex: none; width: 64px; height: 64px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: var(--r-input);
  background: var(--surface); cursor: pointer; transition: border-color .2s ease;
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb[aria-current="true"] { border-color: var(--fg); }
.gal-pusto { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; border-radius: var(--r-card); background: var(--surface); color: var(--fg-muted); }

/* ---------- блок покупки ---------- */
.tovar-buy h1 { font-size: 26px; }
@media (min-width: 1024px) { .tovar-buy h1 { font-size: 34px; } }
.vvod { margin-top: 12px; max-width: 68ch; color: var(--fg-muted); }
.cena { margin-top: 16px; font-size: 28px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
@media (min-width: 1024px) { .cena { font-size: 32px; } }
.cena-net { color: var(--danger); font-size: 22px; }
.nalichie { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 500; font-size: 15px; color: var(--ok); }
.nalichie svg { width: 18px; height: 18px; flex: none; }
.nalichie.net { color: var(--danger); }
.opcii { margin: var(--s4) 0 0; padding: 0; border: 0; min-width: 0; }
.opcii legend { padding: 0; margin-bottom: 10px; font-weight: 600; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: 8px 4px;
  border: 2px solid transparent; border-radius: var(--r-input); background: var(--surface); color: var(--fg);
  text-align: center; cursor: pointer; transition: background-color .2s ease, border-color .2s ease;
}
.opt:hover, .opt:active { background: var(--surface-2); }
.opt-l { font-weight: 600; font-size: 16px; line-height: 1.2; }
.opt-p { font-size: 14px; line-height: 1.3; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.opt[aria-pressed="true"] { background: var(--fg); color: var(--on-dark); }
.opt[aria-pressed="true"] .opt-p { color: var(--on-dark-muted); }
.opt[aria-disabled="true"] { background: var(--bg); border-color: var(--line); border-style: dashed; cursor: not-allowed; }
.opt[aria-disabled="true"] .opt-l { color: var(--fg-muted); text-decoration: line-through; }
.opt[aria-disabled="true"] .opt-p { color: var(--danger); }
.razmery-net { margin-top: var(--s3); color: var(--fg-muted); }
.razmery-net b { color: var(--fg); font-weight: 600; }
.zakaz { display: grid; gap: 8px; margin-top: var(--s4); }
.zakaz-note { color: var(--fg-muted); font-size: 14px; line-height: 1.45; text-align: center; }
.tovar-buy .trust { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.akciya { margin-top: var(--s3); padding: 12px 16px; border-radius: var(--r-input); background: var(--surface); font-size: 14px; line-height: 1.45; }
.akciya b { font-weight: 600; }

/* ---------- описание, вопросы ---------- */
.tovar-more > section + section { margin-top: var(--s5); }
.tovar-more h2 { margin-bottom: var(--s3); }
.opis-p { max-width: 68ch; margin-bottom: 16px; }
.opis { display: grid; gap: 16px; max-width: 68ch; }
.opis div { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.opis div:last-child { border-bottom: 0; padding-bottom: 0; }
.opis dt { margin-bottom: 4px; font-weight: 600; }
.opis dd { margin: 0; color: var(--fg); }

/* ---------- липкая панель заказа (телефон) ---------- */
.obar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg); box-shadow: var(--shadow-up);
  transform: translateY(110%); visibility: hidden; transition: transform .2s ease-out, visibility .2s;
}
.obar.on { transform: none; visibility: visible; }
.obar-i { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.obar-cena { display: block; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.obar-l { display: block; overflow: hidden; color: var(--fg-muted); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.obar .btn { flex: none; padding: 0 20px; }
@media (max-width: 1023px) {
  body.s-panelyu { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* фокус с клавиатуры не прячется под липкой панелью */
  html:has(body.s-panelyu) { scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1024px) { .obar { display: none; } }

/* ---------- категория ---------- */
.kat-page { padding-bottom: var(--s2); }
.kat-head { margin-top: var(--s2); }
.kat-lead { margin-top: 12px; max-width: 68ch; color: var(--fg-muted); }
.kat-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: var(--s4) 0; }
.kat-count { color: var(--fg-muted); font-size: 14px; }
.drugie h2 { margin-bottom: var(--s3); }

/* ---------- ссылка на условия доставки (товар, контакты) ---------- */
.dov-ssylka { margin-top: var(--s3); }
.dov-ssylka a { display: inline-flex; align-items: center; min-height: 48px; }

/* ---------- страницы доверия: «Доставка и оплата», «Контакты» (pages/doverie.md) ---------- */
.dov-page { padding-bottom: var(--s2); }
.dov-head { margin-top: var(--s2); }
.dov-lead { margin-top: 12px; max-width: 60ch; color: var(--fg-muted); font-size: 18px; line-height: 1.5; }
@media (min-width: 1024px) { .dov-lead { font-size: 20px; } }
.dov-grid { display: grid; gap: var(--gap); margin-top: var(--s5); list-style: none; padding: 0; }
/* три карточки в ряд - с 900 px, как полоса доверия на главной: на 768 крупная цена «350-400 сом» ломалась бы */
@media (min-width: 900px) { .dov-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dov-card { padding: var(--s4); border-radius: var(--r-card); background: var(--surface); }
.dov-card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; line-height: 1.3; font-weight: 600; letter-spacing: 0; }
@media (min-width: 1024px) { .dov-card h2 { font-size: 20px; } }
.dov-card h2 svg { flex: none; width: 24px; height: 24px; }
.dov-cena { margin-top: 12px; white-space: nowrap; font-size: 28px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dov-card ul { display: grid; gap: 6px; margin-top: 12px; padding-left: 20px; list-style: disc; color: var(--fg-muted); }
.dov-trust { max-width: 68ch; }
.kontakty { display: grid; gap: 12px; max-width: 560px; margin-top: var(--s5); list-style: none; padding: 0; }
.kontakty a {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 20px; border-radius: var(--r-card);
  background: var(--surface); color: var(--fg); text-decoration: none; transition: background-color .2s ease;
}
.kontakty a:hover, .kontakty a:active { background: var(--surface-2); }
.kontakty svg { flex: none; width: 28px; height: 28px; }
.kontakty b { display: block; font-weight: 600; }
.kontakty span span { display: block; color: var(--fg-muted); font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; }
