/* Компоненты Mini App, мир «Атлас». Только var(--…) из tokens.css. */

/* --- Шапка-атлас (главная) -------------------------------------------------
   Фуксия во всю ширину, внизу — икат: ромбы-«облака» и ступенчатая бахрома.
   Обе детали — маски webapp/assets/ikat/*.svg, цвет приходит из токенов. */

.shell {
  position: relative;
  margin: calc(var(--space-4) * -1) calc(var(--screen-padding) * -1) 0;
  padding: var(--shell-pad-top) var(--screen-padding) var(--shell-pad-bottom);
  background: var(--shell);
  color: var(--on-shell);
}

.shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ikat-motif-h);
  background: var(--ikat-motif);
  -webkit-mask: url("../assets/ikat/motif.svg") repeat-x left bottom / var(--ikat-motif-w) var(--ikat-motif-h);
  mask: url("../assets/ikat/motif.svg") repeat-x left bottom / var(--ikat-motif-w) var(--ikat-motif-h);
  opacity: 0.9;
  pointer-events: none;
}

.shell::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--ikat-edge-h);
  background: var(--shell);
  -webkit-mask: url("../assets/ikat/edge.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  mask: url("../assets/ikat/edge.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  pointer-events: none;
}

/* Нити основы, свисающие из-под бахромы (тот же цвет, что «нить» иката) */
.shell-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--ikat-edge-h);
  background: var(--ikat-thread);
  -webkit-mask: url("../assets/ikat/threads.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  mask: url("../assets/ikat/threads.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  opacity: 0.55;
  pointer-events: none;
}

/* Компактная шапка остальных экранов: заголовок на поле фуксии с той же бахромой */
.screen > .screen-title:first-child,
.screen > .screen-head:first-child {
  position: relative;
  min-height: var(--header-height);
  margin: calc(var(--space-4) * -1) calc(var(--screen-padding) * -1) calc(var(--ikat-edge-h) + var(--space-3));
  padding: var(--shell-pad-top) var(--screen-padding) var(--space-3);
  background: var(--shell);
  color: var(--on-shell);
}

.screen > .screen-title:first-child::after,
.screen > .screen-head:first-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--ikat-edge-h);
  background: var(--shell);
  -webkit-mask: url("../assets/ikat/edge.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  mask: url("../assets/ikat/edge.svg") repeat-x left top / var(--ikat-edge-w) var(--ikat-edge-h);
  pointer-events: none;
}

.screen-head .screen-title {
  margin: 0;
  color: inherit;
}

.screen-head .link-btn {
  color: var(--on-shell);
}

.shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap-min);
}

.shell .logo {
  color: var(--on-shell);
}

.shell-tagline {
  display: block;
  font-size: var(--text-small);
  line-height: var(--lh-small);
  letter-spacing: var(--letter-badge);
  text-transform: uppercase;
  color: var(--on-shell-muted);
}

.shell-cart {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--radius-control);
  color: var(--on-shell);
}

.shell-cart .nav-count {
  top: 0;
  left: auto;
  right: 0;
  transform: none;
  background: var(--saffron);
  color: var(--badge-hit-text);
}

.shell .search {
  margin-top: var(--space-3);
  background: var(--shell-field);
  color: var(--shell-field-text);
}

.shell + .chips {
  margin-top: calc(var(--ikat-edge-h) + var(--space-2));
}

.logo {
  font-family: var(--font-logo);
  font-size: var(--text-logo);
  line-height: var(--lh-screen-title);
  font-weight: var(--weight-logo);
  letter-spacing: var(--letter-logo);
  color: var(--text);
}

.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap-min);
  margin-bottom: var(--space-4);
}

/* --- Поиск ---------------------------------------------------------------- */

.search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  background: var(--surface-alt);
  border-radius: var(--radius-control);
  color: var(--text-muted);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  min-height: var(--tap-min);
  font-size: var(--input-text);
  outline: none;
}

.search input::placeholder {
  color: inherit;
}

.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
}

/* --- Нажатие: всё, что нажимается, отвечает сразу ------------------------- */

.btn,
.chip,
.card,
.category,
.icon-btn,
.shell-cart,
.qty button,
.nav a,
.list-row--button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--duration-press) var(--ease-out), background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.btn:active:not(:disabled),
.chip:active:not(:disabled),
.icon-btn:active,
.shell-cart:active,
.qty button:active:not(:disabled),
.list-row--button:active {
  transform: scale(var(--press-scale));
}

