/* Galerie filtrable : filtres, mosaïque ou grille, légendes, bouton « voir plus », visionneuse. */

.ta-filter-gallery {
	--ta-fg-cols: 3;
	--ta-fg-gap: 16px;
	--ta-fg-ratio: 4/5;
	--ta-fg-radius: 4px;
	--ta-fg-overlay: rgba(24, 19, 15, 0.72);
	--ta-fg-ink: #1e1b18;
	--ta-fg-paper: #f7f3ee;
	position: relative;
}

/* Filtres. */
.ta-fg__filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 28px;
}

.ta-fg__filter {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	margin: 0;
	padding: 0.6em 1.25em;
	border: 1px solid rgba(30, 27, 24, 0.22);
	border-radius: 999px;
	background: transparent;
	color: var(--ta-fg-ink);
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.2;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.ta-fg__filter:hover,
.ta-fg__filter[aria-pressed="true"] {
	border-color: var(--ta-fg-ink);
	background: var(--ta-fg-ink);
	color: var(--ta-fg-paper);
}

.ta-fg__filter:focus-visible,
.ta-fg__more:focus-visible,
.ta-fg__open:focus-visible,
.ta-fg__lb-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.ta-fg__open:focus-visible {
	outline-color: var(--ta-fg-ink);
}

.ta-fg__count {
	font-size: 0.8em;
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}

/* Liste. */
.ta-fg__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ta-fg__item {
	margin: 0;
	padding: 0;
}

.ta-fg__item[hidden] {
	display: none !important;
}

.ta-fg--masonry .ta-fg__list {
	column-count: var(--ta-fg-cols);
	column-gap: var(--ta-fg-gap);
}

/* inline-block : seule façon fiable d'empêcher le navigateur de couper une image entre deux colonnes. */
.ta-fg--masonry .ta-fg__item {
	display: inline-block;
	width: 100%;
	vertical-align: top;
	break-inside: avoid;
	margin-bottom: var(--ta-fg-gap);
}

.ta-fg--grid .ta-fg__list {
	display: grid;
	grid-template-columns: repeat(var(--ta-fg-cols), minmax(0, 1fr));
	gap: var(--ta-fg-gap);
}

.ta-fg__item.is-entering {
	animation: ta-fg-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes ta-fg-in {
	from {
		opacity: 0;
		transform: scale(0.96) translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.ta-fg__figure {
	position: relative;
	margin: 0;
}

.ta-fg__media {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: var(--ta-fg-radius);
	background: rgba(30, 27, 24, 0.06);
	color: inherit;
	font: inherit;
	line-height: 0;
	text-align: inherit;
}

.ta-fg__open {
	cursor: zoom-in;
}

.ta-fg__media .ta-fg__img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	border-radius: 0;
	transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ta-fg--grid .ta-fg__media {
	aspect-ratio: var(--ta-fg-ratio);
}

.ta-fg--grid .ta-fg__media .ta-fg__img {
	height: 100%;
	object-fit: cover;
}

.ta-fg-zoom-yes .ta-fg__figure:hover .ta-fg__img,
.ta-fg-zoom-yes .ta-fg__open:focus-visible .ta-fg__img {
	transform: scale(1.045);
}

/* Légendes. */
.ta-fg__caption {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ta-fg__title {
	font-size: 1rem;
	line-height: 1.3;
}

.ta-fg__title a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.ta-fg__location {
	font-size: 0.8125rem;
	line-height: 1.3;
	letter-spacing: 0.04em;
	opacity: 0.8;
}

.ta-fg--caption-below .ta-fg__caption {
	padding: 12px 2px 4px;
	color: var(--ta-fg-ink);
}

.ta-fg--caption-hover .ta-fg__caption {
	position: absolute;
	inset: auto 0 0;
	max-height: 100%;
	overflow: hidden;
	padding: 48px 18px 16px;
	border-radius: 0 0 var(--ta-fg-radius) var(--ta-fg-radius);
	background: linear-gradient(to top, var(--ta-fg-overlay), transparent);
	color: #fff;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.ta-fg--caption-hover .ta-fg__caption a {
	pointer-events: auto;
}

.ta-fg--caption-hover .ta-fg__figure:hover .ta-fg__caption,
.ta-fg--caption-hover .ta-fg__figure:focus-within .ta-fg__caption {
	opacity: 1;
	transform: none;
}

/* Écrans tactiles : pas de survol, légendes toujours visibles. */
@media (hover: none) {
	.ta-fg--caption-hover .ta-fg__caption {
		opacity: 1;
		transform: none;
	}
}

/* Annonce pour lecteurs d'écran. */
.ta-fg__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Bouton « voir plus ». */
.ta-fg__more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

.ta-fg__more-wrap[hidden] {
	display: none;
}

.ta-fg__more {
	margin: 0;
	padding: 0.9em 2em;
	border: 1px solid var(--ta-fg-ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ta-fg-ink);
	font: inherit;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.ta-fg__more:hover {
	background: var(--ta-fg-ink);
	color: var(--ta-fg-paper);
}

/* Visionneuse (déplacée dans <body> par le script). */
.ta-fg__lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 56px 72px;
	color: #f7f3ee;
	animation: ta-fg-fade 0.25s ease both;
}

.ta-fg__lightbox[hidden] {
	display: none;
}

.ta-fg__lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 17, 14, 0.94);
}

.ta-fg__lb-figure {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}

.ta-fg__lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 170px);
	max-height: calc(100dvh - 170px);
	width: auto;
	height: auto;
	object-fit: contain;
	transition: opacity 0.25s ease;
	user-select: none;
	-webkit-user-drag: none;
}

.ta-fg__lb-img.is-loading {
	opacity: 0.25;
}

.ta-fg__lb-caption {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: center;
	gap: 4px 14px;
	margin-top: 16px;
	text-align: center;
	font-size: 0.9375rem;
	line-height: 1.4;
}

.ta-fg__lb-location,
.ta-fg__lb-counter {
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	opacity: 0.7;
}

.ta-fg__lb-counter {
	font-variant-numeric: tabular-nums;
}

.ta-fg__lb-btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(247, 243, 238, 0.3);
	border-radius: 50%;
	background: rgba(20, 17, 14, 0.4);
	color: #f7f3ee;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ta-fg__lb-btn:hover {
	border-color: #f7f3ee;
	background: rgba(247, 243, 238, 0.12);
}

