* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

.top-nav-link:hover {
  color: #2c3e50;
}

.read-more-button {
  display: inline-block;
  background: none;
  color: black;
  border: none;
  cursor: pointer;
}

/* Header */
.header {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  gap: 14px;
}

.header-top {
  display: flex;
  align-items: baseline;
  flex-direction: column;
  gap: 8px;
}

.header h1 {
  font-size: 2.5em;
  color: #2c3e50;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.header-subtitle, .read-more-wrapper {
  font-size: 1.1em;
  color: #888;
}

.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 2px;
}

.filter-btn {
  padding: 8px 18px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.95em;
  color: #555;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-weight: 500;
  display: inline-block;
}

.filter-btn:hover {
  border-color: #3498db;
  color: #3498db;
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border-color: #2980b9;
  color: white;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.filter-btn.all-btn {
  border-color: #3498db;
  color: #3498db;
  font-weight: 600;
}

.filter-btn.all-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
}

/* Gallery Grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.gallery-item {
  position: relative;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.gallery-item img {
  height: 250px;
  flex-shrink: 0;
}

.gallery-item-description {
  padding: 10px 14px;
  font-size: 0.85em;
  color: #555;
  line-height: 1.45;
  max-height: 5em;
  overflow: hidden;
  position: relative;
}

.gallery-item-description::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5em;
  background: linear-gradient(transparent, white);
  pointer-events: none;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.gallery-item > img {
  width: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(52, 152, 219, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.overlay-label {
  color: white;
  font-weight: 600;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 12px;
  border-radius: 15px;
}

/* Loading & Empty States */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 4em;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* Load More Button */
.load-more-section {
  text-align: center;
  margin-top: 40px;
}

.load-more-btn {
  padding: 15px 40px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.load-more-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(52, 152, 219, 0.4);
}

.load-more-btn:active {
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .header {
    box-shadow: none;
    background: transparent;
    padding: 0;
  }

  .header h1 {
    font-size: 2em;
    white-space: normal;
  }

  .filter-buttons {
    overflow-x: auto;      
    flex-wrap: nowrap;    
    -webkit-overflow-scrolling: touch;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .gallery-item img {
    height: 200px;
  }

  .filters-section {
    overflow-x: auto;
  }

  .filter-buttons {
    padding-bottom: 10px;
  }
}

/* Label Description */
.label-description {
  margin-left: 4px;
  margin-top: -10px;
  padding-left: 14px;
  margin-bottom: 20px;
  font-size: 1.05em;
  color: #525050;
  border-left: 8px solid #2b84bf;
  padding-top: 10px;
  padding-bottom: 10px;
  max-width: 450px;
}

/* Results Info */
.results-info {
  color: #666;
  font-size: 0.9em;
  margin-bottom: 12px;
  padding: 0 4px;
}

/* Image Detail Overlay */
.image-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.image-detail-overlay.active {
  display: block;
}

body.image-detail-open {
  overflow: hidden;
}

.image-detail-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
}

.image-detail-panel {
  position: relative;
  max-width: 900px;
  margin: 40px auto;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.image-detail-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.image-detail-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.image-detail-loading {
  text-align: center;
  padding: 80px;
}

.image-detail-error {
  text-align: center;
  padding: 60px;
  color: #999;
}

.image-detail-image-wrap {
  width: 100%;
  background: #f0f0f0;
}

.image-detail-image-wrap img {
  width: 100%;
  display: block;
}

.image-detail-meta {
  padding: 30px;
}

.image-detail-title {
  font-size: 1.6em;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 700;
}

.image-detail-caption {
  font-size: 1.05em;
  color: #555;
  margin-bottom: 15px;
  font-style: italic;
}

.image-detail-description {
  font-size: 1em;
  color: #444;
  line-height: 1.7;
  margin-bottom: 20px;
}

.image-detail-date {
  color: #777;
  font-size: 0.95em;
  margin-bottom: 10px;
}

.image-detail-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.image-detail-label {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
}

.image-detail-photographer,
.image-detail-source {
  color: #555;
  font-size: 0.95em;
  margin-bottom: 10px;
}

.image-detail-programs {
  margin-top: 0px;
}

.image-detail-programs-title {
  font-size: 0.95em;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.image-detail-programs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.image-detail-program-link {
  color: #2980b9;
  font-size: 0.95em;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.image-detail-program-link:hover {
  color: #1a5276;
}

.image-detail-program-link::after {
  content: " ↗";
  font-size: 0.85em;
}

@media (max-width: 768px) {
  .image-detail-panel {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }
}
