/* ============================================================
 * iNPLANT — Cart Drawer
 * ------------------------------------------------------------
 * Modern, accessible, square-edged Shopify Storefront cart drawer.
 *
 * - Right-slide panel on >= 768px (max-width 420px).
 * - Full-screen sheet on < 768px (slides in from bottom or right
 *   depending on viewport orientation; we use right for layout
 *   continuity with desktop).
 * - CSS custom properties expose every accent color so the theme
 *   (Tailwind brand tokens) can override at the document level.
 * - Honors prefers-reduced-motion.
 * - Refined modern radii (10px on primary action buttons, 8px on
 *   small icon controls). Floating cart FAB stays a pill — that's
 *   the one well-known UX pattern where pill shape is correct.
 * ============================================================ */

#ip-cart-drawer {
  /* Brand tokens (overridable by the global theme). */
  --ip-cd-navy:        #1D4999;
  --ip-cd-navy-hover:  #15387A;
  --ip-cd-black:       #000000;
  --ip-cd-text:        #1f2937;
  --ip-cd-muted:       #6b7280;
  --ip-cd-bg:          #ffffff;
  --ip-cd-surface:     #f8fafc;
  --ip-cd-border:      #e5e7eb;
  --ip-cd-border-soft: #f1f5f9;
  --ip-cd-danger:      #b91c1c;
  --ip-cd-danger-bg:   #fee2e2;
  --ip-cd-focus:       #2563eb;
  --ip-cd-shadow:      0 24px 48px -12px rgba(15, 23, 42, .28);

  /* Layout. */
  --ip-cd-width:       420px;
  --ip-cd-z-overlay:   2147483000;
  --ip-cd-z-drawer:    2147483100;
  --ip-cd-z-fab:       2147482900;
  --ip-cd-z-toast:     2147483200;

  /* Motion. */
  --ip-cd-ease:        cubic-bezier(.22, .61, .36, 1);
  --ip-cd-dur:         250ms;
}

/* ── Overlay ────────────────────────────────────────────────── */
.ip-cd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ip-cd-dur) var(--ip-cd-ease);
  z-index: var(--ip-cd-z-overlay);
}
.ip-cd-overlay[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer panel ───────────────────────────────────────────── */
.ip-cd-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  height: 100dvh;
  width: var(--ip-cd-width);
  max-width: 100vw;
  background: var(--ip-cd-bg);
  color: var(--ip-cd-text);
  box-shadow: var(--ip-cd-shadow);
  transform: translateX(100%);
  transition: transform var(--ip-cd-dur) var(--ip-cd-ease);
  z-index: var(--ip-cd-z-drawer);
  display: flex;
  flex-direction: column;
  font-family: inherit;
  /* iOS safe-area padding for the bottom region. */
  padding-block-end: env(safe-area-inset-bottom, 0px);
}
.ip-cd-drawer[data-open="true"] {
  transform: translateX(0);
}
@media (max-width: 767.98px) {
  .ip-cd-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ── Header ─────────────────────────────────────────────────── */
.ip-cd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-block-end: 1px solid var(--ip-cd-border);
}
.ip-cd-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ip-cd-navy);
}
.ip-cd-close {
  appearance: none;
  /* Glass + outline (Tier-3 icon button) */
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(29, 73, 153, 0.30);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ip-cd-navy);
  cursor: pointer;
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background-color .2s ease, border-color .2s ease,
              color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ip-cd-close:hover,
.ip-cd-close:focus-visible {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(29, 73, 153, 0.55);
  color: var(--ip-cd-navy);
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px -4px rgba(29, 73, 153, 0.20),
    0 2px 4px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.ip-cd-close:focus-visible {
  outline: 2px solid var(--ip-cd-focus);
  outline-offset: 2px;
}

/* ── Body ───────────────────────────────────────────────────── */
.ip-cd-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 20px;
  -webkit-overflow-scrolling: touch;
}
.ip-cd-empty {
  text-align: center;
  color: var(--ip-cd-muted);
  padding: 64px 16px;
  font-size: .9375rem;
  line-height: 1.5;
}
.ip-cd-empty strong {
  display: block;
  color: var(--ip-cd-text);
  font-weight: 600;
  font-size: 1rem;
  margin-block-end: 6px;
}

