/**
 * Gallery Base Styles — minimal fallback for gallery-controller.js
 *
 * These unscoped styles ensure the gallery works without a data-design-system
 * attribute. Theme-specific overrides live in styles/systems/*.css scoped via
 * [data-design-system="..."] selectors.
 *
 * Class names match gallery-controller.js createGalleryItem() output:
 *   .gallery-item > .gallery-figure > a > img.gallery-image
 *                  > .gallery-title
 *                  > .gallery-caption
 *                  > .gallery-info
 */

/* ==================== GALLERY CONTAINER ==================== */
.gallery-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Midrange mobile: 2 columns */
@media (min-width: 481px) and (max-width: 767px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Small mobile: single column */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .gallery-container {
    padding: 0 1rem 2rem;
  }
}

/* ==================== GALLERY ITEMS ==================== */
.gallery-item {
  background: var(--color-background, #fff);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--color-border, #e0e0e0);
}

.gallery-figure {
  margin: 0;
  overflow: hidden;
  background: var(--color-surface, #f5f5f5);
}

.gallery-image {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-title {
  padding: 1rem 1rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text, #000);
  line-height: 1.4;
}

.gallery-caption {
  padding: 0 1rem 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary, #666);
  line-height: 1.5;
}

.gallery-info {
  padding: 0 1rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary, #999);
  margin-top: auto;
}

/* ==================== FILTER UI ==================== */
.filter-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--color-background, #fff);
  border: 1px solid var(--color-border, #ccc);
  padding: 0.5rem;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.filter-action-btn {
  border: none;
  background: var(--color-surface, #f0f0f0);
  color: var(--color-text, #333);
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 1.5rem;
}

/* ==================== CHIPS ==================== */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--color-border, #ccc);
  background: var(--color-surface, #f5f5f5);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-close {
  margin-left: 0.5rem;
  font-size: 1.125rem;
  line-height: 1;
}

/* ==================== LOADING & NO RESULTS ==================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-border, #ccc);
  border-radius: 50%;
  border-top-color: var(--color-accent, #0D6EFD);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.no-results {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-surface, #f5f5f5);
  margin: 2rem auto;
  max-width: 500px;
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
  }
  .gallery-item,
  .gallery-image,
  .chip {
    transition: none;
  }
}
