/*
 * Cart drawer + /cart fallback (2026-08 cart redesign).
 *
 * Ported from the approved mockup (artifact e423d775) — the checkout world:
 * white ground, #fafafa receipt panel, 1px hairlines, one action blue,
 * green strictly for free shipping, black CTA, no shadows (the scrim does
 * separation). Tokens are scoped to the cart roots so nothing bleeds into
 * the Divi-era CSS this theme carries.
 *
 * z-index: Divi's fixed header is 99999, so the scrim/drawer sit above it.
 */

.exd,
.exd-scrim,
.exd-cart-btn,
#exadry-cart-page-region {
  --ex-ink: #1a1a1a;
  --ex-ink-2: #585858;
  --ex-ink-3: #767676;
  --ex-blue: #1479c2;
  --ex-blue-deep: #0f65a3;
  --ex-green: #107a3d;
  --ex-green-deep: #0c5c2e;
  --ex-green-soft: #e7f3ec;
  --ex-green-track: #c8e2d2;
  --ex-error: #c62828;
  --ex-hair: #dedede;
  --ex-hair-2: #e9e9e9;
  --ex-panel: #fafafa;
  --ex-cta: #111111;
  --ex-radius: 8px;
  --ex-radius-lg: 12px;
  font-family: 'Raleway', -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* ============ header cart icon (replaces Divi's .et-cart-info) ============ */

#et-top-navigation .exd-cart-btn {
  float: left;
  margin: -10px 0 0 18px;
}
.exd-cart-btn {
  position: relative;
  display: inline-flex;
  padding: 8px;
  background: none;
  border: 0;
  border-radius: var(--ex-radius);
  color: #1a1a1a;
  cursor: pointer;
  line-height: 0;
}
.exd-cart-btn:hover { background: #f1f1f1; color: #1a1a1a; }
.exd-cart-btn:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: 2px; }
.exd-cart-btn svg { display: block; }
.exd-cart-count {
  position: absolute;
  top: 0;
  right: -2px;
  background: var(--ex-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
}
.exd-cart-count.pop { animation: exd-pop 0.35s cubic-bezier(0.22, 0.8, 0.36, 1); }
@keyframes exd-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}
.exd-cart-count[hidden] { display: none; }

@media (max-width: 980px) {
  #et-top-navigation .exd-cart-btn { margin: -3px 14px 0 6px; }
}

/* ============ scrim + drawer ============ */

.exd-scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100000;
}
.exd-scrim.show { opacity: 1; pointer-events: auto; }

.exd {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  background: #fff;
  border-left: 1px solid var(--ex-hair-2);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.36, 1), visibility 0s 0.32s;
  z-index: 100001;
  color: var(--ex-ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.exd:focus { outline: none; }
.exd.open { transform: none; visibility: visible; transition-delay: 0s, 0s; }
.exd * { box-sizing: border-box; }
.exd button { font-family: inherit; }
.exd img { max-width: 100%; }

.exd-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.exd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ex-hair-2);
  flex: none;
}
.exd-head h2 {
  margin: 0;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ex-ink);
  text-transform: none;
}
.exd-head-count {
  background: var(--ex-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
}
.exd-head-count[hidden] { display: none; }
.exd-close {
  position: relative;
  margin-left: auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: var(--ex-radius);
  color: var(--ex-ink);
  cursor: pointer;
}
.exd-close::after { content: ""; position: absolute; inset: -4px; }
.exd-close:hover { background: #f1f1f1; }
.exd-close:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: 2px; }

.exd-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--ex-hair) transparent;
}
.exd-body::-webkit-scrollbar { width: 8px; }
.exd-body::-webkit-scrollbar-thumb { background: var(--ex-hair); border-radius: 999px; }

