/* =====================================================================
   GALLERY PAGE (v2). Shared styles: css/site.css
   Photos, pagination and the viewer are rendered by js/gallery.js
   Pre-redesign version: css/gallery-classic.css (classic/gallery.html)
   ===================================================================== */

/* --- Filter bar --- */
.g-filters {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 11, 11, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--h-line-dark);
  padding: 0.9rem 0;
  transition: top 0.45s var(--h-ease);
}
/* sit just below the site nav whenever it's showing */
body:has(.h-nav.is-scrolled:not(.is-hidden)) .g-filters { top: 68px; }
@media (max-width: 768px) { body:has(.h-nav.is-scrolled:not(.is-hidden)) .g-filters { top: 60px; } }
.g-filters .nav-buttons { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; }
.g-filters .nav-buttons::-webkit-scrollbar { display: none; }
.g-filters .nav-btn {
  flex-shrink: 0;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--h-line-dark);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.g-filters .nav-btn:hover { border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.g-filters .nav-btn.active { background: var(--h-accent); border-color: var(--h-accent); color: #000; }

/* --- Loading --- */
.gallery-loading { display: none; background: var(--h-ink); padding: 4rem 0; text-align: center; color: var(--h-on-dark-muted); }
.gallery-loading .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 3px solid var(--h-line-dark);
  border-top-color: var(--h-accent);
  animation: gSpin 0.9s linear infinite;
}
@keyframes gSpin { to { transform: rotate(360deg); } }

/* --- Categories --- */
.gallery-main { padding: clamp(3rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem); }
.gallery-category { padding-top: clamp(2rem, 4vw, 3rem); }
.gallery-category + .gallery-category { margin-top: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--h-line-dark); }
.gallery-category.hidden { display: none; }
.gallery-category.hidden + .gallery-category,
.gallery-category:first-child { border-top: 0; margin-top: 0; }
.category-header { display: flex; align-items: flex-end; gap: 1.25rem; margin-bottom: 1.75rem; }
.g-cat-num {
  font-family: var(--h-display);
  font-weight: 700;
  font-size: clamp(3.5rem, 7vw, 5rem);
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--h-accent);
}
.category-header h2 {
  font-family: var(--h-display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
  margin: 0 0 0.35rem;
  color: #fff;
}
.category-header p { margin: 0; color: var(--h-on-dark-muted); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.gallery-grid:empty { display: none; }
.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--h-ink-3);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.8s var(--h-ease); }
.gallery-item:hover img,
.gallery-item:focus-visible img { transform: scale(1.06); }
.gallery-item .gallery-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 1rem 0.9rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s var(--h-ease);
}
.gallery-item:hover .gallery-overlay,
.gallery-item:focus-visible .gallery-overlay { opacity: 1; transform: none; }
.gallery-overlay h3 { font-family: var(--h-display); text-transform: uppercase; font-size: 1.2rem; margin: 0; }
.gallery-overlay p { margin: 0.2rem 0 0; font-size: 0.82rem; color: rgba(255, 255, 255, 0.75); }
@media (hover: none) {
  .gallery-item .gallery-overlay { opacity: 1; transform: none; }
}

/* pagination (rendered by gallery.js) */
.pagination-container { display: flex; justify-content: center; margin-top: 1.5rem; }
.pagination-container:empty { display: none; }
.pagination-container .pagination-btn {
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--h-line-dark);
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.pagination-container .pagination-btn:hover:not(:disabled) { background: var(--h-accent); color: #000; border-color: var(--h-accent); }
.pagination-container .pagination-btn:disabled { opacity: 0.3; cursor: default; }
.pagination-container .pagination-info { display: inline-block; align-self: center; margin: 0 1.25rem; color: var(--h-on-dark-muted); font-size: 0.9rem; }

.no-images-state { text-align: center; padding: 4rem 0; color: var(--h-on-dark-muted); }
.no-images-state h3 { color: #fff; font-family: var(--h-display); text-transform: uppercase; font-size: 1.8rem; }

/* --- Photo viewer (gallery.js toggles style.display) --- */
.g-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 8, 8, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.g-lightbox .lightbox-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 5.5rem 2rem;
}
.g-lightbox .lightbox-image { max-width: 100%; max-height: calc(100vh - 11rem); object-fit: contain; border-radius: 6px; }
.g-lightbox .lightbox-caption { margin-top: 1rem; text-align: center; color: rgba(255, 255, 255, 0.7); font-size: 0.9rem; line-height: 1.5; }
.g-lightbox .lightbox-caption strong { color: #fff; font-family: var(--h-display); text-transform: uppercase; font-size: 1.2rem; letter-spacing: 0.02em; }
.g-lightbox .lightbox-close,
.g-lightbox .lightbox-prev,
.g-lightbox .lightbox-next {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.g-lightbox .lightbox-close:hover,
.g-lightbox .lightbox-prev:hover,
.g-lightbox .lightbox-next:hover { background: var(--h-accent); color: #000; }
.g-lightbox .lightbox-close { top: 1.25rem; right: 1.25rem; }
.g-lightbox .lightbox-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.g-lightbox .lightbox-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .g-lightbox .lightbox-content { padding: 4.5rem 0.75rem 6rem; }
  .g-lightbox .lightbox-prev, .g-lightbox .lightbox-next { top: auto; bottom: 1.5rem; transform: none; }
  .g-lightbox .lightbox-prev { left: calc(50% - 64px); }
  .g-lightbox .lightbox-next { right: calc(50% - 64px); }
}
