/* Leaf & Bloom - the cart (cart.html).
 * Redesigned 30 Sep 2026 to match the homepage's 29 Sep redesign. Linked only
 * from these pages, after the shared stylesheets, so these rules win ties.
 * Shared components (.pcard, .benefits, .acc, .swipe-row) live in base.css. */

/* -- The floating buttons ------------------------------------------------
 *  The WhatsApp and assistant buttons (assistant.css) stack 140px deep in
 *  the bottom-right corner, and on a phone "Send this order" runs the full
 *  width of the screen underneath them. Anything scrolled to or focused on
 *  this page therefore stops clear of the stack, and the order button sits
 *  with its caption and three reassurances below it, so it is never the
 *  last thing on a screen. */
html { scroll-padding-bottom: 160px; }
[data-wa-order] { scroll-margin-bottom: 160px; }

/* -- The head -------------------------------------------------------------- */
.archive-head { padding-block: var(--sp-5) var(--sp-4); }
@media (min-width: 768px) { .archive-head { padding-block: var(--sp-6) var(--sp-5); } }
.cart-layout { gap: var(--sp-6); }
@media (min-width: 900px) {
  .cart-layout { gap: var(--sp-8); grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}
.cart-layout > div:first-child { display: grid; gap: var(--sp-5); align-content: start; }
/*  The "Your items" card holds only the inert <template> until ui.js adds a
 *  line, so it takes no room (and adds no gap) while the basket is empty. */
.cart-box[data-cart-box]:not(:has(.cart-line)) { display: none; }

/* -- The checkout cards (10 Oct 2026) ---------------------------------------
 *  "Your items" and "Your details": two ivory cards, each with its title on
 *  a hairline. The step numbers show only when the shop takes orders itself
 *  (body.orders-on), where there are two steps to number. */
.cart-box {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--c-surface);
  border: var(--card-edge);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
@media (min-width: 620px) { .cart-box { padding: var(--sp-5) var(--sp-6); } }
.cart-box__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--c-line);
}
.cart-box__title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0;
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--c-heading-deep);
}
.cart-box__step {
  display: none;
  place-items: center;
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-brand-fill);
  color: var(--c-on-brand);
  font-family: var(--ff-sans);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
}
body.orders-on .cart-box__step { display: inline-grid; }
.cart-continue { margin: 0; font-size: var(--fs-small); }
.cart-continue a {
  display: inline-block;
  padding: 10px 4px; margin: -10px -4px;   /* a 40px tap target, in place */
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/*  Empty on a laptop: the card beside the summary is as tall as it, its
 *  content centred, so the two boxes side by side are equal. */
@media (min-width: 900px) {
  .cart-layout:has(.cart-empty:not([hidden])) { align-items: stretch; }
  .cart-layout:has(.cart-empty:not([hidden])) > div:first-child { align-content: stretch; }
  .cart-empty { align-content: center; }
}

/* -- The empty state -------------------------------------------------------
 *  The state the page ships in, and the one a stranger sees first: one
 *  ivory card, one focal point (the bag in a forest disc), the sentence, and
 *  the way back to the shop as the page's primary button. */
.cart-empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5);
  text-align: center;
  /*  Ivory like the Order summary beside it, so the pair reads as matched
   *  cards; the warm tone is kept for the well round the bag. */
  background: var(--c-surface);
  border: var(--card-edge);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
.cart-empty:focus { outline: none; }
.cart-empty:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
.cart-empty__icon {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-brand-fill);
  color: var(--c-on-brand);
  margin-block: var(--sp-1);
}
/*  The same 44px solid forest circle as the homepage's .ledger__icon. */
.cart-empty__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.cart-empty__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h2-sm);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  color: var(--c-heading-deep);
}
.cart-empty__text {
  max-width: 40ch;
  font-size: var(--fs-body);
  line-height: var(--lh-copy);
  color: var(--c-text-soft);
}
/*  A fading gold hairline, then the button: the card's footer. The rule is
 *  the card's own ::after, ordered in before the button. */
.cart-empty::after {
  content: '';
  order: 1;
  justify-self: stretch;
  height: 1px;
  margin-top: var(--sp-2);
  background: var(--g-gold);
}
.cart-empty__cta { order: 2; margin-top: var(--sp-2); min-width: min(100%, 240px); }
@media (max-width: 599px) { .cart-empty__cta { width: 100%; } }
@media (min-width: 768px) { .cart-empty { padding: var(--sp-8) var(--sp-7); } }

/* -- The lines ---------------------------------------------------------------
 *  Built by ui.js from #cart-line-tpl. Since 10 Oct 2026 the lines are rows
 *  inside the one "Your items" card, a hairline between them, instead of a
 *  card each: the photo on a warm well, the name and the flavour, the
 *  stepper, and the line total on the right. The body and the controls are
 *  display:contents so their children sit on the line's own grid; nothing
 *  in the template is moved or renamed. */
