/**
 * IOLTO Quick Gallery — affichage public (grille, liste de galeries, lightbox).
 * Styles scopés (.iolto-qg-*) et volontairement sobres : le thème garde la main
 * sur la typographie et les couleurs.
 */

.iolto-qg-date {
	margin: 0 0 1em;
	opacity: .75;
	font-size: .95em;
}

/* ── Grille photos ────────────────────────────────────────────────────── */
.iolto-qg-gallery {
	--qg-cols: 3;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin: 1.5em 0;
}
.iolto-qg-gallery.iolto-qg-cols-1 { --qg-cols: 1; }
.iolto-qg-gallery.iolto-qg-cols-2 { --qg-cols: 2; }
.iolto-qg-gallery.iolto-qg-cols-3 { --qg-cols: 3; }
.iolto-qg-gallery.iolto-qg-cols-4 { --qg-cols: 4; }
.iolto-qg-gallery.iolto-qg-cols-5 { --qg-cols: 5; }
.iolto-qg-gallery.iolto-qg-cols-6 { --qg-cols: 6; }
.iolto-qg-gallery.iolto-qg-cols-1 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) {
	.iolto-qg-gallery { grid-template-columns: repeat(min(var(--qg-cols), 3), minmax(0, 1fr)); gap: 10px; }
}
@media (min-width: 1025px) {
	.iolto-qg-gallery { grid-template-columns: repeat(var(--qg-cols), minmax(0, 1fr)); }
}

.iolto-qg-gallery__item {
	display: block;
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	background: rgba(127, 127, 127, .12);
	line-height: 0;
	-webkit-tap-highlight-color: transparent;
}
.iolto-qg-gallery__item:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}
.iolto-qg-gallery .iolto-qg-gallery__img {
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}
@media (hover: hover) {
	.iolto-qg-gallery__item:hover .iolto-qg-gallery__img { transform: scale(1.04); }
}

/* ── Liste des galeries (cartes) ──────────────────────────────────────── */
.iolto-qg-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
	margin: 1.5em 0;
}
@media (min-width: 600px) {
	.iolto-qg-cards:not(.iolto-qg-cols-1) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1025px) {
	.iolto-qg-cards.iolto-qg-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.iolto-qg-cards.iolto-qg-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.iolto-qg-cards.iolto-qg-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
	.iolto-qg-cards.iolto-qg-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.iolto-qg-card { margin: 0; }
.iolto-qg-card__link {
	display: block;
	height: 100%;
	color: inherit;
	text-decoration: none;
}
.iolto-qg-card__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: 10px;
	background: rgba(127, 127, 127, .12);
	line-height: 0;
}
.iolto-qg-card .iolto-qg-card__img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}
@media (hover: hover) {
	.iolto-qg-card__link:hover .iolto-qg-card__img { transform: scale(1.03); }
}
.iolto-qg-card__body { padding: 12px 2px 0; }
.iolto-qg-card__title { margin: 0 0 4px; font-size: 1.15em; line-height: 1.3; }
.iolto-qg-card__date { margin: 0 0 6px; font-size: .9em; opacity: .7; }
.iolto-qg-card__excerpt { margin: 0; font-size: .95em; opacity: .85; }
.iolto-qg-pagination { margin: 1.5em 0; text-align: center; }
.iolto-qg-pagination .page-numbers { display: inline-block; min-width: 2.2em; padding: .35em .6em; }
.iolto-qg-pagination .current { font-weight: 700; }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
.iolto-qg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .94);
	color: #fff;
	touch-action: pan-y pinch-zoom;
	-webkit-tap-highlight-color: transparent;
}
.iolto-qg-lb[hidden] { display: none; }
.iolto-qg-lb__img {
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-select: none;
	transition: transform .2s ease, opacity .2s ease;
}
.iolto-qg-lb__btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	color: #fff;
	background: rgba(255, 255, 255, .12);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	font-size: 0;
	line-height: 0;
}
.iolto-qg-lb__btn:hover,
.iolto-qg-lb__btn:focus-visible { background: rgba(255, 255, 255, .25); }
.iolto-qg-lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.iolto-qg-lb__btn svg { width: 24px; height: 24px; }
.iolto-qg-lb__close { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
.iolto-qg-lb__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.iolto-qg-lb__next { right: 12px; top: 50%; transform: translateY(-50%); }
.iolto-qg-lb__count {
	position: absolute;
	left: 50%;
	bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	opacity: .8;
	font-variant-numeric: tabular-nums;
}
@media (max-width: 599px) {
	.iolto-qg-lb__prev,
	.iolto-qg-lb__next { display: none; } /* Sur mobile : on glisse. */
}
html.iolto-qg-lb-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.iolto-qg-gallery .iolto-qg-gallery__img,
	.iolto-qg-card .iolto-qg-card__img,
	.iolto-qg-lb__img { transition: none; }
}
