/* Product page (design pass D6). Template: woocommerce/content-single-product.php, logic: includes/product-page.php. */

.nx-pdp__top-wrap {
  padding-bottom: var(--nx-5);
  padding-top: var(--nx-2);
}

.nx-pdp .woocommerce-breadcrumb {
  color: var(--nx-text-muted);
  font-size: 13px;
  margin: 0 0 var(--nx-2);
}

.nx-pdp .woocommerce-breadcrumb a {
  color: var(--nx-text-muted);
}

.nx-pdp__top {
  display: grid;
  gap: var(--nx-3);
}

@media (min-width: 1024px) {
  .nx-pdp__top-wrap {
    padding-top: var(--nx-3);
  }

  .nx-pdp__top {
    align-items: start;
    gap: var(--nx-6);
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }

  .nx-pdp__summary {
    position: sticky;
    top: calc(var(--nanolex-header-h, 72px) + var(--nx-3));
  }
}

/* ---------- Gallery: swipe on phones, thumbnails as a row ---------- */

.nx-gallery {
  position: relative;
}

.nx-gallery__badge {
  left: var(--nx-2);
  position: absolute;
  top: var(--nx-2);
  z-index: 1;
}

.nx-gallery__track {
  background: var(--nx-bg-alt);
  border-radius: var(--nx-radius);
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.nx-gallery__track::-webkit-scrollbar {
  display: none;
}

.nx-gallery__track:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-gallery__slide {
  align-items: center;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  display: flex;
  flex: 0 0 100%;
  justify-content: center;
  scroll-snap-align: start;
}

/* Phones: the gallery takes at most ~55 % of the screen, so title, price and the button follow right after */
@media (max-width: 1023px) {
  .nx-gallery__slide {
    aspect-ratio: auto;
    height: min(55vh, calc(100vw - 2 * var(--nx-gutter)));
  }
}

.nx-gallery__slide img {
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  width: 100%;
}

.nx-gallery__thumbs {
  display: flex;
  gap: var(--nx-1);
  margin-top: var(--nx-1);
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}

.nx-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.nx-gallery__thumb {
  background: var(--nx-bg-alt);
  border: 2px solid transparent;
  border-radius: var(--nx-radius-sm);
  cursor: pointer;
  flex: 0 0 64px;
  height: 64px;
  overflow: hidden;
  padding: 0;
}

.nx-gallery__thumb img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.nx-gallery__thumb[aria-current="true"] {
  border-color: var(--nx-purple);
}

.nx-gallery__thumb:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

/* ---------- Summary ---------- */

.nx-pdp__header {
  display: grid;
  gap: var(--nx-1);
  margin-bottom: var(--nx-3);
}

.nx-pdp__title {
  font-size: clamp(28px, 22px + 1.2vw, 40px);
  line-height: 1.15;
  margin: 0;
}

.nx-pdp__subtitle {
  color: var(--nx-text-muted);
  font-size: 18px;
  margin: 0;
}

.nx-pdp__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-1);
  list-style: none;
  margin: var(--nx-1) 0 0;
  padding: 0;
}

.nx-pdp__chips li {
  margin: 0;
}

.nx-pdp__chips li::before {
  display: none;
}

.nx-pdp__chips .nx-chip {
  min-height: 36px;
  text-decoration: none;
}

.nx-pdp__chips .nx-chip .nx-badge {
  font-size: 11px;
  padding: 2px 8px;
}

.nx-chip--static {
  cursor: default;
}

.nx-pdp__price {
  color: var(--nx-purple);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  margin: var(--nx-2) 0 0;
}

.nx-pdp__price .amount,
.nx-pdp__price bdi,
.nx-pdp__price .woocommerce-Price-amount {
  font-weight: inherit;
}

.nx-pdp__price del {
  color: var(--nx-text-muted);
  font-size: 0.6em;
  font-weight: 600;
  margin-right: 6px;
}

.nx-pdp__price ins {
  text-decoration: none;
}

.nx-pdp__excerpt {
  color: var(--nx-text-muted);
}

.nx-pdp__excerpt p {
  margin: 0;
}

