/* 1.6.1: targeted layout repairs; keep Gutenberg's global reading width unchanged. */
@media (min-width: 981px) {
  body .wp-site-blocks main.product-category-page > .product-category-layout,
  body .wp-site-blocks main.catalog-page > .catalog-layout {
    display: grid !important;
    grid-template-columns: 264px minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: none !important;
    align-items: start !important;
    column-gap: 32px !important;
  }
  body .wp-site-blocks main.product-category-page > .product-category-layout > .product-category-sidebar-column,
  body .wp-site-blocks main.catalog-page > .catalog-layout > .catalog-sidebar-column,
  body .wp-site-blocks main.product-category-page > .product-category-layout > .product-category-content-column,
  body .wp-site-blocks main.catalog-page > .catalog-layout > .catalog-content-column {
    box-sizing: border-box;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: initial !important;
    margin: 0 !important;
  }
}
/* WordPress constrained layout otherwise limits inner collections to 820px. */
body .wp-site-blocks main.product-category-page > .product-category-layout > .product-category-content-column > .wp-block-woocommerce-product-collection,
body .wp-site-blocks main.catalog-page > .catalog-layout > .catalog-content-column > .wp-block-woocommerce-product-collection {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-inline: 0 !important;
}
body .wp-site-blocks main.product-category-page .kristall-product-grid .wc-block-product-template,
body .wp-site-blocks main.catalog-page .kristall-product-grid .wc-block-product-template {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: none !important;
  gap: 16px !important;
  margin-inline: 0 !important;
}
body .wp-site-blocks main.product-category-page .kristall-product-grid .wc-block-product,
body .wp-site-blocks main.catalog-page .kristall-product-grid .wc-block-product {
  box-sizing: border-box;
  min-width: 0 !important;
  width: auto !important;
  overflow-wrap: anywhere;
}
/* The industries section is an alignwide group, not an 820px article. */
body .wp-site-blocks .about-industries.alignwide {
  box-sizing: border-box;
  width: min(var(--kristall-wide, 1380px), calc(100% - 48px)) !important;
  max-width: 1380px !important;
  margin: 48px auto 56px !important;
}
body .wp-site-blocks .about-industries > .about-industry-grid {
  box-sizing: border-box;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: none !important;
  gap: 20px !important;
  margin: 24px 0 0 !important;
}
body .wp-site-blocks .about-industries > .about-industry-grid > .wp-block-column {
  flex: initial !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}
