/* ====== Tag Gallery - معرض الصور (الواجهة الأمامية) ====== */

.tag-gallery {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	align-items: start;
	gap: clamp(12px, 2vw, 24px);
	margin: 2rem auto;
	max-width: 1200px;
	padding: 0 1rem;
}

.tag-gallery__item {
	position: relative;
	margin: 0;
	border-radius: 14px;
	/* يرث ظل وألوان متناسقة مع أغلب القوالب */
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
	background: #fff;
	transition: transform 0.35s ease, box-shadow 0.35s ease;
	/* تجاوز أي تحديد ارتفاع/قص يفرضه القالب */
	height: auto !important;
	max-height: none !important;
	aspect-ratio: auto !important;
	overflow: visible;
}

.tag-gallery__item:hover {
	transform: translateY(-6px);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.tag-gallery__link {
	display: block;
	width: 100%;
	text-decoration: none;
	cursor: zoom-in;
}

.tag-gallery__img {
	display: block;
	width: 100% !important;
	height: auto !important; /* الصورة تظهر كاملة بدون قص */
	max-height: none !important;
	max-width: 100%;
	object-fit: fill !important; /* لا قص */
	border-radius: 14px;
	transition: transform 0.5s ease;
}

.tag-gallery__item:hover .tag-gallery__img {
	transform: scale(1.03);
}

.tag-gallery__caption {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	margin: 0;
	padding: 2.2rem 1rem 0.9rem;
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	text-align: center;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	transform: translateY(8px);
	opacity: 0;
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.tag-gallery__item:hover .tag-gallery__caption {
	opacity: 1;
	transform: translateY(0);
}

/* الأجهزة اللوحية: صورتان بجانب بعض */
@media (max-width: 900px) {
	.tag-gallery {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* الجوال: صورة واحدة في كل سطر */
@media (max-width: 600px) {
	.tag-gallery {
		grid-template-columns: 1fr;
	}

	.tag-gallery__caption {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ====== اللايت بوكس (تكبير الصورة عند الضغط) ====== */
.tag-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.88);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tag-gallery-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.tag-gallery-lightbox__img {
	max-width: 95vw;
	max-height: 90vh;
	width: auto;
	height: auto;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	transform: scale(0.96);
	transition: transform 0.3s ease;
	cursor: zoom-out;
}

.tag-gallery-lightbox.is-open .tag-gallery-lightbox__img {
	transform: scale(1);
}

.tag-gallery-lightbox__close {
	position: absolute;
	top: 18px;
	inset-inline-end: 24px;
	width: 44px;
	height: 44px;
	font-size: 30px;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s ease;
}

.tag-gallery-lightbox__close:hover {
	background: rgba(255, 255, 255, 0.28);
}
