/**
 * Astral Commerce production QA and optimisation safeguards.
 * Package 9.4 / Theme 3.3.0
 */

/* Prevent long text and media from creating horizontal layout shifts. */
:where(main, article, section, aside, .site-content, .woocommerce) {
  min-inline-size: 0;
}

:where(img, video, iframe, svg) {
  max-inline-size: 100%;
}

:where(p, li, dd, figcaption, address, .woocommerce-message, .woocommerce-info, .woocommerce-error) {
  overflow-wrap: anywhere;
}

/* Defer rendering work for safe below-the-fold sections without changing layout. */
@supports (content-visibility: auto) {
  :where(
    .acp-home-section,
    .acp-learn-section,
    .acp-related-section,
    .related.products,
    .upsells.products,
    .cross-sells,
    .site-footer
  ) {
    content-visibility: auto;
    contain-intrinsic-block-size: 720px;
  }

  /* Never defer critical transactional or first-view content. */
  :where(
    .acp-hero,
    .acp-product-hero,
    .woocommerce-cart-form,
    .woocommerce-checkout,
    .woocommerce-account,
    .woocommerce-notices-wrapper
  ) {
    content-visibility: visible;
    contain-intrinsic-block-size: auto;
  }
}

/* Stable media placeholders reduce cumulative layout shift. */
:where(.products .product img, .acp-product-card img, .woocommerce-product-gallery img) {
  block-size: auto;
  object-fit: contain;
}

/* Windows High Contrast / forced-colour support. */
@media (forced-colors: active) {
  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid CanvasText;
    outline-offset: 3px;
  }

  :where(.button, button, input[type="submit"], .acp-button) {
    border: 1px solid ButtonText;
  }
}

/* Honour users who request reduced data usage. */
@media (prefers-reduced-data: reduce) {
  :where(video[autoplay], .acp-autoplay-media) {
    display: none !important;
  }

  :where(*) {
    background-attachment: initial !important;
  }
}

/* Production print baseline for invoices, articles and order information. */
@media print {
  :where(.site-header, .site-footer, .acp-cookie-consent, .acp-mobile-nav, .woocommerce-breadcrumb) {
    display: none !important;
  }

  :where(body, main, article, .site-content) {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  :where(a[href])::after {
    content: none !important;
  }

  :where(.woocommerce-order, .woocommerce-MyAccount-content, article) {
    inline-size: 100% !important;
    max-inline-size: none !important;
  }
}
