/* Galerie réalisations QUALIT (module qe-gal) */
.qe-gal {
  --qe-orange: #e05b11;
  --qe-orange-dark: #b91e1a;
  --qe-ink: #1a1a1a;
  --qe-muted: #6b7a86;
  --qe-line: #e6ebef;
  --qe-bg: #f5f5f6;
  --qe-radius: 0.4rem;
  --qe-shadow: 0 12px 36px rgba(15, 15, 16, 0.12);
  color: var(--qe-ink);
  max-width: 72rem;
  margin: 0 auto;
  box-sizing: border-box;
}

.qe-gal *,
.qe-gal *::before,
.qe-gal *::after {
  box-sizing: border-box;
}

.qe-gal__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 28px;
}

.qe-gal__filter {
  appearance: none;
  border: 1px solid var(--qe-line);
  background: #fff;
  color: var(--qe-ink);
  border-radius: 0.2rem;
  padding: 9px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.qe-gal__filter:hover {
  border-color: var(--qe-orange);
  color: var(--qe-orange);
}

.qe-gal__filter.is-active {
  background: linear-gradient(135deg, #e05b11 0%, #b91e1a 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(224, 91, 17, 0.28);
}

.qe-gal__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.qe-gal__item {
  position: relative;
  grid-column: span 4;
  border-radius: var(--qe-radius);
  overflow: hidden;
  background: var(--qe-bg);
  box-shadow: var(--qe-shadow);
  cursor: pointer;
  min-height: 240px;
  border: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

.qe-gal__item.is-hidden {
  display: none;
}

.qe-gal__item--tall {
  min-height: 320px;
}

.qe-gal__item--wide {
  grid-column: span 8;
}

.qe-gal__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.qe-gal__item:hover img,
.qe-gal__item:focus-visible img {
  transform: scale(1.06);
}

.qe-gal__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  background: linear-gradient(180deg, transparent 40%, rgba(15, 15, 16, 0.82) 100%);
  color: #fff;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.qe-gal__item:hover .qe-gal__overlay,
.qe-gal__item:focus-visible .qe-gal__overlay {
  opacity: 1;
}

.qe-gal__label {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 4px;
}

.qe-gal__meta {
  margin: 0;
  font-size: 12px;
  opacity: 0.85;
}

.qe-gal__zoom {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--qe-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.qe-gal__zoom svg {
  display: block;
  width: 16px;
  height: 16px;
}

.qe-gal__empty {
  display: none;
  text-align: center;
  padding: 48px 16px;
  color: var(--qe-muted);
  grid-column: 1 / -1;
}

.qe-gal__empty.is-visible {
  display: block;
}

.qe-lb {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 24, 0.92);
  padding: 24px;
}

.qe-lb.is-open {
  display: flex;
}

.qe-lb__dialog {
  position: relative;
  width: min(1100px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qe-lb__figure {
  position: relative;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  display: grid;
  place-items: center;
  min-height: 280px;
}

.qe-lb__figure img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.qe-lb__caption {
  color: #fff;
  text-align: center;
}

.qe-lb__caption strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.qe-lb__caption span {
  font-size: 13px;
  opacity: 0.75;
}

.qe-lb__btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s ease;
}

.qe-lb__btn:hover {
  background: var(--qe-orange, #e05b11);
}

.qe-lb__close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
}

.qe-lb__prev,
.qe-lb__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.qe-lb__prev {
  left: 12px;
}

.qe-lb__next {
  right: 12px;
}

@media (max-width: 980px) {
  .qe-gal__item,
  .qe-gal__item--wide {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .qe-gal__grid {
    gap: 10px;
  }

  .qe-gal__item,
  .qe-gal__item--wide,
  .qe-gal__item--tall {
    grid-column: span 12;
    min-height: 220px;
  }

  .qe-gal__overlay {
    opacity: 1;
  }

  .qe-lb__prev {
    left: 4px;
  }

  .qe-lb__next {
    right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qe-gal__item img {
    transition: none;
  }
}
