.qdm-gallery {
  --qdm-gallery-red: #b8112a;
  --qdm-gallery-ink: #171719;
  --qdm-gallery-cols: 3;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 52px) clamp(14px, 3vw, 40px);
  color: var(--qdm-gallery-ink);
}
.qdm-gallery, .qdm-gallery *, .qdm-gallery-lightbox * { box-sizing: border-box; }
.qdm-gallery-cols-2 { --qdm-gallery-cols: 2; }
.qdm-gallery-cols-4 { --qdm-gallery-cols: 4; }
.qdm-gallery h2 {
  color: var(--qdm-gallery-ink);
  margin: 0 0 18px;
  padding: 0 0 10px;
  font-size: clamp(26px, 4vw, 48px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -.035em;
}
.qdm-gallery h2::after {
  display: block;
  width: 38px;
  height: 4px;
  margin-top: 12px;
  border-radius: 5px;
  background: var(--qdm-gallery-red);
  content: "";
}
.qdm-gallery ul.qdm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--qdm-gallery-cols), minmax(0, 1fr));
  gap: clamp(9px, 1.8vw, 22px);
  list-style: none;
  padding: 0;
  margin: 0;
}
.qdm-gallery-grid li { margin: 0; padding: 0; }
.qdm-gallery figure { margin: 0; }
.qdm-gallery figure a {
  display: block;
  overflow: hidden;
  border-radius: 13px;
  background: #f0ebed;
  box-shadow: 0 4px 16px rgba(23, 23, 25, .13);
}
.qdm-gallery figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .2s ease;
}
.qdm-gallery a:hover img { transform: scale(1.025); }
.qdm-gallery figcaption { margin-top: 7px; color: #4e4549; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.qdm-gallery a:focus-visible { outline: 3px solid #b8112a; outline-offset: 3px; }
.qdm-gallery-lightbox {
  width: min(94vw, 1100px);
  max-height: 94vh;
  max-height: 94dvh;
  margin: auto;
  padding: clamp(10px, 2vw, 20px);
  overflow: auto;
  border: 1px solid #4b4145;
  border-radius: 16px;
  background: #19191d;
  color: #fff;
}
.qdm-gallery-lightbox::backdrop { background: rgba(16, 13, 17, .86); }
.qdm-gallery-lightbox [data-qdm-dialog-img] {
  width: 100%; height: auto; max-height: 70vh; max-height: 70dvh;
  display: block; object-fit: contain; background: #101014;
}
.qdm-gallery-lightbox .qdm-gallery-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 0; }
.qdm-gallery-lightbox button {
  display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center;
  padding: 5px 10px; border-radius: 7px; border: 1px solid #82737b; color: #fff; background: #33282d; cursor: pointer; font: inherit;
}
.qdm-gallery-lightbox button[data-qdm-close] { margin-left: auto; }
.qdm-gallery-lightbox button[hidden] { display: none !important; }
.qdm-gallery-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.qdm-gallery-lightbox [data-qdm-dialog-status] { margin: 8px 0 0; color: #fff; font-size: 14px; text-align: center; }
@media (max-width: 740px) { .qdm-gallery { --qdm-gallery-cols: 2; } }
@media (max-width: 360px) { .qdm-gallery { --qdm-gallery-cols: 1; } }
@media (prefers-reduced-motion: reduce) { .qdm-gallery figure img { transition: none; } }
