/* Event Photo Gallery — styles front-end */
.epg,
.epg * {
	box-sizing: border-box;
}

.epg {
	color: var(--epg-text, #0f172a);
	background: var(--epg-bg, #fff);
	font-size: 16px;
	line-height: 1.5;
}

.epg-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}

.epg img {
	max-width: 100%;
	height: auto;
	display: block;
}

.epg a {
	color: inherit;
	text-decoration: none;
}

.epg-back {
	display: inline-block;
	margin-bottom: 16px;
	font-weight: 600;
	color: var(--epg-accent);
}

/* ---- En-tête de liste ---- */
.epg-list__head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.epg-list__title {
	margin: 0;
	font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem);
}

.epg-list__tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.epg-search__input,
.epg-select {
	padding: 10px 12px;
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: calc(var(--epg-radius, 12px) * 0.6);
	background: #fff;
	color: inherit;
	font: inherit;
	min-height: 42px;
}

.epg-search__input {
	min-width: 220px;
}

.epg-search__input:focus-visible,
.epg-select:focus-visible,
.epg-btn:focus-visible,
.epg-chip:focus-visible,
.epg-photo:focus-visible {
	outline: 2px solid var(--epg-accent);
	outline-offset: 2px;
}

/* ---- Filtres ---- */
.epg-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 20px;
}

.epg-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: 999px;
	background: #fff;
	color: inherit;
	font: inherit;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
}

.epg-chip--static {
	cursor: default;
}

.epg-chip:hover {
	border-color: var(--epg-accent);
	color: var(--epg-accent);
}

.epg-chip.is-active {
	background: var(--epg-accent);
	border-color: var(--epg-accent);
	color: var(--epg-accent-text, #fff);
}

/* ---- Grilles ---- */
.epg-grid {
	display: grid;
	gap: var(--epg-gap, 16px);
	grid-template-columns: repeat(var(--epg-cols, 3), minmax(0, 1fr));
	margin: 0;
}

.epg-layout-masonry {
	display: block;
	column-count: var(--epg-cols, 3);
	column-gap: var(--epg-gap, 16px);
}

.epg-layout-masonry > * {
	break-inside: avoid;
	margin-bottom: var(--epg-gap, 16px);
}

.epg-layout-carousel {
	display: flex;
	grid-template-columns: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	padding-bottom: 8px;
}

.epg-layout-carousel > * {
	flex: 0 0 clamp(220px, 30%, 360px);
	scroll-snap-align: start;
}

.epg-grid.is-loading {
	opacity: .5;
	transition: opacity .2s;
}

/* ---- Carte ---- */
.epg-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--epg-card, #f1f5f9);
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: var(--epg-radius, 12px);
	box-shadow: var(--epg-shadow, none);
	transition: transform .2s, box-shadow .2s;
}

.epg-card:hover {
	transform: translateY(-3px);
}

.epg-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--epg-placeholder, #e2e8f0);
}

.epg-card__media.is-ratio {
	aspect-ratio: var(--epg-ratio, 4 / 3);
}

.epg-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease;
}

.epg-card:hover .epg-card__img {
	transform: scale(1.06);
}

.epg-card__noimg {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	font-size: 2rem;
	opacity: .4;
}

.epg-card__badge {
	position: absolute;
	right: 10px;
	bottom: 10px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(15, 23, 42, .78);
	color: #fff;
	font-size: .78rem;
	font-weight: 600;
}

.epg-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 18px;
}

.epg-card__title {
	margin: 0;
	font-size: 1.08rem;
	line-height: 1.3;
}

.epg-card__title a:hover {
	color: var(--epg-accent);
}

.epg-card__meta,
.epg-event-header__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin: 0;
	color: var(--epg-muted, #64748b);
	font-size: .86rem;
}

.epg-card__cats,
.epg-event-header__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
}

.epg-card__excerpt {
	margin: 0;
	color: var(--epg-muted, #64748b);
	font-size: .9rem;
}

.epg-card__cta {
	align-self: flex-start;
	margin-top: 4px;
}

/* ---- Boutons ---- */
.epg-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: calc(var(--epg-radius, 12px) * 0.6);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	background: #fff;
	color: inherit;
	transition: background .15s, color .15s, border-color .15s, opacity .15s;
}

