/* ==========================================================================
   Gallery page — hero strip
   ========================================================================== */

.galleryHero {
  background: linear-gradient(120deg, var(--color-blue-900), var(--color-blue-700) 60%, var(--color-blue-600));
  padding: 168px 0 64px;
}

.galleryHeroInner {
  text-align: center;
}

.galleryHeroInner .eyebrow {
  justify-content: center;
  color: var(--color-gold-300);
}

.galleryHeroInner .eyebrow::before {
  background: var(--color-gold-300);
}

.galleryHeroInner h1 {
  font-size: clamp(34px, 4.4vw, 50px);
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Gallery page — full mosaic (18 images)
   ========================================================================== */

.galleryFull {
  background: var(--color-surface);
  padding: 72px 0 96px;
}

.galleryMosaic {
  max-width: var(--maxWidth);
  margin: 0 auto;
  padding: 0 80px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(19, 130px);
  gap: 14px;
}

.mosaicItem {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.6s var(--ease), box-shadow 0.4s var(--ease);
  will-change: transform;
}

.mosaicItem:hover {
  transform: scale(1.015);
  box-shadow: var(--shadow-md);
}

/* Explicit placement — every block sums to exactly 6 columns wide,
   so the mosaic tiles perfectly with no dead space across all 18
   images. Verified gap-free at build time with a packing simulation. */

/* block 1 — rows 1-3 */
.mosaicItem:nth-child(1)  { grid-area: 1 / 1 / 4 / 5; }   /* feature 4x3 */
.mosaicItem:nth-child(2)  { grid-area: 1 / 5 / 4 / 7; }   /* tall 2x3 */

/* block 2 — rows 4-5 */
.mosaicItem:nth-child(3)  { grid-area: 4 / 1 / 6 / 3; }   /* square 2x2 */
.mosaicItem:nth-child(4)  { grid-area: 4 / 3 / 6 / 5; }   /* square 2x2 */
.mosaicItem:nth-child(5)  { grid-area: 4 / 5 / 6 / 7; }   /* square 2x2 */

/* block 3 — rows 6-8 */
.mosaicItem:nth-child(6)  { grid-area: 6 / 1 / 9 / 3; }   /* tall 2x3 */
.mosaicItem:nth-child(7)  { grid-area: 6 / 3 / 9 / 7; }   /* wide 4x3 */

/* block 4 — rows 9-10 */
.mosaicItem:nth-child(8)  { grid-area: 9 / 1 / 11 / 4; }  /* wide 3x2 */
.mosaicItem:nth-child(9)  { grid-area: 9 / 4 / 11 / 7; }  /* wide 3x2 */

/* block 5 — rows 11-12 */
.mosaicItem:nth-child(10) { grid-area: 11 / 1 / 13 / 3; } /* square 2x2 */
.mosaicItem:nth-child(11) { grid-area: 11 / 3 / 13 / 5; } /* square 2x2 */
.mosaicItem:nth-child(12) { grid-area: 11 / 5 / 13 / 7; } /* square 2x2 */

/* block 6 — rows 13-15 */
.mosaicItem:nth-child(13) { grid-area: 13 / 1 / 16 / 5; } /* wide 4x3 */
.mosaicItem:nth-child(14) { grid-area: 13 / 5 / 16 / 7; } /* tall 2x3 */

/* block 7 — rows 16-17 */
.mosaicItem:nth-child(15) { grid-area: 16 / 1 / 18 / 3; } /* square 2x2 */
.mosaicItem:nth-child(16) { grid-area: 16 / 3 / 18 / 5; } /* square 2x2 */
.mosaicItem:nth-child(17) { grid-area: 16 / 5 / 18 / 7; } /* square 2x2 */

/* block 8 — rows 18-19, closing full-width banner */
.mosaicItem:nth-child(18) { grid-area: 18 / 1 / 20 / 7; } /* banner 6x2 */

/* the single signature element — the feature image gets one quiet
   gold hairline on hover, the only color accent on the whole page */
.mosaicItem:nth-child(1):hover {
  box-shadow: 0 0 0 1px var(--color-gold-500), var(--shadow-lg);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 13, 18, 0.94);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}

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

