/* ------------------------------------------------------------------
   Lux Peptides — card, carousel, quick view

   Everything here targets `.lx-*` classes printed by the plugin's own
   shortcode. It does not style `.woocommerce ul.products` at all, so
   the theme's product cards are left alone and the theme's card CSS
   cannot reach into these.

   Sizes are in px on purpose: the source Shopify theme sets
   `html { font-size: 62.5% }`, WordPress uses 16px, and porting rem
   across that gap is what made everything render 1.6x too large.
   ------------------------------------------------------------------ */

/* ============ CAROUSEL ============================================ */

.lx-carousel {
  position: relative;
  --lx-columns: 4;
	margin-bottom: 50px;
}

.lx-row {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.lx-row::-webkit-scrollbar { display: none; }

.lx-card {
  flex: 0 0 calc(100% / var(--lx-columns));
  /* Keeps the slide on whole pixels where the browser allows it. */
  contain: layout paint;
  width: calc(100% / var(--lx-columns));
  max-width: none;
  scroll-snap-align: start;
  margin: 0;
  padding: 0 4px 8px;
  list-style: none;
  text-align: center;
  box-sizing: border-box;
}

@media (max-width: 1199px) { .lx-carousel { --lx-columns: 3; } }
@media (max-width: 899px)  { .lx-carousel { --lx-columns: 2; } }
@media (max-width: 599px)  { .lx-carousel { --lx-columns: 1.28; } }

/* --- Arrows -------------------------------------------------------- */

.lx-carousel__arrow {
  position: absolute;
  top: 34%;
  z-index: 4;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #151515;
  border: 1px solid rgba(21, 21, 21, 0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.lx-carousel__arrow--prev { left: -12px; }
.lx-carousel__arrow--next { right: -12px; }

.lx-carousel__arrow:hover { background: #151515; color: #fff; }

/* Faded rather than removed, so the row doesn't reflow at the ends. */
.lx-carousel__arrow[disabled] { opacity: 0; pointer-events: none; }

.lx-carousel__arrow svg { width: 16px; height: 16px; }

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

.lx-carousel__progress {
  position: relative;
  height: 3px;
  margin-top: 16px;
  background: rgba(21, 21, 21, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.lx-carousel__progress span {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #151515;
  border-radius: 999px;
  transition: transform 120ms linear;
}

/* ============ CARD ================================================ */

/* The media box is the positioning context for the button and blurb.
   Anchoring them to the whole card is what put the button below the
   price. */
.lx-card__media {
  position: relative;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.lx-card__link {
  display: block;
  line-height: 0;
  text-decoration: none;
}

.lx-card__img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  border-radius: 0;
  mix-blend-mode: multiply;
  /* Without this, a fractional card width (100/4 of an odd container)
     lands the image on a half pixel and the browser resamples it —
     which is the soft edge visible on non-retina Windows displays. */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.lx-card__title {
  display: block;
  padding: 18px 12px 8px;
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  color: var(--color-text, #151515);
}

.lx-card__title:hover { color: var(--color-text, #151515); }

.lx-card__price {
  font-family: var(--font-price, var(--font-base));
  font-size: 18px;
  font-weight: 600;
  color: var(--color-price, #151515);
}

.lx-card__price del { opacity: 0.5; font-weight: 400; }
.lx-card__price ins { text-decoration: none; color: var(--color-sale-price, #870b27); }

/* --- Hover blurb (the yellow leaf) --------------------------------- */

.lx-card__blurb {
  position: absolute;
  top: 5%;
  left: 50%;
  z-index: 2;
  /* Sized to sit above the vial rather than across it. At 62% with a
     3/4 ratio it covered nearly the full image height, which is why the
     product vanished on hover. */
  width: 46%;
  max-width: 170px;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  padding: 18px 14px;
  background: var(--lx-blurb-bg, #f5c518);
  color: #151515;
  /* Rounded at the top, tapering to a point at the bottom. */
  clip-path: polygon(
    50% 0%, 78% 5%, 95% 25%, 100% 50%,
    92% 74%, 72% 92%, 50% 100%,
    28% 92%, 8% 74%, 0% 50%,
    5% 25%, 22% 5%
  );
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.lx-card__blurb-text {
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}

/* --- Choose Options ------------------------------------------------ */

.lx-card__actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 3;
  padding: 0 16px;
  box-sizing: border-box;
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.lx-quickview-btn {
  position: relative;
  display: block;
  width: 100%;
  background-color: #fff;
  color: #151515;
  border: 1px solid #151515;
  border-radius: 4px;
  padding: 15px 12px;
  font-family: var(--font-button);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.lx-quickview-btn:hover {
  background-color: #151515;
  color: #fff;
}

@media (hover: hover) {
  .lx-card:hover .lx-card__actions,
  .lx-card__actions:focus-within {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .lx-card:hover .lx-card__blurb {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* No hover on touch: a hidden button is unreachable, and the blurb has
   no way to be triggered at all. */
@media (hover: none) {
  .lx-card__actions {
    position: static;
    padding: 12px 12px 0;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .lx-card__blurb { display: none; }

  .lx-quickview-btn { padding: 11px 10px; font-size: 12px; }
}

/* ============ MODAL =============================================== */

.lx-quickview {
  width: min(1000px, calc(100vw - 32px));
  max-height: min(90vh, 780px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #151515;
  overflow: hidden;
}

.lx-quickview::backdrop {
  background: rgba(21, 21, 21, 0.5);
  backdrop-filter: blur(4px);
}

.lx-quickview[open]:not(:modal) {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

body.lx-quickview-open { overflow: hidden; }

/* Open transition. The dialog is already filled by the time it is shown,
   so this animates a complete panel rather than an empty shell. */
@keyframes lx-dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lx-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lx-quickview[open] {
  animation: lx-dialog-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.lx-quickview[open]::backdrop {
  animation: lx-backdrop-in 0.28s ease;
}

/* Cold click, before the prefetch has landed: the button shows it is
   working rather than the dialog opening empty. */
.lx-quickview-btn.is-loading {
  color: transparent;
  pointer-events: none;
}

.lx-quickview-btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(21, 21, 21, 0.25);
  border-top-color: #151515;
  border-radius: 999px;
  animation: lx-spin 0.6s linear infinite;
}

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

.lx-quickview__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #151515;
  border: 1px solid rgba(21, 21, 21, 0.14);
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.lx-quickview__close:hover { transform: rotate(90deg); }

.lx-quickview__body {
  max-height: min(90vh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lx-quickview__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100%;
}

.lx-quickview__media {
  background: #f0ebe1;
  padding: 32px;
  display: grid;
  place-items: center;
}

.lx-quickview__media-inner {
  background: #fff;
  border-radius: 4px;
  width: 100%;
  padding: 24px;
  display: grid;
  place-items: center;
}

.lx-quickview__media img {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}

.lx-quickview__summary {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lx-quickview__vendor {
  color: #8a6134;
  font-family: var(--font-button);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lx-quickview__title {
  margin: 0;
  font-family: var(--font-headline);
  font-size: clamp(20px, 1.9vw, 28px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  overflow-wrap: break-word;
  color: #111;
}

.lx-quickview__price { font-size: 18px; font-weight: 600; }

.lx-quickview__excerpt {
  color: #5f5f5f;
  font-size: 15px;
  line-height: 1.55;
}

.lx-quickview__excerpt p { margin: 0; }

/* --- Variation pills ----------------------------------------------- */

/* The <select> stays in the DOM and keeps driving the variation form;
   the pills write to it. Removing it would break price updates, stock
   messages, and the variation id the cart depends on. */
.lx-quickview .variations select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Woo prints its own attribute label in a <th>. The pill group prints
   its own, so hiding this is what stops "Dosage" appearing twice. */
.lx-quickview .variations th,
.lx-quickview .variations .label {
  display: none !important;
}

.lx-quickview .variations,
.lx-quickview .variations tbody,
.lx-quickview .variations tr,
.lx-quickview .variations td {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  text-align: left;
  background: none;
}

.lx-quickview .variations tr + tr { margin-top: 18px; }

.lx-swatches__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lx-swatches__label { font-size: 15px; font-weight: 600; color: #151515; }
.lx-swatches__value { font-size: 14px; color: #8a6134; }

.lx-swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.lx-swatch {
  min-width: 78px;
  padding: 11px 18px;
  background: #fff;
  color: #151515;
  border: 1px solid rgba(21, 21, 21, 0.18);
  border-radius: 999px;
  font-family: var(--font-button);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lx-swatch:hover { border-color: #151515; }

.lx-swatch[aria-pressed="true"] {
  background: #151515;
  color: #fff;
  border-color: #151515;
}

/* Unpurchasable combinations stay visible but clearly unavailable — a
   disappearing option is more confusing than a struck-through one. */
.lx-swatch[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

.lx-quickview .reset_variations { display: none !important; }

.lx-quickview .woocommerce-variation-price {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.lx-quickview .woocommerce-variation-availability p {
  margin: 0;
  font-size: 13px;
  color: #5f5f5f;
}

/* --- Quantity ------------------------------------------------------- */

.lx-quickview form.cart {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.lx-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.lx-qty-row__label { font-size: 15px; color: #151515; }

/* The stepper is built as its own element and the input is moved into
   it. Reusing Woo's `.quantity` meant inheriting whatever the theme
   does to that class — which is what was hiding the number. */
.lx-quickview .lx-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(21, 21, 21, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin: 0;
  padding: 0;
  float: none;
  background: #fff;
}

.lx-qty-btn {
  width: 40px;
  height: 42px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: #151515;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.lx-qty-btn:hover { background: rgba(21, 21, 21, 0.05); }

/* The number. Declared with !important because a theme's `.qty` rules
   would otherwise still reach it through the input's own classes. */
.lx-quickview .lx-qty input {
  width: 46px !important;
  min-width: 46px;
  height: 42px;
  min-height: 42px;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
  clip: auto !important;
  border: 0 !important;
  outline: 0;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  box-shadow: none !important;
  text-align: center;
  font-size: 15px !important;
  font-weight: 600;
  line-height: 42px;
  color: #151515 !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.lx-quickview .lx-qty input::-webkit-outer-spin-button,
.lx-quickview .lx-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* The original wrapper is emptied by the script; hide whatever the
   theme left inside it. */
.lx-quickview .quantity { display: none !important; }

/* --- Variable product wrapper ---------------------------------------- */

/* Woo renders the quantity and the buttons inside `.single_variation_wrap`
   and leaves it hidden until its variation script reveals it. Inside a
   modal that reveal does not always fire, so the whole block — quantity,
   Add to cart, and Buy Now — stayed invisible on variable products.
   Showing it is safe: Woo still disables the button itself until a valid
   variation is picked. */
.lx-quickview .single_variation_wrap {
  display: block !important;
}

.lx-quickview .woocommerce-variation-add-to-cart {
  display: flex !important;
  flex-direction: column;
  gap: 12px;
}

.lx-quickview .woocommerce-variation {
  display: block !important;
}

/* Empty until a variation is chosen; the margin would otherwise leave a
   gap above the quantity row. */
.lx-quickview .woocommerce-variation:empty { display: none !important; }

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

.lx-quickview .single_add_to_cart_button,
.lx-quickview .lx-buy-now {
  width: 100%;
  padding: 17px 18px;
  border: 0;
  border-radius: 4px;
  font-family: var(--font-button);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.25s ease, opacity 0.25s ease;
}

.lx-quickview .single_add_to_cart_button { background: #151515; color: #fff; }
.lx-quickview .single_add_to_cart_button:hover { background: #000; }

.lx-quickview .lx-buy-now { background: #8a6134; color: #fff; }
.lx-quickview .lx-buy-now:hover { background: #74502a; }

.lx-quickview .single_add_to_cart_button.disabled,
.lx-quickview .single_add_to_cart_button:disabled,
.lx-quickview .lx-buy-now[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.lx-quickview__full {
  margin-top: 4px;
  align-self: flex-start;
  color: #151515;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.lx-quickview__loading,
.lx-quickview__error {
  padding: 64px 32px;
  text-align: center;
  color: #5f5f5f;
}

@media (max-width: 899px) {
  .lx-quickview__grid { grid-template-columns: 1fr; }
  .lx-quickview__media { padding: 20px; }
  .lx-quickview__media-inner { padding: 16px; }
  .lx-quickview__summary { padding: 24px 20px; }
  .lx-quickview__close { top: 10px; right: 10px; width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .lx-quickview[open],
  .lx-quickview[open]::backdrop { animation: none; }

  .lx-quickview-btn.is-loading::after { animation: none; }

  .lx-card__actions,
  .lx-card__blurb,
  .lx-quickview__close,
  .lx-quickview-btn { transition: none; }

  .lx-row { scroll-behavior: auto; }

  .lx-quickview__close:hover { transform: none; }
}
@media (max-width: 767px) {
    .lx-row {
        --lx-columns: 1;
    }
}
