/* ============================================================
   Header cart icon + slide-in mini cart
   ============================================================
   Enqueued only when Appearance → Theme Presets → Header cart is on and
   WooCommerce is active (see wpr_cart_drawer_assets), so it costs nothing by
   default. Token-only, so it follows the active palette and font pair.

   Note this file loads on EVERY page when enabled, unlike woocommerce.css
   which is shop-pages-only — the header is site-wide, so the drawer has to be
   too, and it cannot rely on anything in that stylesheet.
   ============================================================ */

/* ---- header icon ---- */
.wpr-cart{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius:10px; /* 44px touch target */
  border:1px solid var(--line); background:var(--ink2); color:var(--cream);
  cursor:pointer; padding:0; flex-shrink:0;
  transition:border-color .15s ease, color .15s ease;
}
.wpr-cart:hover{ border-color:var(--accent); color:var(--accent-dk); }
.wpr-cart:focus-visible{ outline:2px solid var(--focus, var(--accent)); outline-offset:2px; }
.wpr-cart svg{ width:21px; height:21px; }

/* The badge sits on the icon, so it needs a fill that always contrasts with
   its own label rather than with the page. */
.wpr-cart__count{
  position:absolute; top:-5px; right:-5px;
  min-width:19px; height:19px; padding:0 5px; border-radius:999px;
  background:var(--accent2); color:var(--on-accent2);
  font-family:var(--sans); font-size:11px; font-weight:700; line-height:19px;
  text-align:center; box-shadow:0 0 0 2px var(--ink);
}
.wpr-cart__count[hidden]{ display:none; }

/* ---- drawer ---- */
.wpr-cartdrawer{ position:fixed; inset:0; z-index:9999; }
.wpr-cartdrawer[hidden]{ display:none; }
.wpr-cartdrawer__backdrop{
  position:absolute; inset:0; background:rgba(0,0,0,.42);
  opacity:0; transition:opacity .28s ease;
}
.wpr-cartdrawer__panel{
  position:absolute; top:0; right:0; height:100%;
  width:min(420px, 100vw);
  display:flex; flex-direction:column;
  background:var(--ink); border-left:1px solid var(--line);
  box-shadow:-18px 0 44px -20px rgba(0,0,0,.28);
  transform:translateX(100%); transition:transform .28s cubic-bezier(.22,1,.36,1);
}
/* is-open is added a frame after `hidden` is removed, so the panel has a
   position to animate FROM. Toggling both at once renders it already open. */
.wpr-cartdrawer.is-open .wpr-cartdrawer__backdrop{ opacity:1; }
.wpr-cartdrawer.is-open .wpr-cartdrawer__panel{ transform:translateX(0); }

.wpr-cartdrawer__head{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding:20px 22px; border-bottom:1px solid var(--line); flex-shrink:0;
}
.wpr-cartdrawer__title{
  margin:0; font-family:var(--serif); font-weight:400; color:var(--cream);
  font-size:calc(var(--ts,1) * 21px); letter-spacing:-0.01em;
}
.wpr-cartdrawer__close{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  border:1px solid var(--line); background:var(--ink2); color:var(--cream); cursor:pointer;
}
.wpr-cartdrawer__close:hover{ border-color:var(--accent); color:var(--accent-dk); }
.wpr-cartdrawer__close:focus-visible{ outline:2px solid var(--focus, var(--accent)); outline-offset:2px; }
.wpr-cartdrawer__body{ flex:1; overflow-y:auto; padding:20px 22px 26px; }

/* ---- mini cart contents ----
   Woo’s mini-cart markup, mapped onto theme tokens. Scoped inside the drawer so
   it cannot affect a mini-cart widget placed elsewhere. */
.wpr-cartdrawer .woocommerce-mini-cart{ list-style:none; margin:0; padding:0; }
/* Woo’s row is <a.remove> + <a>(img + name) + <span.quantity>, so the image is
   NOT a child of the row — it is nested inside the product link. Grid placement
   on the img therefore does nothing; the link itself has to be the flex row.
   The remove button stays absolutely positioned (Woo’s own default) with the
   row reserving right padding for it. */
/* The row selector carries ul.product_list_widget and li deliberately.
   WooCommerce’s own sheet has `.woocommerce ul.cart_list li` at (0,2,2), which
   out-specifies a plain `.wpr-cartdrawer .woocommerce-mini-cart-item` at
   (0,2,0) and reset padding to `4px 0`. That took away the right-hand gutter
   this row reserves for the remove button, so a product name long enough to
   fill the row ran underneath it. (0,3,2) wins it back. */
