/**
 * PDP Woo bridge — home header stays; Variant A body only.
 * Neutralize prototype PDP header styles from variant-a.css.
 */
body.fm-pdp-page .fm-site-header {
  display: none !important;
}

body.fm-pdp-page .fm-hdr {
  position: relative;
  z-index: 500;
}

body.fm-pdp-page .fm-pdp {
  background: #fff;
}

body.fm-pdp-page .va-promo-banner--text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 12px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fm-gray-700, #374151);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.35;
  max-width: 100%;
}
body.fm-pdp-page .va-promo-banner--text .fm-label {
  flex: 0 0 auto;
}
body.fm-pdp-page .fm-label {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.3;
}
body.fm-pdp-page .fm-label--payu {
  background: #a6c307;
  color: #fff;
}
body.fm-pdp-page .fm-label--gray {
  background: #6b7280;
  color: #fff;
}
body.fm-pdp-page .va-promo-banner__note {
  color: var(--fm-gray-600, #6b7280);
  font-size: 12px;
  font-weight: 500;
}

body.fm-pdp-page .fm-pdp-cart-form {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

body.fm-pdp-page .va-gallery__thumb,
body.fm-pdp-page .fm-fabric-swatch {
  display: block;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  line-height: 0;
  overflow: hidden;
}

body.fm-pdp-page .va-gallery__thumb {
  width: 72px;
}

body.fm-pdp-page .va-gallery__thumb.is-active,
body.fm-pdp-page .fm-fabric-swatch.is-active {
  border-color: var(--fm-red, #d62828);
}

body.fm-pdp-page .va-gallery__thumb img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 900px) {
  body.fm-pdp-page .va-gallery {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  body.fm-pdp-page .va-gallery__main {
    aspect-ratio: 1 / 1 !important;
    max-height: none !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    background: #fff !important;
  }
  body.fm-pdp-page .va-gallery__main img,
  body.fm-pdp-page .va-gallery__main > img,
  body.fm-pdp-page .va-gallery__main img[data-gallery-main] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    display: block !important;
  }
  body.fm-pdp-page .va-gallery__thumb {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: 8px;
    border: 0;
    border-bottom: 3px solid transparent;
  }
  body.fm-pdp-page .va-gallery__thumb.is-active {
    border-color: transparent;
    border-bottom-color: #111;
  }
  body.fm-pdp-page .va-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
  }

  /* FBT trigger under sample — mobile only */
  body.fm-pdp-page .va-fbt-trigger {
    display: flex !important;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
  }
  body.fm-pdp-page .va-secondary-actions {
    grid-template-columns: 1fr !important;
  }
  /* Hide inline FBT on mobile — opens as modal */
  body.fm-pdp-page .va-configurator--wide[data-fm-fbt]:not(.is-in-modal) {
    display: none !important;
  }
  body.fm-pdp-page .va-configurator--wide[data-fm-fbt].is-in-modal {
    display: flex !important;
    flex-direction: column;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    background: transparent;
  }
}

@media (min-width: 901px) {
  body.fm-pdp-page .va-fbt-trigger,
  body.fm-pdp-page .fm-fbt-modal {
    display: none !important;
  }
  /* Desktop: FBT to zwykła sekcja — bez X jak w modalu */
  body.fm-pdp-page .va-configurator--wide[data-fm-fbt] .va-configurator__close {
    display: none !important;
  }
}

/* FBT modal */
.fm-fbt-modal[hidden] { display: none !important; }
.fm-fbt-modal {
  position: fixed;
  inset: 0;
  z-index: 720;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fm-fbt-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.fm-fbt-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 720px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}
.fm-fbt-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}
.fm-fbt-modal__head strong {
  font-size: 16px;
}
.fm-fbt-modal__x {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
}
.fm-fbt-modal__body {
  overflow: auto;
  padding: 12px 16px 8px;
  -webkit-overflow-scrolling: touch;
}
.fm-fbt-modal__foot {
  display: grid;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eee;
  background: #fff;
}
.fm-fbt-modal__atc {
  width: 100%;
  justify-content: center;
}
.fm-fbt-modal__skip {
  border: 0;
  background: transparent;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
}
body.fm-fbt-open {
  overflow: hidden;
}

