/* Right-side cart drawer + paper-fly add animation */

.pg-cart-root {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
}

.pg-cart-root.is-open {
  pointer-events: auto;
}

.pg-cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 26, 22, 0.38);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.pg-cart-root.is-open .pg-cart-backdrop {
  opacity: 1;
}

.pg-cart-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100%;
  background: #fbf8f3;
  color: #1e1a16;
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 48px rgba(30, 26, 22, 0.16);
  transform: translateX(105%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: Quicksand, "Segoe UI", sans-serif;
}

.pg-cart-root.is-open .pg-cart-drawer {
  transform: translateX(0);
}

.pg-cart-head,
.pg-cart-foot {
  padding: 20px 22px;
  flex-shrink: 0;
}

.pg-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(30, 26, 22, 0.1);
}

.pg-cart-head h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pg-cart-close {
  border: 0;
  background: transparent;
  color: #5c564e;
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 0;
}

.pg-cart-items {
  flex: 1;
  overflow: auto;
  padding: 8px 22px 16px;
}

.pg-cart-empty {
  margin: 28px 0;
  color: #5c564e;
  line-height: 1.5;
}

.pg-cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid rgba(30, 26, 22, 0.1);
}

.pg-cart-row:first-child {
  border-top: 0;
}

.pg-cart-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #f4efe8;
  border-radius: 10px;
}

.pg-cart-row strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.pg-cart-row p {
  margin: 0;
  color: #5c564e;
  font-size: 0.88rem;
}

.pg-cart-qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
}

.pg-cart-qty-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(30, 26, 22, 0.16);
  color: #1e1a16;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.pg-cart-qty-btn:hover {
  background: #f4efe8;
}

.pg-cart-qty-val {
  min-width: 1.25rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.98rem;
}

.pg-cart-line {
  font-weight: 600;
  white-space: nowrap;
}

.pg-cart-remove {
  display: inline-block;
  border: 0;
  background: none;
  color: #5c564e;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
}

.pg-cart-foot {
  border-top: 1px solid rgba(30, 26, 22, 0.1);
}

.pg-cart-sub {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.pg-cart-delivery {
  color: #5c564e;
  font-size: 0.98rem;
}

.pg-cart-total {
  font-weight: 700;
  margin-bottom: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(30, 26, 22, 0.1);
}

.pg-cart-note {
  margin: 0 0 14px;
  color: #5c564e;
  font-size: 0.88rem;
  line-height: 1.45;
}

.pg-cart-checkout {
  display: block;
  width: 100%;
  text-align: center;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #1e2f2a;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.pg-cart-checkout[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pg-cart-clear {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: none;
  color: #5c564e;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font: inherit;
  padding: 8px 0;
}

body.pg-cart-open,
body.pg-checkout-open {
  overflow: hidden;
}

.pg-checkout-popup {
  position: fixed;
  inset: 0;
  z-index: 100010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pg-checkout-popup[hidden] {
  display: none !important;
}

.pg-checkout-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(30, 26, 22, 0.45);
  cursor: pointer;
}

.pg-checkout-modal {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fbf8f3;
  color: #1e1a16;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(30, 26, 22, 0.28);
  padding: 22px 22px 24px;
  font-family: Quicksand, "Segoe UI", sans-serif;
  animation: pgCheckoutIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pgCheckoutIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pg-checkout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pg-checkout-head h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.pg-checkout-summary {
  margin: 0 0 16px;
  color: #5c564e;
  font-size: 0.9rem;
  line-height: 1.45;
}

.pg-checkout-form {
  display: grid;
  gap: 12px;
}

.pg-field {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.pg-field span em {
  font-style: normal;
  color: #8a837a;
  font-weight: 400;
}

.pg-field input,
.pg-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(30, 26, 22, 0.16);
  border-radius: 12px;
  background: #fff;
  color: #1e1a16;
  font: inherit;
  font-size: 0.98rem;
  padding: 12px 14px;
  resize: vertical;
}

.pg-field input:focus,
.pg-field textarea:focus {
  outline: 2px solid rgba(30, 47, 42, 0.35);
  outline-offset: 1px;
  border-color: #1e2f2a;
}

.pg-checkout-error {
  margin: 0;
  color: #8b3a2f;
  font-size: 0.9rem;
}

.pg-checkout-done {
  display: grid;
  gap: 12px;
}

.pg-checkout-done-title {
  margin: 8px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.pg-checkout-done-text {
  margin: 0;
  color: #5c564e;
  line-height: 1.5;
}

.pg-checkout-wa {
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .pg-checkout-modal {
    animation: none;
  }
}

/* Fly layer (product wrap → drawer) */
.pg-fly-layer {
  position: fixed;
  inset: 0;
  z-index: 100001;
  pointer-events: none;
  overflow: hidden;
}

.pg-fly-product {
  position: absolute;
  width: 120px;
  height: 120px;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform, opacity, filter;
  z-index: 2;
  border-radius: 10px;
  background: #fbf8f3;
  box-shadow: 0 10px 24px rgba(31, 51, 48, 0.18);
}

.pg-fly-product.is-wrap {
  animation: pgPaperWrap 0.55s ease-in forwards;
}

.pg-fly-product.is-fly {
  animation: pgPaperFly 0.65s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
}

@keyframes pgPaperWrap {
  0% {
    transform: translate(var(--pg-from-x), var(--pg-from-y)) scale(1) rotate(0deg);
    filter: blur(0);
    opacity: 1;
  }
  45% {
    transform: translate(var(--pg-from-x), var(--pg-from-y)) scaleX(0.35) scaleY(1.05) rotate(-8deg);
    filter: blur(0.2px);
  }
  100% {
    transform: translate(var(--pg-from-x), var(--pg-from-y)) scaleX(0.18) scaleY(0.85) rotate(-18deg);
    filter: blur(0.4px);
    opacity: 0.95;
  }
}

@keyframes pgPaperFly {
  0% {
    transform: translate(var(--pg-from-x), var(--pg-from-y)) scaleX(0.18) scaleY(0.85) rotate(-18deg);
    opacity: 0.95;
  }
  70% {
    transform: translate(var(--pg-to-x), var(--pg-to-y)) scaleX(0.12) scaleY(0.45) rotate(12deg);
    opacity: 0.85;
  }
  100% {
    transform: translate(var(--pg-to-x), calc(var(--pg-to-y) + 12px)) scaleX(0.08) scaleY(0.2) rotate(25deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-cart-drawer,
  .pg-cart-backdrop {
    transition-duration: 0.01ms;
  }

  .pg-fly-product.is-wrap,
  .pg-fly-product.is-fly {
    animation-duration: 0.01ms !important;
  }
}