/* Entrance stagger — the drawer's one authored motion moment. */
.exd.open .exd-body > * { animation: exd-rise 0.4s cubic-bezier(0.22, 0.8, 0.36, 1) both; }
.exd.open .exd-body > *:nth-child(2) { animation-delay: 0.05s; }
.exd.open .exd-body > *:nth-child(3) { animation-delay: 0.1s; }
@keyframes exd-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---- error note (stock/validation refusals) ---- */
.exd-note {
  flex: none;
  order: -1;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--ex-radius);
  background: #fbecec;
  color: var(--ex-error);
  font-size: 13px;
  font-weight: 600;
}

/* ---- free-shipping meter ---- */
.exd-meter {
  background: var(--ex-green-soft);
  border-radius: var(--ex-radius);
  padding: 12px 14px;
  flex: none;
}
.exd-meter-copy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ex-green-deep);
  line-height: 1.45;
}
.exd-meter-copy svg { flex: none; color: var(--ex-green); margin-top: 1px; }
.exd-meter-copy strong { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exd-meter-track {
  margin-top: 9px;
  height: 5px;
  background: var(--ex-green-track);
  border-radius: 999px;
  overflow: hidden;
}
.exd-meter-fill {
  height: 100%;
  width: 100%;
  background: var(--ex-green);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s cubic-bezier(0.22, 0.8, 0.36, 1);
}

/* ---- items ---- */
.exd-items { margin-top: 6px; }
.exd-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--ex-hair-2);
}
.exd-item:first-child { border-top: 0; padding-top: 12px; }
.exd-thumb {
  flex: none;
  width: 60px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--ex-hair);
  border-radius: var(--ex-radius);
  overflow: hidden;
  background: #fff;
}
.exd-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.exd-item-mid { flex: 1; min-width: 0; }
.exd-item-name { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ex-ink); }
.exd-item-name a { color: inherit; text-decoration: none; }
.exd-item-name a:hover { text-decoration: underline; text-underline-offset: 2px; }
.exd-item-meta { font-size: 12.5px; color: var(--ex-ink-2); margin-top: 2px; }
.exd-item-ctl { margin-top: 10px; display: flex; align-items: center; gap: 14px; }
.exd-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ex-hair);
  border-radius: 999px;
  height: 34px;
}
.exd-qty button {
  position: relative;
  width: 38px;
  height: 32px;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--ex-ink-2);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
