.vp-gallery-page .site-main,
.vp-gallery-page {
  background:
    radial-gradient(circle at top left, rgba(134, 170, 149, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(79, 127, 114, 0.12), transparent 28%),
    var(--vp-color-surface-alt);
}

.vp-gallery-grid {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  grid-auto-flow: dense;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.vp-gallery-card {
  background: rgba(255, 255, 252, 0.92);
  border: 1px solid rgba(211, 221, 214, 0.84);
  border-radius: 22px;
  box-shadow: 0 20px 42px rgba(35, 53, 47, 0.08);
  grid-column: span 4;
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  position: relative;
}

.vp-gallery-card--wide {
  grid-column: span 8;
}

.vp-gallery-card--tall {
  grid-column: span 4;
  grid-row: span 2;
}

.vp-gallery-card-link {
  color: inherit;
  display: block;
  height: 100%;
  position: relative;
  text-decoration: none;
}

.vp-gallery-card-media {
  display: block;
  height: 100%;
  min-height: 280px;
  overflow: hidden;
  position: relative;
}

.vp-gallery-card-media::after {
  background: linear-gradient(180deg, rgba(19, 35, 31, 0.04) 0%, rgba(19, 35, 31, 0.72) 100%);
  content: "";
  inset: 0;
  position: absolute;
}

.vp-gallery-card-image {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform var(--vp-transition);
  width: 100%;
}

.vp-gallery-card:hover .vp-gallery-card-image {
  transform: scale(1.04);
}

.vp-gallery-card-caption {
  bottom: 0;
  display: grid;
  gap: 0.45rem;
  left: 0;
  padding: 1.2rem 1.2rem 1.3rem;
  position: absolute;
  right: 0;
  z-index: 1;
}

.vp-gallery-card-caption strong {
  color: #fffdf7;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.vp-gallery-card-caption span {
  color: rgba(248, 245, 236, 0.88);
  font-size: 0.94rem;
  line-height: 1.6;
  max-width: 34ch;
}

.vp-gallery-lightbox {
  inset: 0;
  position: fixed;
  z-index: 9999;
}

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

.vp-gallery-lightbox-backdrop {
  background: rgba(16, 27, 24, 0.82);
  backdrop-filter: blur(8px);
  inset: 0;
  position: absolute;
}

.vp-gallery-lightbox-dialog {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  height: 100dvh;
  margin: 0 auto;
  max-width: min(1400px, calc(100vw - 2rem));
  padding: 1.25rem 0;
  position: relative;
  width: 100%;
  z-index: 1;
}

.vp-gallery-lightbox-nav {
  align-items: center;
  background: rgba(255, 255, 252, 0.14);
  border: 1px solid rgba(255, 255, 252, 0.22);
  border-radius: 999px;
  color: #fffdf7;
  cursor: pointer;
  display: inline-flex;
  height: 3rem;
  justify-content: center;
  line-height: 1;
  transition: background var(--vp-transition), transform var(--vp-transition);
  width: 3rem;
  z-index: 3;
}

.vp-gallery-lightbox-nav:hover,
.vp-gallery-lightbox-nav:focus {
  background: rgba(255, 255, 252, 0.28);
  transform: translateY(-1px);
}

.vp-gallery-lightbox-nav-glyph {
  color: #fffdf7;
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.vp-gallery-lightbox-figure {
  background: rgba(29, 45, 40, 0.52);
  border: 1px solid rgba(255, 255, 252, 0.12);
  border-radius: 28px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.28);
  margin: 0;
  max-height: calc(100dvh - 2.5rem);
  overflow: hidden;
}

.vp-gallery-lightbox-media {
  align-items: center;
  background: rgba(12, 19, 17, 0.82);
  display: flex;
  justify-content: center;
  min-height: min(70dvh, 820px);
  padding: 1rem;
}

.vp-gallery-lightbox-image {
  display: block;
  max-height: calc(70dvh - 2rem);
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

.vp-gallery-lightbox-caption {
  background: linear-gradient(180deg, rgba(34, 52, 47, 0.9) 0%, rgba(24, 37, 34, 0.98) 100%);
  color: #f7f4ea;
  padding: 1.1rem 1.25rem 1.25rem;
}

.vp-gallery-lightbox-meta {
  display: grid;
  gap: 0.35rem;
}

.vp-gallery-lightbox-count {
  color: rgba(219, 232, 223, 0.76);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}

.vp-gallery-lightbox-caption h3 {
  color: #fffdf7;
  margin: 0;
}

.vp-gallery-lightbox-caption p:last-child {
  color: rgba(247, 244, 234, 0.86);
  line-height: 1.7;
  margin: 0;
}

body.vp-gallery-lightbox-open {
  overflow: hidden;
}

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

  .vp-gallery-card,
  .vp-gallery-card--wide,
  .vp-gallery-card--tall {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 768px) {
  .vp-gallery-grid {
    grid-template-columns: 1fr;
  }

  .vp-gallery-card,
  .vp-gallery-card--wide,
  .vp-gallery-card--tall {
    grid-column: auto;
    grid-row: auto;
  }

  .vp-gallery-card-media {
    min-height: 240px;
  }

  .vp-gallery-lightbox-dialog {
    gap: 0.75rem;
    grid-template-columns: 1fr;
    max-width: calc(100vw - 1rem);
    padding: 0.75rem 0;
  }

  .vp-gallery-lightbox-nav {
    bottom: 5.5rem;
    position: absolute;
    z-index: 2;
  }

  .vp-gallery-lightbox-nav--prev {
    left: 0.75rem;
  }

  .vp-gallery-lightbox-nav--next {
    right: 0.75rem;
  }

  .vp-gallery-lightbox-figure {
    max-height: calc(100dvh - 1.5rem);
  }

  .vp-gallery-lightbox-media {
    min-height: 58dvh;
    padding: 0.75rem;
  }

  .vp-gallery-lightbox-image {
    max-height: calc(58dvh - 1.5rem);
  }
}
