/* LDC Galerie – site public.
   Calé sur le thème du site : fond sombre, coins à 2 px, titres en 600,
   boutons blancs en petites capitales, bleu d’accent.
   La couleur d’accent se règle dans Galeries photo → Réglages. */
.ldcg,
.ldcg-editions,
.ldcg-head,
.ldcg-affiche {
	--ldcg-accent: #006cff;
	--ldcg-line: color-mix(in srgb, currentColor 18%, transparent);
	--ldcg-gap: 6px;
	--ldcg-tile: 200px;   /* largeur minimale d’une vignette */
	--ldcg-radius: 2px;
}

/* Le titre brut du thème est remplacé par celui du plugin. */
.ldcg-has-hero .post-title-wrapper,
.ldcg-has-hero .entry-header,
.ldcg-has-hero .page-header,
.ldcg-has-hero .entry-title,
.ldcg-has-hero .page-title,
.ldcg-has-hero .wp-block-post-title,
.single-ldc_edition .row-breadcrumb {
	display: none;
}

/* Uncode : pas de double marge intérieure autour de la galerie d’une édition. */
.single-ldc_edition .post-content .row-parent .row-parent {
	padding-left: 0;
	padding-right: 0;
}

/* ---------- En-tête de la page des éditions ---------- */

.ldcg-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px 32px;
	margin: 0 0 24px;
	padding: 0 0 20px;
	border-bottom: 1px solid var(--ldcg-line);
}

.ldcg-head .ldcg-head-title {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: clamp(2.25rem, 5.2vw, 3.5rem);
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

.ldcg-head .ldcg-head-sub {
	max-width: 60ch;
	margin: 10px 0 0;
	opacity: 0.7;
}

.ldcg-meta {
	display: flex;
	flex-wrap: wrap;
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.3;
	opacity: 0.75;
}

.ldcg-meta span + span {
	margin-left: 12px;
	padding-left: 12px;
	border-left: 1px solid var(--ldcg-line);
}

/* ---------- Affiche d’une édition ---------- */

.ldcg-editions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin: 0 0 1.5em;
}

/* La plus récente prend toute la largeur ; une dernière toute seule aussi. */
.ldcg-editions .ldcg-affiche:first-child,
.ldcg-editions .ldcg-affiche:last-child:nth-child(even) {
	grid-column: 1 / -1;
	height: clamp(300px, 38vw, 420px);
}

.ldcg-affiche {
	--ldcg-pad: clamp(18px, 4vw, 44px);
	position: relative;
	container-type: inline-size;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	align-content: flex-end;
	justify-content: space-between;
	gap: 18px;
	box-sizing: border-box;
	min-width: 0;
	height: 280px;
	padding: var(--ldcg-pad);
	overflow: hidden;
	border-radius: var(--ldcg-radius);
	background: #191b1e;
	color: #fff;
	text-decoration: none;
}

.ldcg-affiche--page {
	width: 100%;
	height: clamp(320px, 38vw, 440px);
	margin: 0 0 var(--ldcg-gap);
}

.ldcg-affiche .ldcg-affiche-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Voile sombre en bas, pour que le titre reste lisible sur n’importe quelle photo. */
.ldcg-affiche::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.5) 36%, rgba(10, 10, 10, 0) 68%);
	pointer-events: none;
}

.ldcg-affiche-body,
.ldcg-affiche .ldcg-btn {
	position: relative;
	z-index: 1;
}

.ldcg-affiche-body {
	display: block;
	min-width: 0;
}

.ldcg-affiche .ldcg-affiche-title {
	display: block;
	margin: 0 0 0 -0.045em;
	padding: 0;
	color: #fff;
	font-size: clamp(3.25rem, 17vw, 9rem);
	font-size: clamp(3.25rem, 19cqw, 11rem);
	font-weight: 600;
	line-height: 0.82;
	letter-spacing: -0.045em;
}

