/* JB Side Cart — по прототипу «Корзина»: панель справа, затемнение, на телефоне на весь экран. */
.jbsc-drawer,
.jbsc-overlay,
.jbsc-hdr-cart {
  --jbsc-bg: #f9e5e9;
  --jbsc-pink: #f5cdcb;
  --jbsc-burgundy: #681f2a;
  --jbsc-text: #111111;
  --jbsc-ink: #181818;
  --jbsc-sans: "Montserrat", Arial, sans-serif;
}

.jbsc-drawer *,
.jbsc-drawer *::before,
.jbsc-drawer *::after {
  box-sizing: border-box;
}

.jbsc-drawer button {
  margin: 0;
  font-family: inherit;
  text-transform: none;
  box-shadow: none;
  min-height: 0;
  cursor: pointer;
}

/* ===== header icon: empty / has items + heart / hover ===== */
.jbsc-hdr-cart {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 50px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* All states share one bottom line: the cart is drawn 0.625 above each SVG's bottom edge,
   the "full" icon is just 1px taller because of the heart on top. */
.jbsc-ci {
  position: absolute;
  bottom: calc(50% - 10px);
  left: 50%;
  display: block;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
}

.jbsc-ci-empty,
.jbsc-ci-hover {
  height: 20px;
}

.jbsc-ci-full {
  height: 21px;
}

.jbsc-ci-full,
.jbsc-ci-hover,
.jbsc-hdr-cart.has-items .jbsc-ci-empty {
  display: none;
}

.jbsc-hdr-cart.has-items .jbsc-ci-full {
  display: block;
}

.jbsc-hdr-cart:focus-visible .jbsc-ci-empty,
.jbsc-hdr-cart:focus-visible .jbsc-ci-full {
  display: none;
}

.jbsc-hdr-cart:focus-visible .jbsc-ci-hover {
  display: block;
}

@media (hover: hover) {
  .jbsc-hdr-cart:hover .jbsc-ci-empty,
  .jbsc-hdr-cart:hover .jbsc-ci-full {
    display: none;
  }

  .jbsc-hdr-cart:hover .jbsc-ci-hover {
    display: block;
  }
}

/* theme hides header icons on narrow screens; the cart stays next to the burger */
@media (max-width: 991px) {
  .jb-site-header__actions .jbsc-hdr-cart {
    display: inline-flex;
    width: 40px;
  }
}

/* ===== overlay + drawer ===== */
html.jbsc-lock,
html.jbsc-lock body {
  overflow: hidden;
}

.jbsc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483100;
  background: rgba(24, 16, 18, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s;
}

.jbsc-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.jbsc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2147483101;
  display: flex;
  flex-direction: column;
  width: min(760px, 92vw);
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--jbsc-bg);
  background-repeat: repeat-y;
  background-position: left top;
  color: var(--jbsc-text);
  font-family: var(--jbsc-sans);
  line-height: 1.5;
  text-align: left;
  box-shadow: -20px 0 60px -30px rgba(40, 10, 18, 0.6);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.32s;
  container-type: inline-size;
}

.jbsc-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

@media (max-width: 560px) {
  .jbsc-drawer {
    width: 100%;
  }
}

.jbsc-head,
.jbsc-body,
.jbsc-foot {
  position: relative;
  z-index: 2;
}

.jbsc-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 24px 14px;
}

.jbsc-title {
  margin: 0;
  color: var(--jbsc-ink);
  font-family: var(--jbsc-sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.jbsc-drawer .jbsc-close {
  position: absolute;
  top: 16px;
  right: 20px;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--jbsc-burgundy);
  font-size: 34px;
  line-height: 1;
}

.jbsc-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 40px 10px 32px;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.jbsc-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ===== custom scrollbar: thin pink thumb + burgundy chevrons, always visible ===== */
.jbsc-scroll {
  position: absolute;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 12px;
}

.jbsc-drawer .jbsc-arrow {
  flex: none;
  width: 7px;
  height: 5px;
  padding: 0;
  border: 0;
  background: transparent no-repeat center / contain;
}

.jbsc-track {
  position: relative;
  flex: 1;
  width: 6px;
  border-radius: 40px;
}

.jbsc-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  min-height: 24px;
  border-radius: 40px;
  background: var(--jbsc-pink);
  cursor: grab;
  touch-action: none;
}

