/* =========================================================
   LOOP / TUOTE-KARUSELLI – YLIMENON ESTO (Chrome/Android safe)
   - EI käytetä html/body overflow-x hidden
   - Rajaus koskee vain karusellia
   ========================================================= */

/* Varmista box-sizing, ettei padding/border tee leveysylitystä */
.elementor-widget-loop-carousel,
.elementor-widget-loop-carousel * {
  box-sizing: border-box;
}

/* Rajaa itse karuselli: clip jos tuettu, muuten hidden */
.elementor-widget-loop-carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;      /* fallback */
  contain: layout paint; /* vähentää “vuotoja” transformien kanssa */
}

/* Moderni ja “siistimpi” rajaus (ei sotke scrollia). */
@supports (overflow: clip) {
  .elementor-widget-loop-carousel {
    overflow: clip;      /* parempi kuin hidden joissain Chrome-tapauksissa */
  }
}

/* Swiperin rakenteet eivät saa ylittää leveysrajaa */
.elementor-widget-loop-carousel .swiper,
.elementor-widget-loop-carousel .swiper-wrapper,
.elementor-widget-loop-carousel .swiper-slide {
  max-width: 100%;
}

/* Tärkeä: Swiper-wrapper voi joskus levitä transformin takia → pakota */
.elementor-widget-loop-carousel .swiper-wrapper {
  width: 100% !important;
}

/* Flex-bugi: salli sisällön kutistua (ettei työnnä yli) */
.elementor-widget-loop-carousel .swiper-slide,
.elementor-widget-loop-carousel .swiper-slide > * {
  min-width: 0;
}