.epg-btn:disabled,
.epg-btn[aria-disabled="true"] {
	opacity: .55;
	cursor: not-allowed;
}

.epg-btn--primary {
	background: var(--epg-accent);
	color: var(--epg-accent-text, #fff);
}

.epg-btn--primary:hover {
	filter: brightness(0.94);
}

.epg-btn--ghost {
	background: transparent;
	border-color: var(--epg-border, #e2e8f0);
	color: inherit;
}

.epg-btn--ghost:hover {
	border-color: var(--epg-accent);
	color: var(--epg-accent);
}

/* ---- Pied de liste / pagination ---- */
.epg-list__foot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-top: 28px;
}

.epg-list__foot .page-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.epg-list__foot .page-numbers li {
	margin: 0;
}

.epg-list__foot .page-numbers a,
.epg-list__foot .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	min-height: 42px;
	padding: 0 12px;
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: calc(var(--epg-radius, 12px) * 0.5);
}

.epg-list__foot .page-numbers .current {
	background: var(--epg-accent);
	border-color: var(--epg-accent);
	color: var(--epg-accent-text, #fff);
}

.epg-loadmore__status {
	color: var(--epg-muted, #64748b);
	font-size: .9rem;
}

.epg-empty {
	grid-column: 1 / -1;
	padding: 32px;
	text-align: center;
	color: var(--epg-muted, #64748b);
}

/* ---- Page événement ---- */
.epg-event-header {
	margin-bottom: 24px;
}

.epg-event-header__cover {
	border-radius: var(--epg-radius, 12px);
	overflow: hidden;
	margin-bottom: 20px;
	max-height: 460px;
}

.epg-event-header__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.epg-event-header__title {
	margin: 0 0 8px;
	font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem);
}

.epg-event-header__meta {
	margin-bottom: 6px;
}

.epg-event-header__excerpt {
	margin: 8px 0 0;
	color: var(--epg-muted, #64748b);
	max-width: 70ch;
}

.epg-event-header__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-top: 16px;
}

.epg-event-content {
	margin: 0 0 24px;
	max-width: 75ch;
}

/* ---- Photos ---- */
.epg-layout-grid .epg-photo {
	aspect-ratio: 4 / 3;
}

.epg-photo {
	position: relative;
	display: block;
	padding: 0;
	border: 0;
	margin: 0;
	background: var(--epg-placeholder, #e2e8f0);
	border-radius: calc(var(--epg-radius, 12px) * 0.7);
	overflow: hidden;
	cursor: zoom-in;
	width: 100%;
}

.epg-photo__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease;
}

.epg-photo:hover .epg-photo__img {
	transform: scale(1.04);
}

.epg-photo__dl {
	position: absolute;
	top: 10px;
	right: 10px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(15, 23, 42, .7);
	color: #fff;
	font-size: 1rem;
	opacity: 0;
	transition: opacity .2s;
	z-index: 2;
}

.epg-photo:hover .epg-photo__dl,
.epg-photo:focus-within .epg-photo__dl {
	opacity: 1;
}

/* ---- Partage ---- */
.epg-share {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.epg-share__menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 40;
	min-width: 220px;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: calc(var(--epg-radius, 12px) * 0.7);
	box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}

.epg-share__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	background: transparent;
	border-radius: 8px;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.epg-share__item:hover {
	background: var(--epg-card, #f1f5f9);
}

.epg-share__toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	z-index: 9999;
	padding: 10px 18px;
	background: #0f172a;
	color: #fff;
	border-radius: 999px;
	font-size: .9rem;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}

/* ---- Téléchargement / déblocage ---- */
.epg-download {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	position: relative;
}

.epg-quality {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: .9rem;
	color: var(--epg-muted, #64748b);
}

.epg-download__note {
	flex-basis: 100%;
	margin: 0;
	font-size: .85rem;
	color: var(--epg-muted, #64748b);
}

.epg-download__status {
	flex-basis: 100%;
	font-size: .88rem;
	color: var(--epg-muted, #64748b);
}

.epg-gate {
	flex-basis: 100%;
	margin-top: 8px;
	padding: 18px;
	background: var(--epg-card, #f1f5f9);
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: var(--epg-radius, 12px);
	max-width: 420px;
}

.epg-gate__title {
	margin: 0 0 12px;
	font-size: 1.05rem;
}

.epg-gate__row {
	display: block;
	margin-bottom: 12px;
}

.epg-gate__row span {
	display: block;
	margin-bottom: 4px;
	font-size: .85rem;
	font-weight: 600;
}

.epg-gate__row input[type="email"],
.epg-gate__row input[type="password"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: 8px;
	font: inherit;
}

.epg-gate__consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin-bottom: 12px;
	font-size: .85rem;
}

.epg-gate__error {
	margin: 10px 0 0;
	color: #dc2626;
	font-size: .88rem;
}

/* ---- QR ---- */
.epg-event-qr {
	margin-top: 32px;
}

.epg-qr {
	display: inline-flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	margin: 0;
	padding: 20px;
	background: var(--epg-card, #f1f5f9);
	border: 1px solid var(--epg-border, #e2e8f0);
	border-radius: var(--epg-radius, 12px);
}

.epg-qr__code svg {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.epg-qr__caption {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	font-size: .88rem;
	color: var(--epg-muted, #64748b);
	text-align: center;
}

/* ---- Lightbox ---- */
.epg-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: rgba(2, 6, 23, .94);
	color: #f8fafc;
	opacity: 0;
	visibility: hidden;
	transition: opacity .22s ease;
}

.epg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.epg-lb--light {
	background: rgba(248, 250, 252, .97);
	color: #0f172a;
}

.epg-lb__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
}

.epg-lb__counter {
	font-variant-numeric: tabular-nums;
	font-size: .9rem;
	opacity: .85;
}

.epg-lb__tools {
	display: flex;
	gap: 6px;
	align-items: center;
}

.epg-lb__tool {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1px solid currentColor;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	font: inherit;
	text-decoration: none;
}

.epg-lb__tool:hover {
	background: rgba(148, 163, 184, .18);
}

.epg-lb__stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 56px;
}

.epg-lb__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 6px;
	transition: transform .2s ease;
	cursor: zoom-in;
}

.epg-lb__img.is-zoomed {
	transform: scale(1.8);
	cursor: zoom-out;
}

.epg-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(15, 23, 42, .55);
	color: #fff;
	font-size: 1.4rem;
	cursor: pointer;
	z-index: 2;
}

.epg-lb--light .epg-lb__nav {
	background: rgba(148, 163, 184, .35);
	color: #0f172a;
}

.epg-lb__nav[data-epg-prev] {
	left: 10px;
}

.epg-lb__nav[data-epg-next] {
	right: 10px;
}

.epg-lb__caption {
	max-width: 760px;
	margin: 0 auto;
	padding: 10px 16px;
	text-align: center;
	font-size: .92rem;
	opacity: .92;
}

.epg-lb__thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 10px 16px 16px;
	justify-content: center;
}

.epg-lb__thumb {
	width: 64px;
	height: 64px;
	flex: 0 0 auto;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	padding: 0;
	background: rgba(148, 163, 184, .25);
	cursor: pointer;
	opacity: .65;
}

.epg-lb__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.epg-lb__thumb.is-active {
	border-color: var(--epg-accent, #2563eb);
	opacity: 1;
}

.epg-lb__spinner {
	width: 34px;
	height: 34px;
	border: 3px solid rgba(148, 163, 184, .4);
	border-top-color: var(--epg-accent, #2563eb);
	border-radius: 50%;
	animation: epg-spin .8s linear infinite;
}

@keyframes epg-spin {
	to {
		transform: rotate(360deg);
	}
}

body.epg-lb-open {
	overflow: hidden;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
	.epg-grid {
		grid-template-columns: repeat(min(var(--epg-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.epg-grid {
		grid-template-columns: repeat(var(--epg-columns-mobile, 1), minmax(0, 1fr));
	}
	.epg-layout-masonry {
		column-count: var(--epg-columns-mobile, 1);
	}
	.epg-container {
		padding: 16px 12px 40px;
	}
	.epg-lb__stage {
		padding: 0 8px;
	}
	.epg-lb__nav {
		width: 40px;
		height: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.epg *,
	.epg-lb * {
		transition: none !important;
		animation: none !important;
	}
}
