.gallery-hero { padding-bottom: 2rem; }
.section-heading { max-width: 760px; margin-bottom: 1.5rem; }
.section-heading h2 { margin-bottom: .5rem; }


.gallery-index {
  margin-bottom: 2.5rem;
}

.gallery-index-summary {
  margin-bottom: 1rem;
  color: var(--muted);
}

.gallery-index-summary strong {
  color: inherit;
}

.gallery-index-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.gallery-index-list a {
  display: grid;
  align-content: center;
  gap: .28rem;
  height: 5.15rem;
  padding: .75rem .9rem;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: .65rem;
  text-decoration: none;
}

.gallery-index-list a:hover,
.gallery-index-list a:focus-visible {
  border-color: var(--accent);
}

.gallery-index-title {
  min-width: 0;
  font-weight: 700;
  line-height: 1.28;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.gallery-title-long {
  font-size: .84em;
  line-height: 1.22;
}

.gallery-index-list small {
  color: var(--muted);
  white-space: nowrap;
}

.gallery-sections {
  display: grid;
  gap: 2.5rem;
}

.gallery-section {
  scroll-margin-top: 6rem;
}

.gallery-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.gallery-section-heading h2 {
  margin: .25rem 0 0;
}

.gallery-count,
.gallery-source-note {
  color: var(--muted);
  font-size: .9rem;
}

.gallery-count {
  margin: 0;
  white-space: nowrap;
}

.gallery-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.gallery-image-link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: .65rem;
  background: #151515;
  aspect-ratio: 4 / 3;
  isolation: isolate;
}

.gallery-image-link img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform .2s ease, opacity .18s ease;
}

.gallery-image-link img:not([src]) { opacity: 0; }
.gallery-image-link img[src] { opacity: 1; }
.gallery-image-link[hidden] { display: none !important; }


.gallery-video-link {
  border: 1px solid rgba(255, 255, 255, .12);
}

.gallery-video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(190, 25, 25, .14), transparent 46%),
    #111;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.gallery-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: rgba(0, 0, 0, .72);
  transform: translate(-50%, -50%);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
  pointer-events: none;
}

.gallery-video-play span {
  width: 0;
  height: 0;
  margin-left: .2rem;
  border-top: .6rem solid transparent;
  border-bottom: .6rem solid transparent;
  border-left: .95rem solid #fff;
}

.gallery-video-link:hover .gallery-video-play,
.gallery-video-link:focus-visible .gallery-video-play {
  border-color: var(--accent);
  background: rgba(190, 25, 25, .9);
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 8px 24px rgba(190, 25, 25, .28);
}

.gallery-image-link:hover img,
.gallery-image-link:focus-visible img {
  transform: scale(1.025);
}

.gallery-source-note {
  margin-top: .75rem;
}

.gallery-pending {
  min-height: 0;
}

@media (max-width: 900px) {
  .gallery-index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .gallery-index-list { grid-template-columns: 1fr; }
  .gallery-section-heading {
    align-items: start;
    flex-direction: column;
  }
  .gallery-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .gallery-image-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-image-link img,
  .gallery-video-play { transition: none; }
  .gallery-video-link:hover .gallery-video-play,
  .gallery-video-link:focus-visible .gallery-video-play { transform: translate(-50%, -50%); }
}


.gallery-lightbox {
  width: min(96vw, 1200px);
  max-width: 1200px;
  max-height: 94vh;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: .8rem;
  background: #0b0b0b;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.gallery-lightbox::backdrop { background: rgba(0,0,0,.88); }
.gallery-lightbox-stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .65rem; place-items: center; height: min(70vh, 720px); touch-action: none; overflow: hidden; overscroll-behavior: contain; user-select: none; -webkit-user-select: none; }
.gallery-lightbox-stage.is-video { touch-action: manipulation; user-select: auto; -webkit-user-select: auto; }
.gallery-lightbox-stage img,
.gallery-lightbox-stage video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.gallery-lightbox-stage img { transform-origin: center center; }
.gallery-lightbox-stage video {
  background: #000;
  border-radius: .35rem;
}
.gallery-lightbox-stage > [hidden] { display: none !important; }
.gallery-lightbox-stage.is-zoomed img { will-change: transform; }
.gallery-lightbox-close {
  position: absolute;
  top: .65rem;
  right: .65rem;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.gallery-lightbox-actions { display: flex; justify-content: center; gap: .75rem; margin-top: .75rem; min-height: 3rem; }
.gallery-lightbox-nav {
  min-width: 9rem;
  padding: .7rem 1rem;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: .55rem;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible { border-color: var(--accent); outline-color: var(--accent); }
.gallery-lightbox-nav { transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible { border-color: var(--accent); background: rgba(190,25,25,.20); color: #fff; outline-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(190,25,25,.16); }
.gallery-lightbox-status { margin: 0; color: var(--muted); font-size: .9rem; text-align: center; }
@media (max-width: 620px) {
  .gallery-lightbox { width: 98vw; padding: .75rem; }
  .gallery-lightbox-stage { height: min(68vh, 620px); }
  .gallery-lightbox-stage img { max-height: 100%; }
}

.gallery-more-actions { display: flex; justify-content: center; margin-top: 1rem; }
.gallery-more-toggle {
  min-width: 10rem; padding: .65rem 1rem; border: 1px solid rgba(255,255,255,.20); border-radius: .55rem;
  background: transparent; color: var(--text); cursor: pointer; font: inherit; font-weight: 700;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.gallery-more-toggle:hover, .gallery-more-toggle:focus-visible { border-color: var(--accent); background: rgba(190,25,25,.16); transform: translateY(-1px); }
.is-gallery-extra[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .gallery-lightbox-nav, .gallery-more-toggle { transition: none; } .gallery-lightbox-nav:hover, .gallery-lightbox-nav:focus-visible, .gallery-more-toggle:hover, .gallery-more-toggle:focus-visible { transform: none; } }

/* Mobile gallery batching and touch-friendly layout. */
@media (max-width: 700px) {
  .gallery-image-grid { gap: .55rem; }
  .gallery-image-link { aspect-ratio: 1 / 1; }
  .gallery-more-toggle { width: 100%; max-width: 20rem; min-height: 2.8rem; }
  .gallery-index { margin-bottom: 1.5rem; }
  .gallery-sections { gap: 2rem; }
  .gallery-lightbox-actions { gap: .45rem; }
  .gallery-lightbox-nav { min-width: 0; flex: 1 1 0; }
}