.cart-items { gap: 0; }
.cart-line,
.cart-line:first-child {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-areas:
    "media title  remove"
    "media var    var"
    "media qty    price";
  grid-template-rows: auto auto 1fr;
  column-gap: var(--sp-3);
  row-gap: 2px;
  align-items: start;
  padding: var(--sp-4) 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--c-line);
  border-radius: 0;
  box-shadow: none;
}
/*  of-type: the inert <template> is the list's first child. */
.cart-line:first-of-type { border-top: 0; padding-top: var(--sp-1); }
.cart-line:last-of-type { padding-bottom: var(--sp-1); }
.cart-line__body,
.cart-line__controls { display: contents; }
.cart-line__media {
  grid-area: media;
  display: block;
  padding: 3px;
  background: var(--g-well);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  aspect-ratio: 4 / 5;
}
.cart-line__media--square { aspect-ratio: 1 / 1; }
.cart-line__media img { display: block; border-radius: calc(var(--r-md) - 3px); }
.cart-line__title {
  grid-area: title;
  margin: 0;
  font-size: var(--fs-h4);
  line-height: var(--lh-snug);
  color: var(--c-heading-deep);
}
.cart-line__var {
  grid-area: var;
  margin: 0;
  font-size: var(--fs-small);
  color: var(--c-text-soft);
}
.cart-line .qty { grid-area: qty; justify-self: start; align-self: end; margin-top: var(--sp-2); }
.cart-line__remove {
  grid-area: remove;
  align-self: start;
  justify-self: end;
  min-height: 32px;
  margin-top: -6px;
  padding-inline: 0;
  font-size: var(--fs-small);
}
/*  The line total is the focal point; "Rs 1,850 each" sits under it only
 *  when the quantity is over 1 (ui.js toggles [hidden]). */
.cart-line__cost {
  grid-area: price;
  align-self: end;
  justify-self: end;
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}
.cart-line__sum {
  font-variant-numeric: lining-nums;
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-flat);
  letter-spacing: var(--ls-display);
  color: var(--c-heading-deep);
  white-space: nowrap;
}
.cart-line__price {
  font-family: var(--ff-sans);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--c-text-soft);
  white-space: nowrap;
}
.cart-line__price[hidden] { display: none; }
/*  From 620px each line is one row, like a receipt: photo, name and
 *  flavour (Remove under them), the stepper, then the line total. */
@media (min-width: 620px) {
  .cart-line,
  .cart-line:first-child {
    grid-template-columns: 76px minmax(0, 1fr) auto minmax(104px, auto);
    grid-template-areas:
      "media title  qty price"
      "media var    qty price"
      "media remove qty price";
    grid-template-rows: auto auto 1fr;
    column-gap: var(--sp-5);
  }
  .cart-line .qty { align-self: center; margin-top: 0; }
  .cart-line__cost { align-self: center; }
  .cart-line__remove { align-self: end; justify-self: start; margin-top: 0; }
}

/* -- Free-delivery meter ----------------------------------------------------
 *  Hidden until there is a line (ui.js); a tinted strip with a thin gold
 *  ring, the same wash the homepage uses behind its icons. */
.ship-progress {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--card-radius);
  background: color-mix(in srgb, var(--c-leaf) 14%, var(--c-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-gold) 30%, transparent);
}
.ship-progress__msg { font-size: var(--fs-body); line-height: var(--lh-snug); }
.ship-progress__msg svg { width: 22px; height: 22px; }

/* -- Order summary ----------------------------------------------------------
 *  A card with a forest band for its header, as on the homepage's "What to
 *  expect" cards; the total in Cormorant is its focal point. */
.summary {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-4);
  padding: 0 var(--sp-5) var(--sp-5);
  overflow: hidden;
  background: var(--c-surface);
}
.summary .summary__title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 calc(var(--sp-5) * -1) var(--sp-1);
  padding: var(--sp-3) var(--sp-5);
  background: linear-gradient(135deg, var(--c-ground-2) 30%, var(--c-ground-mid));
  color: var(--c-on-dark);
  font-size: var(--fs-h2-sm);
  line-height: var(--lh-tight);
}
.summary .summary__title svg {
  flex: none;
  width: 36px; height: 36px;
  padding: 8px;
  border-radius: 50%;
  background: var(--c-on-dark);
  color: var(--c-ground-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.summary__row { font-size: var(--fs-body); color: var(--c-text-soft); }
.summary__row span:last-child { color: var(--c-heading-deep); font-weight: 500; }

/*  The discount-code row was removed on 30 Sep 2026 (there are no codes, and
 *  its Apply button did nothing). cart.html says how to bring it back. */

/*  The total: a gold hairline above, and the figure large. */
.summary__total {
  position: relative;
  align-items: center;
  padding-top: var(--sp-4);
  border-top: 0;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--c-heading-deep);
}
.summary__total::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--g-gold);
}
.summary__total .price {
  font-size: var(--fs-h2);
  line-height: var(--lh-flat);
  letter-spacing: var(--ls-display);
  font-variant-numeric: lining-nums;   /* "Rs 0" with a real zero, not an old-style "o" */
  color: var(--c-heading-deep);
}

