/* Облик модуля «Корзина» на сайте: плавающая кнопка, выезжающая панель, оформление.
   Цвета — переменные темы сайта: --s-accent, --s-bg, --s-ink, --s-r. */

/* Плавающая кнопка корзины — видна, когда в корзине что-то есть */
.s-cartbar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--s-ink);
  color: var(--s-bg);
  font-family: var(--font);
  font-size: 14px;
  box-shadow: 0 14px 30px -14px rgba(20, 20, 19, 0.55);
  animation: s-rise 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.s-cartbar[hidden] {
  display: none;
}
.s-cartbar b {
  padding-left: 10px;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.25);
}
@keyframes s-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- Корзина: выезжает справа, на телефоне — во весь экран ---------- */
.s-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  color: var(--s-ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
.s-layer[hidden] {
  display: none;
}
.s-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.42);
  opacity: 0;
  transition: opacity 0.22s ease-out;
}
.s-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: var(--s-bg);
  box-shadow: -24px 0 48px -32px rgba(20, 20, 19, 0.5);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.s-layer.is-open .s-scrim {
  opacity: 1;
}
.s-layer.is-open .s-drawer {
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .s-scrim,
  .s-drawer,
  .s-cartbar {
    transition: none;
    animation: none;
  }
}
.s-drawer__head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 64px;
  padding: 12px 14px 12px 20px;
  box-shadow: inset 0 -1px 0 rgba(29, 31, 26, 0.12);
}
.s-drawer__head h2 {
  flex: 1;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.03em;
  outline: 0;
}
.s-drawer__head .s-x:first-child {
  margin-left: -8px;
}
.s-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: background-color 0.14s ease-out;
}
.s-x:hover {
  background: rgba(29, 31, 26, 0.08);
}
.s-drawer__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 20px 20px;
}
.s-drawer__foot {
  display: grid;
  gap: 10px;
  padding: 14px 20px 20px;
  box-shadow: inset 0 1px 0 rgba(29, 31, 26, 0.12);
}
.s-drawer__foot .s-btn {
  justify-content: center;
  width: 100%;
  margin-top: 0;
}
.s-drawer__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.s-drawer__empty > .i {
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  opacity: 0.5;
}
.s-drawer__empty strong {
  font-size: 18px;
}
.s-drawer__empty p {
  max-width: 26em;
  opacity: 0.7;
}
.s-drawer__empty .s-btn {
  margin-top: 16px;
}
.s-done > .i {
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 50%;
  background: var(--s-accent);
  opacity: 1;
  stroke-width: 2.2;
}
.s-done__sum {
  margin-top: 4px;
}

.s-lines {
  display: grid;
}
.s-line {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  box-shadow: inset 0 -1px 0 rgba(29, 31, 26, 0.1);
}
.s-line__img {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: calc(var(--s-r) * 0.6);
  background: var(--s-accent);
  overflow: hidden;
}
.s-line__img img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.s-line__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.s-line__text strong {
  font-size: 15px;
  font-weight: 620;
  line-height: 1.3;
}
.s-line__text span {
  font-size: 13px;
  opacity: 0.7;
}
.s-qty {
  display: flex;
  align-items: center;
  height: 34px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(29, 31, 26, 0.18);
}
.s-qty button {
  width: 32px;
  height: 34px;
  border-radius: 999px;
  font-size: 17px;
  line-height: 1;
}
.s-qty button:hover:not(:disabled) {
  background: rgba(29, 31, 26, 0.08);
}
.s-qty button:disabled {
  opacity: 0.3;
}
.s-qty output {
  min-width: 18px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.s-line__del {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  opacity: 0.55;
  transition: opacity 0.14s ease-out, background-color 0.14s ease-out;
}
.s-line__del:hover {
  opacity: 1;
  background: rgba(29, 31, 26, 0.08);
}
.s-line__del .i {
  width: 16px;
  height: 16px;
}
.s-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.s-total b {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.s-checkout {
  display: grid;
  align-content: start;
  gap: 18px;
  padding-top: 16px;
}
.s-set {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
}
.s-set legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.6;
}
.s-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: calc(var(--s-r) * 0.6);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: box-shadow 0.14s ease-out;
}
.s-opt:has(input:checked) {
  box-shadow: inset 0 0 0 1.5px var(--s-ink);
}
.s-opt input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--s-ink);
}
.s-opt span {
  display: grid;
  gap: 1px;
}
.s-opt small {
  font-size: 13px;
  opacity: 0.7;
}
.s-muted {
  font-size: 14px;
  opacity: 0.65;
}
.s-sum {
  display: grid;
  gap: 4px;
  font-size: 14px;
}
.s-sum > div:not(.s-total) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  opacity: 0.75;
}
.s-sum .s-total {
  margin-top: 4px;
}

@media (max-width: 520px) {
  .s-drawer__body,
  .s-drawer__foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .s-line {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 6px 10px;
  }
  .s-line__img {
    grid-row: span 2;
    width: 52px;
    height: 52px;
  }
  .s-qty {
    grid-column: 2;
    justify-self: start;
  }
  .s-line__del {
    grid-column: 3;
    grid-row: 1;
  }
  .s-cartbar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    justify-content: center;
  }
}
