/**
 * Cart drawer — slide-out from right, matches theme tokens.
 * Bound to .epg-drawer markup rendered server-side in wp_footer.
 */

.epg-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 24, 0.42);
  z-index: 9998;
  opacity: 0;
  transition: opacity 220ms ease;
  cursor: pointer;
}
.epg-drawer-backdrop.is-open {
  opacity: 1;
}
.epg-drawer-backdrop[hidden] {
  display: none;
}

.epg-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  background: #fdfaf3;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -12px 0 40px rgba(20, 20, 24, 0.12);
  font-family: 'Inter', system-ui, sans-serif;
}
.epg-drawer.is-open {
  transform: translateX(0);
}
@media (max-width: 520px) {
  .epg-drawer { max-width: 100%; }
}

/* Respect the WordPress admin bar (only present for logged-in users in admin context). */
body.admin-bar .epg-drawer,
body.admin-bar .epg-drawer-backdrop {
  top: 32px;
}
@media (max-width: 782px) {
  body.admin-bar .epg-drawer,
  body.admin-bar .epg-drawer-backdrop {
    top: 46px;
  }
}

/* Lock body scroll while drawer is open */
html.epg-drawer-open,
html.epg-drawer-open body {
  overflow: hidden;
}

/* ---------- Header ---------- */
.epg-drawer__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(28, 28, 32, 0.08);
  flex: 0 0 auto;
}
.epg-drawer__close {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: #1a1a1f;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease;
}
.epg-drawer__close:hover { background: rgba(28, 28, 32, 0.06); }
.epg-drawer__close:focus-visible { outline: 2px solid #8a7340; outline-offset: 2px; }

.epg-drawer__title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.01em;
  color: #1a1a1f;
}
.epg-drawer__count-badge {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(28, 28, 32, 0.06);
  color: #1a1a1f;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

/* ---------- Scroll area ---------- */
.epg-drawer__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.epg-drawer__items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.epg-drawer__item {
  position: relative;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(28, 28, 32, 0.06);
}
.epg-drawer__item-remove {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 22px;
  height: 22px;
  background: #fdfaf3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6e6e74;
  transition: color 150ms ease, transform 150ms ease;
  cursor: pointer;
  z-index: 2;
}
.epg-drawer__item-remove:hover { color: #a83232; transform: scale(1.08); }
.epg-drawer__item-image {
  width: 84px;
  height: 84px;
  display: block;
  background: #ece6d6;
  overflow: hidden;
  border-radius: 2px;
}
.epg-drawer__item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.epg-drawer__item-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.epg-drawer__item-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 500;
  color: #1a1a1f;
  text-decoration: none;
  line-height: 1.2;
}
.epg-drawer__item-title:hover { color: #8a7340; }
.epg-drawer__item-meta {
  font-size: 13px;
  color: #5b5b62;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
}
.epg-drawer__frame-thumb {
  width: 32px; height: 32px; flex: none;
  object-fit: cover; border-radius: 3px;
  border: 1px solid #e5e0d3; background: #fff;
}
.epg-drawer__item-meta dl { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.epg-drawer__item-meta dt { font-weight: 500; margin: 0; }
.epg-drawer__item-meta dd { margin: 0; }
.epg-drawer__item-meta dd p { margin: 0; }

.epg-drawer__item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.epg-drawer__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(28, 28, 32, 0.18);
  border-radius: 3px;
  background: #fff;
  height: 30px;
  overflow: hidden;
}
.epg-drawer__qty-btn {
  background: transparent;
  border: 0;
  padding: 0 9px;
  cursor: pointer;
  font-size: 15px;
  color: #1a1a1f;
  height: 100%;
  display: flex;
  align-items: center;
  font-family: inherit;
}
.epg-drawer__qty-btn:hover { background: rgba(28, 28, 32, 0.05); }
.epg-drawer__qty-btn:disabled { color: #b8b8be; cursor: not-allowed; }
.epg-drawer__qty-input {
  width: 32px;
  text-align: center;
  border: 0;
  border-left: 1px solid rgba(28, 28, 32, 0.12);
  border-right: 1px solid rgba(28, 28, 32, 0.12);
  background: transparent;
  font: inherit;
  font-size: 14px;
  height: 100%;
  color: #1a1a1f;
  -moz-appearance: textfield;
}
.epg-drawer__qty-input::-webkit-outer-spin-button,
.epg-drawer__qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.epg-drawer__qty-input:focus { outline: none; }

.epg-drawer__item-price {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Empty state ---------- */
.epg-drawer__empty {
  padding: 60px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.epg-drawer__empty-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: #1a1a1f;
  margin: 0;
}
.epg-drawer__empty-lead {
  color: #5b5b62;
  font-size: 14px;
  margin: 0 0 12px;
  max-width: 280px;
}
.epg-drawer__empty-cta {
  text-decoration: none;
}

/* ---------- Footer ---------- */
.epg-drawer__footer {
  flex: 0 0 auto;
  border-top: 1px solid rgba(28, 28, 32, 0.08);
  background: #f7f2e6;
}
.epg-drawer__totals {
  padding: 16px 22px 4px;
}
.epg-drawer__total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 14px;
  color: #1a1a1f;
}
.epg-drawer__total-row--discount { color: #1f5d3a; }
.epg-drawer__total-row--grand {
  border-top: 1px solid rgba(28, 28, 32, 0.12);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 500;
}
.epg-drawer__total-row--grand span:last-child {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.epg-drawer__shipping-note {
  font-size: 12px;
  color: #6e6e74;
  margin: 6px 0 0;
  font-style: italic;
}
.epg-drawer__actions {
  padding: 12px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Both CTAs span the full drawer width and align contents centered.
   Using width:100% rather than display:block so the inline-flex layout
   inside .epg-btn (centered icon+label) stays intact. */
.epg-drawer__checkout,
.epg-drawer__continue {
  width: 100%;
  text-align: center;
  justify-content: center;
}
.epg-drawer__checkout { text-decoration: none; }

/* ---------- Header cart button (replaces the anchor) ---------- */
.epg-nav__cart {
  cursor: pointer;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
}
.epg-nav__cart:focus-visible { outline: 2px solid #8a7340; outline-offset: 4px; border-radius: 2px; }

/* ---------- Loading state on the drawer while AJAX in flight ---------- */
.epg-drawer.is-loading {
  pointer-events: none;
}
.epg-drawer.is-loading .epg-drawer__scroll {
  opacity: 0.55;
  transition: opacity 150ms ease;
}
