/* ========================================
   IKITAI — Bundles & basket-building

   Styles for the #bundles section, the bundle size modal, and the two
   basket-building elements in the cart drawer (the free-shipping progress bar
   and the "complete the bundle" nudge).

   The visual hierarchy here is doing real work. Three bundle cards sit side by
   side; the last one — the full four-piece set at the deepest discount — is
   the only one with a red border, a flag, and a filled button. The two smaller
   ones exist so the big one has something to be compared against. Everything
   each card claims is arithmetic on the real list prices in PRICE_BOOK; see
   bundlePriceMarkup() in cart.js.
   ======================================== */

.bundles {
  background: var(--black-soft);
}

.bundle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  align-items: stretch;
}

.bundles__note {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--grey-muted);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Bundle card --- */
.bundle-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--grey-dark);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.bundle-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

/* The headline offer. Red border and a slight lift so the eye lands here
   first and the other two read as the alternatives to it. */
.bundle-card--featured {
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(139, 26, 26, 0.1), var(--grey-dark) 55%);
}

.bundle-card--featured:hover {
  border-color: var(--red-bright);
}

.bundle-card__flag {
  position: absolute;
  top: 0;
  right: var(--space-lg);
  transform: translateY(-50%);
  padding: 4px 10px;
  background: var(--red-bright);
  color: var(--white-pure);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

.bundle-card__kanji {
  font-family: var(--font-accent);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--red-bright);
  margin-bottom: var(--space-sm);
}

.bundle-card__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--white);
  margin-bottom: var(--space-xs);
}

.bundle-card__items {
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--grey-light);
  margin-bottom: var(--space-sm);
}

.bundle-card__blurb {
  font-size: 0.78rem;
  line-height: 1.7;
  font-weight: 300;
  color: var(--grey-light);
  /* Push the price block and CTA to the bottom so all three cards line up
     however long the copy is. */
  margin-bottom: var(--space-md);
  flex: 1;
}

.bundle-card__cta {
  width: 100%;
  margin-top: var(--space-md);
}

/* --- Price block ---
   Four framings of the same number: the real sum struck through, the actual
   price, the saving in money and percent, and the per-piece figure. Which one
   lands depends on the shopper, so all four are shown. */
.bundle-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-sm);
}

.bundle-price__was {
  font-size: 0.85rem;
  color: var(--grey-muted);
  text-decoration: line-through;
}

.bundle-price__now {
  font-family: var(--font-display);
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  color: var(--white);
}

.bundle-price__save {
  flex-basis: 100%;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red-glow);
}

.bundle-price__unit {
  flex-basis: 100%;
  margin-top: 2px;
  font-size: 0.68rem;
  color: var(--grey-muted);
}

/* --- Bundle size modal ---
   Wider than the single-product size modal because it stacks one row per
   piece, and the whole point is that choosing all the sizes takes one screen
   rather than four separate add-to-cart trips. */
.modal-box--bundle {
  max-width: 480px;
  /* Four rows overflow 90vh, and scroll anchoring on the thumbnails as they
     load drags the box away from the top. Nothing above should ever move. */
  overflow-anchor: none;
}

.bundle-modal__head {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bundle-modal__kanji {
  font-family: var(--font-accent);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--red-bright);
  margin-bottom: var(--space-xs);
}

.bundle-modal__name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.1em;
  color: var(--white);
}

.bundle-modal__blurb {
  font-size: 0.78rem;
  line-height: 1.7;
  font-weight: 300;
  color: var(--grey-light);
  margin-bottom: var(--space-md);
}

.bundle-modal__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.bundle-modal__cta {
  width: 100%;
  margin-top: var(--space-lg);
}

/* The CTA stays visible while sizes are missing — it just explains what it
   still needs. See syncBundleCta() in cart.js. */
.bundle-modal__cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bundle-modal__note {
  margin-top: var(--space-sm);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-muted);
}

/* --- One row per piece in the modal --- */
.bundle-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--space-md);
  align-items: start;
}

.bundle-row__image {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--grey-mid);
  overflow: hidden;
}

/* Kanji sits underneath as the placeholder; the photo covers it when it
   loads, and an onerror handler removes a photo that doesn't. */
.bundle-row__kanji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-accent);
  font-size: 1.5rem;
  color: rgba(245, 240, 235, 0.15);
}

.bundle-row__image img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bundle-row__name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1.4;
}

.bundle-row__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  margin-bottom: var(--space-sm);
}

.bundle-row__sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bundle-size-btn {
  min-width: 38px;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--grey-light);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.bundle-size-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white);
}

.bundle-size-btn.is-selected {
  background: var(--red);
  border-color: var(--red);
  color: var(--white-pure);
}

/* ========================================
   Cart drawer: basket building
   ======================================== */

/* .cart-progress* was the goal-gradient bar counting up to free shipping. The
   threshold is gone, so the bar is gone with it — deleted rather than left
   unused, because a progress bar pointing at an offer that no longer exists is
   the kind of thing that gets switched back on by accident. */

/* Bundle-completion nudge. Stated in money saved rather than percent, because
   an absolute figure is what a shopper weighs against the extra spend. */
.cart-nudge {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: rgba(139, 26, 26, 0.1);
  border: 1px solid rgba(139, 26, 26, 0.25);
}

.cart-nudge__text {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--grey-light);
}

.cart-nudge__text strong {
  color: var(--white);
}

.cart-nudge__btn {
  margin-top: var(--space-sm);
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red-glow);
  cursor: pointer;
}

.cart-nudge__btn:hover {
  text-decoration: underline;
}

/* The discount line in the drawer and on the checkout summary. Green rather
   than red: red is the brand accent everywhere else on the page, so money
   coming off needs its own colour to read as good news. */
.cart-subtotal--discount,
.checkout__total-row--discount {
  color: #4a9e6a;
}

.cart-subtotal--discount {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 400;
}

/* --- Free gift, shown rather than promised --- */
.free-gift-banner__icon {
  /* Big enough that the individual stickers are recognisable. Below about
     140px the flat-lay reads as a dark smudge and the whole point is lost. */
  width: 160px;
  flex-shrink: 0;
  position: relative;
  aspect-ratio: 1;
  background: var(--grey-mid);
  overflow: hidden;
}

.free-gift-banner__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-accent);
  font-size: 2rem;
  color: rgba(245, 240, 235, 0.15);
}

.free-gift-banner__icon img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.checkout__gift {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.checkout__gift-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
  .bundle-grid {
    grid-template-columns: 1fr;
  }

  /* Stacked, the featured card no longer wins by position, so give it the
     order it has by value. */
  .bundle-card--featured {
    order: -1;
  }

  .bundle-card__flag {
    right: var(--space-md);
  }
}

@media (max-width: 600px) {
  .free-gift-banner__icon {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }

  .bundle-row {
    grid-template-columns: 56px 1fr;
  }

  .bundle-price__now {
    font-size: 1.6rem;
  }
}