body .wp-site-blocks .about-industry-card {
  box-sizing: border-box;
  min-height: 100%;
  overflow-wrap: break-word;
}
body .wp-site-blocks .about-industries > .k-eyebrow { margin: 0 0 8px !important; }
@media (max-width: 1200px) and (min-width: 981px) {
  body .wp-site-blocks main.product-category-page .kristall-product-grid .wc-block-product-template,
  body .wp-site-blocks main.catalog-page .kristall-product-grid .wc-block-product-template { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 980px) {
  body .wp-site-blocks main.product-category-page .kristall-product-grid .wc-block-product-template,
  body .wp-site-blocks main.catalog-page .kristall-product-grid .wc-block-product-template { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  body .wp-site-blocks .about-industries > .about-industry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px !important; }
}
@media (max-width: 650px) {
  body .wp-site-blocks main.product-category-page .kristall-product-grid .wc-block-product-template,
  body .wp-site-blocks main.catalog-page .kristall-product-grid .wc-block-product-template { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  body .wp-site-blocks .about-industries.alignwide { width: calc(100% - 28px) !important; margin: 30px auto 38px !important; }
  body .wp-site-blocks .about-industries > .about-industry-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
}

/* 1.6.2 — fix the outer Gutenberg constrained container, not just its children. */
@media (min-width: 981px) {
  body .wp-site-blocks main.product-category-page.alignwide,
  body .wp-site-blocks main.catalog-page.alignwide,
  body .wp-site-blocks main.product-category-page,
  body .wp-site-blocks main.catalog-page {
    box-sizing: border-box !important;
    width: min(1380px, calc(100% - 48px)) !important;
    max-width: 1380px !important;
    margin-inline: auto !important;
  }
  body .wp-site-blocks main.product-category-page > .wp-block-columns.product-category-layout,
  body .wp-site-blocks main.catalog-page > .wp-block-columns.catalog-layout {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }
  body .wp-site-blocks .about-page-main .wp-block-post-content {
    width: 100% !important;
    max-width: none !important;
  }
  body .wp-site-blocks .about-page-main .about-industries,
  body .wp-site-blocks .about-page-main .wp-block-post-content .about-industries {
    box-sizing: border-box !important;
    width: min(1380px, calc(100% - 48px)) !important;
    max-width: 1380px !important;
    margin-inline: auto !important;
  }
  body .wp-site-blocks .about-page-main .about-industries .about-industry-grid {
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }
}
@media (min-width: 651px) and (max-width: 980px) {
  body .wp-site-blocks main.product-category-page,
  body .wp-site-blocks main.catalog-page,
  body .wp-site-blocks .about-page-main .about-industries {
    width: calc(100% - 36px) !important;
    max-width: none !important;
    margin-inline: auto !important;
  }
}

/* 1.6.3: about page only — bypass block-editor content-width constraints.
   The section may have been edited in Gutenberg, so do not depend solely
   on the original direct-child hierarchy or the alignwide class. */
@media (min-width: 981px) {
  body.page .about-page-main,
  body.page .about-page-main > .wp-block-post-content,
  body.page .about-page-main > .wp-block-post-content.is-layout-constrained {
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
  }
  body.page .about-page-main .about-industries,
  body.page .about-page-main .wp-block-group:has(> .wp-block-columns.about-industry-grid),
  body.page .about-page-main .wp-block-group:has(> .wp-block-columns .about-industry-card) {
    box-sizing: border-box !important;
    width: min(1380px, calc(100% - 48px)) !important;
    max-width: 1380px !important;
    min-width: 0 !important;
    margin: 64px auto 64px !important;
    padding: 0 !important;
  }
  body.page .about-page-main .about-industry-grid,
  body.page .about-page-main .wp-block-columns:has(.about-industry-card),
  body.page .about-page-main .about-industries .wp-block-columns {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 24px 0 0 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch !important;
  }
  body.page .about-page-main .about-industry-grid > .wp-block-column,
  body.page .about-page-main .wp-block-columns:has(.about-industry-card) > .wp-block-column {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    flex: none !important;
  }
  body.page .about-page-main .about-industry-card {
    box-sizing: border-box !important;
    height: 100% !important;
    min-width: 0 !important;
    padding: 24px !important;
    overflow-wrap: break-word;
  }
  body.page .about-page-main .about-industries > h2,
  body.page .about-page-main .wp-block-group:has(> .wp-block-columns.about-industry-grid) > h2 {
    margin: 8px 0 12px !important;
  }
  body.page .about-page-main .about-industries > p:not(.k-eyebrow) {
    margin: 0 !important;
  }
}
@media (min-width: 651px) and (max-width: 980px) {
  body.page .about-page-main .about-industries,
  body.page .about-page-main .wp-block-group:has(> .wp-block-columns.about-industry-grid) {
    width: calc(100% - 36px) !important;
    max-width: none !important;
    margin: 44px auto !important;
  }
  body.page .about-page-main .about-industry-grid,
  body.page .about-page-main .wp-block-columns:has(.about-industry-card) {
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }
}
@media (max-width: 650px) {
  body.page .about-page-main .about-industries,
  body.page .about-page-main .wp-block-group:has(> .wp-block-columns.about-industry-grid) {
    box-sizing: border-box !important;
    width: calc(100% - 28px) !important;
    max-width: none !important;
    margin: 36px auto !important;
  }
  body.page .about-page-main .about-industry-grid,
  body.page .about-page-main .wp-block-columns:has(.about-industry-card) {
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
}