/*  The estimator sits on a warm well at the foot of "Your items" (it was in
 *  the summary until 10 Oct 2026); from 620px its question and the city
 *  list share one row. */
.cart-box .deliv {
  padding: var(--sp-3) var(--sp-4);
  background: var(--g-warm);
  border: var(--card-edge);
  border-radius: var(--r-md);
}
.cart-box .deliv__head { font-size: var(--fs-body); }
.cart-box .deliv__note { font-size: var(--fs-small); line-height: var(--lh-copy); }
@media (min-width: 620px) {
  .cart-box .deliv {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--sp-2) var(--sp-4);
  }
  .cart-box .deliv__out,
  .cart-box .deliv__note { grid-column: 1 / -1; }
}
/*  The answer box reserves its height only once there is an answer to show,
 *  instead of a blank 44px band under an unchosen city. */
.cart-box .deliv__out:not(.is-in) { display: none; }

/*  Place order, in the summary beside the total (form="order-form"). */
.order-pay { display: grid; gap: var(--sp-2); }
.order-pay[hidden] { display: none; }
.order-pay [data-order-submit] { min-height: 52px; font-size: var(--fs-body); }

/*  The order: solid forest, 52px, with the WhatsApp glyph. */
.summary [data-wa-order] { min-height: 52px; padding-inline: var(--sp-3); font-size: var(--fs-small); white-space: normal; }
@media (min-width: 400px) { .summary [data-wa-order] { font-size: var(--fs-body); } }
.summary [data-wa-order] svg { width: 20px; height: 20px; flex: none; fill: currentColor; }
.summary [data-cart-order-note] { margin-top: calc(var(--sp-2) * -1); line-height: var(--lh-copy); color: var(--c-text-soft); text-align: center; }

/*  Three reassurances, each in a tinted disc with a thin gold ring. */
.summary__trust {
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--c-text);
  background: var(--g-gold) top / 100% 1px no-repeat;
}
.summary__trust li { gap: var(--sp-3); min-height: 28px; }
.summary__trust svg {
  width: 28px; height: 28px;
  padding: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-leaf) 17%, var(--c-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-gold) 35%, transparent);
  stroke: var(--c-accent);
}
@media (min-width: 900px) {
  .summary { padding: 0 var(--sp-6) var(--sp-6); }
  .summary .summary__title { margin-inline: calc(var(--sp-6) * -1); padding: var(--sp-4) var(--sp-6); }
  /*  Beside the form the summary stays in view (sticky, shop.css), so it is
   *  kept short: the three reassurances in a row, and no second sentence
   *  under "Order on WhatsApp instead". */
  .summary__trust { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); font-size: var(--fs-micro); line-height: var(--lh-snug); }
  .summary__trust li { display: grid; justify-items: center; gap: var(--sp-1); text-align: center; }
  body.orders-on .summary [data-cart-order-note] { display: none; }
}
/*  On a short laptop screen the summary is taller than the window, and a
 *  sticky box that tall hides its own foot; there it scrolls with the page. */
@media (min-width: 900px) and (max-height: 760px) { .summary { position: static; } }

/* -- Complete your order ----------------------------------------------------
 *  Phones: the shared swipe row (base.css), two full cards with the second
 *  peeking. From 900px the heading sits beside the pair, top-aligned with the
 *  cards, instead of above an empty half-row. */
.cart-cross .section-head { margin-bottom: var(--sp-5); }
/*  Between the swipe row (to 767px) and the side-by-side layout (900px) the
 *  pair fills the row instead of sitting left in base.css's 596px cap. */
@media (min-width: 768px) and (max-width: 899px) { .cart-cross .pgrid { max-width: none; } }
/*  From 900px: the heading above, the cards across the full width (10 Oct
 *  2026). Beside the heading, four cards had 596px between them and their
 *  buttons spilled out of the cards. */
@media (min-width: 900px) {
  .cart-cross .pgrid { margin: 0; width: 100%; max-width: none; }
}