/* Cart form (parent markup): quantity stepper + full-width primary button */
.nx-pdp form.cart {
  margin: 0;
}

.nx-pdp .single-product__add-to-cart {
  align-items: stretch;
  background: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-1);
  padding: 0;
}

.nx-pdp .quantity__wrapper {
  flex: 0 0 auto;
  margin: 0;
}

.nx-pdp .quantity__area {
  align-items: center;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  display: flex;
  height: 52px;
  overflow: hidden;
}

.nx-pdp .quantity__minus,
.nx-pdp .quantity__plus {
  align-items: center;
  background: #fff;
  border: 0;
  border-radius: 0;
  color: var(--nx-purple);
  cursor: pointer;
  display: inline-flex;
  font-size: 20px;
  font-weight: 700;
  height: 100%;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.nx-pdp .quantity__minus:hover,
.nx-pdp .quantity__plus:hover {
  background: var(--nx-bg-alt);
}

.nx-pdp .quantity input.qty {
  -moz-appearance: textfield;
  border: 0;
  color: var(--nx-text);
  font-size: 16px;
  font-weight: 700;
  height: 100%;
  padding: 0;
  text-align: center;
  width: 40px;
}

.nx-pdp .quantity input.qty::-webkit-inner-spin-button,
.nx-pdp .quantity input.qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.nx-pdp .single_add_to_cart_button {
  align-items: center;
  background: var(--nx-mint);
  border: 0;
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  cursor: pointer;
  display: inline-flex;
  flex: 1 1 180px;
  font-family: var(--nx-font);
  font-size: 17px;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  padding: 0 var(--nx-3);
  text-transform: none;
}

.nx-pdp .single_add_to_cart_button:hover {
  background: var(--nx-mint-strong);
}

.nx-pdp .single_add_to_cart_button:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-pdp .single_add_to_cart_button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Variable products: size choice; the price at the top follows it (assets/js/product.js) */
.nx-pdp .variation__container {
  display: grid;
  gap: var(--nx-2);
  margin-bottom: var(--nx-2);
}

.nx-pdp .variation__title {
  color: var(--nx-text);
  font-size: var(--nx-small);
  font-weight: 700;
  margin-bottom: 6px;
}

.nx-pdp .woocommerce-variation-price {
  display: none;
}

.nx-pdp .woocommerce-variation-availability p {
  font-size: var(--nx-small);
  margin: 0 0 var(--nx-1);
}

.nx-pdp .reset_variations {
  font-size: var(--nx-small);
}

/* Stock line */
.nx-pdp__stock {
  align-items: center;
  display: flex;
  font-size: var(--nx-small);
  font-weight: 700;
  gap: 8px;
  margin: var(--nx-2) 0 0;
}

.nx-pdp__stock-dot {
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.nx-pdp__stock.is-in-stock { color: #1d7a4c; }
.nx-pdp__stock.is-in-stock .nx-pdp__stock-dot { background: #2fa36b; }
.nx-pdp__stock.is-backorder { color: #8a5a00; }
.nx-pdp__stock.is-backorder .nx-pdp__stock-dot { background: #e0a400; }
.nx-pdp__stock.is-out { color: var(--nx-text-muted); }
.nx-pdp__stock.is-out .nx-pdp__stock-dot { background: #b8b2c2; }

/* ---------- Accordions with the product description ---------- */

.nx-pdp__sections {
  border-top: 1px solid var(--nx-border);
}

.nx-pdp__sections .nx-accordion__item summary {
  font-size: 20px;
}

.nx-prose {
  color: var(--nx-text);
  font-size: 16px;
  line-height: 1.6;
}

.nx-prose > * + * {
  margin-top: var(--nx-2);
}

.nx-prose p {
  margin: 0;
}

.nx-prose p + p {
  margin-top: var(--nx-2);
}

.nx-prose__heading {
  color: var(--nx-purple);
  font-size: 17px;
  font-weight: 800;
  margin: var(--nx-3) 0 var(--nx-1);
}

.nx-prose__heading:first-child {
  margin-top: 0;
}

.nx-prose ul,
.nx-prose ol {
  margin: var(--nx-1) 0 0;
  padding-left: 1.4em;
}

.nx-prose ul {
  list-style: disc;
}

.nx-prose ol {
  list-style: decimal;
}

.nx-prose li {
  margin: 0 0 6px;
  padding-left: 4px;
}

.nx-prose li::before {
  display: none;
}

.nx-prose li::marker {
  color: var(--nx-purple);
  font-weight: 800;
}

/* The descriptions wrap each list item in a <p>; keep the number and the text on one line */
.nx-prose li > p {
  display: inline;
  margin: 0;
}

/* KKK: question on the first line, answer after the line break */
.nx-prose--kkk li > p {
  display: block;
}

.nx-prose__q {
  color: var(--nx-purple);
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

.nx-prose__q strong {
  font-weight: inherit;
}

.nx-prose__q + br {
  display: none;
}

.nx-prose--kkk ul {
  list-style: none;
  padding-left: 0;
}

.nx-prose--kkk li {
  border-bottom: 1px solid var(--nx-border);
  margin: 0;
  padding: var(--nx-2) 0;
}

.nx-prose--kkk li:last-child {
  border-bottom: 0;
}

.nx-prose video,
.nx-prose .wp-video,
.nx-prose iframe {
  border-radius: var(--nx-radius);
  height: auto;
  max-width: 100%;
  width: 100% !important;
}

/* ---------- "Sobib kokku" and related products ---------- */

.nx-pdp__related .nx-products {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 700px) {
  .nx-pdp__related .nx-products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .nx-pdp__related .nx-products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Phones: gallery, title, price and the button all on the first screen ---------- */

.nx-pdp__back {
  color: var(--nx-text-muted);
  display: none;
  font-size: var(--nx-small);
  font-weight: 700;
  margin-bottom: var(--nx-1);
  text-decoration: none;
}

@media (max-width: 1023px) {
  .nx-pdp .woocommerce-breadcrumb {
    display: none;
  }

  .nx-pdp__back {
    display: inline-block;
  }

  .nx-pdp__top-wrap {
    padding-top: 12px;
  }

  .nx-pdp__top {
    gap: var(--nx-2);
  }

  .nx-gallery__thumb {
    flex-basis: 48px;
    height: 48px;
  }

  .nx-pdp__header {
    gap: 4px;
    margin-bottom: var(--nx-2);
  }

  .nx-pdp__title {
    font-size: 26px;
  }

  .nx-pdp__subtitle {
    font-size: 16px;
  }

  .nx-pdp__chips {
    margin-top: 6px;
  }

  .nx-pdp__chips .nx-chip {
    min-height: 32px;
    padding: 0 12px;
  }

  .nx-pdp__price {
    font-size: 26px;
    margin-top: var(--nx-1);
  }

  .nx-pdp__stock {
    margin-top: 12px;
  }
}


/* Quantity and "Lisa korvi" on one row (the parent sets the button to full width on phones) */
.nx-pdp .single-product__add-to-cart {
  flex-wrap: nowrap;
}

.nx-pdp .single_add_to_cart_button {
  min-width: 0;
  width: auto;
}

.nx-pdp .quantity__minus,
.nx-pdp .quantity__plus {
  width: 40px;
}

.nx-pdp .quantity input.qty {
  width: 32px;
}

/* The parent adds a "Tükihind" label to variation prices; the price at the top needs none */
.nx-pdp__price .price-label {
  display: none;
}

.nx-pdp .reset_variations {
  display: inline-block;
  margin-top: 4px;
}


/* KKK written as "<strong>Question?</strong> Answer" (in a list or as paragraphs): same look */
.nx-prose--kkk p > strong:first-child {
  color: var(--nx-purple);
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

.nx-prose--kkk p > strong:first-child + br {
  display: none;
}

.nx-prose--kkk > p + p {
  border-top: 1px solid var(--nx-border);
  margin-top: 0;
  padding-top: var(--nx-2);
}

.nx-prose--kkk > p {
  padding-bottom: var(--nx-2);
}
