.gallery-page {
  --gallery-navy: #082744;
  --gallery-navy-deep: #061f37;
  --gallery-copy: #52677b;
  --gallery-lime: #8cc63f;
  --gallery-lime-dark: #557b25;
  --gallery-cyan: #24aeb8;
  --gallery-field: #f3f7ed;
  --gallery-line: rgba(8, 39, 68, 0.15);
  overflow: hidden;
  background: #ffffff;
  color: var(--gallery-navy);
  font-family: "Nunito", sans-serif;
  letter-spacing: 0;
}

.gallery-page *,
.gallery-page *::before,
.gallery-page *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.gallery-page h1,
.gallery-page h2,
.gallery-page h3,
.gallery-page p,
.gallery-page figure {
  margin-top: 0;
}

.gallery-page h1,
.gallery-page h2,
.gallery-page h3 {
  font-family: "Raleway", sans-serif;
}

.gallery-page img,
.gallery-page video {
  display: block;
  max-width: 100%;
}

.gallery-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.gallery-kicker {
  display: block;
  margin-bottom: 20px;
  color: var(--gallery-lime-dark);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.gallery-kicker--light {
  color: #c5e995;
}

.gallery-hero {
  position: relative;
  display: flex;
  min-height: min(730px, calc(100svh - 40px));
  align-items: flex-end;
  overflow: hidden;
  background: var(--gallery-navy);
}

.gallery-hero__image,
.gallery-hero__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gallery-hero__image {
  object-fit: cover;
  object-position: center 42%;
}

.gallery-hero__shade {
  background: rgba(4, 28, 49, 0.66);
}

.gallery-hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(360px, 0.7fr);
  align-items: end;
  gap: 80px;
  padding: calc(var(--esihlentu-header-offset) + 80px) 0 54px;
}

.gallery-hero h1 {
  max-width: 13ch;
  margin-bottom: 24px;
  color: #ffffff;
  font-size: 64px;
  font-weight: 650;
  line-height: 1.01;
}

.gallery-hero h1 strong {
  color: #b8df83;
  font-weight: 820;
}

.gallery-hero__inner > div > p:not(.gallery-kicker) {
  max-width: 58ch;
  margin-bottom: 0;
  color: #e5eef3;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.72;
}

.gallery-index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.48);
  border-bottom: 1px solid rgba(255, 255, 255, 0.48);
}

.gallery-index--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gallery-index a {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease;
}

.gallery-index a:first-child {
  border-left: 0;
}

.gallery-index a:hover {
  background: var(--gallery-lime);
  color: var(--gallery-navy);
}

.gallery-index a:focus-visible,
.gallery-button:focus-visible,
.gallery-item:focus-visible,
.lightbox button:focus-visible {
  outline: 3px solid var(--gallery-cyan);
  outline-offset: 4px;
}

.gallery-section {
  padding: 100px 24px;
  background: #ffffff;
}

.gallery-section--field {
  background: var(--gallery-field);
}

.gallery-section__header {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  align-items: end;
  gap: 72px;
  margin-bottom: 54px;
}

.gallery-section__header h2 {
  margin-bottom: 0;
  color: var(--gallery-navy);
  font-size: 48px;
  font-weight: 740;
  line-height: 1.05;
}

.gallery-section__header > p {
  max-width: 60ch;
  margin-bottom: 0;
  color: var(--gallery-copy);
  font-size: 17px;
  line-height: 1.72;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 150px;
  gap: 12px;
}

.gallery-item {
  position: relative;
  grid-column: span 4;
  grid-row: span 2;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #dfe7e2;
  cursor: zoom-in;
}

.gallery-item:nth-child(1),
.gallery-item:nth-child(8) {
  grid-column: span 7;
  grid-row: span 3;
}

.gallery-item:nth-child(2),
.gallery-item:nth-child(9) {
  grid-column: span 5;
  grid-row: span 3;
}

.gallery-item:nth-child(5),
.gallery-item:nth-child(12) {
  grid-column: span 6;
}

.gallery-item:nth-child(6),
.gallery-item:nth-child(13) {
  grid-column: span 6;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

/* Studio portraits and donation records should remain fully visible. */
#people .gallery-item img,
#community .gallery-item img {
  object-fit: contain;
  background: #e4e9e6;
}

#phambili-expo .gallery-item img {
  object-position: center;
}

#phambili-expo .gallery-item:nth-child(n) {
  grid-column: span 4;
  grid-row: span 3;
}

#phambili-expo .gallery-item:nth-child(1) {
  grid-column: span 7;
}

#phambili-expo .gallery-item:nth-child(2) {
  grid-column: span 5;
}

#phambili-expo .gallery-item:nth-child(3) img,
#phambili-expo .gallery-item:nth-child(4) img,
#phambili-expo .gallery-item:nth-child(5) img,
#phambili-expo .gallery-item:nth-child(6) img,
#phambili-expo .gallery-item:nth-child(7) img {
  object-position: center top;
}

#phambili-expo .gallery-item:nth-child(8) img {
  object-fit: contain;
  background: #e4e9e6;
}