.card:active .photo {
  transform: scale(var(--press-scale));
}

/* --- Карточка товара ------------------------------------------------------ */

.card {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.photo {
  position: relative;
  aspect-ratio: var(--photo-ratio);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface-alt);
  transition: transform var(--duration-press) var(--ease-out);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.photo--muted img {
  opacity: 0.55;
}

.card-fav {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  color: var(--text);
}

/* Круглая подложка: сердечко читается на любом фото и в обеих темах */
.photo .card-fav::before {
  content: "";
  position: absolute;
  inset: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  opacity: 0.9;
}

.card-fav .icon {
  position: relative;
}

.card-fav[aria-pressed="true"] {
  color: var(--primary);
}

.card-fav[aria-pressed="true"] .icon {
  fill: currentColor;
}

.badges {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  max-width: 70%;
}

.badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-badge);
  font-size: var(--text-small);
  line-height: var(--lh-small);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--letter-badge);
  text-transform: uppercase;
  color: var(--badge-text);
}

.badge--new {
  background: var(--badge-new);
  color: var(--badge-new-text);
}

.badge--hit {
  background: var(--badge-hit);
  color: var(--badge-hit-text);
}

.badge--sale {
  background: var(--badge-sale);
  color: var(--badge-sale-text);
}

.out-label {
  position: absolute;
  left: var(--space-2);
  bottom: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-badge);
  background: var(--surface);
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.card-body {
  padding-top: var(--space-2);
}

.card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--text-product-name);
  line-height: var(--lh-product-name);
  min-height: calc(var(--lh-product-name) * 2);
}

.card-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--space-2);
  margin-top: var(--space-1);
}

.card-price .price-old {
  margin-left: 0; /* при переносе старая цена встаёт ровно под новую */
}

.card-price .price,
.card-price .price-old {
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--lh-small);
}

.card-sizes {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta-end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

.card-meta .price-old {
  margin-left: 0;
}

.card--sale .price {
  color: var(--price-sale);
}

.dots {
  display: flex;
  gap: var(--space-1);
}

.dot {
  width: var(--color-dot);
  height: var(--color-dot);
  border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--border);
  background: var(--surface-alt);
}

/* Главный кадр раздела «Новинки» — во всю ширину */
.card--hero .photo {
  min-height: var(--hero-min-height);
}

.card--hero .card-name {
  min-height: 0;
  font-family: var(--font-display);
  font-size: var(--text-block-title);
  line-height: var(--lh-block-title);
  font-weight: var(--weight-display);
  letter-spacing: var(--letter-display);
}

/* Наведение — только там, где есть мышь: на телефоне «зависшее» состояние после касания */
@media (hover: hover) and (pointer: fine) {
  .card:hover .photo img {
    transform: scale(var(--hover-zoom));
  }

  .btn:hover:not(:disabled):not(.btn--secondary):not(.btn--ghost) {
    background: var(--primary-press);
  }

  .btn--ghost:hover:not(:disabled) {
    color: var(--primary-press);
  }

  .btn--secondary:hover:not(:disabled) {
    background: var(--surface-alt);
  }

  .chip:hover:not(:disabled):not([aria-pressed="true"]) {
    border-color: var(--text-muted);
  }

  .nav a:hover {
    color: var(--text);
  }
}

/* --- Горизонтальная лента ------------------------------------------------ */

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - var(--space-3)) / 2.3);
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--screen-padding);
  margin: 0 calc(var(--screen-padding) * -1);
  padding: 0 var(--screen-padding);
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail > * {
  scroll-snap-align: start;
}

