.gallery-page {
  padding-top: var(--header-h);
}

.gallery-hero {
  background: var(--navy-deep);
  color: var(--paper);
  padding: clamp(3rem, 8vw, 5rem) var(--space) 2.5rem;
}

.gallery-hero-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.gallery-hero h1 {
  font-size: clamp(3rem, 10vw, 5.5rem);
  margin: 0.35rem 0 0.75rem;
}

.gallery-lead {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.05rem;
}

.gallery-controls {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.gallery-controls-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--space);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gallery-tab {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gallery-tab:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.gallery-tab.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}

.gallery-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.gallery-sections {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem var(--space) clamp(4rem, 8vw, 6rem);
}

.gallery-category {
  margin-bottom: 3.5rem;
}

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

.gallery-category-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--navy);
}

.gallery-category-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--navy);
}

.gallery-category-head span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.gallery-grid-page {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.gallery-item {
  margin: 0;
  overflow: hidden;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: var(--mist);
  cursor: zoom-in;
}

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

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

.gallery-item:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 16, 42, 0.94);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 85vh;
  display: grid;
  gap: 0.75rem;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(85vh - 2rem);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.lightbox-figure figcaption {
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  font-size: 2rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(0, 194, 239, 0.25);
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lightbox-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 960px) {
  .gallery-grid-page {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .gallery-controls-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-count {
    text-align: center;
  }
}