/*  The breadcrumb links get a 40px+ tap target from padding, cancelled by an
 *  equal negative margin so the crumbs stay exactly where they were. */
.crumbs a { padding: 10px 4px; margin: -10px -4px; }

/* -- After Send: "Sent to WhatsApp?" ----------------------------------------
 *  Shown by ui.js once "Send this order" is tapped; the basket is emptied
 *  only on "Empty the cart". A warm well inside the summary card with a thin
 *  gold ring, the two answers side by side (stacked under 400px). */
.cart-sent {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--g-warm);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-gold) 45%, transparent);
}
.cart-sent[hidden] { display: none; }
.cart-sent__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--c-heading-deep);
}
.cart-sent__text { font-size: var(--fs-small); line-height: var(--lh-copy); color: var(--c-text-soft); }
.cart-sent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.cart-sent__actions .btn { min-height: 48px; width: 100%; }
@media (max-width: 399px) { .cart-sent__actions { grid-template-columns: 1fr; } }

/*  While the order button, its caption or the question above is on screen,
 *  the floating WhatsApp/assistant stack steps aside (ui.js sets the class),
 *  so it never sits on top of "Send this order". The order button is itself
 *  the way to WhatsApp; the stack returns as soon as it scrolls away. */
body.order-in-view .fabs { transform: scale(.7); opacity: 0; visibility: hidden; pointer-events: none; }
body.order-in-view .nudge { opacity: 0; visibility: hidden; }

/* -- The order form (6 Oct 2026, BACKEND-PLAN.md Flow A) -------------------
 *  Shown by ui.js only once the shop takes orders itself (GET /api/config).
 *  Since 10 Oct 2026 it is its own "Your details" card under the items, the
 *  fields two to a row from 620px (Address across the row), and Place order
 *  is in the summary (.order-pay above). Once it shows, the WhatsApp order
 *  steps down to an outlined "Order on WhatsApp instead". */
.order-form { column-gap: var(--sp-4); row-gap: 0; }
.order-form[hidden] { display: none; }
.order-form > .cart-box__title { margin-bottom: var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--c-line); }
@media (min-width: 620px) {
  .order-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-form > .cart-box__title,
  .order-form > .field--wide { grid-column: 1 / -1; }
}
.order-form .field { margin: 0 0 var(--sp-3); }
.order-form textarea { min-height: 64px; }
.order-form__opt { font-weight: 400; color: var(--c-text-soft); }
/*  Turnstile draws a 65px box; the space is held so nothing jumps under it. */
.order-form__check { min-height: 65px; }
.order-form__error { margin: 0; }
.order-form [aria-invalid="true"] { border-color: var(--c-bad); }
.order-form__small { margin: 0; text-align: center; color: var(--c-text-soft); line-height: var(--lh-copy); }
.summary .order-wa-alt { min-height: 48px; }

/*  After a saved order: the same warm well as "Sent to WhatsApp?", with the
 *  number as its headline. */
.order-done {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--g-warm);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-gold) 45%, transparent);
  text-align: center;
}
.order-done[hidden] { display: none; }
.order-done:focus { outline: none; }
.order-done:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
.order-done__icon {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-brand-fill);
  color: var(--c-on-brand);
}
.order-done__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.order-done__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-tight);
  font-variant-numeric: lining-nums;
  color: var(--c-heading-deep);
}
.order-done__text { font-size: var(--fs-small); line-height: var(--lh-copy); color: var(--c-text-soft); }
.order-done .btn { margin-top: var(--sp-2); }

.order-fallback {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--c-bad) 10%, var(--c-surface));
  font-size: var(--fs-small);
  line-height: var(--lh-copy);
  color: var(--c-text);
}
.order-fallback[hidden] { display: none; }

/*  The discount code: the box and Apply on one row; the result as the site's
 *  success line (an icon-less .field__msg--success in --c-ok). */
.order-form__coupon-row { display: flex; gap: var(--sp-2); }
.order-form__coupon-row input { flex: 1; min-width: 0; text-transform: uppercase; }
.order-form__coupon-row .btn { flex: none; min-height: 48px; }
.order-form [data-coupon-ok] { margin-top: var(--sp-2); }
.order-form [data-coupon-ok][hidden] { display: none; }

/*  ONE WAY TO ORDER (15 Oct 2026, the owner: "order website ka website pr he
 *  hoga"). Customers placed an order on the site and sent the same basket on
 *  WhatsApp too. Once the shop takes orders itself (body.orders-on) the
 *  WhatsApp order and its note are not shown; ui.js brings the button back
 *  (.is-fallback) only when the site could not take the order. */
body.orders-on .summary [data-wa-order]:not(.is-fallback),
body.orders-on .summary [data-cart-order-note] { display: none !important; }