/* FBT cards — readable mobile stack inside modal */
@media (max-width: 900px) {
  .fm-fbt-modal .fm-addon-card,
  body.fm-pdp-page .va-addons--grid .fm-addon-card {
    grid-template-columns: 22px 56px minmax(0, 1fr);
    grid-template-areas:
      "cb img body"
      "cb img price";
    gap: 8px 12px;
    align-items: start;
    padding: 12px;
  }
  .fm-fbt-modal .fm-addon-card input,
  body.fm-pdp-page .va-addons--grid .fm-addon-card input {
    grid-area: cb;
    margin-top: 4px;
  }
  .fm-fbt-modal .fm-addon-card__thumb,
  body.fm-pdp-page .va-addons--grid .fm-addon-card__thumb {
    grid-area: img;
    width: 56px;
    height: 56px;
  }
  .fm-fbt-modal .fm-addon-card__body,
  body.fm-pdp-page .va-addons--grid .fm-addon-card__body {
    grid-area: body;
    min-width: 0;
  }
  .fm-fbt-modal .fm-addon-card__name,
  body.fm-pdp-page .va-addons--grid .fm-addon-card__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
  }
  .fm-fbt-modal .fm-addon-card__price,
  body.fm-pdp-page .va-addons--grid .fm-addon-card__price {
    grid-area: price;
    white-space: normal;
    justify-self: start;
    text-align: left;
    font-size: 13px;
  }
}

