/* Layout: sidebar + products */
.np-shop-layout__inner {
  width: min(calc(100% - 32px), var(--np-max));
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  /* Anchor: Grid placement */
  grid-auto-flow: row;
}

/* Shop titlebar – centered across sidebar + products
   Anchor: Shop Title Centered */
.np-shop-layout__titlebar {
  grid-column: 1 / -1;
  margin-bottom: 14px;
  text-align: center;
}

.np-shop-layout__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

/* Anchor: Force sidebar + main into the correct columns */
.np-sidebar {
  grid-column: 1;
}

.np-shop {
  grid-column: 2;
  min-width: 0;
  /* prevents overflow issues in grids */
}

/* Toolbar stays inside main column */
.np-shop__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* Woo loop UL is usually .products */
.woocommerce ul.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
}

/* IMPORTANT:
   Prevent Woo/Theme clearfix pseudo-elements from becoming grid items.
   This fixes the "empty first slot" in a CSS grid layout. */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
  content: none !important;
  display: none !important;
}

/* Remove default floats/margins that some themes add */
.woocommerce ul.products li.product {
  list-style: none;
  margin: 0 !important;
  width: auto !important;
  float: none !important;
}

/* Responsive */
@media (max-width: 1000px) {
  .np-shop-layout__inner {
    grid-template-columns: 1fr;
  }
  .np-shop-layout__titlebar {
    margin-bottom: 10px;
  }
  /* Anchor: Stack sidebar above products on small screens */
  .np-sidebar {
    grid-column: 1;
  }
  .np-shop {
    grid-column: 1;
  }
  .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .np-shop-layout__inner {
    width: min(calc(100% - 22px), var(--np-max));
  }
}

@media (max-width: 560px) {
  .woocommerce ul.products {
    grid-template-columns: 1fr;
  }
}

/* Progressive AJAX enhancement: the server-rendered catalogue remains fully
   functional without JavaScript. During an AJAX refresh, keep the existing
   layout in place and only soften it slightly. */
.np-shop-layout__inner.is-loading {
  opacity: .58;
  pointer-events: none;
  transition: opacity .14s ease;
}