/* Kuvat eivät koskaan veny yli */
.elementor-widget-loop-carousel img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* BONUS: jos jokin sisäinen kortti tekee “pitkän rivin” (esim. nimi), katkaise */
.elementor-widget-loop-carousel .swiper-slide * {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================================================
   MOBILE: tuotekortti ja tuotekuva 100% leveäksi
   ========================================================= */
@media (max-width: 767px) {
  .woocommerce ul.products li.product {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .woocommerce ul.products li.product a img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
}

/* Elementor Woo Menu Cart -painike/kuori */
.elementor-widget-woocommerce-menu-cart .elementor-button,
.elementor-widget-woocommerce-menu-cart .elementor-menu-cart__toggle_button {
  background-color: #fff22d !important; /* keltainen */
}

/* =========================================================
   PIILOTA OP LASKU / OSAMAKSU KOKO SIVUSTOLTA
   ========================================================= */
.op-lasku__widget,
.op-lasku__init__,
.op-lasku__container,
.op-lasku__backdrop,
button.op-lasku__btn-open,
.op-lasku__btn,
[class*="op-lasku"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* =========================================================
   PIILOTA WooCommerce "lisätty ostoskoriin" -ilmoitus
   ========================================================= */
.woocommerce-message,
.woocommerce-notices-wrapper,
.wc-block-components-notice-banner {
  display: none !important;
}

/* =========================================================
   MINI CART – CTA-nappien teksti tummanvihreäksi
   ========================================================= */
.wc-block-mini-cart__footer .wc-block-components-button,
.wc-block-mini-cart__footer .wc-block-components-button span,
.wc-block-mini-cart__footer .wc-block-components-button__text {
  color: #1f3d2b !important;
}

.wc-block-mini-cart__footer .wc-block-components-button:hover,
.wc-block-mini-cart__footer .wc-block-components-button:hover span {
  color: #1f3d2b !important;
}

/* =========================================================
   Tuotekuvan suurennuslasi EI muiden elementtien päälle
   ========================================================= */
.woocommerce-product-gallery,
.woocommerce-product-gallery__wrapper {
  position: relative;
  z-index: 1;
}

.woocommerce-product-gallery__trigger,
.woocommerce-product-gallery .zoomImg {
  z-index: 2 !important;
}

/* Header ja mini cart aina päällimmäiseksi */
.site-header,
.wc-block-mini-cart {
  position: relative;
  z-index: 1000;
}

/* Elementor side cart CTA-napit: teksti tummanvihreäksi */
.elementor-menu-cart__footer-buttons a.elementor-button,
.elementor-menu-cart__footer-buttons a.elementor-button .elementor-button-text {
  color: #1f3d2b !important;
  -webkit-text-fill-color: #1f3d2b !important;
}

.elementor-menu-cart__footer-buttons a.elementor-button:hover,
.elementor-menu-cart__footer-buttons a.elementor-button:hover .elementor-button-text {
  color: #1f3d2b !important;
  -webkit-text-fill-color: #1f3d2b !important;
}

/* =========================================================
   TUOTESIVU: piilota related / upsells
   ========================================================= */
.woocommerce div.product .related,
.woocommerce div.product section.related,
.woocommerce div.product .related.products,
.woocommerce div.product .up-sells,
.woocommerce div.product section.up-sells,
.woocommerce div.product .upsells,
.woocommerce div.product section.upsells {
  display: none !important;
}

/* =========================================================
   WOO PAYMENTS: piilota Google Pay / Express checkout (tuotesivulla)
   ========================================================= */
.single-product .wcpay-payment-request-button,
.single-product .wcpay-payment-request-button__button,
.single-product .wcpay-payment-request-button-separator,
.single-product .wcpay-payment-request-buttons,
.single-product .wcpay-payment-request-button-wrapper,
.single-product .wc-block-components-express-payment,
.single-product .wc-block-checkout__express-payment {
  display: none !important;
}

/* =========================================================
   Tuotesivun Elementorin tuotelistat pois
   ========================================================= */
.single-product .elementor-widget-posts,
.single-product .elementor-widget-loop-grid,
.single-product .elementor-widget-woocommerce-products,
.single-product .elementor-widget-woocommerce-product-related,
.single-product .elementor-widget-woocommerce-product-upsell,
.single-product .elementor-widget-woocommerce-product-data-tabs,
.single-product .elementor-widget-container a[href*="/product/"],
.single-product .elementor-widget-container a[href*="/tuote/"] {
  display: none !important;
}

/* Varmistus: tuotesivun viimeinen osio (jos siellä on linkkilista) */
.single-product .elementor-section:last-of-type,
.single-product .elementor-section-wrap > .elementor-section:last-child {
  display: none !important;
}

/* Jetpack Related Posts pois */
#jp-relatedposts,
.jp-relatedposts {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Tuotetagi "Myyty" punaiseksi */
.product_meta a[rel="tag"]:is([href*="myyty"], [href*="sold"]) {
  background: #c15757;
  color: #fff !important;
  padding: 3px 8px;
  border-radius: 0px;
  display: inline-block;
  line-height: 1.2;
}

.product_meta a[rel="tag"]:is([href*="myyty"], [href*="sold"]):hover {
  opacity: 0.85;
}
/* =========================================================
   PIILOTA TUOTEOSASTO "English" (WooCommerce category)/*
                                                        * /* =========================================================
   iOS SAFARI – Vakaa fix: estä vaakaskrolli rikkomatta headeria
   ========================================================= */
@supports (-webkit-touch-callout: none) {
  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Älä klippaa headeria */
  header,
  .site-header,
  .elementor-location-header {
    overflow: visible !important;
    contain: none !important;
  }

  /* Tuotesivun “vuotajat” kuriin (galeria/zoom/kuvat) */
  .single-product .woocommerce,
  .single-product .site-main,
  .single-product .woocommerce-product-gallery,
  .single-product .woocommerce-product-gallery__wrapper,
  .single-product .elementor,
  .single-product .elementor-widget-wrap {
    max-width: 100vw !important;
  }

  .single-product img,
  .single-product video,
  .single-product canvas,
  .single-product svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Swiper/karuselli tuotesivulla */
  .single-product .swiper,
  .single-product .swiper-wrapper,
  .single-product .swiper-slide {
    max-width: 100vw !important;
  }
}