.va-configurator__close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}
/* WoodMart często wymusza display na button — bez !important [hidden] nie działa */
.va-configurator__close[hidden] {
  display: none !important;
}
.va-configurator__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Kolor / wzór — miniaturki; aktywna większa; przy małej liczbie wypełnij rząd */
body.fm-pdp-page .fm-fabric-swatches-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}
body.fm-pdp-page .fm-fabric-swatches-nav__btn {
  flex: 0 0 32px;
  align-self: center;
}
body.fm-pdp-page .fm-fabric-swatches-nav__track {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  container-type: inline-size;
  container-name: fm-swatches;
}
body.fm-pdp-page .fm-fabric-swatches {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 6px;
  scrollbar-width: none;
  max-height: 140px;
}
body.fm-pdp-page .fm-fabric-swatches::-webkit-scrollbar {
  display: none;
}
body.fm-pdp-page .fm-fabric-swatch {
  --fm-swatch-n: 8;
  --fm-swatch-g: 8px;
  --fm-swatch-size: 64px;
  --fm-swatch-size: clamp(52px, calc((100cqw - (var(--fm-swatch-n) - 1) * var(--fm-swatch-g)) / var(--fm-swatch-n)), 96px);
  position: relative;
  flex: 0 0 var(--fm-swatch-size);
  width: var(--fm-swatch-size);
  height: var(--fm-swatch-size);
  max-width: 96px;
  max-height: 96px;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  border: 2px solid var(--fm-gray-200, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  contain: paint;
  background: #fff;
  transition: width 0.15s ease, height 0.15s ease, flex-basis 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  transform-origin: center center;
}
/* Mało wariantów — rozciągnij kafelki na całą szerokość toru (bez dziury po prawej) */
body.fm-pdp-page .fm-fabric-swatches.is-fill {
  justify-content: stretch;
  overflow-x: hidden;
}
body.fm-pdp-page .fm-fabric-swatches.is-fill .fm-fabric-swatch {
  flex: 1 1 0;
  width: auto;
  max-width: none;
  height: auto;
  aspect-ratio: 1;
  max-height: 110px;
}
@media (max-width: 900px) {
  body.fm-pdp-page .fm-fabric-swatch {
    --fm-swatch-n: 5;
    --fm-swatch-size: 56px;
    --fm-swatch-size: clamp(48px, calc((100cqw - (var(--fm-swatch-n) - 1) * var(--fm-swatch-g)) / var(--fm-swatch-n)), 80px);
    max-width: 80px;
    max-height: 80px;
  }
  body.fm-pdp-page .fm-fabric-swatches.is-fill .fm-fabric-swatch {
    max-height: 88px;
  }
}
body.fm-pdp-page .fm-fabric-swatch.is-active {
  border-color: var(--fm-red, #d62828);
  box-shadow: 0 0 0 2px rgba(214, 40, 40, 0.22);
  flex-basis: calc(var(--fm-swatch-size) * 1.28);
  width: calc(var(--fm-swatch-size) * 1.28);
  height: calc(var(--fm-swatch-size) * 1.28);
  max-width: 122px;
  max-height: 122px;
  transform: none;
  z-index: 2;
}
body.fm-pdp-page .fm-fabric-swatches.is-fill .fm-fabric-swatch.is-active {
  flex: 1.28 1 0;
}
body.fm-pdp-page .fm-fabric-swatch img,
body.fm-pdp-page .fm-fabric-swatch__product {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}
body.fm-pdp-page .fm-fabric-swatch__fabric {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}
body.fm-pdp-page .fm-fabric-swatch__fabric img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body.fm-pdp-page .fm-fabric-swatch:hover .fm-fabric-swatch__fabric,
body.fm-pdp-page .fm-fabric-swatch:focus-visible .fm-fabric-swatch__fabric,
body.fm-pdp-page .fm-fabric-swatch.is-fabric-preview .fm-fabric-swatch__fabric {
  opacity: 1;
}
body.fm-pdp-page .fm-fabric-swatches__hint {
  min-height: 1.25em;
  margin-top: 8px;
}

body.fm-pdp-page .va-breadcrumb a {
  color: inherit;
  text-decoration: none;
}

body.fm-pdp-page .fm-params-grid__row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid #eee;
}

body.fm-pdp-page .fm-btn-atc:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.fm-pdp-page .va-gallery__actions {
  pointer-events: none;
}

body.fm-pdp-page .va-gallery__actions .fm-gallery-zoom {
  pointer-events: auto;
  cursor: pointer;
}

body.fm-pdp-page .fm-addon-card--placeholder {
  opacity: 0.92;
}

body.fm-pdp-page .fm-addon-card--placeholder .fm-addon-card__meta {
  font-style: italic;
}

body.fm-pdp-page .fm-addon-card__thumb {
  background: #fff;
  object-fit: contain;
}

body.fm-pdp-page .va-shipping-copy p,
body.fm-pdp-page .va-collection-copy p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--fm-gray-700, #374151);
}
body.fm-pdp-page .va-collection-copy__title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}
body.fm-pdp-page .va-collection-copy__link {
  font-weight: 700;
  color: var(--fm-red, #d62828);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Hide WoodMart single leftovers if any leak in */
body.fm-pdp-page .wd-single-footer,
body.fm-pdp-page .woocommerce-product-gallery:not(.va-gallery),
body.fm-pdp-page .summary.entry-summary:not(.va-buybox) {
  display: none !important;
}

/* Match header width; prevent buybox/gallery overlap */
body.fm-pdp-page .va-container {
  max-width: min(var(--fm-page-max, 1440px), 100%) !important;
  padding-inline: var(--fm-gutter, 24px) !important;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
body.fm-pdp-page .fm-pdp,
body.fm-pdp-page .va-main,
body.fm-pdp-page .va-hero--editorial {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
body.fm-pdp-page .va-hero--editorial {
  overflow-x: clip;
}
body.fm-pdp-page .va-hero__top,
body.fm-pdp-page .va-hero__bottom,
body.fm-pdp-page .va-gallery,
body.fm-pdp-page .va-buybox--panel,
body.fm-pdp-page .va-secondary-actions,
body.fm-pdp-page .va-variants--left,
body.fm-pdp-page .va-product-head {
  min-width: 0 !important;
  max-width: 100%;
}
body.fm-pdp-page .va-hero__top {
  align-items: start;
  column-gap: 48px !important;
  row-gap: 24px;
  overflow: hidden;
}
@media (min-width: 901px) {
  body.fm-pdp-page .va-hero__top,
  body.fm-pdp-page .va-hero__bottom {
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr) !important;
    column-gap: 48px !important;
  }
}
@media (min-width: 901px) and (max-width: 1200px) {
  body.fm-pdp-page .va-hero__top,
  body.fm-pdp-page .va-hero__bottom {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr) !important;
    column-gap: 32px !important;
  }
}
body.fm-pdp-page .va-buybox--panel {
  box-sizing: border-box;
  overflow-x: clip;
  position: relative;
  z-index: 1;
  margin-left: 0 !important;
}
body.fm-pdp-page .va-gallery {
  position: relative;
  z-index: 0;
  overflow: hidden;
  margin-right: 0 !important;
  padding-right: 0 !important;
}
body.fm-pdp-page .fm-label--ship24 {
  background: #0f766e !important;
  background-color: #0f766e !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
/* PDP rata — content-width, tekst do lewej; kwota pogrubiona */
body.fm-pdp-page .fm-price__installment,
body.fm-pdp-page .fm-price-block .fm-price__installment {
  display: inline-block !important;
  width: fit-content !important;
  max-width: 100%;
  margin: 2px 0 0 !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  background: #a6c307 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: .02em !important;
  text-transform: uppercase !important;
  text-align: left !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  align-self: flex-start !important;
}
body.fm-pdp-page .fm-price__installment-label {
  font-weight: 700 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
body.fm-pdp-page .fm-price__installment-amount {
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: 0.03em !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  -webkit-text-stroke: 0.2px #fff;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
}
body.fm-pdp-page .fm-price__installment-note {
  display: block;
  margin: 4px 0 0;
  color: var(--fm-gray-600, #6b7280);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}
body.fm-pdp-page .fm-outlet-head-labels .fm-label--payu {
  background: #a6c307;
  color: #fff;
}
body.fm-pdp-page .va-buybox__title {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  hyphens: auto;
}
body.fm-pdp-page .va-breadcrumb {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.fm-pdp-page .va-gallery__main {
  min-width: 0;
  overflow: hidden;
}
body.fm-pdp-page .va-gallery__thumbs {
  max-width: 100%;
}
@media (max-width: 900px) {
  body.fm-pdp-page .fm-pdp,
  body.fm-pdp-page .va-main,
  body.fm-pdp-page .va-container {
    overflow-x: clip;
    max-width: 100vw;
  }
  body.fm-pdp-page .va-buybox--panel {
    padding: 16px;
  }
  body.fm-pdp-page .va-buybox__title {
    font-size: clamp(18px, 5.2vw, 22px);
  }
  /* Mobile: Kolor/wzór zaraz pod galerią */
  body.fm-pdp-page .va-hero--editorial {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }
  body.fm-pdp-page .va-hero__top,
  body.fm-pdp-page .va-hero__bottom {
    display: contents !important;
  }
  body.fm-pdp-page .va-gallery { order: 1; }
  body.fm-pdp-page .va-variants-wrap {
    order: 2;
    padding-top: 0;
    margin: 0;
  }
  body.fm-pdp-page .va-buybox--panel { order: 3; }
  body.fm-pdp-page .va-secondary-actions { order: 4; }
}
body.fm-pdp-page .fm-fabric-swatches__hint,
body.fm-pdp-page .fm-fabric-swatches__hint[hidden] {
  display: none !important;
}

/* Description (tab Opis): never let leftover BL markup / flex-on-<p> split text into columns. */
body.fm-pdp-page [data-fm-description],
body.fm-pdp-page .fm-product-story {
  column-count: auto;
  columns: auto;
}
body.fm-pdp-page [data-fm-description] img,
body.fm-pdp-page .fm-product-story img {
  max-width: 100%;
  height: auto;
}
body.fm-pdp-page [data-fm-description] p:not(:has(.fm-desc-check)),
body.fm-pdp-page .fm-product-story p:not(:has(.fm-desc-check)) {
  display: block;
  width: 100%;
  max-width: 100%;
  float: none;
  column-count: auto;
  columns: auto;
}
