.gallery-page {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-heading h1,
.gallery-count {
  margin: 0;
  letter-spacing: 0;
}

.gallery-heading h1 {
  color: var(--minimal-text);
  font-size: 0.9rem;
  font-weight: 700;
}

.gallery-count {
  min-width: 3.5rem;
  color: var(--minimal-muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gallery-control {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  place-items: center;
  color: var(--minimal-muted);
  background: transparent;
  border: 1px solid var(--minimal-border);
  border-radius: 50%;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.gallery-control:hover,
.gallery-control:focus-visible {
  color: var(--minimal-accent);
  border-color: var(--minimal-accent);
}

.gallery-control:disabled {
  cursor: default;
  opacity: 0.35;
}

.gallery-scroll {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery-scroll::-webkit-scrollbar {
  display: none;
}

.gallery-scroll:focus-visible {
  outline: 1px solid var(--minimal-accent);
  outline-offset: 4px;
}

.gallery-photo {
  display: grid;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  place-items: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-photo-inner {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.6rem;
  overflow: hidden;
}

.gallery-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: var(--photo-position, center 30%);
  background: #f3eee8;
}

.gallery-photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 1rem;
  color: var(--minimal-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.gallery-photo-date {
  flex: none;
}

.gallery-empty {
  display: grid;
  height: 100%;
  margin: 0;
  place-items: center;
  color: var(--minimal-muted);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 620px) {
  .gallery-site-card #nav_menu.tab-nav .tab-nav-list {
    gap: 0.85rem !important;
  }

  .gallery-site-card #nav_menu.tab-nav .tab-nav-link {
    font-size: 11px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-scroll {
    scroll-behavior: auto;
  }
}
