.gallery-wrap {
  max-width: 89rem;
  margin-inline: auto;
}

.gallery-hero {
  padding-block: clamp(5.3rem, 8vw, 7.5rem) clamp(2.4rem, 5vw, 5rem);
  background: #0a1533;
  color: #f2f5ff;
}

.gallery-crumbs {
  margin-bottom: 1.1rem;
}

.gallery-mosaic {
  display: grid;
  grid-template-columns: 1.42fr 1fr 1fr;
  gap: clamp(.4rem, .85vw, .85rem);
}

.gallery-photo {
  display: block;
  min-width: 0;
}

.gallery-frame {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: .8rem;
  background: #e4e9f5;
}

.gallery-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s var(--ease-out);
}

.gallery-photo:hover img {
  transform: scale(1.035);
}

.gallery-mosaic .gallery-frame {
  height: clamp(14rem, 21vw, 22rem);
  aspect-ratio: auto;
  background: #1a2b50;
}

.gallery-caption {
  display: grid;
  gap: .25rem;
  padding-block: .65rem .2rem;
}

.gallery-caption > span {
  color: #495877;
  font-size: .84rem;
  line-height: 1.35;
}

.gallery-caption strong {
  color: #0a1533;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 650;
}

.gallery-mosaic .gallery-caption > span { color: #b6c6ed; }
.gallery-mosaic .gallery-caption strong { color: #f2f5ff; }

.gallery-intro {
  display: grid;
  grid-template-columns: 1.42fr 2fr;
  gap: 1.6rem;
  align-items: end;
  margin-top: clamp(1.9rem, 4vw, 3.75rem);
}

.gallery-intro h1 {
  font-size: clamp(3.2rem, 7.6vw, 8rem);
  letter-spacing: -.066em;
  line-height: .94;
}

.gallery-intro p {
  max-width: 28rem;
  color: #d1dcf8;
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  line-height: 1.55;
}

.gallery-intro a {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  margin-top: .55rem;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: .28em;
}

.gallery-archive {
  padding-block: clamp(2.8rem, 5vw, 5rem);
  background: #f5f7fc;
  color: #0a1533;
  scroll-margin-top: 5rem;
}

.gallery-archive-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.2rem;
  margin-bottom: clamp(1.25rem, 3vw, 2.4rem);
}

.gallery-index {
  color: #2549b9;
  display: block;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .16em;
  margin-bottom: .6rem;
}

.gallery-archive-head h2 { font-size: clamp(2rem, 4.5vw, 4.2rem); }
.gallery-archive-head p { color: #495877; max-width: 25ch; line-height: 1.5; }

.gallery-filters[hidden], .gallery-photo[hidden], .gallery-more[hidden], .gallery-clear[hidden], .gallery-empty[hidden] { display: none; }

.gallery-activities {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.55rem, 1.3vw, 1.15rem);
}

.gallery-activity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
  color: #0a1533;
  padding: .4rem .4rem .85rem;
  border: 1px solid #dce4f4;
  border-radius: 1.05rem;
  background: #fff;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}

.gallery-activity:hover { border-color: #6481ee; }
.gallery-activity[aria-pressed="true"] { border-color: #244ee9; background: #e9efff; box-shadow: inset 0 0 0 1px #244ee9; }
.gallery-activity-art {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(6.9rem, 11vw, 11rem);
  overflow: hidden;
  border-radius: .72rem;
  background: #dce4f4;
}
.gallery-activity-art img { width: 100%; height: 100%; object-fit: cover; }
.gallery-activity-total {
  position: absolute;
  inset: auto auto .5rem .5rem;
  border-radius: 100px;
  padding: .28rem .55rem;
  font-size: .73rem;
  font-weight: 700;
  background: #fff;
  color: #16254c;
}
.gallery-activity-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .28rem;
  padding: .7rem .42rem 0;
  font-weight: 750;
  font-size: clamp(.9rem, 1.25vw, 1.1rem);
  line-height: 1.25;
}
.gallery-activity-name > span { color: #2549b9; }
.gallery-activity-copy {
  padding: .28rem .42rem 0;
  color: #495877;
  font-size: .81rem;
  line-height: 1.4;
}
.gallery-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  padding-block: 1.35rem 1rem;
  border-bottom: 1px solid #dce4f4;
}
.gallery-reset, .gallery-locations summary, .gallery-clear, .gallery-location-list button {
  display: inline-flex;
  align-items: center;
  gap: .48rem;
  min-height: 44px;
  padding: .48rem .85rem;
  border-radius: 100px;
  border: 1px solid #d4ddf1;
  background: white;
  color: #16254c;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
}
.gallery-reset[aria-pressed="true"], .gallery-location-list button[aria-pressed="true"] {
  border-color: #183bc1;
  background: #183bc1;
  color: white;
}
.gallery-locations { position: relative; }
.gallery-locations summary { list-style: none; }
.gallery-locations summary::-webkit-details-marker { display: none; }
.gallery-location-caret { width: .42rem; height: .42rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -.2rem 0 0 .16rem; }
.gallery-locations[open] .gallery-location-caret { transform: rotate(225deg); margin-top: .2rem; }
.gallery-location-list {
  position: absolute;
  z-index: 2;
  top: calc(100% + .4rem);
  left: 0;
  width: min(29rem, 60vw);
  max-height: min(20rem, 50vh);
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: .4rem;
  padding: .7rem;
  border: 1px solid #d4ddf1;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 18px 48px #0a153326;
}
.gallery-location-list button[hidden] { display: none; }
.gallery-location-list button span { opacity: .78; }
.gallery-clear { background: none; border-color: transparent; text-decoration: underline; text-underline-offset: .18em; }
.gallery-results { padding-block: 1rem; color: #495877; font-size: .9rem; }
.gallery-empty { padding: 1.5rem 0; }
.gallery-archive :is(button, summary):focus-visible { outline: 2px solid #244ee9; outline-offset: 3px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 2rem) clamp(.65rem, 1.4vw, 1.4rem);
}

.gallery-more {
  display: flex;
  width: fit-content;
  min-height: 44px;
  margin: 2rem auto 0;
}

.gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: #060b19;
  color: white;
}

.gallery-viewer-inner {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  height: 100%;
  padding: 4.2rem max(.65rem, 3vw) max(1rem, env(safe-area-inset-bottom));
}

.gallery-viewer img {
  grid-area: 1 / 2;
  justify-self: center;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-viewer .lb-prev, .gallery-viewer .lb-next {
  position: static;
  transform: none;
}

.gallery-viewer .lb-prev { grid-area: 1 / 1; justify-self: end; }
.gallery-viewer .lb-next { grid-area: 1 / 3; justify-self: start; }
.gallery-viewer .lb-btn { font-size: 1.75rem; }
.gallery-viewer-caption { grid-area: 2 / 1 / 3 / 4; text-align: center; }
.gallery-viewer-caption strong, .gallery-viewer-caption span { display: block; }
.gallery-viewer-caption span { color: #b6c6ed; margin-top: .3rem; font-size: .88rem; }

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

@media (max-width: 640px) {
  .gallery-hero, .gallery-archive { padding-inline: clamp(.85rem, 4vw, 1.4rem); }
  .gallery-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .6rem; }
  .gallery-mosaic .gallery-photo:first-child { grid-column: 1 / -1; }
  .gallery-mosaic .gallery-frame { height: auto; aspect-ratio: 16 / 10; }
  .gallery-mosaic .gallery-photo:first-child .gallery-frame { aspect-ratio: 16 / 8; }
  .gallery-intro { grid-template-columns: 1fr; gap: .8rem; }
  .gallery-intro h1 { max-width: 12ch; }
  .gallery-grid, .gallery-activities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-archive-head { display: grid; gap: .6rem; }
  .gallery-archive-head p { max-width: none; }
  .gallery-location-list { left: auto; right: 0; width: min(27rem, calc(100vw - 2rem)); }
  .gallery-toolbar { position: relative; }
  .gallery-locations { position: static; }
  .gallery-viewer-inner { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto 48px; }
  .gallery-viewer img { grid-area: 1 / 1 / 2 / 3; }
  .gallery-viewer-caption { grid-area: 2 / 1 / 3 / 3; }
  .gallery-viewer .lb-prev { grid-area: 3 / 1; }
  .gallery-viewer .lb-next { grid-area: 3 / 2; }
}

.gallery-viewer-open { overflow: hidden; }
.gallery-viewer .lb-btn[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .gallery-frame img, .gallery-activity { transition: none; }
}
