/* Page Galerie : filtres, mosaïque sobre et visionneuse plein écran */
.fgl .ftm-section:first-of-type { padding-top: 48px; }

/* Filtres */
.fgl-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.fgl-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid var(--ftm-line); border-radius: 999px; background: #fff; color: var(--ftm-ink); font: 500 14px/1 Poppins, system-ui, sans-serif; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.fgl-filter span { color: var(--ftm-muted); font-size: 12px; }
.fgl-filter:hover { border-color: var(--ftm-blue); color: var(--ftm-blue); }
.fgl-filter[aria-pressed="true"] { border-color: var(--ftm-navy); background: var(--ftm-navy); color: #fff; }
.fgl-filter[aria-pressed="true"] span { color: #c9d6e8; }
.fgl-filter:focus-visible { outline: 3px solid var(--ftm-orange); outline-offset: 2px; }

/* Mosaïque (colonnes : les photos gardent leurs proportions) */
.fgl-grid { columns: 4 240px; column-gap: 16px; margin: 0; padding: 0; list-style: none; }
.fgl-item { break-inside: avoid; margin: 0 0 16px; }
.fgl-item[hidden] { display: none; }
.fgl-open { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--ftm-soft); cursor: zoom-in; }
.fgl-open img { display: block; width: 100%; height: auto; transition: transform .5s ease; }
.fgl-open:hover img { transform: scale(1.04); }
.fgl-open:focus-visible { outline: 3px solid var(--ftm-orange); outline-offset: 3px; }
.fgl-caption { position: absolute; right: 0; bottom: 0; left: 0; padding: 28px 14px 12px; background: linear-gradient(transparent, rgba(12, 32, 58, .85)); color: #fff; font-size: 13px; line-height: 1.45; text-align: left; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.fgl-open:hover .fgl-caption, .fgl-open:focus-visible .fgl-caption { opacity: 1; transform: none; }

/* Visionneuse */
html.fgl-lock { overflow: hidden; }
.fgl-box { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 20, 38, .96); color: #fff; }
.fgl-box::backdrop { background: rgba(8, 20, 38, .9); }
.fgl-box:not([open]) { display: none !important; } /* le thème force l'affichage des <dialog> */
.fgl-box[open] { display: flex; align-items: center; justify-content: center; }
.fgl-box figure { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: min(1200px, 100% - 140px); margin: 0; }
.fgl-box img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 6px; object-fit: contain; }
.fgl-box figcaption { max-width: 760px; color: #d6e1ef; font: 400 15px/1.55 Poppins, system-ui, sans-serif; text-align: center; }
.fgl-count { position: absolute; top: 22px; left: 26px; color: #c9d6e8; font: 500 13px/1 Poppins, system-ui, sans-serif; }
.fgl-nav, .fgl-close { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; transition: background .2s; }
.fgl-nav:hover, .fgl-close:hover { background: rgba(255, 255, 255, .2); }
.fgl-nav:focus-visible, .fgl-close:focus-visible { outline: 3px solid var(--ftm-orange); outline-offset: 2px; }
.fgl-nav svg, .fgl-close svg { width: 22px; height: 22px; fill: currentColor; }
.fgl-prev { top: 50%; left: 20px; margin-top: -24px; }
.fgl-next { top: 50%; right: 20px; margin-top: -24px; }
.fgl-close { top: 14px; right: 18px; }

@media (max-width: 760px) {
	.fgl-grid { columns: 2; column-gap: 10px; }
	.fgl-item { margin-bottom: 10px; }
	.fgl-filters { flex-wrap: nowrap; margin-right: -16px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
	.fgl-filter { flex: none; }
	.fgl-box figure { max-width: calc(100% - 24px); }
	.fgl-box img { max-height: calc(100vh - 190px); }
	.fgl-prev, .fgl-next { top: auto; bottom: 22px; margin: 0; }
	.fgl-prev { left: calc(50% - 60px); }
	.fgl-next { right: calc(50% - 60px); }
}
@media (prefers-reduced-motion: reduce) { .fgl-open img, .fgl-caption { transition: none; } }
