/* Плашки предзаказа и подарка */
.cart-promo-badge {
  background: #F4EFE6;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 8px 0 12px;
  border: 1.5px dashed var(--flame, #C03B2A);
}
.cpb-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink, #101418);
}
.cpb-top b.done {
  color: var(--green, #186A43);
}
.cpb-bar {
  height: 5px;
  background: #E0D9CD;
  border-radius: 3px;
  overflow: hidden;
}
.cpb-fill {
  height: 100%;
  background: var(--flame, #C03B2A);
  transition: width .3s ease;
}
.cpb-fill.done {
  background: var(--green, #186A43);
}
.cart-preorder-notice {
  background: #FFF6E5;
  border: 1.5px dashed #F2D9A5;
  border-radius: 10px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  color: #6B4E0E;
  font-weight: 600;
  line-height: 1.35;
}
/* ── F5.65: Доставка — субфильтры, плашки опций и кнопки шага ── */
#deliveryGrid .card .cbody {
  display: flex;
  flex-direction: column;
}
#deliveryGrid .cbody h3{
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  line-clamp: 2;
  overflow:hidden; min-height:calc(15.5px * 1.3 * 2);
}
/* Субфильтры */
.subfilter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0;
  padding: 4px 2px 8px 2px;
  min-height: 38px;
}

.subfilter-bar::-webkit-scrollbar {
  display: none;
}

/* The scroll viewport owns the cue; it must stay fixed while the chip row moves. */
.subfilter-viewport {
  position: relative;
  min-width: 0;
  margin-bottom: 0;
  /* The viewport now hugs the 56px chip rail; the cue stays centered on it. */
  --subfilter-reserved-gap: 0px;
}

.subfilter-viewport.has-overflow::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 3;
  width: 58px;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--fr-paper, var(--card)) 90%
  );
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.subfilter-viewport.has-overflow::before {
  content: "";
  position: absolute;
  inset-block: 0 var(--subfilter-reserved-gap);
  inset-inline-end: 13px;
  z-index: 4;
  width: 7px;
  height: 7px;
  margin-block: auto;
  border-block-start: 2px solid var(--fr-choc, var(--ink));
  border-inline-end: 2px solid var(--fr-choc, var(--ink));
  transform: rotate(45deg);
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.subfilter-viewport.has-overflow.at-end::after,
.subfilter-viewport.has-overflow.at-end::before {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .subfilter-viewport.has-overflow::before,
  .subfilter-viewport.has-overflow::after {
    transition: none;
  }
}

/* Desktop/tablet: keep ingredient filters in one horizontal rail with a visible scrollbar. */
@media (min-width: 821px) {
  #deliveryView #deliverySubFilter {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--fr-tan, var(--line)) var(--fr-rice, var(--panel));
    padding-bottom: 8px;
  }

  #deliveryView #deliverySubFilter::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  #deliveryView #deliverySubFilter::-webkit-scrollbar-track {
    background: var(--fr-rice, var(--panel));
    border-radius: 999px;
  }

  #deliveryView #deliverySubFilter::-webkit-scrollbar-thumb {
    background: var(--fr-tan, var(--line));
    border-radius: 999px;
  }
}

.subchip {
  position: relative;
  isolation: isolate;
  flex: 0 0 auto;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fr-choc, var(--ink));
  font: 600 13px / 1 "Golos Text", system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease;
  user-select: none;
}

.subchip::before {
  content: "";
  position: absolute;
  inset: 2px 0;
  z-index: -1;
  border-radius: 999px;
  background: var(--fr-paper, var(--card));
  border: 1.5px solid var(--fr-tan, var(--line));
  pointer-events: none;
}

.subchip:hover::before {
  background: var(--fr-rice);
}

.subchip.on {
  color: #fff;
  font-weight: 700;
}

.subchip.on::before {
  background: var(--flame);
  border-color: var(--fr-choc);
  box-shadow: 2px 2px 0 var(--fr-choc);
}

