/* Hamesila Gallery: image grid + accessible lightbox on course/event pages. */

/* The shortcode widget in the template carries this class; hide it when the post has no images. */
.hm-gallery-widget:not(:has(.hm-gallery)),
.hm-gallery-section:not(:has(.hm-gallery)) {
	display: none !important;
}

/* Template 3182: when a gallery follows, the content section above drops its bottom padding
   (the gallery section carries it instead, incl. the space for the mobile sticky bar). */
/* Boxed containers apply padding on .e-con-inner through this variable. */
body:has(.hm-gallery-section .hm-gallery) .elementor-element.elementor-element-c00c6e2 {
	--padding-bottom: 0px !important;
}

.hm-gallery-section .elementor-widget-shortcode {
	width: 100%;
}

.hm-gallery {
	background: #FCFAE3;
	color: #282827;
	padding: 40px 0 10px;
	direction: rtl;
}

.hm-gallery__title {
	font-family: "Ezer Loft", sans-serif;
	font-size: 46px;
	line-height: 1.05;
	font-weight: 400;
	color: #282827;
	margin: 0 0 30px;
}

/* Small black bar under the heading, like the site dividers. */
.hm-gallery__title::after {
	content: "";
	display: block;
	width: 70px;
	height: 12px;
	margin-top: 12px;
	background: #282827;
}

.hm-gallery__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.hm-gallery__item {
	margin: 0;
	padding: 0;
}

.hm-gallery__item[hidden] {
	display: none;
}

.hm-gallery button.hm-gallery__link {
	display: block;
	width: 100%;
	padding: 0 !important;
	margin: 0;
	border: 0 !important;
	border-radius: 0 !important;
	background: #F5F2D9 !important;
	cursor: zoom-in;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #F5F2D9;
	border-radius: 0;
}

/* Specificity above Elementor's ".elementor img { height: auto }". */
.hm-gallery .hm-gallery__grid .hm-gallery__link img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	transition: transform .4s ease;
}

.hm-gallery .hm-gallery__grid .hm-gallery__link:hover img {
	transform: scale(1.04);
}

.hm-gallery__link:focus-visible {
	outline: 3px solid #282827;
	outline-offset: 3px;
}

.hm-gallery__more-wrap {
	text-align: center;
	margin-top: 30px;
}

.hm-gallery button.hm-gallery__more {
	font-family: "Ezer Loft", sans-serif;
	font-size: 18px;
	background: #282827 !important;
	color: #FCFAE3 !important;
	border: 2px solid #282827 !important;
	border-radius: 0 !important;
	padding: 12px 34px !important;
	cursor: pointer;
}

.hm-gallery button.hm-gallery__more:hover,
.hm-gallery button.hm-gallery__more:focus-visible {
	background: #FCFAE3 !important;
	color: #282827 !important;
}

.hm-gallery__more:focus-visible {
	outline: 3px solid #282827;
	outline-offset: 3px;
}

/* ---------- Lightbox ---------- */

.hm-lb {
	position: fixed;
	inset: 0;
	/* Above the site's accessibility widget button. */
	z-index: 2147483000;
	background: rgba(40, 40, 39, .94);
	color: #FCFAE3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 70px 30px;
	direction: rtl;
}

.hm-lb[hidden] {
	display: none;
}

.hm-lb__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
	max-height: 100%;
}

.hm-lb .hm-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 150px);
	width: auto;
	height: auto;
	border-radius: 0;
}

.hm-lb__caption {
	font-family: "Ezer Loft", sans-serif;
	font-size: 17px;
	margin-top: 12px;
	text-align: center;
}

.hm-lb__caption:empty {
	display: none;
}

.hm-lb__count {
	position: absolute;
	top: 18px;
	right: 20px;
	font-size: 15px;
	unicode-bidi: isolate;
}

/* Site-wide button styles (Elementor kit) are strong, so these win explicitly. */
body .hm-lb button.hm-lb__btn {
	position: absolute;
	background: #FCFAE3 !important;
	color: #282827 !important;
	border: 2px solid #FCFAE3 !important;
	border-radius: 0 !important;
	width: 48px !important;
	height: 48px !important;
	min-width: 0;
	padding: 0 !important;
	margin: 0;
	box-shadow: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

body .hm-lb button.hm-lb__btn:hover {
	background: #282827 !important;
	color: #FCFAE3 !important;
}

body .hm-lb button.hm-lb__btn:focus-visible {
	outline: 3px solid #FCFAE3;
	outline-offset: 3px;
}

.hm-lb button.hm-lb__btn svg {
	flex: none;
	width: 22px;
	height: 22px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2.5;
}

.hm-lb__close {
	top: 10px;
	left: 10px;
}

/* RTL: "previous" sits on the right, "next" on the left. */
.hm-lb__prev {
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
}

.hm-lb__next {
	top: 50%;
	left: 10px;
	transform: translateY(-50%);
}

.hm-lb--single .hm-lb__prev,
.hm-lb--single .hm-lb__next,
.hm-lb--single .hm-lb__count {
	display: none;
}

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

@media (max-width: 767px) {
	.hm-gallery {
		padding-top: 30px;
	}

	.hm-gallery__title {
		font-size: 38px;
		margin-bottom: 22px;
	}

	.hm-gallery__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.hm-lb {
		padding: 70px 10px 80px;
	}

	.hm-lb .hm-lb__img {
		max-height: calc(100vh - 190px);
	}

	/* Arrows side by side at the bottom center (thumb reach, clear of corner widgets). */
	body .hm-lb button.hm-lb__prev,
	body .hm-lb button.hm-lb__next {
		top: auto;
		bottom: 16px;
		transform: none;
		right: auto;
	}

	body .hm-lb button.hm-lb__prev {
		left: calc(50% + 6px);
	}

	body .hm-lb button.hm-lb__next {
		left: calc(50% - 54px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hm-gallery .hm-gallery__grid .hm-gallery__link img {
		transition: none;
	}
}
