.portal-gallery {
  width: min(100%, 820px);
  margin: clamp(32px, 6vw, 68px) auto 0;
  padding-block: 24px;
  color: #f1f5ff;
}

.portal-gallery h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.25rem); }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-top: 18px; }
.gallery > * { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }

.gallery.carousel {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  gap: 0;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid #465062;
  border-radius: 20px;
  background: radial-gradient(ellipse, #262e3d, #11141b);
}
.gallery.carousel :is(img, video) {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  aspect-ratio: auto;
  border-radius: 0;
  background: transparent;
  opacity: 0;
}
.gallery.carousel :is(img, video).current { opacity: 1; }
.gallery-controls:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
.gallery-controls button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 14px;
  border: 1px solid #606e83;
  border-radius: 24px;
  color: inherit;
  background: #202735;
  font: inherit;
  cursor: pointer;
}
.gallery-controls button:hover { background: #333f53; }
.gallery-controls button:focus-visible { outline: 2px solid #d8e7ff; outline-offset: 2px; }
.gallery-count { min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 650px) {
  .gallery.carousel { aspect-ratio: 16/10; border-radius: 14px; }
}
.gallery.carousel :is(img, video):not(.current) { display: none; }
.gallery.carousel img { touch-action: pan-y pinch-zoom; }

.gallery-filters:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1.25rem;
}
.gallery-filters button {
  border: 1px solid #606e83;
  border-radius: 999px;
  background: #202735;
  color: inherit;
  font: inherit;
  min-height: 44px;
  padding: .4rem 1rem;
  cursor: pointer;
}
.gallery-filters button[aria-pressed="true"] { background: #d8e7ff; color: #111826; }
.gallery-filters button:focus-visible { outline: 2px solid #d8e7ff; outline-offset: 2px; }