.ldcg-affiche.is-long .ldcg-affiche-title {
	margin-left: 0;
	font-size: clamp(2rem, 8vw, 4.5rem);
	font-size: clamp(2rem, 8.5cqw, 5rem);
	line-height: 0.98;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.ldcg-affiche .ldcg-meta {
	--ldcg-line: rgba(255, 255, 255, 0.4);
	margin-top: 16px;
	color: #fff;
	font-size: 0.95rem;
	opacity: 0.85;
}

.ldcg-affiche .ldcg-back {
	position: absolute;
	color: #fff;
	font-size: 0.85rem;
	text-decoration: none;
}

/* Le lien de retour s’accroche en haut de l’affiche, pas au bloc de texte. */
.ldcg-affiche--page .ldcg-affiche-body {
	position: static;
}

.ldcg-affiche--page .ldcg-back {
	z-index: 1;
	top: var(--ldcg-pad);
	left: var(--ldcg-pad);
	padding: 6px 12px;
	border-radius: var(--ldcg-radius);
	background: rgba(10, 10, 10, 0.55);
	opacity: 1;
	transition: background 0.15s;
}

.ldcg-affiche--page .ldcg-back:hover,
.ldcg-affiche--page .ldcg-back:focus-visible {
	background: var(--ldcg-accent);
	color: #fff;
}

.ldcg-affiche--page .ldcg-affiche-title,
.ldcg-affiche--page .ldcg-meta {
	position: relative;
	z-index: 1;
}

/* Carte cliquable : la photo avance un peu et un trait d’accent se tire en bas. */
a.ldcg-affiche::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	height: 4px;
	background: var(--ldcg-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

a.ldcg-affiche:hover,
a.ldcg-affiche:focus-visible {
	color: #fff;
}

a.ldcg-affiche:hover::before,
a.ldcg-affiche:focus-visible::before {
	transform: scaleX(1);
}

a.ldcg-affiche:hover .ldcg-affiche-img,
a.ldcg-affiche:focus-visible .ldcg-affiche-img {
	transform: scale(1.03);
}

a.ldcg-affiche:focus-visible,
.ldcg-item:focus-visible,
.ldcg-btn:focus-visible {
	outline: 2px solid var(--ldcg-accent);
	outline-offset: 2px;
}

/* ---------- Bouton (même gabarit que les boutons du thème) ---------- */

.ldcg-btn {
	display: inline-flex;
	align-items: center;
	padding: 13px 31px;
	border: 4px solid #fff;
	border-radius: var(--ldcg-radius, 2px);
	background: #fff;
	color: #303133;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	max-width: 100%;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ldcg-btn:hover,
.ldcg-btn:focus-visible,
.ldcg-bar .ldcg-btn {
	border-color: var(--ldcg-accent);
	background: var(--ldcg-accent);
	color: #fff;
}

.ldcg-bar .ldcg-btn:hover,
.ldcg-bar .ldcg-btn:focus-visible {
	filter: brightness(1.12);
}

/* ---------- Grille de photos ---------- */

.ldcg {
	margin: 0 0 1.5em;
}

.ldcg-desc {
	max-width: 70ch;
	margin: 22px 0;
}

.ldcg-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.ldcg-count {
	font-size: 0.9rem;
	opacity: 0.75;
}

.ldcg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(var(--ldcg-tile), 45%), 1fr));
	grid-auto-flow: dense;
	gap: var(--ldcg-gap);
}

.ldcg-item {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--ldcg-radius);
	background: #191b1e;
	cursor: zoom-in;
}

/* Mosaïque : une grande photo de temps en temps pour casser la grille. */
@media (min-width: 560px) {
	.ldcg-grid .ldcg-item:nth-child(10n + 4),
	.ldcg-grid .ldcg-item:nth-child(10n + 9) {
		grid-column: span 2;
		grid-row: span 2;
		align-self: stretch;
	}
}

.ldcg-item img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform 0.35s ease, filter 0.35s ease;
}

.ldcg-item:hover img,
.ldcg-item:focus-visible img {
	transform: scale(1.04);
	filter: brightness(1.1);
}

.ldcg-empty {
	opacity: 0.7;
}

@media (max-width: 700px) {
	.ldcg-editions {
		grid-template-columns: 1fr;
	}

	.ldcg-editions .ldcg-affiche,
	.ldcg-affiche--page {
		height: 300px;
	}

	.ldcg-affiche--page {
		height: 360px;
	}

	.ldcg-btn {
		padding: 11px 18px;
	}
}

/* ---------- Visionneuse ---------- */

.pswp {
	--pswp-bg: #0a0a0a;
}

.pswp .ldcg-i-pause,
.pswp.ldcg-playing .ldcg-i-play {
	display: none;
}

.pswp.ldcg-playing .ldcg-i-pause {
	display: inline;
}

.pswp .pswp__button:hover .pswp__icn {
	fill: var(--ldcg-accent, #fff);
}

/* En diaporama, les boutons se cachent quand la souris ne bouge plus. */
.pswp.ldcg-playing.ldcg-idle {
	cursor: none;
}

.pswp.ldcg-playing.ldcg-idle .pswp__top-bar,
.pswp.ldcg-playing.ldcg-idle .pswp__button--arrow {
	opacity: 0 !important;
	transition: opacity 0.4s;
}

@media (prefers-reduced-motion: reduce) {
	.ldcg-item img,
	.ldcg-affiche .ldcg-affiche-img,
	a.ldcg-affiche::before {
		transition: none;
	}
}
