/**
 * Page Modèles — galerie médias
 */

/* Filtre catégories */
.mhama-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 20px;
	padding: 0;
	list-style: none !important;
}

.mhama-gallery-filters__label {
	margin: 0 4px 0 0;
	font-size: 14px;
	font-weight: 600;
	color: #475569;
}

.mhama-gallery-filters__item {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.mhama-gallery-filters__link {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding: 6px 12px;
	border: 1px solid #dbe3ee;
	border-radius: 999px;
	background: #fff;
	color: #334155 !important;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mhama-gallery-filters__link:hover,
.mhama-gallery-filters__link:focus-visible {
	border-color: #2e71d4;
	color: #1d4ed8 !important;
	background: #eff6ff;
}

.mhama-gallery-filters__link.is-active {
	border-color: #2e71d4;
	background: #2e71d4;
	color: #fff !important;
}

.mhama-gallery-empty {
	margin: 12px 0 24px;
	padding: 16px;
	color: #475569;
	font-size: 15px;
}

/* Grille masonry — largeur utile (3 / 2 / 1 col) */
.mhama-gallery-grid.grid {
	width: 100%;
	margin: 0 0 28px;
	clear: both;
}

.mhama-gallery-grid .grid-sizer,
.mhama-gallery-grid .grid-item {
	box-sizing: border-box;
	width: calc((100% - 40px) / 3);
	padding: 6px;
	margin-bottom: 20px;
	background: #fff;
	border: solid 1px #fff;
	border-radius: 3px;
	box-shadow: 0 0 8px -2px rgba(0, 0, 0, 0.25);
}

.mhama-gallery-grid .grid-item img {
	width: 100%;
	display: block;
	margin-bottom: 6px;
}

.mhama-gallery-grid .mhama-gallery-image-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 8px;
	color: #1f2937;
}

.mhama-gallery-grid .meta-box h5 {
	font-size: 14px;
	margin: 4px 0 0;
	font-weight: 600;
}

@media screen and (max-width: 980px) {
	.mhama-gallery-grid .grid-sizer,
	.mhama-gallery-grid .grid-item {
		width: calc((100% - 20px) / 2);
	}
}

@media screen and (max-width: 640px) {
	.mhama-gallery-grid .grid-sizer,
	.mhama-gallery-grid .grid-item {
		width: 100%;
	}
}

/* Pagination */
.mhama-pagination,
.page-template-page-template-media-gallery .custom-pagination {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin: 24px 0 8px;
	padding: 0;
	clear: both;
	position: relative;
	z-index: 2;
	background: transparent;
	border: none;
}

.mhama-pagination .page-numbers,
.page-template-page-template-media-gallery .custom-pagination .page-numbers {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none !important;
}

.mhama-pagination .page-numbers li,
.page-template-page-template-media-gallery .custom-pagination .page-numbers li {
	margin: 0;
	padding: 0;
	list-style: none !important;
}

.mhama-pagination .page-numbers a,
.mhama-pagination .page-numbers span,
.page-template-page-template-media-gallery .custom-pagination a.page-numbers,
.page-template-page-template-media-gallery .custom-pagination span.page-numbers {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	min-height: 38px;
	padding: 6px 12px;
	margin: 0 !important;
	border: 1px solid #e3e8ef;
	border-radius: 8px;
	background: #fff !important;
	color: #1f2937 !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none !important;
	box-sizing: border-box;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mhama-pagination .page-numbers a:hover,
.mhama-pagination .page-numbers a:focus-visible,
.page-template-page-template-media-gallery .custom-pagination a.page-numbers:hover,
.page-template-page-template-media-gallery .custom-pagination a.page-numbers:focus-visible {
	background: #eff6ff !important;
	border-color: #2e71d4;
	color: #1d4ed8 !important;
}

.mhama-pagination .page-numbers .current,
.page-template-page-template-media-gallery .custom-pagination span.page-numbers.current {
	background: #2e71d4 !important;
	border-color: #2e71d4 !important;
	color: #fff !important;
	cursor: default;
}

.mhama-pagination .page-numbers .dots,
.page-template-page-template-media-gallery .custom-pagination span.page-numbers.dots {
	min-width: auto;
	border: none !important;
	background: transparent !important;
	color: #94a3b8 !important;
}

.mhama-pagination .page-numbers .prev,
.mhama-pagination .page-numbers .next,
.page-template-page-template-media-gallery .custom-pagination a.prev,
.page-template-page-template-media-gallery .custom-pagination a.next {
	padding-left: 14px;
	padding-right: 14px;
}

/* Lightbox */
.mhama-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	box-sizing: border-box;
}

.mhama-lightbox.is-open {
	display: flex;
}

.mhama-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.82);
	border: 0;
	padding: 0;
	cursor: pointer;
}

.mhama-lightbox__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(960px, 100%);
	max-height: calc(100vh - 48px);
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

.mhama-lightbox__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-bottom: 1px solid #e5e7eb;
	background: #f8fafc;
}

.mhama-lightbox__title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mhama-lightbox__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.mhama-lightbox__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid #dbe3ee;
	border-radius: 8px;
	background: #fff;
	color: #1f2937;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

.mhama-lightbox__btn:hover,
.mhama-lightbox__btn:focus-visible {
	border-color: #2e71d4;
	color: #1d4ed8;
	background: #eff6ff;
}

.mhama-lightbox__btn--primary {
	border-color: #2e71d4;
	background: #2e71d4;
	color: #fff;
}

.mhama-lightbox__btn--primary:hover,
.mhama-lightbox__btn--primary:focus-visible {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff;
}

.mhama-lightbox__btn--close {
	min-width: 36px;
	padding-left: 10px;
	padding-right: 10px;
	font-size: 18px;
	line-height: 1;
}

.mhama-lightbox__figure {
	margin: 0;
	padding: 16px;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #0f172a;
	min-height: 240px;
}

.mhama-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 160px);
	width: auto;
	height: auto;
	margin: 0 auto;
}

body.mhama-lightbox-open {
	overflow: hidden;
}

@media screen and (max-width: 640px) {
	.mhama-lightbox__toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.mhama-lightbox__title {
		white-space: normal;
	}

	.mhama-lightbox__actions {
		justify-content: flex-end;
	}

	.mhama-pagination .page-numbers a,
	.mhama-pagination .page-numbers span,
	.page-template-page-template-media-gallery .custom-pagination a.page-numbers,
	.page-template-page-template-media-gallery .custom-pagination span.page-numbers {
		min-width: 34px;
		min-height: 34px;
		padding: 5px 9px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mhama-gallery-filters__link,
	.mhama-pagination .page-numbers a {
		transition: none;
	}
}
