/**
 * Kaiko Mini-Cart — toast, header badge pulse, slide-out drawer
 * Lifted from kaiko-cart-concept.html (Scene 1).
 */

:root {
  --k-gold:       #c89b3c;
  --k-success:    #0f7a4a;
  --k-success-bg: #ecfdf5;
  --k-r-sm: 8px;
  --k-r-md: 12px;
  --k-r-lg: 18px;
  --k-shadow-md: 0 8px 24px rgba(28,25,23,0.08);
  --k-shadow-lg: 0 24px 60px rgba(28,25,23,0.18);
  --k-shadow-xl: 0 40px 90px rgba(28,25,23,0.22);
}


/* ===========================
   HEADER CART BUTTON + BADGE PULSE
   =========================== */

.kaiko-nav-cart-wrap {
  display: inline-flex;
  align-items: center;
}

/*
 * Header cart BUTTON styling lives in kaiko-shell.css (§"Cart icon in nav").
 * This stylesheet used to own `.kaiko-nav .kaiko-nav-cart` too, but the dark
 * pill background here collided with shell's `color: var(--kaiko-dark)!important`
 * on pages where both stylesheets loaded against the Kaiko header (e.g.
 * /checkout/), producing a dark-icon-on-dark-pill "blob". The mini-cart
 * drawer has no `.kaiko-nav-cart` element of its own, so this isn't the
 * right file for it. Only the count badge + pulse animation stay here.
 */

.kaiko-nav-cart-count {
  background: var(--kaiko-lime);
  color: var(--kaiko-dark);
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 4px;
}

.kaiko-nav-cart-count.just-added {
  animation: kaikoBadgePop 600ms cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes kaikoBadgePop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); background: var(--k-gold); }
  100% { transform: scale(1); background: var(--kaiko-lime); }
}


/* ===========================
   TOAST
   =========================== */

.kaiko-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-40px);
  background: var(--kaiko-dark);
  color: var(--kaiko-white);
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  box-shadow: var(--k-shadow-lg);
  font-family: var(--kaiko-font-body);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(.34, 1.56, .64, 1),
              transform 320ms cubic-bezier(.34, 1.56, .64, 1);
  z-index: 2000;
  max-width: calc(100vw - 32px);
}

.kaiko-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.kaiko-toast__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--kaiko-lime);
  color: var(--kaiko-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.admin-bar .kaiko-toast {
  top: calc(100px + 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .kaiko-toast {
    top: calc(100px + 46px);
  }
}


/* ===========================
   DRAWER BACKDROP
   =========================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
  z-index: 2100;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}


/* ===========================
   DRAWER
   =========================== */

.kaiko-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background: var(--kaiko-white);
  box-shadow: var(--k-shadow-xl);
  transform: translateX(100%);
  transition: transform 360ms cubic-bezier(.22, 1, .36, 1);
  z-index: 2110;
  display: flex;
  flex-direction: column;
  font-family: var(--kaiko-font-body);
  color: var(--kaiko-dark);
}

.kaiko-drawer.is-open {
  transform: translateX(0);
}

.kaiko-drawer__head {
  padding: 22px 26px;
  border-bottom: 1px solid var(--kaiko-border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.kaiko-drawer__head__badge {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--k-success-bg);
  color: var(--k-success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kaiko-drawer__head__title {
  font-family: var(--kaiko-font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}

.kaiko-drawer__head__meta {
  display: block;
  font-family: var(--kaiko-font-body);
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--kaiko-mid-gray);
  margin-top: 2px;
}

body.kaiko-page .kaiko-drawer__close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--kaiko-border);
  border-radius: var(--k-r-md);
  background: var(--kaiko-white);
  color: var(--kaiko-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms ease;
  flex-shrink: 0;
}

body.kaiko-page .kaiko-drawer__close:hover,
body.kaiko-page .kaiko-drawer__close:focus-visible {
  border-color: var(--kaiko-dark);
}

.kaiko-drawer__close svg {
  display: block;
  width: 20px;
  height: 20px;
  color: inherit;
}

.kaiko-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px;
}

.kaiko-drawer__empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--kaiko-mid-gray);
}

.kaiko-drawer__empty p {
  margin: 0 0 16px;
}


/* ---- Line items ---- */

.kaiko-drawer__item {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr auto 28px;
  gap: 12px 10px;
  padding: 16px 4px;
  border-bottom: 1px solid #f5f5f4;
  transition: opacity 220ms ease, transform 220ms ease;
}

.kaiko-drawer__item.is-removing {
  opacity: 0;
  transform: translateX(-18px);
  pointer-events: none;
}

.kaiko-drawer__item__body {
  min-width: 0;
}

.kaiko-drawer__item:last-child {
  border-bottom: 0;
}

.kaiko-drawer__item.just-added {
  animation: kaikoItemFlash 1200ms ease;
}