.jbsc-thumb:active {
  cursor: grabbing;
}

/* ===== items ===== */
.jbsc-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "img head" "img foot";
  column-gap: 20px;
  padding: 18px 0;
}

.jbsc-item-thumb {
  grid-area: img;
  align-self: start;
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  background: #ebd3d9;
}

.jbsc-item-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jbsc-item-head {
  grid-area: head;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.jbsc-item-info {
  min-width: 0;
}

.jbsc-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 10px;
  color: var(--jbsc-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.jbsc-item-title a {
  color: inherit;
  text-decoration: none;
}

.jbsc-item-meta {
  margin: 3px 0;
  color: var(--jbsc-text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.jbsc-drawer .jbsc-item-rm {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 24px;
  margin-top: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #b7a4a9;
  font-size: 20px;
  line-height: 1;
}

.jbsc-item-foot {
  grid-area: foot;
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
}

.jbsc-stepper {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--jbsc-text);
  font-size: 20px;
  font-weight: 500;
}

.jbsc-drawer .jbsc-stepper button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--jbsc-text);
  font-size: 22px;
  line-height: 1;
}

.jbsc-drawer .jbsc-stepper button:disabled {
  opacity: 0.35;
  cursor: default;
}

.jbsc-qty {
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.jbsc-item-price {
  color: var(--jbsc-text);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.jbsc-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding: 22px 0 8px;
}

.jbsc-total-label {
  color: var(--jbsc-text);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.jbsc-total-value {
  color: var(--jbsc-text);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.jbsc-empty {
  padding: 40px 6px;
  color: #9a8085;
  font-size: 15px;
  text-align: center;
}

.jbsc-error {
  margin: 4px 0 8px;
  color: var(--jbsc-burgundy);
  font-size: 13px;
  text-align: center;
}

.jbsc-drawer.is-busy .jbsc-body {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* ===== checkout button ===== */
.jbsc-foot {
  z-index: 1;
  padding: 16px 32px 26px;
}

.jbsc-drawer .jbsc-checkout {
  width: 100%;
  padding: 17px;
  border: 2px solid var(--jbsc-burgundy);
  border-radius: 999px;
  background: var(--jbsc-burgundy);
  color: var(--jbsc-pink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.jbsc-drawer .jbsc-checkout:hover,
.jbsc-drawer .jbsc-checkout:focus-visible {
  background: transparent;
  border-color: var(--jbsc-burgundy);
  color: var(--jbsc-burgundy);
}

.jbsc-drawer.is-empty .jbsc-foot {
  display: none;
}

/* ===== phone-width layout (driven by the drawer's own width) ===== */
@container (max-width: 460px) {
  .jbsc-title {
    font-size: 16px;
  }

  .jbsc-head {
    padding: 40px 16px 10px;
  }

  .jbsc-drawer .jbsc-close {
    top: 12px;
    right: 12px;
    font-size: 24px;
  }

  .jbsc-body {
    padding: 4px 26px 8px 16px;
  }

  .jbsc-scroll {
    right: 8px;
  }

  .jbsc-item {
    grid-template-columns: clamp(66px, 24cqw, 96px) 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: "img head" "foot foot";
    column-gap: 12px;
  }

  .jbsc-item-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .jbsc-item-title {
    margin-bottom: 5px;
    font-size: clamp(11px, 3.5cqw, 13px);
  }

  .jbsc-item-meta {
    margin: 2px 0;
    font-size: clamp(10.5px, 3.2cqw, 12px);
  }

  .jbsc-drawer .jbsc-item-rm {
    width: 18px;
    height: 18px;
    font-size: 16px;
  }

  .jbsc-item-foot {
    align-self: auto;
    padding-top: 10px;
  }

  .jbsc-stepper,
  .jbsc-item-price,
  .jbsc-total-label,
  .jbsc-total-value {
    font-size: clamp(12px, 3.8cqw, 14px);
  }

  .jbsc-drawer .jbsc-stepper button {
    font-size: clamp(16px, 4.6cqw, 18px);
  }

  .jbsc-foot {
    position: sticky;
    bottom: 0;
    padding: 0;
  }

  .jbsc-drawer .jbsc-checkout {
    padding: 20px;
    border-radius: 0;
  }
}
