.gallery-listing { margin-top: 0; }

[data-gallery-listing] .subpage-content { padding-top: 16px; }

.gallery-filter-bar {
  background: var(--bg-3);
  position: relative; /* anchors the gradient-fade ::after below */
  padding-block: 14px;
}
.gallery-filter-bar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 28px;
  background: linear-gradient(to bottom, var(--bg-3), var(--bg));
  pointer-events: none;
}

.gallery-filter-bar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
}

/* ---------- search ---------- */
.gallery-search {
  display: flex;
  flex: 0 1 300px;
  min-width: 200px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.gallery-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  font: inherit;
  font-family: var(--font-body);
  color: var(--text);
}
.gallery-search input:focus { outline: none; }
.gallery-search button {
  border: 0;
  background: transparent;
  padding: 0 14px;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.gallery-search button:hover,
.gallery-search button:focus-visible { color: var(--biru-boss); }

/* ---------- category pills (scrollable, edge-fade on overflow — same
   affordance as news-listing.css's .news-filter-bar-categories /
   .subpage-tabs-edge in subpage.css) ---------- */
.gallery-filter-bar-categories {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.gallery-filter-bar-categories .products-filter {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: flex-start;
  margin-bottom: 0;
}
.gallery-filter-bar-categories .products-filter::-webkit-scrollbar { display: none; }
.gallery-filter-bar-categories .products-pill { flex: 0 0 auto; }

.gallery-scroll-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(24px, 5vw, 36px);
  z-index: 2;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  color: #fff;
  background: rgba(10, 14, 28, 0.4);
  cursor: pointer;
  opacity: 1;
  transition: opacity var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.gallery-scroll-edge:hover:not(:disabled) { background: rgba(10, 14, 28, 0.55); }
.gallery-scroll-edge:disabled { opacity: 0; pointer-events: none; cursor: default; }
.gallery-scroll-edge--left { left: 0; }
.gallery-scroll-edge--right { right: 0; }

@media (max-width: 640px) {
  .gallery-filter-bar { padding-block: 10px; }
  .gallery-filter-bar-inner { padding: 8px 10px; }
  .gallery-search { flex-basis: 100%; }
  .gallery-filter-bar-categories { flex-basis: 100%; }
}

/* ---------- results ---------- */
/* filter/search change: gallery-listing.js swaps in .gallery-skeleton tiles (no more 50% fade) */
[data-gallery-listing-results].is-loading { pointer-events: none; }

[data-gallery-listing-results] .gallery {
  max-width: none;
  column-count: 4;
}
@media (max-width: 1100px) {
  [data-gallery-listing-results] .gallery { column-count: 3; }
}
@media (max-width: 900px) {
  [data-gallery-listing-results] .gallery { column-count: 2; }
}
@media (max-width: 560px) {
  [data-gallery-listing-results] .gallery { column-count: 1; }
}

.gallery-listing-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-3);
  font-family: var(--font-body);
}

/* ---------- infinite scroll ---------- */
.gallery-listing-sentinel {
  height: 1px;
}
.gallery-listing-loading {
  padding: 8px 0 20px;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.gallery-listing-loading[hidden] { display: none; }

/* skeleton row: one tile per live column (4 / 3 / 2 / 1, same breakpoints as .gallery above) */
.gallery-loading-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: clamp(12px, 1.6vw, 20px);
}
.gallery-loading-tiles .gallery-skel { margin-bottom: 0; }
@media (max-width: 1100px) {
  .gallery-loading-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-loading-tiles .gallery-skel:nth-child(n+4) { display: none; }
}
@media (max-width: 900px) {
  .gallery-loading-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-loading-tiles .gallery-skel:nth-child(n+3) { display: none; }
}
@media (max-width: 560px) {
  .gallery-loading-tiles { grid-template-columns: 1fr; }
  .gallery-loading-tiles .gallery-skel:nth-child(n+2) { display: none; }
}

.gallery-loading-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 0;
}
.gallery-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--biru-boss);
  border-radius: 50%;
  animation: gallery-spin .7s linear infinite;
}
@keyframes gallery-spin { to { transform: rotate(360deg); } }
