.gallery-page {
  min-height: 100svh;
  padding-bottom: max(4rem, calc(env(safe-area-inset-bottom) + 3rem));
  overflow: clip;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 4%, rgba(221, 204, 181, 0.34), transparent 22rem),
    radial-gradient(circle at 92% 23%, rgba(255, 255, 255, 0.46), transparent 26rem),
    linear-gradient(180deg, rgba(248, 244, 237, 0.5), rgba(239, 230, 218, 0.18));
}

.gallery-header {
  display: flex;
  width: min(100% - 2rem, 72rem);
  min-height: max(6rem, calc(env(safe-area-inset-top) + 5rem));
  margin: auto;
  padding-top: max(1rem, env(safe-area-inset-top));
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line-soft);
}

.gallery-brand {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 600;
  line-height: 1.2;
}

.gallery-brand i {
  margin: 0 0.25em;
  font-family: var(--font-curtain-display);
  font-size: 1.35em;
  font-style: normal;
  font-weight: 400;
  color: var(--accent);
}

.gallery-back {
  display: inline-flex;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--accent-deep);
  transition: 0.2s ease;
}

.gallery-brand:focus-visible,
.gallery-back:focus-visible,
.gallery-photo__button:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 5px;
}

.gallery-intro {
  position: relative;
  width: min(100% - 2rem, 72rem);
  margin: auto;
  padding: clamp(5rem, 13vw, 9rem) 0 clamp(4rem, 10vw, 7rem);
  text-align: center;
}

.gallery-intro > p {
  margin-bottom: 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.gallery-intro h1 {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 11vw, 6.8rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.gallery-intro small {
  display: block;
  margin-top: 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.gallery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 8vw, 3.6rem);
  width: min(100% - 2rem, 72rem);
  margin: auto;
}

.gallery-photo {
  min-width: 0;
  align-self: start;
}

.gallery-photo__button {
  position: relative;
  display: block;
  width: 100%;
  padding: clamp(0.25rem, 0.7vw, 0.42rem);
  overflow: hidden;
  border: 1px solid rgba(95, 74, 57, 0.1);
  border-radius: clamp(0.7rem, 1.8vw, 1.15rem);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 1.4rem 3.2rem rgba(96, 73, 55, 0.1);
  cursor: zoom-in;
  appearance: none;
}

.gallery-photo__button picture {
  display: block;
  overflow: hidden;
  border-radius: calc(clamp(0.7rem, 1.8vw, 1.15rem) - 0.25rem);
  background: rgba(226, 216, 202, 0.42);
}

.gallery-photo__button img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.72s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-photo__number,
.gallery-photo__zoom {
  position: absolute;
  right: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(32, 28, 26, 0.3);
  backdrop-filter: blur(9px);
  color: #fff;
}

.gallery-photo__number {
  bottom: 1rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.15em;
}

.gallery-photo__zoom {
  top: 1rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.gallery-footer {
  display: grid;
  width: min(100% - 2rem, 72rem);
  margin: clamp(5rem, 14vw, 10rem) auto 0;
  padding-top: clamp(2.4rem, 6vw, 3.5rem);
  justify-items: center;
  gap: 1.5rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.gallery-footer > p {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 7vw, 3.8rem);
  line-height: 1.2;
}

.gallery-lightbox__figure {
  display: grid;
  grid-column: 2;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
  place-items: center;
}

.gallery-lightbox__figure > img {
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-lightbox__meta {
  position: fixed;
  right: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  max-width: min(calc(100% - 8rem), 44rem);
  min-height: 2.8rem;
  padding: 0.55rem 0.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(17, 20, 24, 0.56);
  backdrop-filter: blur(10px);
  transform: translateX(50%);
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
}

.gallery-lightbox__nav {
  position: fixed;
  top: 50%;
  z-index: 4;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(17, 20, 24, 0.56);
  backdrop-filter: blur(10px);
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #fff;
  cursor: pointer;
}

.gallery-lightbox__nav--previous {
  left: max(1rem, env(safe-area-inset-left));
}

.gallery-lightbox__nav--next {
  right: max(1rem, env(safe-area-inset-right));
}

.gallery-lightbox__nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

@media (min-width: 720px) {
  .gallery-header,
  .gallery-intro,
  .gallery-grid,
  .gallery-footer {
    width: min(100% - 3rem, 72rem);
  }

  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(1.4rem, 3vw, 2.5rem);
  }

  .gallery-photo {
    grid-column: span 3;
  }

  .gallery-photo--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .gallery-header,
  .gallery-intro,
  .gallery-grid,
  .gallery-footer {
    width: min(100% - 4rem, 72rem);
  }

  .gallery-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.4rem, 2.5vw, 2.15rem);
    row-gap: clamp(3.8rem, 8vw, 7rem);
  }

  .gallery-photo--01 { grid-column: 2 / 12; }
  .gallery-photo--02 { grid-column: 1 / 6; }
  .gallery-photo--03 { grid-column: 6 / 13; }
  .gallery-photo--04 { grid-column: 2 / 6; }
  .gallery-photo--05 { grid-column: 6 / 13; }
  .gallery-photo--06 { grid-column: 1 / 13; }
  .gallery-photo--07 { grid-column: 2 / 10; }
  .gallery-photo--08 { grid-column: 5 / 13; }
  .gallery-photo--09 { grid-column: 1 / 5; }
  .gallery-photo--10 { grid-column: 5 / 13; }
  .gallery-photo--11 { grid-column: 2 / 6; }
  .gallery-photo--12 { grid-column: 6 / 13; }
  .gallery-photo--13 { grid-column: 2 / 7; }
  .gallery-photo--14 { grid-column: 7 / 12; }
  .gallery-photo--15 { grid-column: 1 / 9; }
  .gallery-photo--16 { grid-column: 9 / 13; }
  .gallery-photo--17 { grid-column: 1 / 13; }
}

@media (hover: hover) and (pointer: fine) {
  .gallery-back:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.6);
  }

  .gallery-photo__button:hover img {
    transform: scale(1.012);
  }
}

@media (max-width: 719px) {
  .gallery-brand {
    max-width: 8rem;
  }

  .gallery-lightbox__content {
    padding-bottom: 4.8rem;
  }

  .gallery-lightbox__nav {
    top: auto;
    bottom: max(0.85rem, env(safe-area-inset-bottom));
    width: 3.15rem;
    height: 3.15rem;
    transform: none;
  }

  .gallery-lightbox__meta {
    bottom: max(1rem, env(safe-area-inset-bottom));
    max-width: calc(100% - 9.5rem);
  }

  .gallery-lightbox__figure {
    grid-column: 1 / -1;
  }
}

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