/* ── Hubble Gallery ──────────────────────────────────────────────────────────── */

.hg-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero */
.hg-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hg-hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.hg-hero-sub {
  color: var(--text-muted, #888);
  font-size: 0.95rem;
  margin: 0;
}

.hg-hero-sub a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Tabs */
.hg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border, #2a2a2a);
  padding-bottom: 1rem;
}

.hg-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 2rem;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.hg-tab:hover {
  background: var(--surface-hover, #1a1a1a);
  color: var(--text, #eee);
  border-color: var(--text-muted, #555);
}

.hg-tab.active {
  background: var(--accent, #3b82f6);
  border-color: var(--accent, #3b82f6);
  color: #fff;
}

.hg-tab-count {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Grid */
.hg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  min-height: 200px;
}

/* Card */
.hg-card {
  background: var(--card-bg, #111);
  border: 1px solid var(--border, #222);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.hg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.hg-card-img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  background: #0a0a0a;
  overflow: hidden;
}

.hg-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.hg-card:hover .hg-card-img {
  transform: scale(1.03);
}

.hg-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 2rem;
  background: #0d0d0d;
}

.hg-card-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.hg-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hg-card-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
}

.hg-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: var(--badge-bg, #1e3a5f);
  color: var(--badge-text, #7eb8f7);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hg-card-date {
  font-size: 0.68rem;
  color: var(--text-muted, #666);
  margin-left: auto;
}

/* Footer */
.hg-footer {
  text-align: center;
  margin-top: 2rem;
}

.hg-load-more {
  padding: 0.6rem 2rem;
  background: var(--accent, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.hg-load-more:hover {
  background: var(--accent-hover, #2563eb);
}

.hg-status {
  font-size: 0.82rem;
  color: var(--text-muted, #666);
  margin: 0.75rem 0 0;
}

/* Lightbox */
.hg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hg-lightbox[hidden] {
  display: none;
}

.hg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  cursor: pointer;
}

.hg-lightbox-panel {
  position: relative;
  z-index: 1;
  background: var(--card-bg, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  width: min(92vw, 820px);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .hg-lightbox-panel {
    flex-direction: row;
    max-height: 80vh;
  }
}

.hg-lb-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
  padding: 0.2rem 0.4rem;
}

.hg-lb-close:hover {
  color: var(--text, #eee);
}

.hg-lb-img-wrap {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  background: #000;
}

@media (min-width: 640px) {
  .hg-lb-img-wrap {
    width: 55%;
    max-width: 55%;
  }
}

.hg-lb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-height: 50vh;
}

@media (min-width: 640px) {
  .hg-lb-img {
    max-height: 80vh;
  }
}

.hg-lb-meta {
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
}


.hg-lb-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.hg-lb-desc {
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  line-height: 1.6;
  margin: 0;
  max-height: 160px;
  overflow-y: auto;
}

.hg-lb-details {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted, #666);
  margin-top: 0.25rem;
}

.hg-lb-link {
  display: inline-block;
  margin-top: auto;
  padding: 0.45rem 1rem;
  background: var(--accent, #3b82f6);
  color: #fff;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s;
}

.hg-lb-link:hover {
  background: var(--accent-hover, #2563eb);
}

/* Empty / loading states */
.hg-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted, #666);
  padding: 4rem 0;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .hg-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .hg-tab {
    font-size: 0.72rem;
    padding: 0.28rem 0.6rem;
  }
}

/* Subcategory chips */
.hg-subcats {
  margin-bottom: 1.25rem;
}

.hg-subcat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.hg-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 2rem;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.hg-chip:hover {
  background: var(--surface-hover, #1a1a1a);
  color: var(--text, #eee);
  border-color: var(--text-muted, #555);
}

.hg-chip.active {
  background: rgba(59,130,246,0.15);
  border-color: var(--accent, #3b82f6);
  color: var(--accent, #3b82f6);
}

/* Lightbox badges row */
.hg-lb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}

.hg-lb-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.hg-lb-badge--category {
  background: rgba(59,130,246,0.15);
  color: var(--accent, #3b82f6);
}

.hg-lb-badge--type {
  background: rgba(168,85,247,0.15);
  color: #a855f7;
}

/* Hubble-specific lightbox additions */
.hg-lb-objects {
  font-size: 0.78rem;
  color: var(--accent, #3b82f6);
  font-weight: 600;
  margin: 0;
}

.hg-lb-credit {
  font-size: 0.72rem;
  color: var(--text-muted, #666);
  font-style: italic;
  margin: 0;
}
