.bab { padding: 48px 0 80px; }
.bab__head { text-align: center; margin-bottom: 32px; }
.bab__sub { color: var(--bone-muted); margin-top: 8px; }
.bab__layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.bab__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--ink-rule); border: 1px solid var(--ink-rule); }
.bab-card { background: var(--ink-card); padding: 0 0 16px; display: flex; flex-direction: column; }
.bab-card__media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--ink-deeper); }
.bab-card__name { font-family: var(--f-display); font-size: 16px; color: var(--bone); margin: 12px 16px 4px; line-height: 1.15; }
.bab-card__price { font-family: var(--f-mono); color: var(--ember-warm); margin: 0 16px 12px; font-size: 13px; }
.bab-card__add {
  margin: auto 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--ember);
  background: transparent;
  color: var(--ember-warm);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .1s ease;
}
.bab-card__add:hover { background: var(--ember); color: var(--bone); }
.bab-card__add:focus-visible { outline: 2px solid var(--ember-warm); outline-offset: 2px; }
.bab-card__add:active { transform: translateY(1px); }
/* Out of stock card */
.bab-card.is-oos .img-fill { filter: grayscale(0.55) brightness(0.7); }
.bab-card__oos {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  background: rgba(13, 11, 10, 0.82);
  color: var(--bone-muted);
  border: 1px solid var(--ink-rule-strong);
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 8px;
}
.bab-card__add.is-oos, .bab-card__add.is-oos:hover {
  border-color: var(--ink-rule-strong);
  color: var(--bone-faint);
  background: transparent;
  cursor: not-allowed;
}
.bab__tray { position: sticky; top: 92px; background: var(--ink-card); border: 1px solid var(--ink-rule); padding: 22px; }
.bab-tray__title { font-family: var(--f-display); color: var(--bone); margin: 0 0 14px; }
.bab-tray__bar { height: 6px; background: var(--ink-deeper); border-radius: 3px; overflow: hidden; }
.bab-tray__bar-fill { height: 100%; background: var(--ember); transition: width .4s cubic-bezier(.2,.7,.3,1.1); }
.bab-tray__hint { font-family: var(--f-mono); font-size: 11px; color: var(--ember-warm); margin: 8px 0 16px; letter-spacing: .04em; }
.bab-tray__items { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.bab-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; font-size: 13px; color: var(--bone); }
.bab-line__qty { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); }
.bab-line__qty button { width: 22px; height: 22px; border: 1px solid var(--ink-rule-strong); background: transparent; color: var(--bone); cursor: pointer; line-height: 1; }
.bab-line__qty button:hover { border-color: var(--ember); color: var(--ember-warm); }
.bab-line__rm { border: 0; background: transparent; color: var(--bone-muted); cursor: pointer; font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 0 0; transition: color .15s ease; }
.bab-line__rm:hover { color: var(--ember-warm); text-decoration: underline; }
.bab-line__rm:focus-visible { outline: 2px solid var(--ember-warm); outline-offset: 1px; }
.bab-tray__totals { border-top: 1px solid var(--ink-rule); margin-top: 16px; padding-top: 14px; }
.bab-tray__row { display: flex; justify-content: space-between; font-size: 13px; color: var(--bone-muted); margin-bottom: 6px; }
.bab-tray__row--disc span { color: var(--ember-warm); }
.bab-tray__row--total { color: var(--bone); font-weight: 600; font-size: 15px; }
.bab-tray__checkout {
  width: 100%;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 20px;
  border: 0;
  background: var(--ember);
  color: var(--bone);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 28px -12px rgba(199, 90, 54, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.45);
  transition: background-color .18s ease, transform .12s cubic-bezier(.2,.7,.3,1.1), box-shadow .18s ease;
}
.bab-tray__checkout:hover {
  background: var(--ember-warm);
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -12px rgba(199, 90, 54, 0.8), 0 3px 8px -2px rgba(0, 0, 0, 0.5);
}
.bab-tray__checkout:active { transform: translateY(0); }
.bab-tray__checkout:focus-visible { outline: 2px solid var(--ember-warm); outline-offset: 3px; }
.bab-tray__checkout:disabled {
  background: var(--ink-rule-strong);
  color: var(--bone-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.bab-tray__checkout-arr { transition: transform .18s cubic-bezier(.2,.7,.3,1.1); }
.bab-tray__checkout:hover .bab-tray__checkout-arr { transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) {
  .bab-tray__checkout, .bab-tray__checkout-arr { transition: none; }
  .bab-tray__checkout:hover { transform: none; }
  .bab-tray__checkout:hover .bab-tray__checkout-arr { transform: none; }
}
.bab-tray__empty { color: var(--bone-muted); font-size: 13px; }

/* Sticky mobile summary bar + bottom-sheet plumbing (desktop hides all three). */
.bab-tray__close { display: none; }
.bab-bar { display: none; }
.bab-sheet-backdrop { display: none; }

@media (max-width: 980px) {
  .bab__layout { grid-template-columns: 1fr; }
  .bab__grid { grid-template-columns: repeat(2, 1fr); }

  /* Tray becomes a slide-up bottom sheet, hidden until the bar is tapped. */
  .bab__tray {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto; /* cancel the desktop sticky top:92px so the sheet hugs content */
    z-index: 90;
    max-height: 82vh;
    overflow-y: auto;
    border: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -16px 44px -10px rgba(0, 0, 0, 0.6);
    transform: translateY(110%);
    transition: transform .32s cubic-bezier(.2,.7,.3,1.04);
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .bab__tray::before {
    content: "";
    display: block;
    width: 40px; height: 4px;
    margin: -6px auto 14px;
    border-radius: 999px;
    background: var(--ink-rule-strong);
  }
  body.bab-sheet-open .bab__tray { transform: translateY(0); }

  .bab-tray__close {
    display: block;
    position: absolute;
    top: 12px; right: 14px;
    width: 32px; height: 32px;
    border: 0; background: transparent;
    color: var(--bone-muted);
    font-size: 24px; line-height: 1;
    cursor: pointer;
  }
  .bab-tray__close:hover { color: var(--ember-warm); }
  .bab-tray__items { max-height: 44vh; }

  /* Backdrop behind the sheet */
  .bab-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(13, 11, 10, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
  }
  body.bab-sheet-open .bab-sheet-backdrop { opacity: 1; visibility: visible; }
  body.bab-sheet-open { overflow: hidden; }

  /* Sticky summary bar — appears once the box has items */
  .bab-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 85;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid var(--ink-rule);
    background: var(--ink-card);
    color: var(--bone);
    cursor: pointer;
    box-shadow: 0 -8px 24px -8px rgba(0, 0, 0, 0.5);
    transition: transform .28s cubic-bezier(.2,.7,.3,1.04);
  }
  .bab-bar.is-visible { display: flex; }
  /* While the sheet is up it owns the bottom — tuck the bar away so it
     doesn't peek beneath the sheet. Close via the × or the backdrop. */
  body.bab-sheet-open .bab-bar { transform: translateY(100%); pointer-events: none; }
  .bab-bar__info { display: flex; align-items: baseline; gap: 8px; }
  .bab-bar__count { font-family: var(--f-display); font-weight: 600; font-size: 15px; }
  .bab-bar__total { font-family: var(--f-mono); font-size: 12px; color: var(--ember-warm); }
  .bab-bar__chev { font-size: 16px; color: var(--ember-warm); }
}
@media (max-width: 560px) { .bab__grid { grid-template-columns: 1fr; } }
