/* Плашка при прокрутке: стрелка наверх, поиск по ленте, корзина. */
.spill {
  --spill-bg: #e11d48;
  --spill-bg-dark: #be123c;
  --spill-r: 14px;
  position: fixed;
  /* шапка сайта в этот момент свёрнута, поэтому плашка стоит у самого верха */
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translate(-50%, -24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2);
  z-index: 15; /* выше шапки (5), ниже окон корзины/просмотра (20+) */
  display: flex;
  align-items: center;
  gap: 2px;
  height: 48px;
  padding: 0 8px;
  max-width: calc(100vw - 24px);
  border-radius: var(--spill-r);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}
.spill::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: var(--spill-r);
  background: var(--spill-bg);
  box-shadow: 0 10px 24px rgba(225, 29, 72, .28);
}
.spill.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }

/* Шапка сайта плавно сворачивается вверх при прокрутке и возвращается наверху страницы */
header {
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
  will-change: transform;
}
body.head-collapsed header {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.spill button {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  color: inherit;
  border-radius: 10px;
  transition: background .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.spill button:hover { background: rgba(255, 255, 255, .18); }
.spill button:active { transform: scale(.94); }
.spill button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.spill svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- стрелка наверх --- */
.spill-up { width: 40px; height: 36px; justify-content: center; flex: none; }
.spill-arrow {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: #fff; color: var(--spill-bg);
}
.spill-arrow svg { width: 15px; height: 15px; stroke-width: 3; }

.spill-sep {
  width: 1px; height: 22px; margin: 0 4px;
  background: rgba(255, 255, 255, .35);
  transition: opacity .2s, margin .3s;
}

/* --- поиск --- */
.spill-search { display: flex; align-items: center; height: 36px; margin: 0; padding: 0; }
.spill-search-btn { width: 36px; height: 36px; justify-content: center; flex: none; }
.spill-search-btn svg { display: block; width: 24px; height: 24px; stroke-width: 2.2; }
.spill-search input {
  width: 2px; /* не 0: в поле нулевой ширины Chrome вставляет буквы в обратном порядке */
  margin-left: -2px;
  opacity: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: none;
  background: rgba(255, 255, 255, .22);
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 16px; /* 16px — чтобы iPhone не увеличивал страницу при фокусе */
  font-weight: 400;
  -webkit-appearance: none;
  appearance: none;
  transition: width .3s ease, padding .3s ease, margin .3s ease, opacity .2s;
}
.spill-search input::placeholder { color: rgba(255, 255, 255, .8); }
.spill-search input::-webkit-search-cancel-button { display: none; }
.spill-search.is-open input { width: min(130px, 34vw); padding: 0 9px; margin: 0 2px 0 0; opacity: 1; }

/* --- корзина --- */
.spill-cart { gap: 7px; height: 36px; padding: 0 8px 0 10px; }
.spill-badge {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: #fff; color: var(--spill-bg);
  font-size: 13px; font-weight: 700; line-height: 1;
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.6);
}
.spill-badge[hidden] { display: none; }
.spill-badge.bump { transform: scale(1.35); }

@media (prefers-reduced-motion: reduce) {
  .spill, .spill *, header { transition: none !important; }
}
