/* ── Variables ── */
:root {
  --gal-navy:    #1c2b4a;
  --gal-blue:    #1a73e8;
  --gal-bg:      #f0f2f5;
  --gal-white:   #ffffff;
  --gal-radius:  10px;
  --gal-gap:     10px;
  --gal-shadow:  0 2px 14px rgba(0,0,0,.10);
  --lb-bg:       rgba(0,0,0,.93);
}

/* ── Conteneur global — full width ── */
.gal-wrap {
  width: 100%;
  padding-bottom: 60px;
  background: var(--gal-bg);
}

/* ── En-tête ── */
.gal-header {
  padding: 28px 24px 22px;
  background: var(--gal-white);
  border-bottom: 3px solid var(--gal-navy);
  text-align: center;
}
.gal-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--gal-navy);
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.gal-title span {
  color: var(--gal-blue);
}
.gal-subtitle {
  color: #666;
  margin: 0;
  font-size: .9rem;
}

/* ── Barre de filtres sticky ── */
.gal-filters-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--gal-white);
  border-bottom: 1px solid #dde2ea;
  box-shadow: 0 3px 10px rgba(0,0,0,.07);
  padding: 10px 16px 12px;
}

.gal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

/* ── Bouton filtre ── */
.gal-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 8px;
  border-radius: 6px;
  border: 1.5px solid #d0d7e3;
  background: #f6f7fb;
  color: #3a4560;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.gal-filter-btn:hover {
  background: #eaeff9;
  border-color: #9eb5d8;
  color: var(--gal-navy);
}
.gal-filter-btn.active {
  background: var(--gal-navy);
  border-color: var(--gal-navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(28,43,74,.30);
}

/* Numéro en badge rond */
.gal-filter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(0,0,0,.09);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1;
  flex-shrink: 0;
}
.gal-filter-btn.active .gal-filter-num {
  background: rgba(255,255,255,.2);
}

/* Label court */
.gal-filter-lbl {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
}

/* Ambiance — variante dorée */
.gal-filter-btn--ambiance {
  border-color: #e0b84a;
  background: #fffbf0;
  color: #6b4800;
}
.gal-filter-btn--ambiance .gal-filter-num {
  background: rgba(200,130,0,.15);
}
.gal-filter-btn--ambiance:hover {
  background: #fff3d0;
  border-color: #c89400;
  color: #4a3000;
}
.gal-filter-btn--ambiance.active {
  background: #c89400;
  border-color: #c89400;
  color: #fff;
}
.gal-filter-btn--ambiance.active .gal-filter-num {
  background: rgba(255,255,255,.2);
}

/* ── Sections épreuves ── */
.gal-section {
  margin: 14px 14px 0;
  border-radius: var(--gal-radius);
  overflow: hidden;
  box-shadow: var(--gal-shadow);
  background: var(--gal-white);
}

.gal-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: #3d6b9e;
  color: #fff;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .2s;
}
.gal-section-header:hover { background: #2e5585; }

.gal-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255,255,255,.18);
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.gal-section-name  { flex: 1; }
.gal-section-count { font-size: .78rem; opacity: .65; font-weight: 400; white-space: nowrap; }

/* Chevron CSS pur */
.gal-chevron {
  width: 0; height: 0;
  border-left:   5px solid transparent;
  border-right:  5px solid transparent;
  border-top:    6px solid rgba(255,255,255,.7);
  flex-shrink: 0;
  transition: transform .25s;
}
.gal-section-header[aria-expanded="false"] .gal-chevron { transform: rotate(-90deg); }

/* ── Grille de photos ── */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--gal-gap);
  padding: var(--gal-gap);
  overflow: hidden;
  transition: max-height .3s ease, opacity .3s ease;
}
.gal-grid.collapsed {
  max-height: 0 !important;
  padding: 0 var(--gal-gap);
  opacity: 0;
}

