/**
 * Universal Store Clean Child 3.5.0
 * Critical fixes: archive CTA behavior, checkout address visibility, strict mobile single-product responsiveness.
 */
html, body { max-width: 100%; overflow-x: hidden; }
body.usg-theme, body.usg-theme * { box-sizing: border-box; }
body.usg-theme img, body.usg-theme video, body.usg-theme iframe { max-width: 100%; height: auto; }

/* Archive CTA must look like a shop action but behave like a product-view link. */
body.usg-theme .woocommerce ul.products li.product a.usg-view-product-button,
body.usg-theme.woocommerce ul.products li.product a.usg-view-product-button,
body.usg-theme.woocommerce-page ul.products li.product a.usg-view-product-button {
  width: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 46px !important;
  border-radius: 999px !important;
  background: var(--usg-primary, #2563eb) !important;
  color: #fff !important;
  font-weight: 950 !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: 1.3 !important;
}
body.usg-theme .woocommerce ul.products li.product a.usg-view-product-button::after { content: "‹"; font-size: 18px; line-height: 1; }

/* Checkout: force postal address fields to be visible and stable. */
body.usg-theme.woocommerce-checkout .woocommerce,
body.usg-theme.woocommerce-checkout .usg-page-checkout,
body.usg-theme.woocommerce-checkout .usg-checkout-layout,
body.usg-theme.woocommerce-checkout form.checkout {
  max-width: 100% !important;
  min-width: 0 !important;
}
body.usg-theme.woocommerce-checkout #billing_address_1_field,
body.usg-theme.woocommerce-checkout #billing_address_2_field,
body.usg-theme.woocommerce-checkout #billing_city_field,
body.usg-theme.woocommerce-checkout #billing_state_field,
body.usg-theme.woocommerce-checkout #billing_country_field,
body.usg-theme.woocommerce-checkout #billing_postcode_field,
body.usg-theme.woocommerce-checkout #shipping_address_1_field,
body.usg-theme.woocommerce-checkout #shipping_address_2_field,
body.usg-theme.woocommerce-checkout #shipping_city_field,
body.usg-theme.woocommerce-checkout #shipping_state_field,
body.usg-theme.woocommerce-checkout #shipping_country_field,
body.usg-theme.woocommerce-checkout #shipping_postcode_field {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  clear: both !important;
}
body.usg-theme.woocommerce-checkout #billing_address_1_field,
body.usg-theme.woocommerce-checkout #billing_address_2_field,
body.usg-theme.woocommerce-checkout #shipping_address_1_field,
body.usg-theme.woocommerce-checkout #shipping_address_2_field {
  grid-column: 1 / -1 !important;
}
body.usg-theme .usg-checkout-address-notice {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--usg-border, rgba(15,23,42,.1));
  border-radius: 18px;
  background: color-mix(in srgb, var(--usg-primary, #2563eb) 7%, var(--usg-surface, #fff));
  color: var(--usg-text, #0f172a);
}
body.usg-theme .usg-checkout-address-notice strong { font-weight: 950; }
body.usg-theme .usg-checkout-address-notice span { color: var(--usg-muted, #64748b); font-size: 13px; line-height: 1.8; }
body.usg-theme.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
body.usg-theme.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper,
body.usg-theme.woocommerce-checkout .woocommerce-additional-fields__field-wrapper {
  width: 100% !important;
  min-width: 0 !important;
}
body.usg-theme.woocommerce-checkout .form-row input,
body.usg-theme.woocommerce-checkout .form-row select,
body.usg-theme.woocommerce-checkout .form-row textarea,
body.usg-theme.woocommerce-checkout .select2-container,
body.usg-theme.woocommerce-checkout .select2-selection {
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Single product: strict no-horizontal-overflow mobile layout. */
body.usg-theme.single-product,
body.usg-theme.single-product #page,
body.usg-theme.single-product .site,
body.usg-theme.single-product .site-content,
body.usg-theme.single-product .content-area,
body.usg-theme.single-product .site-main,
body.usg-theme.single-product .inside-article,
body.usg-theme.single-product .entry-content,
body.usg-theme.single-product .woocommerce,
body.usg-theme.single-product .usg-woo-page,
body.usg-theme.single-product .usg-container,
body.usg-theme.single-product div.product {
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: clip !important;
}
body.usg-theme.single-product .usg-woo-page > .usg-container,
body.usg-theme.single-product .site-main,
body.usg-theme.single-product .inside-article {
  width: min(100%, 1280px) !important;
  padding-inline: clamp(10px, 3vw, 24px) !important;
  margin-inline: auto !important;
}
body.usg-theme.single-product div.product {
  width: 100% !important;
  margin-inline: auto !important;
}
body.usg-theme.single-product div.product .woocommerce-product-gallery,
body.usg-theme.single-product div.product div.images,
body.usg-theme.single-product div.product .summary,
body.usg-theme.single-product div.product .woocommerce-tabs,
body.usg-theme.single-product div.product .related,
body.usg-theme.single-product div.product .upsells {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
body.usg-theme.single-product .woocommerce-product-gallery,
body.usg-theme.single-product .woocommerce-product-gallery__wrapper,
body.usg-theme.single-product .woocommerce-product-gallery__image,
body.usg-theme.single-product .woocommerce-product-gallery__image a,
body.usg-theme.single-product .flex-viewport,
body.usg-theme.single-product .flex-viewport figure,
body.usg-theme.single-product .flex-viewport .woocommerce-product-gallery__wrapper {
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
body.usg-theme.single-product .woocommerce-product-gallery__image img,
body.usg-theme.single-product .wp-post-image {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center !important;
}
body.usg-theme.single-product .summary,
body.usg-theme.single-product .product_title,
body.usg-theme.single-product .woocommerce-product-details__short-description,
body.usg-theme.single-product .price,
body.usg-theme.single-product .product_meta,
body.usg-theme.single-product form.cart,
body.usg-theme.single-product .woocommerce-tabs,
body.usg-theme.single-product .woocommerce-Tabs-panel {
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  max-width: 100% !important;
}

/* Responsive product cards and related products. */
body.usg-theme .woocommerce ul.products,
body.usg-theme.woocommerce ul.products,
body.usg-theme.woocommerce-page ul.products {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
body.usg-theme .woocommerce ul.products li.product,
body.usg-theme.woocommerce ul.products li.product,
body.usg-theme.woocommerce-page ul.products li.product {
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 940px) {
  body.usg-theme.single-product .site-main,
  body.usg-theme.single-product .inside-article,
  body.usg-theme.single-product .usg-woo-page > .usg-container {
    width: 100% !important;
    padding-inline: 10px !important;
  }
  body.usg-theme.single-product div.product {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  body.usg-theme.single-product div.product .woocommerce-product-gallery,
  body.usg-theme.single-product div.product div.images,
  body.usg-theme.single-product div.product .summary {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 16px !important;
    position: static !important;
  }
  body.usg-theme.single-product .woocommerce-product-gallery__image {
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
  }
  body.usg-theme.single-product .woocommerce-product-gallery__image img,
  body.usg-theme.single-product .wp-post-image {
    max-height: min(58vh, 390px) !important;
    padding: 8px !important;
  }
  body.usg-theme.single-product .flex-control-thumbs {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 10px 0 0 !important;
    padding: 0 0 8px !important;
    list-style: none !important;
    scrollbar-width: thin;
  }
  body.usg-theme.single-product .flex-control-thumbs li {
    flex: 0 0 72px !important;
    width: 72px !important;
    max-width: 72px !important;
    float: none !important;
  }
  body.usg-theme.single-product .summary {
    padding: 16px !important;
    border-radius: 20px !important;
  }
  body.usg-theme.single-product .product_title {
    font-size: clamp(22px, 6.3vw, 30px) !important;
    line-height: 1.45 !important;
  }
  body.usg-theme.single-product form.cart {
    display: grid !important;
    grid-template-columns: 96px minmax(0, 1fr) !important;
    width: 100% !important;
  }
  body.usg-theme.single-product form.cart .quantity,
  body.usg-theme.single-product form.cart .quantity input.qty {
    width: 100% !important;
    min-width: 0 !important;
  }
  body.usg-theme.single-product form.cart .single_add_to_cart_button {
    width: 100% !important;
    min-width: 0 !important;
  }
  body.usg-theme.woocommerce-checkout form.checkout {
    display: block !important;
    width: 100% !important;
  }
  body.usg-theme.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
  body.usg-theme.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper,
  body.usg-theme.woocommerce-checkout .woocommerce-additional-fields__field-wrapper {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  body.usg-theme.woocommerce-checkout .col2-set .col-1,
  body.usg-theme.woocommerce-checkout .col2-set .col-2,
  body.usg-theme.woocommerce-checkout #order_review,
  body.usg-theme.woocommerce-checkout #order_review_heading {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }
}
@media (max-width: 420px) {
  body.usg-theme.single-product .site-main,
  body.usg-theme.single-product .inside-article,
  body.usg-theme.single-product .usg-woo-page > .usg-container { padding-inline: 8px !important; }
  body.usg-theme.single-product .summary { padding: 14px !important; }
  body.usg-theme.single-product form.cart { grid-template-columns: 1fr !important; }
  body.usg-theme.single-product .woocommerce-product-gallery__image img,
  body.usg-theme.single-product .wp-post-image { max-height: 330px !important; }
}