.ta-fg__lb-btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ta-fg__lb-close {
	top: 16px;
	right: 16px;
}

.ta-fg__lb-prev,
.ta-fg__lb-next {
	top: 50%;
	transform: translateY(-50%);
}

.ta-fg__lb-prev {
	left: 16px;
}

.ta-fg__lb-next {
	right: 16px;
}

.ta-fg__lb-btn[hidden] {
	display: none;
}

@keyframes ta-fg-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@media (max-width: 767px) {
	.ta-fg__filters {
		margin-bottom: 20px;
	}

	.ta-fg__filter {
		padding: 0.5em 1em;
		font-size: 0.875rem;
	}

	.ta-fg--caption-hover .ta-fg__caption {
		padding: 36px 12px 10px;
	}

	.ta-fg__title {
		font-size: 0.875rem;
	}

	.ta-fg__location {
		font-size: 0.75rem;
	}

	.ta-fg__lightbox {
		padding: 64px 12px 24px;
	}

	.ta-fg__lb-prev,
	.ta-fg__lb-next {
		top: auto;
		bottom: 16px;
		transform: none;
	}

	.ta-fg__lb-img {
		max-height: calc(100vh - 200px);
		max-height: calc(100dvh - 200px);
	}

	.ta-fg__lb-figure {
		margin-bottom: 56px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ta-fg__item.is-entering,
	.ta-fg__lightbox {
		animation: none;
	}

	.ta-fg__media .ta-fg__img,
	.ta-fg--caption-hover .ta-fg__caption,
	.ta-fg__lb-img {
		transition: none;
	}

	.ta-fg-zoom-yes .ta-fg__figure:hover .ta-fg__img,
	.ta-fg-zoom-yes .ta-fg__open:focus-visible .ta-fg__img {
		transform: none;
	}
}