/* ── Vignette ── */
.gal-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  background: #d8dce6;
}
.gal-item:focus-visible { outline: 3px solid var(--gal-blue); outline-offset: 2px; }

.gal-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.gal-item:hover .gal-thumb { transform: scale(1.06); }

.gal-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.25);
  opacity: 0;
  transition: opacity .25s;
}
.gal-item:hover .gal-item-overlay,
.gal-item:focus-visible .gal-item-overlay { opacity: 1; }

/* ── Lightbox ── */
.gal-lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gal-lb[hidden] { display: none; }

.gal-lb-overlay {
  position: absolute;
  inset: 0;
  background: var(--lb-bg);
}

.gal-lb-box {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  max-height: 100dvh;
  padding: 56px 60px 0;
  box-sizing: border-box;
}

.gal-lb-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  position: relative;
}
.gal-lb-img {
  max-width: 100%;
  max-height: calc(100dvh - 180px);
  object-fit: contain;
  border-radius: 4px;
  display: block;
  transition: opacity .2s;
  cursor: zoom-in;
}
.gal-lb-img.zoomed {
  cursor: zoom-out;
  max-width: none;
  max-height: none;
  transform-origin: center center;
}

.gal-lb-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.gal-lb-loader::after {
  content: '';
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gal-spin .7s linear infinite;
}
@keyframes gal-spin { to { transform: rotate(360deg); } }
.gal-lb-img-wrap.loading .gal-lb-loader { display: flex; }
.gal-lb-img-wrap.loading .gal-lb-img    { opacity: 0; }

/* Nav lightbox */
.gal-lb-close,
.gal-lb-prev,
.gal-lb-next {
  position: absolute;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.gal-lb-close:hover,
.gal-lb-prev:hover,
.gal-lb-next:hover { background: rgba(255,255,255,.28); }

.gal-lb-close { top: 12px; right: 12px; width: 40px; height: 40px; font-size: 1.1rem; }
.gal-lb-prev,
.gal-lb-next  { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 1.9rem; line-height: 1; }
.gal-lb-prev { left: 8px; }
.gal-lb-next { right: 8px; }
.gal-lb-prev:disabled,
.gal-lb-next:disabled { opacity: .22; cursor: default; }

/* Footer lightbox */
.gal-lb-footer {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0 14px;
  color: rgba(255,255,255,.85);
  font-size: .85rem;
}
.gal-lb-caption { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-lb-counter { white-space: nowrap; opacity: .55; }
.gal-lb-actions { display: flex; gap: 8px; flex-shrink: 0; }

.gal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: .82rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
  white-space: nowrap;
}
.gal-btn:hover { background: rgba(255,255,255,.24); color: #fff; }

/* ── Toast ── */
.gal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #2c3e50;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 10000;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.gal-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Bouton retour en haut ── */
.gal-back-top {
  position: fixed;
  bottom: 28px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gal-navy);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s, background .2s;
  pointer-events: none;
  z-index: 200;
}
.gal-back-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.gal-back-top:hover { background: #2e5585; }

/* ── Vide ── */
.gal-empty { text-align: center; color: #888; padding: 60px 0; font-size: 1.1rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .gal-section { margin: 10px 10px 0; }
}
@media (max-width: 600px) {
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; padding: 6px; }
  .gal-lb-box { padding: 52px 32px 0; }
  .gal-lb-prev { left: 2px; }
  .gal-lb-next { right: 2px; }
  .gal-lb-actions { flex-wrap: wrap; }
  .gal-section { margin: 8px 6px 0; }
  .gal-filters-bar { padding: 8px 10px 10px; }
  .gal-filter-btn { padding: 4px 8px 4px 6px; }
  .gal-filter-lbl { font-size: .67rem; }
}
@media (max-width: 380px) {
  .gal-grid { grid-template-columns: repeat(2, 1fr); }
  .gal-filter-num { min-width: 18px; height: 18px; font-size: .72rem; }
}
