.gallery-page {
  background: #f7f5ef;
}

.gallery-page .site-header {
  position: fixed;
}

.gallery-page .nav-links .active {
  color: var(--clay);
}

.gallery-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(30px, 7vw, 110px);
  align-items: end;
  min-height: 540px;
  padding: 170px clamp(20px, 5vw, 72px) 76px;
  background:
    linear-gradient(110deg, rgba(20, 20, 20, 0.94), rgba(32, 36, 34, 0.72)),
    url("assets/gallery/paving-01.png") center 61% / cover;
  color: var(--white);
}

.gallery-hero h1 {
  margin: 0;
  font-size: clamp(3.2rem, 7.5vw, 7rem);
}

.gallery-hero > p {
  max-width: 530px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.gallery-section {
  padding: 84px clamp(16px, 3vw, 44px) 110px;
}

.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  max-width: 1500px;
  margin: 0 auto 38px;
}

.gallery-toolbar h2 {
  margin-bottom: 0;
}

.gallery-count {
  flex: 0 0 auto;
  margin: 0 0 8px;
  color: var(--muted);
}

.gallery-count strong {
  color: var(--ink);
  font-size: 1.5rem;
}

.gallery-grid {
  display: grid;
  grid-auto-flow: dense;
  grid-auto-rows: 235px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 18px);
  max-width: 1500px;
  margin: 0 auto;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: var(--charcoal);
  color: var(--white);
  cursor: zoom-in;
  isolation: isolate;
}

.gallery-item:nth-child(7n + 1),
.gallery-item:nth-child(7n + 5) {
  grid-row: span 2;
}

.gallery-item:nth-child(9n + 3) {
  grid-column: span 2;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 550ms ease, filter 550ms ease;
}

.gallery-item:nth-child(3n + 2) img {
  object-position: 25% center;
}

.gallery-item:nth-child(4n + 3) img {
  object-position: 75% center;
}

.gallery-item::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(15, 17, 16, 0.82));
  opacity: 0;
  transition: opacity 300ms ease;
}

.gallery-item span {
  position: absolute;
  z-index: 2;
  right: 22px;
  bottom: 20px;
  left: 22px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
}

.gallery-item:hover img {
  filter: saturate(1.08);
  transform: scale(1.075);
}

.gallery-item:hover::after,
.gallery-item:hover span {
  opacity: 1;
}

.gallery-item:hover span {
  transform: translateY(0);
}

.gallery-cta {
  padding: 90px 20px;
  background: var(--green);
  color: var(--white);
  text-align: center;
}

.gallery-cta h2 {
  margin-right: auto;
  margin-left: auto;
}

.lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 90px;
  place-items: center;
  visibility: hidden;
  background: rgba(12, 13, 12, 0.96);
  color: var(--white);
  opacity: 0;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.lightbox.open {
  visibility: visible;
  opacity: 1;
}

.lightbox-top {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}

.lightbox-counter {
  font-weight: 800;
}

.lightbox-close,
.lightbox-arrow {
  border: 0;
  color: var(--white);
  background: transparent;
  cursor: pointer;
}

.lightbox-close {
  width: 48px;
  height: 48px;
  font-size: 2.5rem;
  line-height: 1;
}

.lightbox-arrow {
  display: grid;
  place-items: center;
  width: 58px;
  height: 72px;
  font-size: 4rem;
  opacity: 0.72;
  transition: opacity 180ms ease, transform 180ms ease;
}

.lightbox-arrow:hover {
  opacity: 1;
  transform: scale(1.08);
}

.lightbox-figure {
  display: flex;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 76px 10px 30px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-figure img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.lightbox-figure figcaption {
  min-height: 24px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 1050px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .gallery-hero {
    grid-template-columns: 1fr;
    min-height: 600px;
    padding: 150px 20px 58px;
  }

  .gallery-toolbar {
    align-items: start;
    flex-direction: column;
    gap: 14px;
  }

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

  .gallery-item:nth-child(9n + 3) {
    grid-column: auto;
  }

  .gallery-item:nth-child(5n + 1) {
    grid-column: span 2;
  }

  .lightbox {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
  }

  .lightbox-arrow {
    width: 46px;
    font-size: 3.2rem;
  }
}

@media (max-width: 460px) {
  .gallery-section {
    padding-right: 10px;
    padding-left: 10px;
  }

  .gallery-toolbar {
    padding: 0 6px;
  }

  .gallery-grid {
    grid-auto-rows: 150px;
    gap: 6px;
  }

  .lightbox {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .lightbox-top {
    padding: 12px 10px;
  }

  .lightbox-figure {
    padding-right: 0;
    padding-left: 0;
  }
}
