.gallery-section { padding-top: 2rem; }
.gallery-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1.5rem;
  margin-bottom: 1.25rem;
}
.gallery-tools p { font-size: .9rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery-photo a {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .3rem;
  overflow: hidden;
}
.gallery-photo a:hover { border-color: var(--red-bright); }
.gallery-photo img { width: 100%; height: auto; background: var(--panel-deep); }


body:has(.gallery-viewer[open]) { overflow: hidden; }
.gallery-viewer {
  position: fixed;
  box-sizing: border-box;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: 100%;
  max-height: 100dvh;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: auto;
  color: var(--text);
  background: #101011;
}
.gallery-viewer::backdrop { background: #101011; }
.gallery-viewer-inner {
  width: min(100%, 92rem);
  min-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(7rem, 1fr) auto;
  margin-inline: auto;
  padding: max(.7rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(.7rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.gallery-viewer-header, .gallery-viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65rem 1.25rem;
}
.gallery-viewer-header { padding-bottom: .55rem; }
.gallery-viewer-footer { justify-content: flex-end; padding-top: .55rem; }
.gallery-stage { position: relative; min-height: 7rem; touch-action: pan-y pinch-zoom; }
.gallery-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-viewer-actions { display: flex; flex: none; gap: .45rem; }


@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .gallery-viewer-footer { display: grid; justify-content: stretch; }
  .gallery-viewer-actions { display: grid; grid-template-columns: 1fr 1fr; }

}

.gallery-video-link { margin-top: 1.2rem; }
.gallery-videos { padding-bottom: clamp(3rem, 7vw, 6rem); }
.gallery-videos h2 { margin-bottom: 1.1rem; }
.gallery-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 58rem;
}
.gallery-video {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .3rem;
}
.gallery-video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: contain;
  background: #080809;
}
.gallery-video-details { padding: .75rem .9rem; }
.gallery-video-details h3 { font-size: 1.65rem; line-height: 1.15; }

@media (max-width: 640px) {
  .gallery-video-grid { grid-template-columns: 1fr; }
  .gallery-video video { aspect-ratio: 4 / 5; }
}
