main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(88px, 11vw, 108px) 0 60px;
  background: #676d70;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.gallery-wrap {
  padding: clamp(24px, 4vw, 40px)
    calc(var(--page-padding) + var(--edge-margin)) 0 var(--logo-inset);
}

.gallery-section {
  margin-bottom: clamp(48px, 7vw, 80px);
  scroll-margin-top: 96px;
}

.gallery-section:last-child {
  margin-bottom: 0;
}

.gallery-section-title {
  font-family: "Cormorant", serif;
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  margin: 0 0 22px;
  color: var(--text);
}

.gallery-grid {
  display: grid;
  gap: clamp(12px, 1.8vw, 18px);
}

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

.gallery-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  min-height: 180px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  background: rgba(12, 12, 12, 0.92);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox:not([hidden]) {
  display: flex;
}

.lightbox-img {
  display: block;
  max-width: min(100%, calc(100vw - 120px));
  width: auto;
  height: auto;
  max-height: calc(
    100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 48px
  );
  object-fit: contain;
  object-position: center;
  cursor: default;
  border-radius: 4px;
}

.lightbox-close {
  position: fixed;
  top: max(4px, env(safe-area-inset-top));
  right: max(4px, env(safe-area-inset-right));
  z-index: 101;
  margin: 0;
  padding: 14px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 2rem;
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-close:focus-visible {
  color: #fff;
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-prev {
  left: max(10px, env(safe-area-inset-left));
}

.lightbox-next {
  right: max(10px, env(safe-area-inset-right));
}

.lightbox-nav:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

.lightbox-nav:focus-visible {
  color: #fff;
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  main {
    padding: clamp(76px, 18vw, 96px) 0 48px;
  }

  .gallery-wrap {
    padding: clamp(16px, 4vw, 28px) var(--page-padding) 0;
    padding-left: var(--logo-text-start);
    padding-right: var(--logo-text-start);
  }

  .gallery-section {
    scroll-margin-top: 80px;
  }

  .gallery-section-title {
    text-align: left;
    margin-left: 0;
    padding-left: 0;
  }

  .gallery-item {
    min-height: 140px;
  }

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

  .lightbox {
    align-items: center;
    justify-content: center;
    padding: max(52px, calc(env(safe-area-inset-top) + 40px))
      max(12px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lightbox-nav {
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
  }

  .lightbox-nav svg {
    width: 18px;
    height: 18px;
  }

  .lightbox-prev {
    left: max(6px, env(safe-area-inset-left));
  }

  .lightbox-next {
    right: max(6px, env(safe-area-inset-right));
  }

  .lightbox-img {
    max-width: min(calc(100vw - 24px), calc(100vw - 88px));
    width: auto;
    height: auto;
    max-height: calc(
      100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 96px
    );
    max-height: calc(
      100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 96px
    );
  }
}
