/* ============================================================
   gallery.css — Photo gallery styles for michaelpierce.com
   Dark sci-fi theme extension
   ============================================================ */

/* ── Page shell ───────────────────────────────────────────── */
.gallery-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 3rem 0 5rem;
}

.gallery-page__header {
  text-align: center;
  margin-bottom: 3rem;
}

.gallery-page__back {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.2s, text-shadow 0.2s;
  margin-bottom: 2rem;
}

.gallery-page__back:hover {
  opacity: 1;
  text-shadow: var(--glow-cyan);
}

.gallery-page__title {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.gallery-page__desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ── Gallery index grid ───────────────────────────────────── */
.gallery-index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .gallery-index-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .gallery-index-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Gallery index card ───────────────────────────────────── */
.gallery-index-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.25s,
    box-shadow 0.25s,
    transform 0.2s;
  overflow: hidden;
}

.gallery-index-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 213, 0.25),
              0 0 30px rgba(0, 255, 213, 0.1),
              inset 0 0 20px rgba(0, 255, 213, 0.03);
  transform: translateY(-3px);
}

/* Cover image — top 60% of card */
.gallery-index-card__cover {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
  filter: brightness(0.85);
  transition: filter 0.25s;
}

.gallery-index-card:hover .gallery-index-card__cover {
  filter: brightness(1);
}

/* Info area */
.gallery-index-card__info {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.gallery-index-card__title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.gallery-index-card__desc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1.4;
}

.gallery-index-card__count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* ── Gallery story block ──────────────────────────────────── */
.gallery-story {
  max-width: 680px;
  margin: 0 auto 3rem;
  border-left: 2px solid var(--border-subtle);
  padding-left: 1.4rem;
}

.gallery-story p {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.72;
  color: var(--text-primary);
  opacity: 0.78;
  margin: 0 0 1.72rem;
}

.gallery-story p:last-child {
  margin-bottom: 0;
}

/* ── Individual gallery view ──────────────────────────────── */
.photo-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  text-align: center;
  margin-top: 2.5rem;
  margin-bottom: 1.8rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}

.photo-thumb {
  display: block;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-surface);
}

.photo-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: filter 0.2s, transform 0.2s;
  filter: brightness(0.88);
}

.photo-thumb:hover img {
  filter: brightness(1.15) drop-shadow(0 0 6px rgba(0, 255, 213, 0.55));
  transform: scale(1.04);
}

/* ── Lightbox ─────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#lightbox.is-open {
  display: flex;
}

#lightbox-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 85vh;
}

#lightbox-img {
  display: block;
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 255, 213, 0.15);
  border: 1px solid rgba(0, 255, 213, 0.2);
}

/* Prev / Next arrows */
.lb-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid rgba(0, 255, 213, 0.3);
  color: var(--accent-cyan);
  font-size: 1.6rem;
  width: 44px;
  height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
  z-index: 1010;
  font-family: var(--font-mono);
  line-height: 1;
}

.lb-arrow:hover {
  opacity: 1;
  border-color: var(--accent-cyan);
  background: rgba(0, 255, 213, 0.08);
}

#lb-prev {
  left: 1.2rem;
}

#lb-next {
  right: 1.2rem;
}

/* Close button */
#lb-close {
  position: fixed;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: 1px solid rgba(0, 255, 213, 0.3);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
  z-index: 1010;
  line-height: 1;
}

#lb-close:hover {
  opacity: 1;
  border-color: var(--accent-cyan);
  background: rgba(0, 255, 213, 0.08);
}

/* Caption */
#lb-caption {
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  max-width: 90vw;
  min-height: 1.2em;
}

/* Counter */
#lb-counter {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* Loading spinner overlay inside lightbox */
#lb-spinner {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#lb-spinner.is-loading {
  display: flex;
}

@media (max-width: 540px) {
  .lb-arrow {
    width: 36px;
    height: 48px;
    font-size: 1.2rem;
  }

  #lb-prev {
    left: 0.3rem;
  }

  #lb-next {
    right: 0.3rem;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
  }
}
