.gallery-main {
  min-height: 60vh;
}

.gallery-hero {
  background: linear-gradient(
      160deg,
      var(--color-navy) 0%,
      var(--color-navy-deep) 45%,
      #0f2458 100%
    );
  color: var(--color-sky);
  padding: 2.5rem 1.25rem 2.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(0, 242, 255, 0.12);
}

.gallery-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 5vw, 2.65rem);
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: -0.03em;
}

.gallery-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, var(--color-cyan), var(--color-sky));
  border-radius: 2px;
  box-shadow: var(--glow-cyan);
}

.gallery-lede {
  margin: 0 auto 1.5rem;
  max-width: 36rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(160, 196, 255, 0.95);
}

.gallery-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 42rem;
  margin: 0 auto;
}

.gallery-jump a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-sky);
  text-decoration: none;
  border: 1px solid rgba(160, 196, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.06);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
    box-shadow 0.2s ease;
}

.gallery-jump a:hover,
.gallery-jump a:focus-visible {
  color: var(--color-cyan);
  border-color: rgba(0, 242, 255, 0.55);
  background: rgba(0, 242, 255, 0.12);
  box-shadow: var(--glow-cyan);
}

.gallery-section {
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

.gallery-section .gallery-grid {
  margin-top: 0.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--color-navy-deep);
  box-shadow: 0 6px 20px rgba(21, 42, 102, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.12);
  pointer-events: none;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(21, 42, 102, 0.2),
    0 0 0 1px rgba(0, 242, 255, 0.2);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 74, 0.92);
  cursor: pointer;
}

.gallery-lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(92vw, 56rem);
  max-height: 90vh;
}

.gallery-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 242, 255, 0.25);
}

.gallery-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-navy-deep);
  background: var(--color-cyan);
  cursor: pointer;
  box-shadow: var(--glow-cyan);
  transition: transform 0.15s ease, background 0.15s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
  transform: scale(1.06);
  background: var(--color-white);
}

.gallery-lightbox-close:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .gallery-item img {
    aspect-ratio: 1;
  }
}