/* ── Line items ─────────────────────────────────────────────── */
.ip-cd-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  padding: 16px 0;
  border-block-end: 1px solid var(--ip-cd-border-soft);
  align-items: start;
}
.ip-cd-line:last-child {
  border-block-end: 0;
}
.ip-cd-line-thumb,
.ip-cd-line-noimg {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--ip-cd-surface);
  border: 1px solid var(--ip-cd-border-soft);
}
.ip-cd-line-noimg {
  display: inline-block;
}
.ip-cd-line-info {
  min-width: 0;
}
.ip-cd-line-name {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: .9375rem;
  line-height: 1.35;
  color: var(--ip-cd-text);
}
.ip-cd-line-price {
  color: var(--ip-cd-muted);
  font-size: .8125rem;
  margin-block-end: 8px;
}
.ip-cd-line-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ip-cd-qty-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ip-cd-border);
  border-radius: 8px;
  background: var(--ip-cd-bg);
  color: var(--ip-cd-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.ip-cd-qty-btn:hover,
.ip-cd-qty-btn:focus-visible {
  background: var(--ip-cd-surface);
  border-color: var(--ip-cd-navy);
}
.ip-cd-qty-btn:focus-visible {
  outline: 2px solid var(--ip-cd-focus);
  outline-offset: 1px;
}
.ip-cd-qty-btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}
.ip-cd-qty-val {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--ip-cd-text);
}
.ip-cd-line-remove {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ip-cd-muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}
.ip-cd-line-remove:hover,
.ip-cd-line-remove:focus-visible {
  background: var(--ip-cd-danger-bg);
  color: var(--ip-cd-danger);
}
.ip-cd-line-remove:focus-visible {
  outline: 2px solid var(--ip-cd-focus);
  outline-offset: 1px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.ip-cd-foot {
  padding: 16px 20px 20px;
  border-block-start: 1px solid var(--ip-cd-border);
  background: var(--ip-cd-surface);
}
.ip-cd-foot[hidden] {
  display: none;
}
.ip-cd-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: var(--ip-cd-navy);
  font-size: .9375rem;
  margin-block-end: 4px;
}
.ip-cd-subtotal-val {
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}
.ip-cd-foot-note {
  color: var(--ip-cd-muted);
  font-size: .75rem;
  margin: 0 0 14px;
  line-height: 1.4;
}
.ip-cd-checkout,
.ip-cd-checkout:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--ip-cd-black);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: .9375rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06),
              0 1px 3px rgba(15, 23, 42, 0.10);
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ip-cd-checkout:hover,
.ip-cd-checkout:focus-visible {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.08),
              0 2px 4px rgba(15, 23, 42, 0.06);
}
.ip-cd-checkout:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.ip-cd-checkout:focus-visible {
  outline: 2px solid var(--ip-cd-focus);
  outline-offset: 2px;
}
.ip-cd-checkout[aria-disabled="true"] {
  opacity: .6;
  pointer-events: none;
}

/* ── Floating cart pill (FAB) ───────────────────────────────── */
.ip-cd-fab {
  position: fixed;
  inset-block-end: max(24px, env(safe-area-inset-bottom, 0px));
  inset-inline-end: 24px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--ip-cd-navy);
  color: #fff;
  font-weight: 700;
  font-size: .875rem;
  font-family: inherit;
  border: 0;
  border-radius: 999px; /* the ONE pill exception — well-known UX pattern */
  cursor: pointer;
  box-shadow: 0 12px 24px -10px rgba(29, 73, 153, .55);
  z-index: var(--ip-cd-z-fab);
  transition: transform .2s var(--ip-cd-ease), background-color .15s ease;
}
.ip-cd-fab[data-show="true"] {
  display: inline-flex;
}
.ip-cd-fab:hover {
  background: var(--ip-cd-navy-hover);
  transform: translateY(-2px);
}
.ip-cd-fab:focus-visible {
  outline: 2px solid var(--ip-cd-focus);
  outline-offset: 3px;
}
.ip-cd-fab svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.ip-cd-fab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #fff;
  color: var(--ip-cd-navy);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  .ip-cd-fab {
    inset-inline-end: 16px;
    inset-block-end: max(16px, env(safe-area-inset-bottom, 0px));
  }
}

