/* ═══════════════════════════════════════════════════════════════
   Gallery — 3 tabs, product cards grid, filter bar
   BEM scope: .gallery__*, .product-card__*
   ═══════════════════════════════════════════════════════════════ */

.gallery {
  padding: var(--space-6) var(--space-4);
  max-width: 1400px;
  margin: 0 auto;
}

.gallery__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
  margin-bottom: var(--space-5);
  background: var(--gradient-title);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── Tabs ──────────────────────────────────────────────────────── */

.gallery__tabs {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-5);
  padding: 0 var(--space-3);
  flex-wrap: wrap; /* wrap to second line on very narrow screens */
}

.gallery__tab {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  min-height: 44px;
  flex: 1 1 auto; /* equal width, shrink to fit viewport */
  text-align: center;
  max-width: 160px;
}

/* On narrow mobile, ensure all 3 tabs fit in 1 row */
@media (max-width: 400px) {
  .gallery__tab {
    padding: var(--space-2) var(--space-3);
    font-size: 11px;
  }
}

.gallery__tab:hover {
  background: var(--surface-glass-strong);
  color: var(--text-primary);
}

.gallery__tab--active {
  background: var(--accent-primary);
  color: var(--bg-start);
  border-color: var(--accent-primary);
}

/* ─── Filters ───────────────────────────────────────────────────── */

.gallery__filters {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.gallery__series-filter {
  padding: var(--space-2) var(--space-4);
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.gallery__series-filter option {
  background: var(--bg-start);
  color: var(--text-primary);
}

/* ─── Grid ──────────────────────────────────────────────────────── */

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .gallery__grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .gallery__grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Loading skeleton ──────────────────────────────────────────── */

.gallery__loading {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.gallery__skeleton {
  aspect-ratio: 1;
  background: var(--surface-glass);
  border-radius: var(--radius-md);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ─── Empty state ───────────────────────────────────────────────── */

.gallery__empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   Product Card
   ═══════════════════════════════════════════════════════════════ */

.product-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(120, 60, 200, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.product-card__image-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-end);
  overflow: hidden;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Card badge (top-right corner) */
.product-card__card-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.product-card__card-badge--yes {
  background: var(--status-new);
  color: #000;
}

.product-card__card-badge--no {
  background: transparent;
  border: 1px solid var(--text-muted);
}

/* Info section */
.product-card__info {
  padding: var(--space-3);
}

.product-card__series {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: capitalize;
  margin-bottom: var(--space-1);
}

.product-card__name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: var(--space-2);
}

.product-card__ask {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

.product-card__stock {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.product-card__stock--in_stock {
  background: rgba(74, 222, 128, 0.15);
  color: var(--status-instock);
}

.product-card__stock--reserved {
  background: rgba(251, 191, 36, 0.15);
  color: var(--status-used);
}

.product-card__stock--sold {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-sold);
}
