/* Shared landing gallery grid + lightbox (theme via CSS variables) */
:root {
  --gallery-overlay: rgba(12, 10, 14, 0.94);
  --gallery-control-bg: rgba(255, 255, 255, 0.12);
  --gallery-control-hover: rgba(255, 255, 255, 0.25);
  --gallery-thumb-radius: 10px;
  --gallery-grid-gap: 1rem;
  --gallery-grid-min: 180px;
  --gallery-caption-color: rgba(45, 31, 36, 0.7);
  --gallery-lightbox-caption: rgba(255, 255, 255, 0.85);
}

.lp-section-gallery {
  padding: clamp(3rem, 8vw, 5rem) 0;
}

.lp-section-gallery .lp-container {
  width: min(1140px, 100% - 2.5rem);
  margin-inline: auto;
}

.lp-section-gallery .lp-section-head {
  text-align: center;
  margin-bottom: 2.5rem;
}

.lp-section-gallery .lp-section-head h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
}

.lp-section-gallery .lp-section-head h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: 0.75rem auto 0;
  background: linear-gradient(90deg, transparent, var(--lp-accent, var(--ic-gold, #c4a265)), transparent);
}

.lp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-grid-min)), 1fr));
  gap: var(--gallery-grid-gap);
}

.lp-gallery-item {
  margin: 0;
}

.lp-gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: var(--gallery-thumb-radius);
  overflow: hidden;
  cursor: pointer;
  background: color-mix(in srgb, var(--lp-text, #2d1f24) 8%, transparent);
  aspect-ratio: 1;
  transition: transform 0.2s, box-shadow 0.2s;
}

.lp-gallery-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lp-primary, #8b2252) 15%, transparent);
}

.lp-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

a.lp-gallery-link {
  text-decoration: none;
  color: inherit;
}

a.lp-gallery-link img {
  pointer-events: none;
}

.lp-gallery-item figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  text-align: center;
  color: var(--gallery-caption-color);
}

body.lp-gallery-open {
  overflow: hidden;
}

body.lp-gallery-open .lp-section-gallery .lp-gallery {
  visibility: hidden;
}

.lp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gallery-overlay);
  padding: 1rem;
}

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

.lp-lightbox-figure {
  margin: 0;
  max-width: min(900px, 95vw);
  max-height: 90vh;
  position: relative;
  z-index: 1;
}

.lp-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--gallery-thumb-radius);
  margin-inline: auto;
}

.lp-lightbox-figure figcaption {
  margin-top: 0.75rem;
  text-align: center;
  color: var(--gallery-lightbox-caption);
  font-size: 0.9rem;
}

.lp-lightbox-figure figcaption[hidden] {
  display: none;
}

.lp-lightbox-close,
.lp-lightbox-prev,
.lp-lightbox-next {
  position: fixed;
  border: none;
  background: var(--gallery-control-bg);
  color: #fff;
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
  z-index: 2;
}

.lp-lightbox-close:hover,
.lp-lightbox-prev:hover,
.lp-lightbox-next:hover {
  background: var(--gallery-control-hover);
}

.lp-lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lp-lightbox-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lp-lightbox-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 640px) {
  .lp-lightbox-prev {
    left: 0.5rem;
  }

  .lp-lightbox-next {
    right: 0.5rem;
  }

  .lp-gallery {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  }
}

/* Consulting theme overrides */
.landing-consulting {
  --gallery-overlay: rgba(30, 45, 74, 0.97);
  --gallery-control-hover: rgba(196, 162, 101, 0.35);
  --gallery-thumb-radius: 6px;
  --gallery-grid-min: 200px;
  --gallery-caption-color: var(--ic-text-muted, #4a5a72);
}

.landing-consulting .lp-section-gallery {
  background: var(--ic-cream, #f7f3ed);
}

.landing-consulting .lp-section-gallery .lp-section-head h2 {
  color: var(--ic-navy, #1e2d4a);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: 0.04em;
}

.landing-consulting .lp-section-gallery .lp-section-head h2::after {
  background: var(--ic-gold, #c4a265);
}

.landing-consulting .lp-gallery-thumb {
  background: rgba(30, 45, 74, 0.08);
  aspect-ratio: 4 / 3;
}

.landing-consulting .lp-gallery-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(30, 45, 74, 0.18);
}

/* Default landing page theme */
.landing-page {
  --gallery-overlay: rgba(20, 10, 15, 0.92);
}

.landing-page .lp-section-gallery .lp-section-head h2 {
  color: var(--lp-primary);
}