.category {
  display: block;
  width: var(--category-tile-width);
  color: inherit;
  text-decoration: none;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.category .photo {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: var(--text-block-title);
  font-weight: var(--weight-display);
  color: var(--primary);
  background: var(--primary-soft);
}

.category span {
  display: block;
  padding-top: var(--space-2);
  font-size: var(--text-product-name);
  line-height: var(--lh-product-name);
}

/* --- Чипы: выбранный — ночная синева с икат-подчёркиванием ----------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chips--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: 0 calc(var(--screen-padding) * -1);
  padding: 0 var(--screen-padding);
}

.chips--scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  justify-content: center;
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.chip[aria-pressed="true"],
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Подпись мира: ступенчатая икат-полоса под выбранным */
.chip[aria-pressed="true"]::after,
.chip.active::after {
  content: "";
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  bottom: var(--space-1);
  height: var(--ikat-under-h);
  background: var(--ikat-motif);
  -webkit-mask: url("../assets/ikat/underline.svg") repeat-x left center / var(--ikat-under-w) var(--ikat-under-h);
  mask: url("../assets/ikat/underline.svg") repeat-x left center / var(--ikat-under-w) var(--ikat-under-h);
}

.chip:disabled {
  color: var(--text-muted);
  text-decoration: line-through;
  cursor: default;
  opacity: 0.55;
}

.chip .dot {
  width: var(--color-dot);
  height: var(--color-dot);
}

/* --- Кнопки и поля -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost {
  width: auto;
  background: transparent;
  color: var(--primary);
  padding: 0 var(--space-2);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  text-decoration: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  min-height: var(--tap-min);
  font-size: var(--text-product-name);
  font-weight: var(--weight-semibold);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-size: var(--text-small);
  line-height: var(--lh-small);
  color: var(--text-muted);
}

.input {
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-size: var(--input-text);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input--invalid {
  border-color: var(--error);
}

textarea.input {
  resize: vertical;
  min-height: calc(var(--tap-min) * 2);
}

.field-error {
  color: var(--error);
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.check {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  min-height: var(--tap-min);
  cursor: pointer;
}

.check input {
  flex: none;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  margin: var(--space-1) 0 0;
  accent-color: var(--primary);
}

/* --- Панели и списки ------------------------------------------------------ */

.panel {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: var(--border-width) solid var(--border);
  padding: var(--space-4);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap-min);
  padding: var(--space-2) 0;
  border-bottom: var(--border-width) solid var(--border);
  color: inherit;
  text-decoration: none;
}

.list-row:last-child {
  border-bottom: 0;
}

/* Деньги всегда сходятся на виду: цифры одной ширины, итог — крупно */
.sum-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-1) 0;
  font-variant-numeric: tabular-nums;
}

.sum-row--total {
  border-top: var(--border-width) solid var(--border);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-price);
  line-height: var(--lh-price);
}

.note {
  padding: var(--space-3);
  border-radius: var(--radius-control);
  background: var(--primary-soft);
  font-size: var(--text-product-name);
  line-height: var(--lh-product-name);
}

.note--error {
  background: var(--surface-alt);
  color: var(--error);
}

.status {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-badge);
  background: var(--surface-alt);
  font-size: var(--text-small);
  line-height: var(--lh-small);
  font-weight: var(--weight-medium);
}

/* --- Корзина -------------------------------------------------------------- */

.cart-item:last-of-type {
  border-bottom: 0;
}

.cart-item {
  display: grid;
  grid-template-columns: var(--thumb-size) minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-width) solid var(--border);
}

.thumb {
  width: var(--thumb-size);
  aspect-ratio: var(--thumb-ratio);
  border-radius: var(--radius-control);
  object-fit: cover;
  background: var(--surface-alt);
}

.qty {
  display: inline-grid;
  grid-template-columns: var(--tap-min) 1fr var(--tap-min);
  align-items: center;
  width: var(--qty-width);
  border-radius: var(--radius-control);
  border: var(--border-width) solid var(--border);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
}

.qty button {
  height: var(--tap-min);
  border: 0;
  background: transparent;
  color: var(--text);
}

.qty button:disabled {
  color: var(--text-muted);
  opacity: 0.5;
}

/* --- Страница товара ------------------------------------------------------ */

.gallery {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  margin: calc(var(--space-4) * -1) calc(var(--screen-padding) * -1) 0;
  scrollbar-width: none;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery img {
  flex: none;
  width: 100%;
  aspect-ratio: var(--photo-ratio);
  object-fit: cover;
  scroll-snap-align: start;
  background: var(--surface-alt);
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.gallery-dots span {
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--border);
  transition: width var(--duration-base) var(--ease-out), background-color var(--duration-base) var(--ease-out);
}

.gallery-dots span.active {
  width: var(--space-5);
  background: var(--primary);
}

.product-title {
  font-family: var(--font-display);
  font-size: var(--text-block-title);
  line-height: var(--lh-block-title);
  font-weight: var(--weight-display);
  letter-spacing: var(--letter-display);
  margin-top: var(--space-4);
}

/* Цена на странице товара — самый крупный текст экрана */
.product-title + .price,
.product-price .price {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--text-price-hero);
  line-height: var(--lh-price-hero);
}

