/* STAMPON Signature Cart 1.0.0
   Scoped visual enhancements. No WooCommerce templates or product fields replaced. */

body.stampon-signature-cart-enabled {
  --stampon-cart-primary: #D71920;
  --stampon-cart-hover: #B5121B;
  --stampon-cart-ink: #171717;
  --stampon-cart-border: #dcdcdc;
  --stampon-cart-radius: 10px;
  --stampon-cart-ease: cubic-bezier(.22, .61, .36, 1);
}

/* Product page - preserve the existing form/variation/designer layout. */
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button,
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button.button {
  position: relative;
  min-height: 58px;
  min-width: 0;
  padding: 13px 25px;
  background: var(--stampon-cart-primary) !important;
  background-image: none !important;
  color: #fff !important;
  border: 1px solid transparent !important;
  border-radius: var(--stampon-cart-radius) !important;
  box-shadow: 0 4px 12px rgba(141, 0, 19, .13);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.25;
  font-family: inherit;
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 750;
  letter-spacing: -.012em;
  text-transform: none;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color .2s var(--stampon-cart-ease),
              transform .2s var(--stampon-cart-ease),
              box-shadow .2s var(--stampon-cart-ease);
  -webkit-tap-highlight-color: transparent;
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button:not(.stampon-native-icon)::before,
body.stampon-signature-cart-enabled.stampon-style-archive a.add_to_cart_button.ajax_add_to_cart:not(.stampon-native-icon)::before {
  content: '';
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%221.8%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M5 8h14l-1 13H6L5 8Z%22/%3E%3Cpath d=%22M9 9V6a3 3 0 0 1 6 0v3%22/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%221.8%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M5 8h14l-1 13H6L5 8Z%22/%3E%3Cpath d=%22M9 9V6a3 3 0 0 1 6 0v3%22/%3E%3C/svg%3E') no-repeat center / contain;
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button:hover:not(:disabled):not(.disabled),
body.stampon-signature-cart-enabled.stampon-style-archive a.add_to_cart_button:hover {
  background: var(--stampon-cart-hover) !important;
  box-shadow: 0 8px 20px rgba(141, 0, 19, .2);
  transform: translateY(-1px);
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button:active:not(:disabled),
body.stampon-signature-cart-enabled.stampon-style-archive a.add_to_cart_button:active {
  transform: translateY(0) scale(.995);
  box-shadow: 0 3px 9px rgba(141, 0, 19, .14);
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button:focus-visible,
body.stampon-signature-cart-enabled.stampon-style-archive a.add_to_cart_button:focus-visible,
body.stampon-signature-cart-enabled .stampon-sticky-cart__action:focus-visible,
body.single-product.stampon-signature-cart-enabled form.cart .quantity :is(input,button):focus-visible {
  outline: 3px solid rgba(215, 25, 32, .48) !important;
  outline-offset: 3px !important;
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button:disabled,
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button.disabled,
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button.wc-variation-selection-needed {
  background: #adadad !important;
  color: #fff !important;
  opacity: .75;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* AJAX state styling - WooCommerce/Blocksy remain owners of the cart operation. */
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button[data-stampon-state="loading"] {
  pointer-events: none;
  cursor: progress;
  opacity: .88;
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button[data-stampon-state="loading"]::before {
  content: '';
  display: inline-block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.38);
  border-top-color: #fff;
  border-radius: 50%;
  box-sizing: border-box;
  background: none;
  -webkit-mask: none;
  mask: none;
  animation: stampon-cart-spin .7s linear infinite;
}

body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button[data-stampon-state="success"] {
  background: #191919 !important;
  border-color: #191919 !important;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .14);
}
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button[data-stampon-state="success"]::before {
  content: '';
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background: #fff;
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22m5 12 4 4L19 6%22/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22m5 12 4 4L19 6%22/%3E%3C/svg%3E') no-repeat center / contain;
}
body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button[data-stampon-state="error"] {
  background: #981a22 !important;
  box-shadow: 0 4px 12px rgba(152, 26, 34, .14);
}

@keyframes stampon-cart-spin { to { transform: rotate(360deg); } }

/* Quantity control: only skin existing minus/plus; don't insert duplicates. */
body.single-product.stampon-signature-cart-enabled form.cart .quantity {
  min-height: 56px;
  border: 1px solid var(--stampon-cart-border);
  border-radius: var(--stampon-cart-radius);
  background: #fff;
  box-shadow: none;
  overflow: hidden;
  transition: border-color .2s ease;
}
body.single-product.stampon-signature-cart-enabled form.cart .quantity:focus-within {
  border-color: var(--stampon-cart-primary);
}
body.single-product.stampon-signature-cart-enabled form.cart .quantity input.qty {
  min-height: 54px;
  color: var(--stampon-cart-ink);
  border: 0 !important;
  background: transparent;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
}
body.single-product.stampon-signature-cart-enabled form.cart .quantity :is(.ct-increase,.ct-decrease,.plus,.minus) {
  color: var(--stampon-cart-ink);
  background: #fff;
  border: 0;
  box-shadow: none;
  transition: color .2s ease, background-color .2s ease;
}
body.single-product.stampon-signature-cart-enabled form.cart .quantity :is(.ct-increase,.ct-decrease,.plus,.minus):hover {
  color: var(--stampon-cart-primary);
  background: #f8f8f8;
}

/* Wishlist remains a secondary action, clearly distinct from the red CTA. */
body.single-product.stampon-signature-cart-enabled :is(.ct-wishlist-button,.yith-wcwl-add-button a) {
  color: #444;
  transition: color .2s ease;
}
body.single-product.stampon-signature-cart-enabled :is(.ct-wishlist-button,.yith-wcwl-add-button a):hover {
  color: var(--stampon-cart-primary);
}

/* Shop / archives: only real add-to-cart actions, not "Choose options" or external links. */
body.stampon-signature-cart-enabled.stampon-style-archive :is(ul.products, .products) a.add_to_cart_button.ajax_add_to_cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 11px 15px;
  color: #fff !important;
  background: var(--stampon-cart-primary) !important;
  border: 0 !important;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
body.stampon-signature-cart-enabled.stampon-style-archive :is(ul.products, .products) a.add_to_cart_button.ajax_add_to_cart.loading {
  opacity: .7;
  pointer-events: none;
}
body.stampon-signature-cart-enabled.stampon-style-archive :is(ul.products, .products) a.add_to_cart_button.ajax_add_to_cart.added {
  background: #191919 !important;
}

/* Mobile / tablet bar: appears only after shopper has scrolled beyond original CTA. */
.stampon-sticky-cart { display: none; }
.stampon-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
@media (max-width: 1024px) {
  body.single-product.stampon-signature-cart-enabled .stampon-sticky-cart {
    position: fixed;
    z-index: 9997;
    display: flex;
    align-items: center;
    gap: 14px;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 76px;
    padding: 11px max(16px, env(safe-area-inset-right)) calc(11px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(255,255,255,.97);
    border-top: 1px solid #e7e7e7;
    box-shadow: 0 -8px 30px rgba(0,0,0,.09);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    visibility: hidden;
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: transform .25s var(--stampon-cart-ease), opacity .25s ease, visibility .25s;
  }
  body.single-product.stampon-signature-cart-enabled.stampon-sticky-visible .stampon-sticky-cart {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  body.single-product.stampon-signature-cart-enabled.stampon-sticky-visible {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .stampon-sticky-cart__details { min-width: 0; flex: 0 1 auto; }
  .stampon-sticky-cart__eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #676767;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
  }
  .stampon-sticky-cart__price {
    color: #171717;
    font-size: 18px;
    line-height: 1.1;
    white-space: nowrap;
    font-weight: 800;
  }
  .stampon-sticky-cart__action {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 53px;
    padding: 11px 16px;
    border: 0;
    border-radius: var(--stampon-cart-radius);
    background: var(--stampon-cart-primary);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s ease;
  }
  .stampon-sticky-cart__action:hover { background: var(--stampon-cart-hover); }
  .stampon-sticky-cart__action:disabled { background: #ababab; cursor: not-allowed; }
  .stampon-sticky-cart__action[data-stampon-state="success"] { background: #191919; }
  .stampon-sticky-cart__action[data-stampon-state="loading"] { opacity: .8; cursor: progress; }
}
@media (max-width: 600px) {
  body.single-product.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button { min-height: 55px; padding: 12px 14px; font-size: 14px; }
  .stampon-sticky-cart__eyebrow { display: none; }
  .stampon-sticky-cart__price { font-size: 16px; }
  .stampon-sticky-cart__action { font-size: 13px; }
}
@media (max-width: 360px) {
  .stampon-sticky-cart { gap: 8px !important; }
  .stampon-sticky-cart__action { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  body.stampon-signature-cart-enabled form.cart button.single_add_to_cart_button,
  body.stampon-signature-cart-enabled.stampon-style-archive a.add_to_cart_button,
  .stampon-sticky-cart, .stampon-sticky-cart__action {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