@keyframes kaikoItemFlash {
  0%   { background: rgba(184, 212, 53, 0.24); }
  100% { background: transparent; }
}

.kaiko-drawer__thumb {
  width: 72px;
  height: 72px;
  background: var(--kaiko-off-white);
  border-radius: var(--k-r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kaiko-drawer__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kaiko-drawer__title {
  font-family: var(--kaiko-font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--kaiko-dark);
  line-height: 1.3;
  margin-bottom: 4px;
}

.kaiko-drawer__title a {
  color: inherit;
  text-decoration: none;
}

.kaiko-drawer__title a:hover {
  color: var(--kaiko-teal);
}

.kaiko-drawer__meta {
  font-size: 0.76rem;
  color: var(--kaiko-mid-gray);
  margin-bottom: 8px;
}

.kaiko-drawer__meta span:not(:last-child)::after {
  content: "·";
  margin: 0 6px;
  color: var(--kaiko-light-gray);
}

.kaiko-drawer__tier-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(26, 92, 82, 0.08);
  color: var(--kaiko-teal);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kaiko-drawer__right {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
}

.kaiko-drawer__line-total {
  font-family: var(--kaiko-font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--kaiko-dark);
  line-height: 1.2;
}

.kaiko-drawer__unit {
  font-size: 0.72rem;
  color: var(--kaiko-mid-gray);
}

.kaiko-drawer__qtymini {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--kaiko-border);
  border-radius: var(--k-r-sm);
  overflow: hidden;
  background: var(--kaiko-white);
}

.kaiko-drawer__qtymini button {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--kaiko-dark);
  font-family: var(--kaiko-font-body);
  font-weight: 600;
  transition: background 180ms ease;
}

.kaiko-drawer__qtymini button:hover {
  background: var(--kaiko-off-white);
}

.kaiko-drawer__qtymini button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kaiko-drawer__qtymini .q {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0 4px;
}

.kaiko-drawer__qtymini.is-busy {
  opacity: 0.6;
  pointer-events: none;
}


/* ---- Progress bar ---- */

.kaiko-drawer__progress {
  margin: 18px 4px 4px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(26, 92, 82, 0.05), rgba(184, 212, 53, 0.06));
  border: 1px solid rgba(26, 92, 82, 0.12);
  border-radius: var(--k-r-md);
}

.kaiko-drawer__progress__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--kaiko-dark);
  margin-bottom: 8px;
}

.kaiko-drawer__progress__row small {
  color: var(--kaiko-mid-gray);
  font-weight: 500;
}

.kaiko-drawer__progress__bar {
  height: 6px;
  background: var(--kaiko-border);
  border-radius: 999px;
  overflow: hidden;
}

.kaiko-drawer__progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--kaiko-teal), var(--kaiko-lime));
  border-radius: 999px;
  transition: width 420ms ease;
}


/* ---- Foot / CTAs ---- */

.kaiko-drawer__foot {
  padding: 18px 22px 24px;
  border-top: 1px solid var(--kaiko-border);
  background: var(--kaiko-white);
}

.kaiko-drawer__subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.kaiko-drawer__subtotal span:first-child {
  font-size: 0.84rem;
  color: var(--kaiko-dark);
  font-weight: 600;
}

.kaiko-drawer__subtotal span:last-child {
  font-family: var(--kaiko-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--kaiko-dark);
}

.kaiko-drawer__tax {
  font-size: 0.74rem;
  color: var(--kaiko-mid-gray);
  margin: 0 0 14px;
}

.kaiko-drawer__ctas {
  display: grid;
  gap: 10px;
}

.kaiko-drawer__ctas .btn {
  height: 52px;
  border-radius: var(--k-r-md);
  font-family: var(--kaiko-font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  text-decoration: none;
}

.kaiko-drawer__ctas .btn--primary {
  background: var(--kaiko-teal);
  color: var(--kaiko-white);
}

.kaiko-drawer__ctas .btn--primary:hover,
.kaiko-drawer__ctas .btn--primary:focus-visible {
  background: var(--kaiko-deep-teal);
  color: var(--kaiko-white);
}

.kaiko-drawer__ctas .btn--ghost {
  background: transparent;
  color: var(--kaiko-dark);
  border: 1.5px solid var(--kaiko-light-gray);
}

.kaiko-drawer__ctas .btn--ghost:hover,
.kaiko-drawer__ctas .btn--ghost:focus-visible {
  border-color: var(--kaiko-dark);
  color: var(--kaiko-dark);
}

.kaiko-drawer__reassure {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--kaiko-mid-gray);
}

.kaiko-drawer__reassure span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kaiko-drawer__reassure svg {
  color: var(--kaiko-teal);
}


/* ===========================
   BODY SCROLL LOCK
   =========================== */

body.kaiko-cart-open {
  overflow: hidden;
}