.option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-5) 0 var(--space-2);
  font-weight: var(--weight-semibold);
}

.facts {
  display: grid;
  margin-top: var(--space-5);
}

/* Подпись ближе к своему значению, чем к предыдущему абзацу */
.facts dt {
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.facts dt:first-child {
  margin-top: 0;
}

.facts dd {
  margin: var(--space-1) 0 0;
}

.size-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-product-name);
}

.size-table th,
.size-table td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: var(--border-width) solid var(--border);
}

.size-table th {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.table-scroll {
  overflow-x: auto;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--screen-padding) calc(var(--space-3) + var(--safe-bottom));
  background: var(--bg);
  border-top: var(--border-width) solid var(--border);
}

.action-bar .btn {
  flex: 1;
}

/* --- Нижняя навигация ----------------------------------------------------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: var(--border-width) solid var(--border);
}

.nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.nav a.active {
  color: var(--primary);
  font-weight: var(--weight-semibold);
}

.nav a.active .icon {
  stroke-width: 2;
}

.nav-count {
  position: absolute;
  top: var(--space-1);
  left: 50%;
  min-width: var(--badge-dot);
  height: var(--badge-dot);
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  line-height: var(--badge-dot);
  text-align: center;
  font-variant-numeric: tabular-nums;
  transform: translateX(var(--space-1));
}

.nav-count.bump {
  animation: bump var(--duration-slow) var(--ease-out);
}

@keyframes bump {
  50% {
    transform: translateX(var(--space-1)) scale(1.25);
  }
}

/* --- Шторка ----------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: var(--overlay);
  animation: fade-in var(--duration-base) var(--ease-out);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sheet);
  max-height: var(--sheet-max-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-3) var(--screen-padding) calc(var(--space-5) + var(--safe-bottom));
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  animation: sheet-in var(--duration-slow) var(--ease-drawer);
}

.sheet-handle {
  width: var(--sheet-handle-width);
  height: var(--sheet-handle-height);
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--border);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* --- Уведомления ------------------------------------------------------------ */

.toast {
  position: fixed;
  left: var(--screen-padding);
  right: var(--screen-padding);
  bottom: calc(var(--nav-height) + var(--space-3) + var(--safe-bottom));
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-soft);
  animation: toast-in var(--duration-slow) var(--ease-out);
}

.toast--error {
  background: var(--error);
  color: var(--on-primary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(var(--space-3));
  }
}

/* --- Скелетоны, пустые состояния, ошибки ---------------------------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface-alt);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  animation: shine var(--duration-shimmer) infinite;
}

@keyframes shine {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
}

.skeleton--photo {
  aspect-ratio: var(--photo-ratio);
  border-radius: var(--radius-card);
}

.skeleton--line {
  height: var(--skeleton-line);
  margin-top: var(--space-2);
}

.skeleton--short {
  width: 50%;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
}

.empty .icon {
  width: var(--empty-icon-size);
  height: var(--empty-icon-size);
  color: var(--primary);
  stroke-width: 1.3;
}

.empty .btn {
  width: auto;
  margin-top: var(--space-2);
}

.list-row--button {
  width: 100%;
  border: 0;
  border-bottom: var(--border-width) solid var(--border);
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  text-align: left;
  color: inherit;
}

/* Цена со скидкой — фуксией: скидку видно до того, как прочитана старая цена */
.card-price:has(.price-old) .price,
.price:has(+ .price-old) {
  color: var(--price-sale);
}

/* --- Слайдер баннеров (главная): обычная прокрутка с примагничиванием, без автопрокрутки --- */

.banners {
  margin-top: var(--space-3);
}

.shell + .banners {
  margin-top: calc(var(--ikat-edge-h) + var(--space-2));
}

.banners + .chips {
  margin-top: var(--space-3);
}

.banner-track {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.banner-track::-webkit-scrollbar {
  display: none;
}

.banner {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: var(--banner-ratio);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface-alt);
  scroll-snap-align: start;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--duration-press) var(--ease-out);
}

.banner:active {
  transform: scale(var(--press-scale));
}

.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-title {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  max-width: calc(100% - var(--space-5));
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-badge);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-product-name);
  line-height: var(--lh-product-name);
}
