:root {
  --gallery-card-bg: #ffffff;
  --gallery-card-shadow: 0 20px 35px -25px rgba(15, 23, 42, 0.45);
  --gallery-accent: #ff8c00;
  --gallery-text: #1d2134;
  --gallery-muted: #5b6270;
  --gallery-border: rgba(15, 23, 42, 0.08);
}

body.no-scroll {
  overflow: hidden;
}

.gallery-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 3vw, 2rem) clamp(3rem, 5vw, 4rem);
}

.gallery-intro {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.gallery-intro h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.35rem;
}

.gallery-tagline {
  margin-top: 1rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--gallery-muted);
}

.gallery-grid {
  margin-top: clamp(1.75rem, 3vw, 3rem);
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-card {
  background: var(--gallery-card-bg);
  border-radius: 18px;
  box-shadow: var(--gallery-card-shadow);
  border: 1px solid var(--gallery-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.gallery-card:hover,
.gallery-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 24px 40px -28px rgba(10, 15, 35, 0.55);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.35s ease;
  filter: saturate(88%) contrast(95%);
}

.gallery-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.15), rgba(255, 140, 0, 0.18));
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-card:hover .gallery-thumb::after,
.gallery-thumb:focus-visible::after {
  opacity: 1;
}

.gallery-card:hover .gallery-thumb img,
.gallery-thumb:focus-visible img {
  filter: saturate(112%) contrast(107%);
}

.gallery-thumb:focus-visible {
  outline: 3px solid var(--gallery-accent);
  outline-offset: 4px;
}

.gallery-thumb.is-active {
  outline: 3px solid var(--gallery-accent);
  outline-offset: -3px;
}

figcaption {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.caption-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gallery-text);
  line-height: 1.4;
}

.caption-link {
  align-self: flex-start;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gallery-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.caption-link::after {
  content: "\2197";
  font-size: 0.85rem;
}

.caption-link:hover,
.caption-link:focus-visible {
  text-decoration: underline;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 25, 0.78);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  z-index: 1200;
}

.gallery-lightbox.is-open {
  display: flex;
}

.lightbox-dialog {
  position: relative;
  width: min(960px, 100%);
  border-radius: 20px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 30px 60px -30px rgba(9, 9, 17, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.75);
  color: #f8fafc;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  opacity: 0.85;
  transform: scale(1.05);
}

.lightbox-media {
  padding: clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 16px;
  box-shadow: 0 20px 40px -25px rgba(0, 0, 0, 0.65);
}

.lightbox-meta {
  padding: 0 clamp(1.25rem, 3vw, 2.5rem) clamp(1.5rem, 4vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lightbox-title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
}

.lightbox-description {
  color: rgba(241, 245, 249, 0.85);
  font-size: 1rem;
  line-height: 1.6;
}

.lightbox-link {
  align-self: flex-start;
  display: none;
  padding: 0.55rem 1.1rem;
  background: var(--gallery-accent);
  color: #1f1300;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lightbox-link.is-visible {
  display: inline-flex;
}

.lightbox-link:hover,
.lightbox-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -14px rgba(255, 140, 0, 0.65);
}

.lightbox-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  padding: 0 clamp(0.5rem, 2vw, 1.5rem);
}

.lightbox-prev,
.lightbox-next {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.6);
  color: #f8fafc;
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-prev:hover,
.lightbox-prev:focus-visible,
.lightbox-next:hover,
.lightbox-next:focus-visible {
  background: rgba(15, 23, 42, 0.85);
  transform: scale(1.06);
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .lightbox-image {
    max-height: 60vh;
  }
}

@media (max-width: 768px) {
  .gallery-section {
    padding: 2rem 1.25rem 3rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
  }

  .lightbox-dialog {
    border-radius: 16px;
  }

  .lightbox-controls {
    padding: 0 0.5rem;
  }
}

@media (max-width: 540px) {
  .gallery-tagline {
    font-size: 0.95rem;
  }

  .caption-title {
    font-size: 1rem;
  }

  .gallery-card {
    border-radius: 16px;
  }

  .lightbox-image {
    max-height: 55vh;
  }

  .lightbox-meta {
    padding: 0 1.25rem 1.75rem;
  }

  .lightbox-link {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 42px;
    height: 42px;
  }
}
