/* ==========================================================================
   Product grid columns — driven by admin ProductSettings
   ========================================================================== */
.kx-product-grid {
  display: grid;
  grid-template-columns: repeat(var(--kx-grid-cols-mobile, 2), minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .kx-product-grid { gap: 1rem; }
}

@media (min-width: 1024px) {
  .kx-product-grid {
    grid-template-columns: repeat(var(--kx-grid-cols-desktop, 4), minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.kx-grid-m1-d2 { --kx-grid-cols-mobile: 1; --kx-grid-cols-desktop: 2; }
.kx-grid-m1-d4 { --kx-grid-cols-mobile: 1; --kx-grid-cols-desktop: 4; }
.kx-grid-m1-d6 { --kx-grid-cols-mobile: 1; --kx-grid-cols-desktop: 6; }
.kx-grid-m2-d2 { --kx-grid-cols-mobile: 2; --kx-grid-cols-desktop: 2; }
.kx-grid-m2-d4 { --kx-grid-cols-mobile: 2; --kx-grid-cols-desktop: 4; }
.kx-grid-m2-d6 { --kx-grid-cols-mobile: 2; --kx-grid-cols-desktop: 6; }
.kx-grid-m4-d2 { --kx-grid-cols-mobile: 4; --kx-grid-cols-desktop: 2; }
.kx-grid-m4-d4 { --kx-grid-cols-mobile: 4; --kx-grid-cols-desktop: 4; }
.kx-grid-m4-d6 { --kx-grid-cols-mobile: 4; --kx-grid-cols-desktop: 6; }

/* ==========================================================================
   Shared card skeleton
   ========================================================================== */
.kx-pcard-wrap { height: 100%; }

.kx-pcard {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.kx-pcard__media {
  position: relative;
  display: block;
  overflow: hidden;
}

/* product-visual.php renders an absolute inset-0 wrapper; make sure it fills */
.kx-pcard__media > div { position: absolute; inset: 0; }
.kx-pcard__media img { transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1); }

/* generic cart icon sizing */
.kx-buy__icon { width: 1rem; height: 1rem; flex-shrink: 0; }

/* ==========================================================================
   DEFAULT — native dark glass, gradient brand button
   ========================================================================== */
.kx-pcard--default {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.kx-pcard--default .kx-pcard__media {
  aspect-ratio: 16 / 10;
  margin-top: 0.7rem;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 30%, rgba(124, 58, 237, 0.16), rgba(255, 255, 255, 0.02) 70%);
}
.kx-pcard--default .kx-pcard__body { padding: 0.75rem 0.9rem 0.9rem; }
.kx-card-style-default .kx-pcard-wrap:hover .kx-pcard--default,
.kx-pcard-wrap:hover > .kx-pcard--default {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.kx-pcard-wrap:hover .kx-pcard--default .kx-pcard__media img { transform: scale(1.06); }

/* ==========================================================================
   APPLE — dark glassmorphism + 3D tilt, brand-gradient flowing "Buy" pill
   ========================================================================== */
.kx-pcard-wrap { perspective: 1200px; }

.kx-pcard--apple {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  will-change: transform;
}
/* glowing gradient border on hover */
.kx-pcard--apple::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
  padding: 1px;
  background: linear-gradient(140deg, rgba(124, 58, 237, 0.65), rgba(34, 211, 238, 0.45) 50%, transparent 80%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 3;
}
/* holographic sheen sweep */
.kx-pcard__sheen {
  position: absolute;
  top: -60%;
  left: -75%;
  width: 55%;
  height: 220%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: skewX(-18deg);
  transition: left 0.7s ease;
  pointer-events: none;
  z-index: 4;
}
.kx-pcard--apple .kx-pcard__title { color: #f5f5f7; }
.kx-pcard--apple .kx-pcard__brand { color: #a1a1aa; }
.kx-pcard--apple .kx-pcard__media {
  aspect-ratio: 4 / 3;
  margin: 0.4rem 0.9rem 0.6rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 28%, rgba(124, 58, 237, 0.22), rgba(255, 255, 255, 0.02) 70%);
}
.kx-pcard--apple .kx-pcard__price-from { color: #8a8a93; font-size: 0.72rem; }
.kx-pcard--apple .kx-pcard__price { color: #ffffff; }
.kx-pcard-wrap:hover .kx-pcard--apple {
  transform: translateY(-8px) rotateX(4.5deg);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 38px 70px -28px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 56px -16px rgba(99, 102, 241, 0.5);
}
.kx-pcard-wrap:hover .kx-pcard--apple::before { opacity: 1; }
.kx-pcard-wrap:hover .kx-pcard__sheen { left: 170%; }
.kx-pcard-wrap:hover .kx-pcard--apple .kx-pcard__media img { transform: scale(1.07); }

.kx-pcard__actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }

/* Buy now — flowing brand-gradient pill (data-buy-now → checkout) */
.kx-buy-apple {
  position: relative;
  isolation: isolate;
  flex: 1 1 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 980px;
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  background: linear-gradient(110deg, #7c3aed 0%, #6366f1 30%, #22d3ee 50%, #6366f1 70%, #7c3aed 100%);
  background-size: 220% 100%;
  animation: kx-apple-flow 3.6s linear infinite;
  box-shadow: 0 6px 18px -4px rgba(99, 102, 241, 0.6);
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.kx-buy-apple .kx-buy__icon { width: 0.95rem; height: 0.95rem; }
.kx-buy-apple:hover { animation-duration: 1.2s; box-shadow: 0 8px 24px -4px rgba(34, 211, 238, 0.7); }
.kx-buy-apple:active { transform: scale(0.96); }
.kx-buy-apple:disabled { animation: none; background: rgba(255, 255, 255, 0.08); color: #6b6b73; box-shadow: none; cursor: not-allowed; }

@keyframes kx-apple-flow {
  to { background-position: 220% 0; }
}

/* Add to cart — ghost glass pill (data-add-to-cart). Icon is a ::before mask
   so cart.js swapping textContent ("Added ✓") never removes it. */
.kx-add-apple {
  position: relative;
  flex: 1 1 90px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 980px;
  padding: 0.5rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e5e7ef;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.12s ease, color 0.2s ease;
  --kx-cart-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.4'/%3E%3Ccircle cx='18' cy='20' r='1.4'/%3E%3Cpath d='M2 3h3l2.2 11.3a2 2 0 0 0 2 1.6h8.1a2 2 0 0 0 2-1.6L21 7H6'/%3E%3C/svg%3E");
}
.kx-add-apple::before {
  content: "";
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--kx-cart-mask) center / contain no-repeat;
  mask: var(--kx-cart-mask) center / contain no-repeat;
}
.kx-add-apple:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); color: #fff; }
.kx-add-apple:active { transform: scale(0.95); }
.kx-add-apple:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==========================================================================
   BEST BUY — dark glass + 3D, bold amber full-width "Add to cart"
   ========================================================================== */
.kx-pcard--bestbuy {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  will-change: transform;
}
.kx-pcard--bestbuy::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  padding: 1px;
  background: linear-gradient(140deg, rgba(245, 158, 11, 0.6), rgba(124, 58, 237, 0.4) 55%, transparent 80%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 3;
}
.kx-pcard--bestbuy .kx-pcard__title { color: #f5f5f7; }
.kx-pcard--bestbuy .kx-pcard__media {
  aspect-ratio: 4 / 3;
  margin: 0.6rem 0.6rem 0;
  border-radius: 0.7rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 30%, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.02) 70%);
}
.kx-pcard--bestbuy .kx-pcard__price { color: #ffffff; }
.kx-pcard--bestbuy .kx-pcard__price-from { color: #8a8a93; }
.kx-pcard--bestbuy .kx-pcard__rating { color: #fbbf24; }
.kx-pcard--bestbuy .kx-pcard__reviews { color: #a1a1aa; }
.kx-pcard-wrap:hover .kx-pcard--bestbuy {
  transform: translateY(-8px) rotateX(4.5deg);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 38px 70px -28px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 50px -16px rgba(245, 158, 11, 0.5);
}
.kx-pcard-wrap:hover .kx-pcard--bestbuy::before { opacity: 1; }
.kx-pcard-wrap:hover .kx-pcard--bestbuy .kx-pcard__media img { transform: scale(1.06); }

.kx-buy-bestbuy {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  border-radius: 0.7rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #241a02;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  box-shadow: 0 8px 22px -6px rgba(245, 158, 11, 0.6);
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
}
.kx-buy-bestbuy:hover { filter: brightness(1.06); box-shadow: 0 10px 28px -6px rgba(245, 158, 11, 0.78); }
.kx-buy-bestbuy:active { transform: scale(0.97); }
.kx-buy-bestbuy:disabled { background: rgba(255, 255, 255, 0.08); color: #6b6b73; box-shadow: none; cursor: not-allowed; }

/* ==========================================================================
   TARGET — dark glass + 3D, glossy red pill + wishlist heart
   ========================================================================== */
.kx-pcard--target {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  will-change: transform;
}
.kx-pcard--target::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  padding: 1px;
  background: linear-gradient(140deg, rgba(239, 68, 68, 0.6), rgba(124, 58, 237, 0.4) 55%, transparent 80%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 3;
}
.kx-pcard--target .kx-pcard__title { color: #f5f5f7; }
.kx-pcard--target .kx-pcard__media {
  aspect-ratio: 1 / 1;
  margin: 0.6rem 0.6rem 0;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 30%, rgba(239, 68, 68, 0.16), rgba(255, 255, 255, 0.02) 70%);
}
.kx-pcard--target .kx-pcard__price { color: #ffffff; }
.kx-pcard--target .kx-pcard__price-from { color: #8a8a93; }
.kx-pcard--target .kx-pcard__brand { color: #a1a1aa; }
.kx-pcard-wrap:hover .kx-pcard--target {
  transform: translateY(-8px) rotateX(4.5deg);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 38px 70px -28px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 50px -16px rgba(239, 68, 68, 0.5);
}
.kx-pcard-wrap:hover .kx-pcard--target::before { opacity: 1; }
.kx-pcard-wrap:hover .kx-pcard--target .kx-pcard__media img { transform: scale(1.06); }

.kx-buy-target {
  position: relative;
  isolation: isolate;
  z-index: 2;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 980px;
  padding: 0.5rem 1.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(180deg, #ff4d4d 0%, #e00000 55%, #c20000 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 5px 16px rgba(204, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
/* glass gloss top highlight */
.kx-buy-target::before {
  content: "";
  position: absolute;
  inset: 0 0 50% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  border-radius: 980px 980px 0 0;
  z-index: -1;
}
/* shine sweep */
.kx-buy-target::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-22deg);
  transition: left 0.6s ease;
  z-index: -1;
}
.kx-pcard-wrap:hover .kx-buy-target::after { left: 130%; }
.kx-buy-target:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 7px 22px rgba(204, 0, 0, 0.6); }
.kx-buy-target:active { transform: scale(0.96); }
.kx-buy-target:disabled { background: rgba(255, 255, 255, 0.08); color: #6b6b73; box-shadow: none; cursor: not-allowed; }
.kx-buy-target:disabled::before, .kx-buy-target:disabled::after { display: none; }

.kx-wishlist {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #c9c9d2;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.kx-wishlist:hover { color: #ff6b6b; border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.12); transform: scale(1.08); }
.kx-wishlist.is-on { color: #ff4d4d; border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.16); }
.kx-wishlist.is-on svg { fill: currentColor; }

/* ==========================================================================
   MINIMAL — ultra-clean dark, thin border, underline reveal
   ========================================================================== */
.kx-pcard--minimal {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.kx-pcard--minimal .kx-pcard__media { aspect-ratio: 3 / 2; }
.kx-pcard--minimal .kx-pcard__body { padding: 0.75rem; }
.kx-pcard-wrap:hover .kx-pcard--minimal {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.045);
}
.kx-pcard-wrap:hover .kx-pcard--minimal .kx-pcard__media img { transform: scale(1.05); }

.kx-buy-minimal {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #8ab4ff;
  background: none;
  transition: gap 0.2s ease, color 0.2s ease;
}
.kx-buy-minimal:hover { gap: 0.55rem; color: #b9d3ff; }
.kx-buy-minimal:disabled { color: #555; }

/* ==========================================================================
   Shared typography — multi-color "glass" title + distinct price color.
   Placed after the per-style rules (so it wins their solid colors) and
   before the compact tweaks (so 4-col font-size still wins). Applies to
   every style, in every section (featured, browse-all, sliders) and locale.
   ========================================================================== */
.kx-pcard .kx-pcard__title {
  font-size: 0.98rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 0.06em;
  background: linear-gradient(120deg, #ffffff 0%, #d9c8ff 42%, #7af0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
@media (min-width: 640px) {
  .kx-pcard .kx-pcard__title { font-size: 1.1rem; }
}
.kx-pcard .kx-pcard__brand { color: #a1a1aa; }

.kx-pcard .kx-pcard__price {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #34d399 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.kx-pcard .kx-pcard__price-from { color: #8b8f9a; font-weight: 500; }

/* even breathing room between the card frame and the product image */
.kx-pcard .kx-pcard__media { margin-left: 0.7rem; margin-right: 0.7rem; }

/* ==========================================================================
   "Buy now" — glassy, glossy, animated shine + blinking glow
   ========================================================================== */
.kx-buy-shine {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: kx-buy-pulse 2.2s ease-in-out infinite;
}
/* top glass gloss */
.kx-buy-shine::before {
  content: "";
  position: absolute;
  inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}
/* moving shine sweep */
.kx-buy-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -125%;
  width: 55%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  z-index: 2;
  animation: kx-buy-sweep 2.8s ease-in-out infinite;
}
.kx-buy-shine:hover { animation-duration: 1.1s; }
.kx-buy-shine:hover::after { animation-duration: 1.3s; }

@keyframes kx-buy-sweep {
  0% { left: -125%; }
  60%, 100% { left: 150%; }
}
@keyframes kx-buy-pulse {
  0%, 100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 20px 2px rgba(124, 77, 255, 0.65);
  }
}
@media (prefers-reduced-motion: reduce) {
  .kx-buy-shine { animation: none; }
  .kx-buy-shine::after { display: none; }
}

/* ==========================================================================
   Compact (4-col mobile) tweaks
   ========================================================================== */
@media (max-width: 639px) {
  .kx-grid-m4-d2 .kx-pcard__title,
  .kx-grid-m4-d4 .kx-pcard__title,
  .kx-grid-m4-d6 .kx-pcard__title { font-size: 0.7rem; }

  .kx-grid-m4-d2 .kx-pcard__buy,
  .kx-grid-m4-d4 .kx-pcard__buy,
  .kx-grid-m4-d6 .kx-pcard__buy { padding: 0.25rem 0.5rem; font-size: 0.625rem; }
}