/* ── Spinner ────────────────────────────────────────────────── */
.ip-cd-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ip-cd-spin .75s linear infinite;
  vertical-align: middle;
}
@keyframes ip-cd-spin {
  to { transform: rotate(360deg); }
}

/* ── Toast (error / status announcements) ───────────────────── */
.ip-cd-toast {
  position: fixed;
  inset-block-start: 20px;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  background: var(--ip-cd-text);
  color: #fff;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--ip-cd-shadow);
  z-index: var(--ip-cd-z-toast);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .2s var(--ip-cd-ease), transform .2s var(--ip-cd-ease);
}
.ip-cd-toast[data-show="true"] {
  opacity: 1;
  transform: translateY(0);
}
.ip-cd-toast[data-variant="error"] {
  background: var(--ip-cd-danger);
}

/* ── Visually-hidden helper (live region) ───────────────────── */
.ip-cd-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;
}

/* ── Per-product Buy Now / Add buttons (on the order page) ──── */
.ip-buy-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  max-width: 320px;
  margin-inline: auto;
}
/* Tier-1 — Buy Now: solid black + glow harmony (navy halo on hover so it
   reads with the .btn-outline family). */
.ip-buy-now,
.ip-buy-now:visited {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--ip-cd-black, #000);
  color: #fff;
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 500;
  font-size: .9375rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 0 0 0 rgba(29, 73, 153, 0);
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ip-buy-now:hover:not([disabled]),
.ip-buy-now:focus-visible {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 12px rgba(0, 0, 0, 0.22),
    0 0 0 4px rgba(29, 73, 153, 0.18);
}
.ip-buy-now:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 1px 2px rgba(0, 0, 0, 0.18);
}
.ip-buy-now:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff,
              0 0 0 4px #000,
              0 1px 2px rgba(15, 23, 42, 0.06);
}
.ip-buy-now[disabled] {
  opacity: .5;
  cursor: progress;
  pointer-events: none;
}
.ip-buy-now svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

/* Tier-3 — Add to cart icon: outline + glass (was solid navy). */
.ip-add-cart,
.ip-add-cart:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  color: var(--ip-cd-navy, #1D4999);
  border: 1px solid rgba(29, 73, 153, 0.30);
  border-radius: 10px;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background-color .2s ease, border-color .2s ease,
              color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ip-add-cart:hover:not([disabled]),
.ip-add-cart:focus-visible {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(29, 73, 153, 0.55);
  color: var(--ip-cd-navy, #1D4999);
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px -4px rgba(29, 73, 153, 0.20),
    0 2px 4px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.ip-add-cart:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.ip-add-cart:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff,
              0 0 0 4px var(--ip-cd-navy, #1D4999),
              0 1px 2px rgba(15, 23, 42, 0.06);
}
.ip-add-cart[disabled] {
  opacity: .5;
  cursor: progress;
  pointer-events: none;
}
.ip-add-cart svg {
  width: 20px;
  height: 20px;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ip-cd-overlay,
  .ip-cd-drawer,
  .ip-cd-fab,
  .ip-cd-toast,
  .ip-cd-checkout,
  .ip-buy-now,
  .ip-add-cart,
  .ip-cd-qty-btn,
  .ip-cd-line-remove,
  .ip-cd-close {
    transition: none !important;
  }
  .ip-cd-spinner {
    animation-duration: 1.5s;
  }
}
