/**
 * Shell: di dalam Elementor, .elementor-widget-container sering jadi flex item
 * dengan min-width: auto → isi grid memaksa kolom melebar & tampak “melebihi”
 * sampai harus ditambal padding besar. min-width: 0 + overflow di sini memperbaiki itu.
 */
.alphauzi-blog-index-grid-shell--loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.alphauzi-blog-index-grid-shell {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flow-root;
  /* clip horizontal: jangan hidden penuh agar sticky/dropdown di luar widget tidak ikut terpotong */
  overflow-x: clip;
  overflow-y: visible;
}

/* Elemen Elementor: data-widget_type lebih andal daripada class (underscore vs hyphen). */
.elementor-element[data-widget_type^="alphauzi_blog_index_grid"],
.elementor-element[data-widget_type^="alphauzi-blog-index-grid"] {
  min-width: 0;
  max-width: 100%;
  flex-shrink: 1;
  width: 100%;
  box-sizing: border-box;
}

.elementor-element[data-widget_type^="alphauzi_blog_index_grid"]
  > .elementor-widget-container,
.elementor-element[data-widget_type^="alphauzi-blog-index-grid"]
  > .elementor-widget-container {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Flexbox Container (Elementor 3+) */
.e-con:has(.alphauzi-blog-index-grid-shell),
.e-con-inner:has(.alphauzi-blog-index-grid-shell),
.e-con.e-flex:has(.alphauzi-blog-index-grid-shell),
.e-child:has(.alphauzi-blog-index-grid-shell) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.elementor-section .elementor-container:has(.alphauzi-blog-index-grid-shell) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Kontainer widget Elementor yang langsung membungkus shell */
.elementor-widget-container:has(> .alphauzi-blog-index-grid-shell) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Kolom yang berisi grid */
.elementor-column:has(.alphauzi-blog-index-grid-shell),
.elementor-column-wrap:has(.alphauzi-blog-index-grid-shell) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fallback jika :has tidak didukung: nama class dari get_name() (underscore / hyphen) */
.elementor-widget-alphauzi_blog_index_grid .elementor-widget-container,
.elementor-widget-alphauzi-blog-index-grid .elementor-widget-container {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.alphauzi-blog-index-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  --auzi-blog-img-ratio: 3 / 4;
  --auzi-blog-img-object-fit: cover;
}

.alphauzi-blog-index-grid__items {
  display: grid;
  /* minmax(0, 1fr): track boleh menyusut di bawah ukuran konten → tidak “blow out” container */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 100%;
}

.alphauzi-blog-index-grid__item {
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.alphauzi-blog-index-grid__article {
  margin: 0;
  text-align: center;
  min-width: 0;
  max-width: 100%;
}

.alphauzi-blog-index-grid__thumb {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--auzi-blog-img-ratio, 3 / 4);
  overflow: hidden;
  background: #f1f1ed;
  /* Pastikan kotak punya tinggi jelas untuk isi gambar (cover). */
  min-height: 0;
}

.alphauzi-blog-index-grid__thumb:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Absolute fill: mengalahkan aturan tema seperti img { height: auto; } agar selalu crop + cover */
.alphauzi-blog-index-grid__thumb .alphauzi-blog-index-grid__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: var(--auzi-blog-img-object-fit, cover);
  object-position: center;
  display: block;
  transition: transform 0.35s ease;
}

.alphauzi-blog-index-grid__thumb:hover .alphauzi-blog-index-grid__img {
  transform: scale(1.03);
}

.alphauzi-blog-index-grid__title {
  margin: 1rem 0 0 0;
  padding: 0 0.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem);
  font-weight: 400;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.alphauzi-blog-index-grid__title a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.alphauzi-blog-index-grid__title a:hover {
  opacity: 0.75;
}

.alphauzi-blog-index-grid__empty {
  margin: 0;
  text-align: center;
}

/* Category / taxonomy filter: “All” first, then terms (horizontal scroll on narrow viewports) */
.alphauzi-blog-index-grid__filters {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
}

.alphauzi-blog-index-grid__filters-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.alphauzi-blog-index-grid--filter-scroll-x
  .alphauzi-blog-index-grid__filters-list {
  flex-wrap: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.alphauzi-blog-index-grid--filter-scroll-x
  .alphauzi-blog-index-grid__filters-list::-webkit-scrollbar {
  display: none;
}

.alphauzi-blog-index-grid__filters-list.is-overflowing {
  justify-content: flex-start !important;
}

.alphauzi-blog-index-grid__filter-item {
  margin: 0;
  padding: 0;
  list-style: none;
  flex-shrink: 0;
}

.alphauzi-blog-index-grid__filter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.85rem;
  box-sizing: border-box;
  font-size: 0.875rem;
  line-height: 1.2;
  text-decoration: none;
  color: #2f2f2f;
  border: 1px solid #d3d3cc;
  background: #fff;
  border-radius: 2px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.alphauzi-blog-index-grid__filter-link:hover {
  background: #f4f2ee;
  border-color: #cfcfc8;
}

.alphauzi-blog-index-grid__filter-link.is-active,
.alphauzi-blog-index-grid__filter-link[aria-current="true"] {
  background-color: #ede8e0;
  border-color: #d6d1c9;
  color: #111827;
  font-weight: 500;
}

.alphauzi-blog-index-grid__filter-link:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* Tablet: 2 columns */
@media (max-width: 991px) {
  .alphauzi-blog-index-grid__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*
 * Sangat sempit: 1 kolom (seperti CSS lama). Perlu specificity + !important agar
 * mengalahkan aturan grid dari panel Elementor (mobile default 2 kolom).
 */
@media (max-width: 599px) {
  .elementor-element.elementor-widget-alphauzi_blog_index_grid
    .alphauzi-blog-index-grid__items,
  .elementor-element.elementor-widget-alphauzi-blog-index-grid
    .alphauzi-blog-index-grid__items {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  }

  .alphauzi-blog-index-grid__items {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Pagination: square controls, centered */
.alphauzi-blog-index-grid__pagination {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.alphauzi-blog-index-grid__pagination ul.page-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.alphauzi-blog-index-grid__pagination ul.page-numbers li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.alphauzi-blog-index-grid__pagination a.page-numbers,
.alphauzi-blog-index-grid__pagination span.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.4rem;
  box-sizing: border-box;
  font-size: 0.875rem;
  line-height: 1;
  text-decoration: none;
  color: #2f2f2f;
  border: 1px solid #d3d3cc;
  background: #fff;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.alphauzi-blog-index-grid__pagination a.page-numbers:hover {
  background: #f4f2ee;
  border-color: #cfcfc8;
}

.alphauzi-blog-index-grid__pagination span.page-numbers.current {
  background-color: #ede8e0;
  border-color: #d6d1c9;
  color: #111827;
  font-weight: 500;
}

.alphauzi-blog-index-grid__pagination span.page-numbers.dots {
  border: none;
  background: transparent;
  min-width: auto;
  padding: 0 0.25rem;
}

.alphauzi-blog-index-grid__pagination a.page-numbers:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}
