/* Photo Gallery — portfolio layout + lightbox */

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

.gallery-hero,
.services-hero {
  position: relative;
  min-height: 58svh;
  display: grid;
  align-items: end;
  color: #fff;
  isolation: isolate;
}

.gallery-hero-media,
.services-hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.gallery-hero-media img,
.services-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  transform: scale(1.04);
}

.gallery-hero-scrim,
.services-hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(100deg, rgba(10, 22, 40, 0.92) 0%, rgba(10, 22, 40, 0.78) 48%, rgba(10, 22, 40, 0.5) 100%),
    linear-gradient(180deg, rgba(10, 22, 40, 0.66) 0%, rgba(10, 22, 40, 0.22) 42%, rgba(10, 22, 40, 0.84) 100%);
}

/* Gallery hero photo is bright. Keep the overlay above the image so white type stays readable. */
.gallery-hero-scrim {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(10, 22, 40, 0.84) 0%, rgba(10, 22, 40, 0.62) 28%, rgba(10, 22, 40, 0.5) 52%, rgba(10, 22, 40, 0.86) 100%);
}

.gallery-hero-content,
.services-hero-content {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 7.25rem 0 3.25rem;
}

.gallery-hero-content h1,
.services-hero-content h1 {
  margin: 0.55rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.2rem, 5.8vw, 3.8rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 14ch;
}

.gallery-hero-content p,
.services-hero-content p {
  margin: 1rem 0 0;
  max-width: 38rem;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.6;
  font-size: 1.05rem;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.75rem;
}

.gallery-filter {
  min-height: 2.6rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.gallery-filter.is-active,
.gallery-filter:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.gallery-masonry,
.gallery-featured-grid {
  margin-top: 1.75rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 640px) {
  .gallery-masonry,
  .gallery-featured-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 800px) {
  .gallery-featured-grid,
  .gallery-masonry.is-count-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 720px) {
  .gallery-masonry.is-count-4 {
    grid-template-columns: 1fr 1fr;
  }
}

.portfolio-section + .portfolio-section {
  margin-top: 2.75rem;
}

.portfolio-heading {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -0.03em;
  color: var(--navy);
}

.gallery-card {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}

.gallery-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--gray-100);
  cursor: zoom-in;
  overflow: hidden;
}

.gallery-open img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition: transform 0.55s var(--ease-out);
}

/* Phone portraits stay full-frame so fronts, carpet lines, and cabins are not cropped. */
.gallery-card--tall .gallery-open img {
  aspect-ratio: 9 / 16;
  object-position: center;
}

.gallery-card--portrait .gallery-open img {
  aspect-ratio: 2 / 3;
  object-position: center;
}

@media (min-width: 980px) {
  .gallery-masonry.is-varied {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-masonry.is-varied .gallery-card--feature {
    grid-column: span 2;
  }

  .gallery-masonry.is-varied .gallery-card--feature .gallery-open img {
    aspect-ratio: 3 / 4;
    object-position: center 45%;
  }
}

.gallery-card:hover .gallery-open img {
  transform: scale(1.04);
}

.gallery-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.55rem;
  background: rgba(10, 22, 40, 0.78);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.gallery-card figcaption {
  padding: 0.8rem 0.9rem;
  font-size: 0.88rem;
  color: var(--steel);
  line-height: 1.45;
}

.gallery-empty {
  margin-top: 1.5rem;
  border: 1px dashed rgba(10, 22, 40, 0.22);
  background: linear-gradient(180deg, #fff, var(--gray-100));
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.gallery-empty h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.gallery-empty p {
  margin: 0.75rem 0 0;
  max-width: 38rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

body.lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

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

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 40, 0.88);
}

.gallery-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: calc(100svh - 2rem);
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.gallery-lightbox-dialog img {
  max-width: 100%;
  max-height: min(78svh, 820px);
  object-fit: contain;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-caption {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: 40rem;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 22, 40, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.gallery-lightbox-close {
  top: -0.25rem;
  right: 0;
  width: 2.6rem;
  height: 2.6rem;
}

.gallery-lightbox-nav {
  top: 45%;
  width: 2.6rem;
  height: 2.6rem;
}

.gallery-lightbox-nav.prev {
  left: 0;
}

.gallery-lightbox-nav.next {
  right: 0;
}

@media (max-width: 700px) {
  .gallery-lightbox-nav {
    display: none;
  }
}

.home-gallery-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
