.gallery-page {
  width: 100%;
  max-width: 53rem;
  margin-inline: auto;
  padding-inline: 1rem;
  padding-top: clamp(2.25rem, 5vw, 4rem);
  padding-bottom: clamp(3.5rem, 7vw, 6rem);
}

.gallery-heading {
  margin-bottom: clamp(2.75rem, 6vw, 4.25rem);
  text-align: center;
}

.gallery-heading h1 {
  margin: 0 auto .5rem;
  max-width: 48rem;
  text-wrap: balance;
}

.gallery-heading p {
  margin: .5rem auto 0;
  max-width: 44rem;
}

.gallery-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem 1.5rem;
  margin-top: 1.05rem;
}

.gallery-nav a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: .22em;
}

.gallery-group + .gallery-group {
  margin-top: 3rem;
}

.gallery-group > h2 {
  margin-bottom: .85rem;
  scroll-margin-top: 5.5rem;
}

.gallery-row {
  padding: 1.3rem 0 1.55rem;
  border-bottom: 1px solid var(--color-border, #eaeaea);
}

.gallery-lecture {
  scroll-margin-top: 5.5rem;
}

.gallery-row-copy {
  margin-bottom: .65rem;
}

.gallery-row-copy h3 {
  margin: .2rem 0 .35rem;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.25;
}

.gallery-row-copy h3 a:hover,
.gallery-back:hover,
.gallery-pdf:hover {
  text-decoration: underline;
  text-underline-offset: .18em;
}

.gallery-meta {
  color: var(--color-text-light, #717171);
  font-size: .875rem;
}

.gallery-album {
  --album-card-width: min(37cqw, 17.5rem);
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--album-slots), minmax(0, 1fr)) min(37%, 17.5rem);
  grid-auto-flow: column;
  align-items: center;
  isolation: isolate;
  padding: 1.5rem .9rem 1.3rem;
}

.gallery-sheet {
  --sheet-mask: .49;
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.gallery-sheet-art {
  position: relative;
  display: block;
  width: var(--album-card-width);
  padding: .19rem;
  border: 1px solid #ddd;
  border-radius: .6rem;
  background: #fff;
  box-shadow: 0 .24rem .75rem #0002;
  transform: rotate(var(--sheet-tilt));
  transition: transform 350ms cubic-bezier(.2, .78, .33, 1.16), box-shadow 300ms ease-out;
  pointer-events: none;
}

.gallery-sheet-art::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: white;
  opacity: var(--sheet-mask);
  transition: opacity 300ms ease-out;
  content: "";
}

.gallery-sheet img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: .39rem;
  background: #fff;
}

.gallery-sheet[data-gallery-enlarge] {
  cursor: zoom-in;
}

.gallery-album:not(:has(.gallery-sheet:is(:hover, :focus-visible))) .gallery-sheet--cover,
.gallery-album:not(:has(.gallery-sheet:hover)) .gallery-sheet:focus-visible {
  --sheet-mask: 0;
  z-index: 1;
}

.gallery-album:not(:has(.gallery-sheet:hover)) .gallery-sheet:focus-visible .gallery-sheet-art {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  transform: translateY(-.6rem) scale(1.07) rotate(0);
  box-shadow: 0 .6rem 1.35rem #0003;
}

@media (hover: hover) {
  .gallery-sheet:hover {
    --sheet-mask: 0;
    z-index: 2;
  }

  .gallery-sheet:hover .gallery-sheet-art {
    transform: translateY(-.6rem) scale(1.07) rotate(0);
    box-shadow: 0 .6rem 1.35rem #0003;
  }
}

.gallery-pdf,
.gallery-close {
  padding: .3rem .6rem;
  border: 1px solid var(--color-border, #eaeaea);
  border-radius: .5rem;
  font-size: .875rem;
}

.gallery-close {
  cursor: pointer;
}

.gallery-close:hover {
  background: var(--color-light, #f6f6f6);
}

.gallery-page :focus-visible,
.gallery-lightbox :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.gallery-back {
  display: inline-block;
  margin-bottom: 1rem;
  text-decoration: underline;
  text-underline-offset: .18em;
}

.gallery-detail .gallery-heading {
  margin-bottom: 2.5rem;
}

.gallery-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.25rem;
  margin-bottom: .8rem;
}

.gallery-section-header h2 {
  margin: 0;
}

.gallery-lightbox {
  margin: auto;
  padding: 0;
  width: max-content;
  max-width: calc(100% - 1.5rem);
  border: 0;
  border-radius: .8rem;
  background: var(--color-body, #fff);
  color: var(--color-text, #444);
}

.gallery-lightbox::backdrop {
  background: rgb(9 11 14 / .83);
}

.gallery-lightbox figure {
  margin: 0;
  padding: 0 .7rem .65rem;
}

.gallery-lightbox img {
  display: block;
  max-width: 100%;
  max-height: 76dvh;
  width: auto;
  height: auto;
  margin-inline: auto;
  object-fit: contain;
}

.gallery-lightbox figcaption {
  padding-top: .55rem;
  text-align: center;
}

.gallery-close {
  display: block;
  margin: .55rem .7rem .55rem auto;
}

.dark .gallery-row,
.dark .gallery-pdf,
.dark .gallery-close {
  border-color: #3e3e3e;
}

.dark .gallery-meta {
  color: #b4afb6;
}

.dark .gallery-lightbox {
  background: #1c1c1c;
  color: #e4e4e4;
}

.dark .gallery-close:hover {
  background: #303030;
}

@media (max-width: 600px) {
  .gallery-album {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: .55rem;
    padding: .55rem .25rem .75rem;
  }

  .gallery-sheet-art { width: 100%; }
  .gallery-sheet-art::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-sheet-art,
  .gallery-sheet-art::after { transition: none; }
}
