.class-gallery-page {
  --gallery-pink: #ebc5bd;
  --gallery-paper: #fffdf6;
}

.gallery-hero {
  min-height: 430px;
  padding-bottom: 70px;
}

.gallery-hero .directory-hero-copy > p:last-child {
  max-width: 720px;
}

.gallery-content {
  background:
    radial-gradient(circle at 12% 18%, rgb(198 44 59 / 9%), transparent 28%),
    radial-gradient(circle at 88% 46%, rgb(245 173 33 / 10%), transparent 26%),
    var(--gallery-pink);
}

.gallery-back {
  display: inline-block;
  margin-bottom: 34px;
  padding-bottom: 5px;
  color: #1e2d4d;
  border-bottom: 1px solid currentColor;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.gallery-status {
  margin: 0 0 28px;
  color: #4f586a;
}

.gallery-status:empty {
  display: none;
}

.class-album-grid,
.class-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 34px);
  align-items: start;
}

.class-photo-grid:empty,
.class-album-grid:empty {
  display: none;
}

.class-album-card,
.class-photo-card {
  display: block;
  width: 100%;
  padding: 0;
  min-width: 0;
  overflow: hidden;
  color: #1e2d4d;
  background: var(--gallery-paper);
  border: 10px solid var(--gallery-paper);
  border-radius: 5px;
  box-shadow: 0 20px 45px rgb(73 30 32 / 13%);
  text-decoration: none;
  text-align: left;
  transform: rotate(var(--card-tilt, 0deg));
  transition: transform .25s ease, box-shadow .25s ease;
}

.class-photo-card {
  margin: 0;
  align-self: start;
  font: inherit;
}

.class-album-card:nth-child(3n+1),
.class-photo-card:nth-child(3n+1) { --card-tilt: -1.2deg; }
.class-album-card:nth-child(3n+2),
.class-photo-card:nth-child(3n+2) { --card-tilt: .9deg; }
.class-album-card:nth-child(3n),
.class-photo-card:nth-child(3n) { --card-tilt: -.35deg; }

.class-album-card:hover,
.class-photo-card:hover,
.class-album-card:focus-visible,
.class-photo-card:focus-visible {
  z-index: 2;
  outline: none;
  box-shadow: 0 28px 62px rgb(73 30 32 / 22%);
  transform: rotate(0) translateY(-6px);
}

.class-album-card img,
.class-photo-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #efe5d9;
}

.class-album-card img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.class-photo-card img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.class-album-card-copy,
.class-photo-card-copy {
  display: block;
  padding: 17px 12px 13px;
}

.class-album-card strong,
.class-photo-card strong {
  display: block;
  font: 400 clamp(22px, 2.2vw, 32px)/1.08 Georgia, serif;
}

.class-album-card span,
.class-photo-card span {
  display: block;
  margin-top: 7px;
  color: #687080;
  font-size: 11px;
  line-height: 1.45;
}

.class-photo-card {
  cursor: zoom-in;
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 72px 24px;
  text-align: center;
  color: #4f586a;
  background: rgb(255 253 246 / 72%);
  border: 1px dashed rgb(30 45 77 / 28%);
  border-radius: 18px;
}

.gallery-lightbox {
  box-sizing: border-box;
  width: min(1120px, calc(100vw - 24px));
  max-width: none;
  height: min(850px, calc(100dvh - 24px));
  max-height: none;
  padding: 58px 16px 82px;
  overflow: hidden;
  color: #fff;
  background: #101c35;
  border: 0;
  border-radius: 18px;
  margin: auto;
}

.gallery-lightbox::backdrop {
  background: rgb(13 24 47 / 84%);
  backdrop-filter: blur(6px);
}

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

.gallery-lightbox-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0 0 5px;
  color: #101c35;
  background: rgb(255 253 246 / 94%);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 8px 28px rgb(0 0 0 / 24%);
  font: 400 43px/1 Georgia, serif;
  transform: translateY(-50%);
  cursor: pointer;
}

.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible {
  color: #fff;
  background: #c62c3b;
  outline: 3px solid rgb(255 253 246 / 82%);
  outline-offset: 2px;
}

.gallery-lightbox-prev { left: 18px; }
.gallery-lightbox-next { right: 18px; }

.gallery-lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #101c35;
  background: #fff;
  border: 0;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
}

.gallery-lightbox-caption {
  position: absolute;
  right: 20px;
  bottom: 18px;
  left: 20px;
  display: flex;
  gap: 15px;
  align-items: baseline;
  justify-content: center;
  text-align: center;
}

.gallery-lightbox-caption span {
  color: #cbd4e6;
  font-size: 11px;
}

@media (max-width: 900px) {
  .class-album-grid,
  .class-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  /* Class albums open with the first photographs already in the phone viewport. */
  .is-class-view .gallery-hero {
    min-height: 0;
    padding: 105px 20px 24px;
  }

  .is-class-view .gallery-hero h1 {
    margin: 10px 0 0;
    font-size: clamp(43px, 13.5vw, 58px);
    line-height: .84;
  }

  .is-class-view .gallery-hero-copy > p:last-child {
    display: none;
  }

  .is-class-view .gallery-content {
    padding-top: 18px;
  }

  .is-class-view .gallery-back {
    margin-bottom: 13px;
  }

  .is-class-view .gallery-status {
    margin-bottom: 14px;
  }

  .gallery-hero { min-height: 390px; }
  .gallery-content { padding-right: 11px; padding-left: 11px; }
  .class-album-grid { gap: 13px 10px; }
  .class-photo-grid { gap: 13px 10px; }
  .class-album-card,
  .class-photo-card { border-width: 6px; }
  .class-album-card-copy,
  .class-photo-card-copy { padding: 12px 7px 10px; }
  .class-album-card strong,
  .class-photo-card strong { font-size: clamp(17px, 5.3vw, 23px); }
  .class-album-card span,
  .class-photo-card span { font-size: 9px; }
  .gallery-lightbox { padding: 54px 8px 84px; border-radius: 10px; }
  .gallery-lightbox-nav { width: 42px; height: 42px; font-size: 38px; }
  .gallery-lightbox-prev { left: 10px; }
  .gallery-lightbox-next { right: 10px; }
  .gallery-lightbox-caption { flex-direction: column; gap: 4px; align-items: center; }
}
