/*
 * wp-layout-fixes.css
 * Fixes for WordPress template context:
 *  1. Footer appearing at top of page (shape divider + z-index)
 *  2. Page min-height so footer stays at bottom
 *  3. Header offset for fixed navbar
 *  4. Shape divider hidden on pages where they don't belong
 */

/* ── 1. Prevent footer from appearing at top ──────────────── */

/* The footer must stay at the bottom — never flow to the top */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Main content stretches to push footer down */
#smooth-wrapper,
#ie-main-content,
.ie-page-main {
  flex: 1 0 auto;
}

/* Footer always at the bottom */
.footer-big {
  flex-shrink: 0;
  position: relative;
  /* ensure shape-divider is relative to footer */
  overflow: hidden;
  z-index: 1;
}

/* Fix the shape divider — it must be INSIDE the footer, not above it */
.footer-big .tp-shape-divider.divider-footer {
  position: absolute;
  top: 0;
  /* at the very top of the footer element */
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  z-index: 2;
  pointer-events: none;
}

/* ── 2. Minimum page height so empty pages don't look broken ─ */

.ie-page-main {
  min-height: 70vh;
}

/* Page banner section */
.ie-page-banner {
  padding-top: 160px;
  padding-bottom: 80px;
}

/* ── 3. Fixed header offset ───────────────────────────────── */

/* Already handled by body padding-top in navbar-redesign.css,
   but reinforce it for WordPress pages */
.ie-page-main,
#main-content {
  padding-top: 0;
  /* banner handles its own padding */
}

/* ── 4. Hide stray shape-dividers on page.php / index.php ─── */

/* Shape dividers are only meant to be inside sections with bg changes.
   On plain page template where sections are managed by Gutenberg,
   shape dividers won't appear unless a block includes them. */
.ie-page-content>.tp-shape-divider:first-child {
  display: none;
}

/* ── 5. Smooth wrapper layout fix ─────────────────────────── */

#smooth-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#smooth-content {
  flex: 1;
}

/* ── 6. Gutenberg .wp-block-post-content spacing ─────────── */

.wp-block-post-content,
.entry-content,
.ie-page-content {
  min-height: 200px;
}

/* ── 7. Admin bar offset ──────────────────────────────────── */

.admin-bar #header-sticky {
  top: 32px !important;
}

@media screen and (max-width: 782px) {
  .admin-bar #header-sticky {
    top: 46px !important;
  }
}

/* ── 8. Page empty-state dashed box ──────────────────────── */

.ie-page-content [style*="dashed"] {
  margin: 80px auto;
  max-width: 600px;
}

/* ── 9. Products Layout: Sidebar Filter & Grid Side-by-Side ── */
@media (min-width: 992px) {

  /* Parent container styling if it contains both blocks */
  .site-main:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid),
  .entry-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid),
  .ie-page-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid) {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 30px;
    /* max-width: 1340px; */
    margin-left: auto;
    margin-right: auto;

    align-items: start;
  }

  /* Force other blocks in the same container to take full width */
  .site-main:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>*,
  .entry-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>*,
  .ie-page-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>* {
    grid-column: span 12;
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Specific column widths for filters and products grid */
  .site-main:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-sidebar-filter,
  .entry-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-sidebar-filter,
  .ie-page-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-sidebar-filter {
    grid-column: span 3;
    max-width: 100%;
    width: 100%;
    padding: 0;
    border: none;
  }

  .site-main:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-grid,
  .entry-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-grid,
  .ie-page-content:has(.wp-block-acf-products-sidebar-filter):has(.wp-block-acf-products-grid)>.wp-block-acf-products-grid {
    grid-column: span 9;
    max-width: 100%;
    width: 100%;
    margin-top: 0 !important;
    padding: 0;
    border: none;
  }
}