.gallery-item:hover img {
  transform: scale(1.025);
}

.gallery-video {
  grid-column: span 8;
  grid-row: span 3;
  margin: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--gallery-navy);
}

.gallery-video video {
  width: 100%;
  height: calc(100% - 48px);
  object-fit: cover;
}

.gallery-video figcaption {
  min-height: 48px;
  padding: 14px 16px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.gallery-grid--community .gallery-item:nth-child(1),
.gallery-grid--community .gallery-item:nth-child(6) {
  grid-column: span 6;
  grid-row: span 3;
}

.gallery-cta {
  padding: 78px 24px;
  background: var(--gallery-navy);
}

.gallery-cta__inner {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  align-items: center;
  gap: 72px;
}

.gallery-cta h2 {
  max-width: 11ch;
  margin-bottom: 0;
  color: #ffffff;
  font-size: 44px;
  line-height: 1.05;
}

.gallery-cta p {
  max-width: 58ch;
  margin-bottom: 24px;
  color: #dce8ef;
  font-size: 16px;
  line-height: 1.7;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.gallery-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid #ffffff;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.gallery-button--light {
  border-color: var(--gallery-lime);
  background: var(--gallery-lime);
  color: var(--gallery-navy-deep);
}

.gallery-button--line {
  background: transparent;
}

.gallery-button:hover {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--gallery-navy);
}

.lightbox {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #06131e;
}

.lightbox.active {
  display: flex;
}

.lightbox__topbar {
  display: flex;
  min-height: 72px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.lightbox__counter {
  color: #a9bccb;
  font-size: 13px;
  font-weight: 800;
}

.lightbox__close,
.lightbox__arrow {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
}

.lightbox__close:hover,
.lightbox__arrow:hover {
  border-color: var(--gallery-lime);
  background: var(--gallery-lime);
  color: var(--gallery-navy);
}

.lightbox__body {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 0 88px 28px;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 116px);
  object-fit: contain;
  user-select: none;
}

.lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__arrow--prev {
  left: 24px;
}

.lightbox__arrow--next {
  right: 24px;
}

.lightbox__dots {
  display: none;
}

@media (max-width: 1024px) {
  .gallery-hero__inner {
    grid-template-columns: minmax(440px, 1fr) minmax(300px, 0.7fr);
    gap: 44px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .gallery-hero h1 {
    font-size: 54px;
  }

  .gallery-grid {
    grid-auto-rows: 128px;
  }
}

@media (max-width: 780px) {
  .gallery-hero {
    min-height: 690px;
  }

  .gallery-hero__image {
    object-position: 47% center;
  }

  .gallery-hero__shade {
    background: rgba(4, 28, 49, 0.72);
  }

  .gallery-hero__inner,
  .gallery-section__header,
  .gallery-cta__inner {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .gallery-hero__inner {
    padding: calc(var(--esihlentu-header-offset) + 48px) 20px 36px;
  }

  .gallery-hero h1 {
    font-size: 46px;
  }

  .gallery-section {
    padding: 72px 20px;
  }

  .gallery-section__header h2,
  .gallery-cta h2 {
    font-size: 38px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 230px;
    gap: 10px;
  }

  .gallery-item,
  .gallery-item:nth-child(n),
  .gallery-grid--community .gallery-item:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
  }

  #phambili-expo .gallery-item:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
  }

  #phambili-expo .gallery-item:nth-child(1),
  #phambili-expo .gallery-item:nth-child(2) {
    grid-column: span 2;
  }

  .gallery-item:nth-child(1),
  .gallery-item:nth-child(6),
  .gallery-item:nth-child(11),
  .gallery-grid--community .gallery-item:nth-child(1) {
    grid-column: span 2;
  }

  .gallery-video {
    grid-column: span 2;
    grid-row: span 2;
  }

  .gallery-cta {
    padding: 68px 20px;
  }
}

@media (max-width: 520px) {
  .gallery-hero h1 {
    font-size: 40px;
  }

  .gallery-hero__inner > div > p:not(.gallery-kicker) {
    font-size: 16px;
  }

  .gallery-index a {
    min-height: 52px;
    font-size: 13px;
  }

  .gallery-index--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-index--four a:nth-child(3) {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
  }

  .gallery-index--four a:nth-child(4) {
    border-top: 1px solid rgba(255, 255, 255, 0.28);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 300px;
  }

  .gallery-item,
  .gallery-item:nth-child(n),
  .gallery-grid--community .gallery-item:nth-child(n),
  .gallery-video {
    grid-column: span 1;
    grid-row: span 1;
  }

  #phambili-expo .gallery-item:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gallery-video {
    min-height: 360px;
  }

  .gallery-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .gallery-button {
    width: 100%;
  }

  .lightbox__body {
    padding: 0 56px 18px;
  }

  .lightbox__arrow {
    width: 40px;
    height: 40px;
  }

  .lightbox__arrow--prev {
    left: 8px;
  }

  .lightbox__arrow--next {
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-page *,
  .gallery-page *::before,
  .gallery-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