.wpr-cartdrawer ul.product_list_widget li.woocommerce-mini-cart-item{
  position:relative; display:block;
  padding:16px 34px 16px 0; margin:0;
  border-bottom:1px solid var(--line);
}
.wpr-cartdrawer .woocommerce-mini-cart-item > a:not(.remove){
  display:flex; align-items:center; gap:12px;
  color:var(--cream); text-decoration:none; font-weight:600; font-size:15px; line-height:1.4;
  /* Belt as well as braces: a flex item will not shrink below its content
     without this, so a long unbroken name would overflow the row even with
     the gutter above restored. */
  min-width:0; overflow-wrap:anywhere;
}
.wpr-cartdrawer .woocommerce-mini-cart-item > a:not(.remove):hover{ color:var(--accent-dk); }
.wpr-cartdrawer .woocommerce-mini-cart-item > a:not(.remove) img{
  width:56px; height:56px; object-fit:cover; border-radius:10px;
  flex-shrink:0; margin:0; float:none;
}
.wpr-cartdrawer .woocommerce-mini-cart-item .quantity{
  display:block; margin:6px 0 0 68px; color:var(--dim); font-size:14px;
}
/* Variable products carry their chosen attributes as a <dl class=”variation”>
   between the name and the quantity. Nothing here styled it, so it fell back
   to the page’s own dl/paragraph spacing: a floated term, a 40px indent and
   16px above and below every value. Two attributes took the row from 112px to
   224px — a two-line product filled the drawer. Laid out as wrapped pairs at
   the drawer’s own text size, the same two attributes cost one short line.
   Indented to 68px so it lines up with the name and the quantity above and
   below it. */
.wpr-cartdrawer .woocommerce-mini-cart-item dl.variation{
  display:flex; flex-wrap:wrap; gap:0 4px;
  margin:5px 0 0 68px; padding:0; border:0;
  font-size:13px; line-height:1.4; color:var(--dim);
}
.wpr-cartdrawer .woocommerce-mini-cart-item dl.variation dt{
  float:none; clear:none; margin:0; padding:0;
  font-size:inherit; font-weight:600;
}
.wpr-cartdrawer .woocommerce-mini-cart-item dl.variation dd{
  margin:0 10px 0 0; padding:0; font-size:inherit;
}
.wpr-cartdrawer .woocommerce-mini-cart-item dl.variation dd :is(p,span){
  margin:0; padding:0; font-size:inherit; line-height:inherit;
}
/* The one place this sheet needs !important: WooCommerce paints a.remove
   `color:var(--wc-red)!important`, and nothing but !important beats that. The
   result was a bare red x on a chip the theme had already styled. */
.wpr-cartdrawer .woocommerce-mini-cart-item .remove_from_cart_button{
  position:absolute; top:16px; right:0; left:auto; margin:0;
  width:26px; height:26px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--ink3); color:var(--dim)!important; font-size:15px; text-decoration:none;
  line-height:1; font-weight:400;
}
.wpr-cartdrawer .woocommerce-mini-cart-item .remove_from_cart_button:hover{
  background:var(--accent2); color:var(--on-accent2)!important;
}
.wpr-cartdrawer .woocommerce-mini-cart__total{
  display:flex; align-items:baseline; justify-content:space-between; gap:14px;
  margin:20px 0 0; padding-top:18px; border-top:1px solid var(--line);
  font-size:15px; color:var(--dim);
}
.wpr-cartdrawer .woocommerce-mini-cart__total strong{ color:var(--cream); font-weight:600; }
/* WooCommerce's "(incl. tax)" after the subtotal, on shops that show prices
   with tax: under the amount, like the total's note, not floating mid-row. */
.wpr-cartdrawer .woocommerce-mini-cart__total{ flex-wrap:wrap; row-gap:2px; }
.wpr-cartdrawer .woocommerce-mini-cart__total .tax_label{ flex-basis:100%; text-align:end; font-size:13px; color:var(--dim); }
.wpr-cartdrawer .woocommerce-mini-cart__total .amount{
  font-family:var(--serif); font-size:calc(var(--ts,1) * 22px); color:var(--cream);
}
/* Delivery and total under the subtotal (wpr_minicart_totals). The total
   matches the subtotal's weight so the two figures read as one column. */
