.gallery-section {
  padding: clamp(64px, 8vw, 108px) 0;
  background:
    radial-gradient(circle at 92% 4%, rgba(225,29,51,.055), transparent 22%),
    #f6f7f9;
}

.gallery-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  margin-bottom: 34px;
}

.gallery-section-copy { max-width: 720px; }
.gallery-section-copy .lead { margin-top: 14px; }

.gallery-count {
  min-width: 150px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.gallery-count strong {
  display: block;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}

.gallery-count span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.gallery-filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  margin: 0 0 28px;
  padding: 2px 1px 8px;
  scrollbar-width: thin;
}

.gallery-filter {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  background: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .25s ease, background .25s ease, border-color .25s ease, transform .25s ease;
}

.gallery-filter:hover,
.gallery-filter.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  transform: translateY(-1px);
}

.mission-gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.gallery-card {
  grid-column: span 4;
  position: relative;
  min-height: 330px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: #0b1017;
  box-shadow: 0 18px 42px rgba(12,16,23,.14);
  cursor: zoom-in;
  text-align: left;
  isolation: isolate;
  transition: transform .38s var(--ease-out), box-shadow .38s var(--ease-out), opacity .3s ease;
}

.gallery-card:nth-child(8n + 1),
.gallery-card:nth-child(8n + 6) { grid-column: span 7; min-height: 430px; }
.gallery-card:nth-child(8n + 2),
.gallery-card:nth-child(8n + 5) { grid-column: span 5; min-height: 430px; }

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0,0,0,.03) 35%, rgba(3,5,8,.86) 100%);
}

.gallery-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 26px 60px rgba(12,16,23,.22);
}

.gallery-card.is-hidden { display: none; }

.gallery-card-media,
.gallery-card img,
.gallery-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card img,
.gallery-card video {
  transform: scale(1.01);
  transition: transform .8s var(--ease-out), filter .8s ease;
}

.gallery-card:hover img,
.gallery-card:hover video {
  transform: scale(1.065);
  filter: contrast(1.04) saturate(1.08);
}

.gallery-card-content {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px;
}

.gallery-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.gallery-card-category,
.gallery-card-type {
  color: rgba(255,255,255,.62);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.gallery-card-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff;
  background: rgba(0,0,0,.26);
  backdrop-filter: blur(8px);
  font-size: 12px;
}

.gallery-card h3 {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.15;
}

.gallery-card p {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: rgba(255,255,255,.68);
  font-size: .86rem;
  line-height: 1.55;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.gallery-empty {
  padding: 52px 24px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  color: var(--text-secondary);
  background: #fff;
  text-align: center;
}

.gallery-lightbox {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(2,4,7,.93);
  backdrop-filter: blur(18px);
  transition: opacity .25s ease, visibility .25s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: #080c12;
  box-shadow: 0 40px 100px rgba(0,0,0,.55);
}

.lightbox-media {
  min-height: min(68vh, 720px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #030508;
}

.lightbox-media img,
.lightbox-media video {
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.lightbox-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  color: #fff;
  background: #0b1017;
}

.lightbox-caption h3 { margin: 0; color: #fff; font-size: 1.1rem; }
.lightbox-caption p { margin: 5px 0 0; color: rgba(255,255,255,.58); font-size: .85rem; }

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  color: #fff;
  background: rgba(6,9,14,.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.lightbox-close { width: 44px; height: 44px; top: 22px; right: 22px; font-size: 24px; }
.lightbox-nav { width: 48px; height: 48px; top: 50%; transform: translateY(-50%); font-size: 22px; }
.lightbox-prev { left: 22px; }
.lightbox-next { right: 22px; }

body.lightbox-open { overflow: hidden; }

@media (max-width: 900px) {
  .mission-gallery-grid { gap: 14px; }
  .gallery-card,
  .gallery-card:nth-child(8n + 1),
  .gallery-card:nth-child(8n + 2),
  .gallery-card:nth-child(8n + 5),
  .gallery-card:nth-child(8n + 6) { grid-column: span 6; min-height: 350px; }
}

@media (max-width: 650px) {
  .gallery-section-header { grid-template-columns: 1fr; gap: 18px; }
  .gallery-count { width: fit-content; min-width: 130px; }
  .mission-gallery-grid { grid-template-columns: 1fr; gap: 13px; }
  .gallery-card,
  .gallery-card:nth-child(8n + 1),
  .gallery-card:nth-child(8n + 2),
  .gallery-card:nth-child(8n + 5),
  .gallery-card:nth-child(8n + 6) { grid-column: 1; min-height: 310px; border-radius: 18px; }
  .gallery-card-content { padding: 18px; }
  .gallery-lightbox { padding: 0; }
  .lightbox-dialog { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .lightbox-media { min-height: 0; }
  .lightbox-caption { padding: 16px; }
  .lightbox-nav { width: 42px; height: 42px; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-close { top: 12px; right: 12px; }
}