.subchip:focus-visible {
  outline: 2px solid var(--focus, #1A6DDF);
  outline-offset: 2px;
}

/* Плашки выбора опций пиццы (Segmented Control Grid)
   margin-top: auto здесь не нужен и вреден: он «съедает» свободное место .cbody,
   и кнопка добавления (.steprow) перестаёт быть единственной прижатой к низу.
   Единственный владелец прижатия к низу в карточке доставки — .steprow (theme/20-cards.css). */
#deliveryGrid .opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  width: 100%;
}

#deliveryGrid .opts button,
#deliveryGrid .opts label.opt-btn,
#deliveryGrid .opts .opt-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 4px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--card, #FFFFFF);
  color: var(--ink, #101418);
  min-height: 52px;
  width: 100%;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#deliveryGrid .opts .opt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  width: 100%;
  min-width: 0;
  line-height: 1.2;
}

#deliveryGrid .opts .opt-size {
  font-size: 12.5px;
  font-weight: 800;
  color: inherit;
  white-space: nowrap;
}

#deliveryGrid .opts .opt-crust {
  font-size: 11px;
  font-weight: 700;
  color: inherit;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop cards have enough width for the complete crust label. Do not ellipsize
   semantic choices such as «тонкое» / «пышное»; keep the compact clipping only
   on narrow mobile cards where horizontal space is genuinely constrained. */
@media (min-width: 821px) {
  #deliveryGrid .opts .opt-size,
  #deliveryGrid .opts .opt-crust {
    flex: 0 0 auto;
    overflow: visible;
    text-overflow: clip;
  }
}

#deliveryGrid .opts .opt-weight {
  font-size: 11px;
  font-weight: 600;
  color: var(--soft, #586470);
  white-space: nowrap;
}

#deliveryGrid .opts .opt-price,
#deliveryGrid .opts button .op {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--price-color, var(--flame));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) {
  background: var(--btn-fire-bg, var(--flame));
  border: var(--btn-fire-border, 1.5px solid var(--flame));
  color: var(--btn-fire-color, #FFFFFF);
  box-shadow: var(--btn-fire-shadow, none);
}

#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-size,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-crust,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-weight,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-price {
  color: var(--btn-fire-color, #FFFFFF);
  opacity: 1;
}


/* Native pizza option group */
#deliveryGrid fieldset.opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-inline-size: 0;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  margin: 6px 0 0;
  padding: 6px 0 0;
}
#deliveryGrid .opts legend {
  grid-column: 1 / -1;
  padding: 0;
  margin: 0 0 4px;
  color: var(--soft, #586470);
  font-size: 11px;
  font-weight: 700;
}
#deliveryGrid .opts label.opt-btn { position: relative; min-height: 52px; cursor: pointer; }
#deliveryGrid .opts .opt-radio { position:absolute; width:1px; height:1px; margin:0; opacity:0; }
#deliveryGrid .opts .opt-content { display:flex; flex-direction:column; justify-content:space-between; gap:4px; width:100%; min-width:0; pointer-events:none; }
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) { background:var(--btn-fire-bg,var(--flame)); border:var(--btn-fire-border,1.5px solid var(--flame)); color:var(--btn-fire-color,#fff); box-shadow:var(--btn-fire-shadow,none); }
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-size,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-crust,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-weight,
#deliveryGrid .opts .opt-btn:has(.opt-radio:checked) .opt-price { color:var(--btn-fire-color,#fff); opacity:1; }
#deliveryGrid .opts .opt-btn:focus-within { outline: 3px solid var(--focus, #1A6DDF); outline-offset: 3px; border-radius: 6px; }
#deliveryGrid .opts-error { grid-column:1 / -1; margin:2px 0 0; color:var(--flame,#C03B2A); font-size:11px; font-weight:700; }

/* Keep lazy-card reservation aligned with the native fieldset + legend geometry. */
#deliveryGrid .card:nth-child(n+5) { contain-intrinsic-block-size: 502px; }

/* 320px cards: compact option labels so both crust names fit without truncation. */
@media (max-width:350px) {
  #deliveryGrid .opts .opt-size { font-size:10px; }
  #deliveryGrid .opts .opt-crust { font-size:8px; }
  #deliveryGrid .opts .opt-weight { font-size:8.5px; }
  #deliveryGrid .opts .opt-price,
  #deliveryGrid .opts button .op { font-size:10.5px; }
}
