.home-gallery {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 10% 15%, rgba(47, 203, 68, 0.08), transparent 30%),
    #0c0f0d;
}

.home-gallery-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.55fr);
  align-items: end;
  gap: clamp(2rem, 8vw, 8rem);
  margin-bottom: 3.5rem;
}

.home-gallery-eyebrow {
  margin-bottom: 0.85rem;
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-gallery-heading h2 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.home-gallery-heading > p {
  color: #9aa19b;
}

.home-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 230px;
  gap: 0.85rem;
}

.home-gallery-item {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: #171b18;
  border: 0;
  border-radius: 8px;
  cursor: zoom-in;
}

.home-gallery-item:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}

.home-gallery-item:nth-child(4),
.home-gallery-item:nth-child(11),
.home-gallery-item:nth-child(18) {
  grid-row: span 2;
}

.home-gallery-item:nth-child(6),
.home-gallery-item:nth-child(9),
.home-gallery-item:nth-child(15),
.home-gallery-item:nth-child(21) {
  grid-column: span 2;
}

.home-gallery-grid:not(.is-expanded) .home-gallery-item:nth-child(n+11) {
  display: none;
}

.home-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.3s ease;
}

.home-gallery-item::after {
  content: "View";
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #0b0d0c;
  background: var(--color-accent);
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.home-gallery-item:hover img,
.home-gallery-item:focus-visible img {
  transform: scale(1.035);
  filter: brightness(0.8);
}

.home-gallery-item:hover::after,
.home-gallery-item:focus-visible::after {
  opacity: 1;
  transform: none;
}

.home-gallery-item:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.home-gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.home-gallery-more .btn {
  appearance: none;
  min-width: 220px;
  background: transparent;
}

body.gallery-open {
  overflow: hidden;
}

.home-lightbox {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.home-lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.home-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 4, 0.94);
  backdrop-filter: blur(10px);
}

.home-lightbox-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 1rem;
  width: min(1500px, 96vw);
  max-height: 94dvh;
}

.home-lightbox figure {
  min-width: 0;
  margin: 0;
}

.home-lightbox-image-wrap {
  display: grid;
  place-items: center;
  min-height: 280px;
  max-height: calc(94dvh - 74px);
}

.home-lightbox-image-wrap img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(94dvh - 74px);
  object-fit: contain;
  border-radius: 5px;
  opacity: 0;
  transition: opacity 0.18s ease;
  touch-action: pan-y;
}

.home-lightbox-image-wrap img.loaded {
  opacity: 1;
}

.home-lightbox figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.8rem;
  color: #aab0ab;
  font-size: 0.75rem;
}

.home-lightbox figcaption strong {
  flex: 0 0 auto;
  color: #fff;
}

.home-lightbox-close,
.home-lightbox-arrow {
  appearance: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: #171b18;
  border: 1px solid #363c37;
  border-radius: 50%;
  cursor: pointer;
}

.home-lightbox-close:hover,
.home-lightbox-arrow:hover,
.home-lightbox-close:focus-visible,
.home-lightbox-arrow:focus-visible {
  color: #0b0d0c;
  background: var(--color-accent);
  border-color: var(--color-accent);
  outline: none;
}

.home-lightbox-close {
  position: fixed;
  z-index: 2;
  top: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  font-size: 1.8rem;
}

.home-lightbox-arrow {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

@media (max-width: 900px) {
  .home-gallery-heading {
    grid-template-columns: 1fr;
    gap: 1.3rem;
  }

  .home-gallery-heading > p {
    max-width: 620px;
  }

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

  .home-gallery-item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .home-gallery-item:nth-child(4),
  .home-gallery-item:nth-child(11),
  .home-gallery-item:nth-child(18) {
    grid-row: span 1;
  }

  .home-gallery-item:nth-child(6),
  .home-gallery-item:nth-child(9),
  .home-gallery-item:nth-child(15),
  .home-gallery-item:nth-child(21) {
    grid-column: span 1;
  }

  .home-gallery-grid:not(.is-expanded) .home-gallery-item:nth-child(n+7) {
    display: none;
  }

  .home-lightbox-content {
    display: block;
    width: 100%;
    padding: 3.5rem 0 4.5rem;
  }

  .home-lightbox-image-wrap,
  .home-lightbox-image-wrap img {
    max-height: calc(100dvh - 160px);
  }

  .home-lightbox-arrow {
    position: fixed;
    bottom: 1rem;
  }

  .home-lightbox-prev { left: calc(50% - 68px); }
  .home-lightbox-next { right: calc(50% - 68px); }
  .home-lightbox-close { top: 0.8rem; right: 0.8rem; }
}

@media (max-width: 480px) {
  .home-gallery {
    padding-top: 78px;
    padding-bottom: 78px;
  }

  .home-gallery-heading {
    margin-bottom: 2rem;
  }

  .home-gallery-heading h2 {
    font-size: 2.35rem;
  }

  .home-gallery-grid {
    grid-auto-rows: 145px;
    gap: 0.55rem;
  }

  .home-gallery-item:nth-child(1) {
    grid-row: span 2;
  }

  .home-gallery-item {
    border-radius: 5px;
  }

  .home-gallery-item::after {
    display: none;
  }

  .home-lightbox {
    padding: 0.65rem;
  }

  .home-lightbox figcaption {
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-gallery-item img,
  .home-gallery-item::after,
  .home-lightbox,
  .home-lightbox-image-wrap img {
    transition: none;
  }
}
