/*
 * X:AGE 7.2 — layout WooCommerce strutturale e galleria senza bordi laterali.
 * Il template crea sempre i contenitori usati qui; il foglio non modifica l'header.
 */

body.woocommerce-page .xage-shop-main {
  box-sizing: border-box;
  width: 100%;
  min-height: 70vh;
  padding:
    calc(var(--xage-header-offset, 144px) + 78px)
    clamp(20px, 7vw, 96px)
    96px !important;
  background: var(--paper);
  clear: both;
}

body.woocommerce-page .xage-shop-container {
  box-sizing: border-box;
  width: min(1180px, 100%) !important;
  max-width: 1180px !important;
  margin-inline: auto !important;
}

body.post-type-archive-product .xage-shop-hero,
body.tax-product_cat .xage-shop-hero,
body.tax-product_tag .xage-shop-hero {
  width: 100%;
  margin: 0 auto 54px;
  padding: clamp(44px, 6vw, 72px) clamp(20px, 5vw, 64px);
}

body.post-type-archive-product ul.products,
body.tax-product_cat ul.products,
body.tax-product_tag ul.products {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body.post-type-archive-product ul.products li.product a img,
body.tax-product_cat ul.products li.product a img,
body.tax-product_tag ul.products li.product a img {
  height: 340px !important;
  padding: 22px !important;
  object-fit: contain !important;
  object-position: center !important;
}

body.single-product .xage-shop-container {
  width: min(1100px, 100%) !important;
  max-width: 1100px !important;
}

body.single-product div.product {
  width: 100%;
  display: grid !important;
  grid-template-columns: minmax(0, 500px) minmax(320px, 460px) !important;
  justify-content: center !important;
  align-items: start !important;
  gap: clamp(42px, 6vw, 76px) !important;
  margin-inline: auto !important;
}

body.single-product div.product::before,
body.single-product div.product::after {
  display: none !important;
}

body.single-product div.product > .woocommerce-product-gallery {
  box-sizing: border-box;
  float: none !important;
  position: relative !important;
  inset: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 500px !important;
  margin: 0 !important;
  justify-self: center !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body.single-product div.product > .summary {
  box-sizing: border-box;
  float: none !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: 460px !important;
  margin: 0 !important;
  justify-self: center !important;
}

body.single-product div.product .woocommerce-product-gallery__wrapper,
body.single-product div.product .woocommerce-product-gallery__image {
  width: 100% !important;
  margin: 0 !important;
}

/* Mantiene stabile l'area della galleria mentre WooCommerce inizializza FlexSlider. */
body.single-product div.product .woocommerce-product-gallery .flex-viewport {
  width: 100% !important;
  min-height: 480px;
}

body.single-product div.product .woocommerce-product-gallery__wrapper {
  min-height: 480px;
  align-items: stretch !important;
  transition: none !important;
}

body.single-product div.product .woocommerce-product-gallery__image {
  flex: 0 0 100%;
  min-width: 100%;
  transition: none !important;
}

body.single-product div.product .flex-control-thumbs img {
  transition: opacity .18s ease, border-color .18s ease !important;
}

body.single-product div.product .woocommerce-product-gallery__image a {
  display: flex !important;
  width: 100% !important;
  height: 480px !important;
  min-height: 0 !important;
  align-items: center;
  justify-content: center;
}

body.single-product div.product .woocommerce-product-gallery__image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 480px !important;
  object-fit: contain !important;
  object-position: center !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Foto principale: proporzione nativa 3:4 e nessun contorno laterale.
 * Le miniature mantengono intenzionalmente padding e sfondo bianco. */
body.single-product div.product > .woocommerce-product-gallery {
  padding: 0 !important;
  background: transparent !important;
}

body.single-product div.product .woocommerce-product-gallery .flex-viewport,
body.single-product div.product .woocommerce-product-gallery__wrapper {
  min-height: 0 !important;
  background: transparent !important;
}

body.single-product div.product .woocommerce-product-gallery__image a {
  height: auto !important;
  aspect-ratio: 3 / 4 !important;
  background: transparent !important;
}

body.single-product div.product .woocommerce-product-gallery__image img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  padding: 0 !important;
  object-fit: cover !important;
}

body.single-product div.product .flex-control-thumbs li,
body.single-product div.product .flex-control-thumbs img {
  background: #fff !important;
}

body.single-product .woocommerce-tabs,
body.single-product .related.products,
body.single-product .upsells.products {
  grid-column: 1 / -1 !important;
  box-sizing: border-box;
  width: 100% !important;
  max-width: 1100px !important;
  margin-inline: auto !important;
}

body.single-product .related.products ul.products,
body.single-product .upsells.products ul.products {
  width: 100% !important;
  max-width: 1100px !important;
  margin-inline: auto !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body.woocommerce-page .woocommerce-result-count,
body.woocommerce-page .woocommerce-ordering {
  display: none !important;
}

@media (max-width: 980px) {
  body.single-product div.product {
    grid-template-columns: minmax(0, 680px) !important;
  }

  body.single-product div.product > .summary {
    max-width: 680px !important;
  }

  body.single-product .related.products ul.products,
  body.single-product .upsells.products ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 780px) {
  body.woocommerce-page .xage-shop-main {
    padding:
      calc(var(--xage-mobile-header-offset, 118px) + 52px)
      20px
      72px !important;
  }

  body.single-product div.product .woocommerce-product-gallery .flex-viewport,
  body.single-product div.product .woocommerce-product-gallery__wrapper {
    min-height: min(390px, 84vw);
  }

  body.post-type-archive-product ul.products,
  body.tax-product_cat ul.products,
  body.tax-product_tag ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.post-type-archive-product ul.products li.product a img,
  body.tax-product_cat ul.products li.product a img,
  body.tax-product_tag ul.products li.product a img {
    height: 300px !important;
    padding: 16px !important;
  }
}

@media (max-width: 520px) {
  body.woocommerce-page .xage-shop-main {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body.post-type-archive-product ul.products,
  body.tax-product_cat ul.products,
  body.tax-product_tag ul.products,
  body.single-product .related.products ul.products,
  body.single-product .upsells.products ul.products {
    grid-template-columns: 1fr !important;
    max-width: 420px !important;
  }

  body.post-type-archive-product ul.products li.product a img,
  body.tax-product_cat ul.products li.product a img,
  body.tax-product_tag ul.products li.product a img {
    height: min(360px, 84vw) !important;
  }

  body.single-product div.product .woocommerce-product-gallery__image a {
    height: min(390px, 84vw) !important;
  }
}

/*
 * X:AGE 8.3.5 — carrello vuoto premium.
 * Supporta sia il Cart Block moderno sia il template WooCommerce classico.
 */
body.woocommerce-cart .xage-shop-container,
body.woocommerce-cart .xage-content-container {
  max-width: 1320px !important;
}

body.woocommerce-cart .xage-shop-container > h1,
body.woocommerce-cart .xage-content-container article > h1,
body.woocommerce-cart .entry-title {
  margin: 0 0 clamp(38px, 5vw, 66px);
  font-size: clamp(42px, 5vw, 66px);
  line-height: 1;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block,
body.woocommerce-cart .wc-block-cart__empty-cart__title,
body.woocommerce-cart .cart-empty.woocommerce-info {
  position: relative;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block {
  margin: 0;
}

/* Hero vuoto */
body.woocommerce-cart .wc-block-cart__empty-cart__title,
body.woocommerce-cart .cart-empty.woocommerce-info {
  box-sizing: border-box;
  width: min(900px, 100%);
  min-height: 300px;
  margin: 0 auto 68px !important;
  padding: 146px clamp(24px, 7vw, 90px) 48px !important;
  overflow: hidden;
  border: 1px solid rgba(189, 135, 60, .22) !important;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,.96), transparent 48%),
    linear-gradient(135deg, #f1e9df 0%, #faf7f2 52%, #eee2d5 100%);
  color: var(--ink) !important;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(25px, 3vw, 36px) !important;
  font-weight: 400 !important;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 24px 70px rgba(74, 53, 36, .08);
}

body.woocommerce-cart .wc-block-cart__empty-cart__title::before,
body.woocommerce-cart .cart-empty.woocommerce-info::before {
  content: '' !important;
  position: absolute;
  top: 47px;
  left: 50%;
  width: 52px;
  height: 58px;
  border: 1.5px solid var(--gold);
  border-radius: 2px 2px 8px 8px;
  background: rgba(255,255,255,.45);
  transform: translateX(-50%);
  box-shadow: none;
}

body.woocommerce-cart .wc-block-cart__empty-cart__title::after,
body.woocommerce-cart .cart-empty.woocommerce-info::after {
  content: '';
  position: absolute;
  top: 35px;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--gold);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform: translateX(-50%);
}

/* Nasconde esclusivamente l'illustrazione standard del blocco. */
body.woocommerce-cart .wc-block-cart__empty-cart__title.with-empty-cart-icon::before {
  background-image: none !important;
}

body.woocommerce-cart .wc-block-cart__empty-cart__title > svg,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block > svg {
  display: none !important;
}

body.woocommerce-cart .return-to-shop {
  margin: -116px auto 78px;
  position: relative;
  z-index: 2;
  text-align: center;
}

body.woocommerce-cart .return-to-shop .button {
  padding: 15px 28px !important;
  border: 1px solid var(--ink) !important;
  border-radius: 0 !important;
  background: var(--ink) !important;
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 400 !important;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

/* Raccomandazioni */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block > h2,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-heading,
body.woocommerce-cart .cross-sells > h2 {
  margin: 0 0 42px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(32px, 3.4vw, 46px);
  font-weight: 400;
  line-height: 1.15;
  text-align: center;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block > h2::before,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-heading::before,
body.woocommerce-cart .cross-sells > h2::before {
  content: 'UNA SELEZIONE PER TE';
  display: block;
  margin-bottom: 13px;
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 2.4px;
}

body.woocommerce-cart .wp-block-woocommerce-product-new,
body.woocommerce-cart .wc-block-grid__products,
body.woocommerce-cart .cross-sells ul.products {
  gap: clamp(18px, 2.5vw, 32px) !important;
}

body.woocommerce-cart .wc-block-grid__products,
body.woocommerce-cart .wp-block-woocommerce-product-new ul.products,
body.woocommerce-cart .cross-sells ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: none !important;
  margin-inline: auto !important;
}

body.woocommerce-cart .wc-block-grid__product {
  box-sizing: border-box;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  border: 0 !important;
}

body.woocommerce-cart .wc-block-grid__product-image,
body.woocommerce-cart .wc-block-grid__product-image a {
  display: block;
  overflow: hidden;
  background: #f1ebe4;
}

body.woocommerce-cart .wc-block-grid__product-image img {
  width: 100%;
  aspect-ratio: 1 / 1.06;
  object-fit: cover;
  transition: transform .55s ease;
}

body.woocommerce-cart .wc-block-grid__product:hover .wc-block-grid__product-image img {
  transform: scale(1.025);
}

body.woocommerce-cart .wc-block-grid__product-title {
  margin: 20px 0 9px;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(17px, 1.55vw, 21px);
  font-weight: 400;
  line-height: 1.3;
}

body.woocommerce-cart .wc-block-grid__product-price {
  margin-bottom: 17px;
  color: var(--gold);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
}

body.woocommerce-cart .wc-block-grid__product-add-to-cart .wp-block-button__link {
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  transition: background .25s ease, color .25s ease;
}

body.woocommerce-cart .wc-block-grid__product-add-to-cart .wp-block-button__link:hover {
  background: var(--ink);
  color: #fff;
}

@media (max-width: 780px) {
  body.woocommerce-cart .wc-block-cart__empty-cart__title,
  body.woocommerce-cart .cart-empty.woocommerce-info {
    min-height: 270px;
    margin-bottom: 54px !important;
    padding-top: 138px !important;
  }

  body.woocommerce-cart .wc-block-grid__products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.woocommerce-cart .wp-block-woocommerce-product-new ul.products,
  body.woocommerce-cart .cross-sells ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.woocommerce-cart .wc-block-grid__product {
    width: auto;
    max-width: none;
  }
}

@media (max-width: 520px) {
  body.woocommerce-cart .xage-shop-container > h1,
  body.woocommerce-cart .xage-content-container article > h1,
  body.woocommerce-cart .entry-title {
    margin-bottom: 28px;
  }

  body.woocommerce-cart .wc-block-cart__empty-cart__title,
  body.woocommerce-cart .cart-empty.woocommerce-info {
    min-height: 250px;
    padding: 132px 22px 38px !important;
    font-size: 27px !important;
  }

  body.woocommerce-cart .wc-block-grid__products {
    grid-template-columns: 1fr !important;
  }

  body.woocommerce-cart .wp-block-woocommerce-product-new ul.products,
  body.woocommerce-cart .cross-sells ul.products {
    grid-template-columns: 1fr !important;
  }
}