.wpr-minitotals{ margin:10px 0 0; padding:0; display:grid; gap:8px; }
.wpr-minitotals__row{ display:flex; align-items:baseline; justify-content:space-between; gap:14px; margin:0; }
.wpr-minitotals dt{ font-size:15px; color:var(--dim); font-weight:400; margin:0; }
.wpr-minitotals dd{ margin:0; font-size:15px; color:var(--text); text-align:end; }
.wpr-minitotals__row--total{ padding-top:10px; border-top:1px solid var(--line); }
.wpr-minitotals__row--total dt{ color:var(--cream); font-weight:600; }
.wpr-minitotals__row--total dd .amount{
  font-family:var(--serif); font-size:calc(var(--ts,1) * 22px); color:var(--cream);
}
/* The "(incl. Rs 6 GST)" note under the total, when prices are
   shown with tax. Its own amount stays at note size, not the total's. */
.wpr-minitotals dd strong{ font-weight:inherit; }
.wpr-minitotals .includes_tax{ display:block; margin-top:2px; font-size:13px; color:var(--dim); }
.wpr-minitotals .includes_tax .amount{ font-family:inherit; font-size:inherit; color:inherit; }
.wpr-cartdrawer .woocommerce-mini-cart__buttons{
  display:flex; flex-direction:column; gap:10px; margin:20px 0 0; padding:0;
}
/* Both mini-cart buttons are <a>; the first is ”View cart” (quieter) and the
   checkout one is the primary action. */
.wpr-cartdrawer .woocommerce-mini-cart__buttons a{
  display:inline-flex; align-items:center; justify-content:center;
  padding:14px 24px; border-radius:999px; border:1px solid var(--line);
  background:transparent; color:var(--cream); text-decoration:none;
  font-family:var(--sans); font-weight:600; font-size:calc(var(--ts,1) * 15px); line-height:1;
}
.wpr-cartdrawer .woocommerce-mini-cart__buttons a:hover{ border-color:var(--cream); }
.wpr-cartdrawer .woocommerce-mini-cart__buttons a.checkout{
  background:var(--accent2); color:var(--on-accent2); border-color:transparent;
  box-shadow:0 8px 18px -12px var(--accent2-dk);
}
.wpr-cartdrawer .woocommerce-mini-cart__buttons a.checkout:hover{ background:var(--accent2-dk); color:var(--on-accent2-dk,var(--on-accent2)); }
.wpr-cartdrawer .woocommerce-mini-cart__empty-message{
  color:var(--dim); font-size:15px; margin:0;
}

@media (max-width:520px){
  .wpr-cartdrawer__panel{ width:100vw; }
}

/* The panel is a large moving surface; honour the same opt-out the rest of the
   theme’s motion respects. */
@media (prefers-reduced-motion: reduce){
  .wpr-cartdrawer__panel, .wpr-cartdrawer__backdrop{ transition:none; }
}

/* ---------- cross-sells in the drawer (T20) ----------
   A short list, not a grid: the drawer is one column and a two-up grid of
   tiles here would be two columns of about 120px each. */
.wpr-xsell{ margin:16px 0 0; padding-top:14px; border-top:1px solid var(--line); }
.wpr-xsell__head{
  margin:0 0 10px; font-family:var(--sans); font-size:13px; font-weight:700;
  letter-spacing:.04em; text-transform:uppercase; color:var(--dim);
}
.wpr-xsell__list{ list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.wpr-xsell__item{ margin:0; }
.wpr-xsell__link{
  display:flex; align-items:center; gap:10px; padding:6px; border-radius:10px;
  text-decoration:none; color:inherit; min-height:48px;
}
@media (hover:hover){ .wpr-xsell__link:hover{ background:var(--ink3); } }
.wpr-xsell__thumb{
  width:44px; height:44px; flex:0 0 auto; border-radius:8px; object-fit:cover; display:block;
}
.wpr-xsell__text{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.wpr-xsell__name{
  font-family:var(--sans); font-size:14px; font-weight:600; color:var(--cream);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wpr-xsell__price{ font-family:var(--sans); font-size:13px; color:var(--text); }
.wpr-xsell__price del{ display:none; }
.wpr-xsell__price ins{ text-decoration:none; background:transparent; color:var(--promo-text, inherit); }
