/* SOP 1.1.1: isolate the storefront from legacy Avada/Fusion layout rules.
 * Keep builder styles available for existing pages, without letting generic
 * .container and .products rules resize SOP-owned layout components.
 */
body.sop-theme .sop-container {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding-inline: 0;
  float: none;
}
body.sop-theme .header-inner > *,
body.sop-theme .hero-content,
body.sop-theme .build-section > *,
body.sop-theme .finder-fields > *,
body.sop-theme .about-inner > *,
body.sop-theme .footer-grid > *,
body.sop-theme .shop-main {
  min-width: 0;
}
body.sop-theme .hero { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
body.sop-theme .about-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
body.sop-theme .footer-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); }
body.sop-theme .about-visual > img { width: 100%; max-width: 100%; }
body.sop-theme .about-copy,
body.sop-theme .footer-grid { overflow-wrap: anywhere; }

/* Grid is an explicit contract on every SOP loop, including homepage loops
 * that do not have WooCommerce's .woocommerce body/ancestor class. */
body.sop-theme ul.products.product-grid {
  --sop-product-columns: 4;
  display: grid !important;
  grid-template-columns: repeat(var(--sop-product-columns), minmax(0, 1fr)) !important;
  grid-auto-flow: row;
  grid-auto-rows: 1fr;
  align-items: stretch !important;
  justify-items: stretch !important;
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  gap: 20px;
  list-style: none;
}
body.sop-theme ul.products.product-grid::before,
body.sop-theme ul.products.product-grid::after { display: none !important; content: none !important; }
body.sop-theme .shop-main ul.products.product-grid { --sop-product-columns: 3; }
body.sop-theme ul.products.product-grid > li.product {
  box-sizing: border-box;
  float: none !important;
  clear: none !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  flex: none !important;
  align-self: stretch;
}
body.sop-theme ul.products.product-grid > li.product.product-card {
  display: flex !important;
  flex-direction: column !important;
}
body.sop-theme ul.products.product-grid .product-card__media {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  overflow: hidden;
}
body.sop-theme ul.products.product-grid .product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
body.sop-theme ul.products.product-grid .product-card__title {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
body.sop-theme ul.products.product-grid .product-card__actions { margin-top: 0; }
body.sop-theme section.related.products,
body.sop-theme section.up-sells.products { display: block; }

/* Keep controls on one header row without inheriting old Bootstrap padding. */
body.sop-theme .header-inner { margin-inline: auto; padding: 0; }
body.sop-theme .header-actions { flex: 0 0 auto; }

/* Account/cart shortcodes do not add WooCommerce's catalog body class. */
body.sop-theme .woocommerce form.login,
body.sop-theme .woocommerce form.register,
body.sop-theme .woocommerce form.checkout_coupon {
  border: 1px solid #383838;
  border-radius: 22px;
  background: #171717;
}
body.sop-theme .woocommerce form .form-row input.input-text,
body.sop-theme .woocommerce form .form-row textarea {
  border-radius: 14px;
  background: #222;
  color: #fff;
}
body.sop-theme .woocommerce form .button {
  border-radius: 14px;
  background: var(--yellow, #f1be10);
  color: #111;
  border: 1px solid var(--yellow, #f1be10);
  font-weight: 800;
}
body.sop-theme .woocommerce form .button:hover {
  background: #fff;
  border-color: #fff;
  color: #111;
}

@media (max-width: 1199px) {
  body.sop-theme .shop-main ul.products.product-grid { --sop-product-columns: 2; }
}
@media (max-width: 959px) {
  body.sop-theme .header-actions { margin-left: auto; }
  body.sop-theme .hero { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  body.sop-theme .about-inner { grid-template-columns: minmax(0, 1fr); }
  body.sop-theme .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.sop-theme ul.products.product-grid { --sop-product-columns: 2; }
  body.sop-theme .shop-main ul.products.product-grid { --sop-product-columns: 3; }
}
@media (max-width: 680px) {
  body.sop-theme .hero { grid-template-columns: minmax(0, 1fr); }
  body.sop-theme .finder-fields { grid-template-columns: minmax(0, 1fr); }
  body.sop-theme .category-quicklinks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.sop-theme ul.products.product-grid,
  body.sop-theme .shop-main ul.products.product-grid {
    --sop-product-columns: 2;
    gap: 12px;
  }
  body.sop-theme .footer-top > p { min-width: 0; }
  body.sop-theme .header-actions { gap: 0; }
}