/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 480px) {
  .kaiko-drawer {
    max-width: 100%;
  }

  .kaiko-drawer__head {
    padding: 18px 20px;
  }

  .kaiko-drawer__body {
    padding: 12px 16px;
  }

  .kaiko-drawer__foot {
    padding: 16px 20px 20px;
  }

  .kaiko-toast {
    font-size: 0.82rem;
    padding: 12px 18px 12px 14px;
    top: 84px;
  }
}


/* ===========================
   REDUCED MOTION
   =========================== */

@media (prefers-reduced-motion: reduce) {
  .kaiko-drawer,
  .drawer-backdrop,
  .kaiko-toast,
  .kaiko-drawer__progress__fill {
    transition-duration: 0ms;
  }

  .kaiko-nav-cart-count.just-added,
  .kaiko-drawer__item.just-added {
    animation: none;
  }

  .kaiko-drawer__item,
  .kaiko-undo-toast,
  .kaiko-drawer__body.is-emptying {
    transition-duration: 0ms;
  }
}


/* ============================================================
   SHARED TIER CHIP + NUDGE
   Used by BOTH the cart page (body.kaiko-cart-page) AND the mini-cart
   drawer. Lives in this file (which is enqueued sitewide) because the
   drawer renders on every page. Compact variant tightens padding +
   font-size for the drawer's narrower body column.
   ============================================================ */

.kaiko-tier-applied {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin-top: 6px;
  background: rgba(26, 92, 82, 0.08);
  color: var(--kaiko-teal);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.kaiko-tier-applied svg {
  color: var(--kaiko-teal);
}

.kaiko-tier-nudge {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(184, 212, 53, 0.08), rgba(26, 92, 82, 0.05));
  border: 1px dashed rgba(26, 92, 82, 0.25);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.76rem;
  color: var(--kaiko-deep-teal);
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: all 180ms ease;
}

.kaiko-tier-nudge:hover,
.kaiko-tier-nudge:focus-visible {
  background: linear-gradient(180deg, rgba(184, 212, 53, 0.15), rgba(26, 92, 82, 0.08));
  border-color: var(--kaiko-teal);
  outline: none;
}

.kaiko-tier-nudge strong {
  color: var(--kaiko-teal);
}

/* Compact modifier — live inside .kaiko-drawer. Wrap is intentional. */
.kaiko-tier-nudge--compact {
  margin-top: 6px;
  padding: 6px 9px;
  font-size: 0.7rem;
  line-height: 1.3;
  white-space: normal;
}

/* Drawer-scoped chip sizing — narrower column, tighter copy. */
.kaiko-drawer .kaiko-tier-applied {
  margin-top: 4px;
  padding: 3px 8px;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}

.kaiko-drawer .kaiko-tier-applied svg {
  width: 9px;
  height: 9px;
}


/* ============================================================
   DRAWER × REMOVE BUTTON
   ============================================================ */

body.kaiko-page .kaiko-drawer__item__remove {
  align-self: start;
  justify-self: end;
  margin-top: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--kaiko-border);
  background: var(--kaiko-white);
  color: var(--kaiko-mid-gray);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

body.kaiko-page .kaiko-drawer__item__remove:hover,
body.kaiko-page .kaiko-drawer__item__remove:focus-visible {
  color: #c0392b;
  background: #fef3f2;
  border-color: #c0392b;
  outline: none;
}


/* ============================================================
   DRAWER EMPTY-STATE TRANSITION
   When the final line is removed we fade the body before the
   fragment swap replaces it with the empty-state markup.
   ============================================================ */

.kaiko-drawer__body.is-emptying {
  opacity: 0;
  transition: opacity 320ms ease;
}


/* ============================================================
   UNDO TOAST
   Lifted from assets/css/kaiko-cart.css so both the cart-page ×
   and the drawer × can show the same toast on any page. When the
   drawer is open, toast anchors to the drawer's top edge via
   .is-in-drawer so it doesn't hide behind the drawer body.
   ============================================================ */

.kaiko-undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--kaiko-dark);
  color: var(--kaiko-white);
  padding: 12px 16px 12px 18px;
  border-radius: 999px;
  box-shadow: 0 24px 60px rgba(28, 25, 23, 0.18);
  font-family: var(--kaiko-font-body);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease, transform 280ms ease;
  z-index: 2000;
}

.kaiko-undo-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.kaiko-undo-toast button {
  background: transparent;
  color: var(--kaiko-lime);
  border: 0;
  padding: 2px 10px;
  font-family: var(--kaiko-font-body);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 999px;
  transition: background 180ms ease;
}

.kaiko-undo-toast button:hover {
  background: rgba(184, 212, 53, 0.15);
}

/* When the drawer is the active surface, pin toast above the drawer. */
.kaiko-undo-toast.is-in-drawer {
  top: 88px;
  right: 28px;
  bottom: auto;
  left: auto;
  transform: translateX(0) translateY(-10px);
}

.kaiko-undo-toast.is-in-drawer.is-visible {
  transform: translateX(0) translateY(0);
}
