/* Print Fabrique v1.7.8.18 | Werkelijke galerijrand uitgelijnd op de productinformatie.
   Scope: uitsluitend WooCommerce-productdetailpagina's.
   Laat FlexSlider/zoom hun eigen animatie en breedteberekening beheren. */
:root {
  --pf-gallery-window-desktop: 620px;
  --pf-gallery-photo-desktop: 560px;
  --pf-single-gallery-window: var(--pf-gallery-window-desktop);
  --pf-single-gallery-photo: var(--pf-gallery-photo-desktop);
}

/* Begrens de BUITENSTE WooCommerce-galerij, inclusief foto's van leveranciers.
   Brede productkolommen vergroten de fotoweergave niet langer. */
body.single-product .woocommerce div.product div.images,
body.single-product .woocommerce div.product .woocommerce-product-gallery,
body.single-product div.product div.images.woocommerce-product-gallery {
  box-sizing: border-box;
  float: none !important;
  width: min(100%, var(--pf-single-gallery-window)) !important;
  max-width: var(--pf-single-gallery-window) !important;
  min-width: 0 !important;
  margin-inline: auto !important;
}

/* Geen kunstmatige vulling boven of onder de eerste foto. De slider behoudt zijn
   eigen 1-slide-breedte; alleen de hoogte van het beeldvenster ligt vast. */
body.single-product div.product .woocommerce-product-gallery .flex-viewport {
  box-sizing: border-box;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  max-height: var(--pf-single-gallery-window) !important;
  overflow: hidden !important;
  border-radius: 18px;
}
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
  max-width: none; /* FlexSlider gebruikt een brede, verschuifbare wrapper. */
}

/* Elk galeriescherm heeft exact dezelfde hoogte, zowel met als zonder slider. */
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image,
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image--placeholder {
  box-sizing: border-box;
  position: relative;
  display: block !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden;
  border: 1px solid var(--bk-border,#e2e8f0);
  border-radius: 18px;
  background: var(--bk-product-image-bg,#fff);
}

/* Foto midden in het venster, met witruimte rondom en behoud van verhouding. */
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image > a {
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  display: flex !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 14px !important;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image > a > img:not(.zoomImg),
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image--placeholder > img,
body.single-product div.product div.images:not(.woocommerce-product-gallery) img.wp-post-image {
  box-sizing: border-box !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: min(100%, var(--pf-single-gallery-photo)) !important;
  max-height: min(100%, var(--pf-single-gallery-photo)) !important;
  object-fit: contain !important;
  object-position: center !important;
  margin: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
/* WooCommerce zoom legt een afzonderlijk groot beeld over de huidige foto;
   die blijft bewust onbeperkt binnen zijn eigen zoomcomponent. */

body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image--placeholder {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 14px !important;
}

/* Thumbnails blijven klikbaar en uniform, zonder bijsnijden. */
body.single-product div.product .woocommerce-product-gallery .flex-control-thumbs li img {
  display: block;
  width: 100% !important;
  height: 66px !important;
  max-height: 66px !important;
  object-fit: contain !important;
  object-position: center;
  padding: 6px;
  border-radius: 8px;
  background: var(--bk-product-image-bg,#fff);
}

@media (max-width: 600px) {
  :root {
    --pf-single-gallery-window: min(calc(100vw - 28px), var(--pf-gallery-window-desktop));
    --pf-single-gallery-photo: min(calc(100vw - 64px), var(--pf-gallery-photo-desktop));
  }
  body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image > a {
    padding: 14px !important;
  }
}

/* De galerij en de producttitel horen bij dezelfde eerste gridrij.
   Als een leverancier vóór de galerij eigen markup toevoegt, kan de
   automatische grid-plaatsing de foto anders een rij omlaag duwen. */
@media (min-width: 621px) {
  body.single-product .woocommerce div.product > .woocommerce-product-gallery,
  body.single-product .woocommerce div.product > div.images {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: start !important;
    justify-self: center !important;
  }
  body.single-product .woocommerce div.product > .summary {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: start !important;
  }
}

/* Geen witruimte vóór de galerij: bovenkant gelijk aan het titel-/prijsblok. */
body.single-product .woocommerce div.product > .woocommerce-product-gallery,
body.single-product .woocommerce div.product > div.images {
  margin-top: 0 !important;
  padding-top: 0 !important;
  /* Een sticky top-offset verschoof de foto soms onder de producttitel. */
  position: relative !important;
  top: auto !important;
}
body.single-product .woocommerce-product-gallery .flex-viewport,
body.single-product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

@media (max-width: 620px) {
  /* Op kleine schermen onder elkaar en zonder sticky-scroll of gridplaatsing. */
  body.single-product .woocommerce div.product > .woocommerce-product-gallery,
  body.single-product .woocommerce div.product > div.images {
    position: relative !important;
    top: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
    margin-bottom: 22px !important;
  }
}

/* v1.7.8.18: vaste bovenuitlijning, ook wanneer een andere plugin de
   afbeeldingen of hun wrappers extra verticale ruimte geeft. */
@media (min-width: 621px) {
  body.single-product .woocommerce div.product {
    align-items: start !important;
    align-content: start !important;
  }
  body.single-product .woocommerce div.product .woocommerce-product-gallery,
  body.single-product .woocommerce div.product div.images {
    align-self: start !important;
    justify-self: center !important;
    vertical-align: top !important;
    margin-block-start: 0 !important;
    padding-block-start: 0 !important;
    /* Alleen de werkelijke afwijking wordt met JS gemeten. De standaard is nul.
       'translate' laat eventuele transforms voor WooCommerce-zoom intact. */
    translate: 0 var(--pf-gallery-align-y, 0px) !important;
  }
  body.single-product .woocommerce div.product .woocommerce-product-gallery > .flex-viewport,
  body.single-product .woocommerce div.product .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper,
  body.single-product .woocommerce div.product .woocommerce-product-gallery > .woocommerce-product-gallery__image {
    margin-block-start: 0 !important;
    padding-block-start: 0 !important;
  }
}
@media (max-width: 620px) {
  body.single-product .woocommerce div.product .woocommerce-product-gallery,
  body.single-product .woocommerce div.product div.images {
    translate: none !important;
  }
}