.lightboxFigure {
  position: relative;
  max-width: min(92vw, 1280px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightboxImg {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.lightboxImg.isVisible {
  opacity: 1;
  transform: scale(1);
}

.lightboxClose,
.lightboxPrev,
.lightboxNext {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 1001;
}

.lightboxClose:hover,
.lightboxPrev:hover,
.lightboxNext:hover {
  background: var(--color-blue-600);
}

.lightboxClose {
  top: 24px;
  right: 24px;
}

.lightboxPrev,
.lightboxNext {
  top: 50%;
  transform: translateY(-50%);
}

.lightboxPrev:hover,
.lightboxNext:hover {
  transform: translateY(-50%);
}

.lightboxPrev {
  left: 24px;
}

.lightboxNext {
  right: 24px;
}

.lightboxCounter {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  z-index: 1001;
}

@media (prefers-reduced-motion: reduce) {
  .lightboxImg {
    transition: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 1200px) {
  .galleryMosaic {
    padding: 0 48px;
    grid-template-rows: repeat(19, 110px);
  }
}

@media screen and (max-width: 900px) {
  .galleryHero {
    padding: 148px 0 56px;
  }

  .galleryMosaic {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(24, 120px);
    gap: 12px;
  }

  /* pattern: two squares side by side, then one full-width band,
     repeating 6 times across 18 images. 4 cols, 0 gaps — verified. */
  .mosaicItem:nth-child(1)  { grid-area: 1 / 1 / 3 / 3; }
  .mosaicItem:nth-child(2)  { grid-area: 1 / 3 / 3 / 5; }
  .mosaicItem:nth-child(3)  { grid-area: 3 / 1 / 5 / 5; }
  .mosaicItem:nth-child(4)  { grid-area: 5 / 1 / 7 / 3; }
  .mosaicItem:nth-child(5)  { grid-area: 5 / 3 / 7 / 5; }
  .mosaicItem:nth-child(6)  { grid-area: 7 / 1 / 9 / 5; }
  .mosaicItem:nth-child(7)  { grid-area: 9 / 1 / 11 / 3; }
  .mosaicItem:nth-child(8)  { grid-area: 9 / 3 / 11 / 5; }
  .mosaicItem:nth-child(9)  { grid-area: 11 / 1 / 13 / 5; }
  .mosaicItem:nth-child(10) { grid-area: 13 / 1 / 15 / 3; }
  .mosaicItem:nth-child(11) { grid-area: 13 / 3 / 15 / 5; }
  .mosaicItem:nth-child(12) { grid-area: 15 / 1 / 17 / 5; }
  .mosaicItem:nth-child(13) { grid-area: 17 / 1 / 19 / 3; }
  .mosaicItem:nth-child(14) { grid-area: 17 / 3 / 19 / 5; }
  .mosaicItem:nth-child(15) { grid-area: 19 / 1 / 21 / 5; }
  .mosaicItem:nth-child(16) { grid-area: 21 / 1 / 23 / 3; }
  .mosaicItem:nth-child(17) { grid-area: 21 / 3 / 23 / 5; }
  .mosaicItem:nth-child(18) { grid-area: 23 / 1 / 25 / 5; }

  .lightboxPrev,
  .lightboxNext {
    width: 42px;
    height: 42px;
  }
}

@media screen and (max-width: 720px) {
  .galleryMosaic {
    padding: 0 28px;
  }
}

@media screen and (max-width: 540px) {
  .galleryHero {
    padding: 136px 0 48px;
  }

  .galleryMosaic {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 160px 130px 160px 130px 160px 130px 160px 130px 160px 130px 160px 130px;
    gap: 10px;
    padding: 0 20px;
  }

  /* pattern: two squares side by side, then one wide band,
     repeating 6 times across 18 images. 2 cols, 0 gaps — verified. */
  .mosaicItem:nth-child(1)  { grid-area: 1 / 1 / 2 / 2; }
  .mosaicItem:nth-child(2)  { grid-area: 1 / 2 / 2 / 3; }
  .mosaicItem:nth-child(3)  { grid-area: 2 / 1 / 3 / 3; }
  .mosaicItem:nth-child(4)  { grid-area: 3 / 1 / 4 / 2; }
  .mosaicItem:nth-child(5)  { grid-area: 3 / 2 / 4 / 3; }
  .mosaicItem:nth-child(6)  { grid-area: 4 / 1 / 5 / 3; }
  .mosaicItem:nth-child(7)  { grid-area: 5 / 1 / 6 / 2; }
  .mosaicItem:nth-child(8)  { grid-area: 5 / 2 / 6 / 3; }
  .mosaicItem:nth-child(9)  { grid-area: 6 / 1 / 7 / 3; }
  .mosaicItem:nth-child(10) { grid-area: 7 / 1 / 8 / 2; }
  .mosaicItem:nth-child(11) { grid-area: 7 / 2 / 8 / 3; }
  .mosaicItem:nth-child(12) { grid-area: 8 / 1 / 9 / 3; }
  .mosaicItem:nth-child(13) { grid-area: 9 / 1 / 10 / 2; }
  .mosaicItem:nth-child(14) { grid-area: 9 / 2 / 10 / 3; }
  .mosaicItem:nth-child(15) { grid-area: 10 / 1 / 11 / 3; }
  .mosaicItem:nth-child(16) { grid-area: 11 / 1 / 12 / 2; }
  .mosaicItem:nth-child(17) { grid-area: 11 / 2 / 12 / 3; }
  .mosaicItem:nth-child(18) { grid-area: 12 / 1 / 13 / 3; }

  .lightboxClose {
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
  }

  .lightboxPrev,
  .lightboxNext {
    width: 40px;
    height: 40px;
  }

  .lightboxPrev {
    left: 10px;
  }

  .lightboxNext {
    right: 10px;
  }

  .lightboxCounter {
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mosaicItem {
    transition: none;
  }
}