/* Invisible hit-area extension — 44px touch floor without visual bulk. */
.exd-qty button::after { content: ""; position: absolute; inset: -6px -3px; }
.exd-qty button:hover { color: var(--ex-ink); background: none; }
.exd-qty button:disabled { color: var(--ex-hair); cursor: default; }
.exd-qty button:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: -2px; border-radius: 999px; }
.exd-qty-n {
  min-width: 22px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
a.exd-remove {
  position: relative;
  background: none;
  border: 0;
  padding: 12px 6px;
  margin: -12px -6px;
  font-size: 12.5px;
  color: var(--ex-ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
a.exd-remove::after { content: ""; position: absolute; inset: -3px 0; }
a.exd-remove:hover { color: var(--ex-ink); }
.exd-item-price {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- upsell ---- */
.exd-up { margin-top: 8px; flex: none; }
.exd-up-h { margin: 0 0 10px; padding: 0; font-size: 13.5px; font-weight: 600; color: var(--ex-ink); }
.exd-up-group {
  border: 1px solid var(--ex-hair);
  border-radius: var(--ex-radius-lg);
  overflow: hidden;
  background: #fff;
}
.exd-up-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--ex-hair);
}
.exd-up-row:first-child { border-top: 0; }
.exd-up-thumb {
  flex: none;
  width: 42px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--ex-hair);
  border-radius: 6px;
  overflow: hidden;
}
.exd-up-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.exd-up-text { flex: 1; min-width: 0; }
.exd-up-t { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--ex-ink); }
.exd-up-m { display: block; font-size: 12px; color: var(--ex-ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.exd-up-add {
  position: relative;
  flex: none;
  background: var(--ex-blue);
  color: #fff;
  border: 0;
  border-radius: var(--ex-radius);
  font-size: 13px;
  font-weight: 600;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.exd-up-add::after { content: ""; position: absolute; inset: -3px 0; }
.exd-up-add:hover { background: var(--ex-blue-deep); color: #fff; }
.exd-up-add:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: 2px; }

/* ---- empty state ---- */
.exd-empty { margin: auto; text-align: center; padding: 40px 30px; }
.exd-empty svg { color: var(--ex-ink-3); }
.exd-empty h3 { margin: 14px 0 0; padding: 0; font-size: 17px; font-weight: 700; color: var(--ex-ink); text-transform: none; }
.exd-empty p { margin: 6px 0 0; padding: 0; font-size: 13.5px; color: var(--ex-ink-2); line-height: 1.55; }
a.exd-empty-cta {
  display: inline-block;
  margin-top: 18px;
  padding: 14px 24px;
  background: var(--ex-cta);
  color: #fff;
  border: 0;
  border-radius: var(--ex-radius);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
a.exd-empty-cta:hover { background: #000; color: #fff; }
a.exd-empty-cta:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: 3px; }

/* ---- footer ---- */
.exd-foot {
  flex: none;
  border-top: 1px solid var(--ex-hair-2);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--ex-panel);
}
.exd-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.exd-sub-lbl { font-size: 17px; font-weight: 700; color: var(--ex-ink); }
.exd-sub-note { font-size: 12px; color: var(--ex-ink-3); margin-top: 2px; }
.exd-sub-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ex-ink); }
a.exd-cta {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 16px 20px;
  background: var(--ex-cta);
  color: #fff;
  border: 0;
  border-radius: var(--ex-radius);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
a.exd-cta:hover { background: #000; color: #fff; }
a.exd-cta:active { transform: scale(0.995); }
a.exd-cta:focus-visible { outline: 2px solid var(--ex-blue); outline-offset: 3px; }
.exd-trust {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ex-ink-2);
}
.exd-trust div { display: flex; align-items: flex-start; gap: 9px; }
.exd-trust svg { flex: none; color: var(--ex-ink-3); margin-top: 1px; }
.exd-trust strong { color: var(--ex-ink); font-weight: 600; }
.exd-foot-row {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.exd-chips { display: flex; gap: 6px; }
.exd-chip {
  height: 24px;
  min-width: 38px;
  padding: 0 5px;
  border: 1px solid var(--ex-hair);
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exd-chip svg { display: block; }
.exd-continue {
  position: relative;
  background: none;
  border: 0;
  padding: 12px 10px;
  margin: -8px 0 -6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ex-blue);
  text-decoration: none;
  cursor: pointer;
}
.exd-continue::after { content: ""; position: absolute; inset: -3px 0; }
.exd-continue:hover { color: var(--ex-blue-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ============ /cart fallback page ============ */

/* page.php prints the stored page title; the region carries its own H1. */
body.woocommerce-cart .entry-title.main_title { display: none; }

#exadry-cart-page-region { color: var(--ex-ink); font-size: 15px; line-height: 1.5; }
#exadry-cart-page-region * { box-sizing: border-box; }
#exadry-cart-page-region .exp-main { max-width: 560px; margin: 0 auto; padding: 26px 20px 70px; }
#exadry-cart-page-region h1 {
  margin: 0;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ex-ink);
  text-transform: none;
}
.exp-count { font-size: 14px; font-weight: 400; color: var(--ex-ink-2); }
.exp-cart { margin-top: 18px; }
.exp-cart .exd-meter { margin-top: 0; }
.exp-foot {
  margin: 8px -20px 0;
  border-top: 1px solid var(--ex-hair-2);
  padding: 16px 20px;
  background: var(--ex-panel);
}

/* ============ utilities ============ */

html.exd-lock { overflow: hidden; }

.exd .sr-only,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .exd, .exd-scrim, .exd-meter-fill { transition: none; }
  .exd.open .exd-body > * { animation: none; }
  .exd-cart-count.pop { animation: none; }
}
