/* ─── Site Gallery Widget (ngw-*) ───
 * The gallery is a white card (--nsimco-card-bg) on the page background;
 * tiles sit on --nsimco-table-bg.
 */

.ngw-wrap {
	direction: rtl;
	text-align: right;
}

.ngw-title {
	margin: 0 0 24px;
	font-size: var(--nsimco-text-lg);
	font-weight: 800;
	color: var(--nsimco-primary);
}

.ngw-card {
	background: var(--nsimco-card-bg);
	border-radius: var(--nsimco-radius-lg);
	padding: 24px;
	overflow: hidden;
}

.ngw-card-head {
	display: flex;
	justify-content: flex-end;
	margin: 0 0 16px;
}

.ngw-count {
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--nsimco-table-bg);
	color: var(--nsimco-muted);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
}

/* ── Grid ── */
.ngw-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
}

.ngw-item {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--nsimco-radius-sm);
	background: var(--nsimco-table-bg);
	cursor: zoom-in;
}

.ngw-item--video {
	cursor: pointer;
}

.ngw-item img,
.ngw-item video {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	border-radius: 0 !important;
	object-fit: cover;
	transition: transform 0.35s ease;
	pointer-events: none;
}

.ngw-item::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: rgba(0, 0, 0, 0);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
	transition: background 0.2s ease;
}

.ngw-item:hover::after,
.ngw-item:focus-visible::after {
	background: rgba(0, 0, 0, 0.18);
}

.ngw-item:hover img,
.ngw-item:hover video {
	transform: scale(1.05);
}

/* Video: large centered play button */
.ngw-play {
	position: absolute;
	z-index: 2;
	top: 50%;
	left: 50%;
	width: 72px;
	height: 72px;
	border: 3px solid rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
	transform: translate(-50%, -50%);
	transition: transform 0.2s ease, background 0.2s ease;
	pointer-events: none;
}

.ngw-play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -14px 0 0 -8px;
	border-style: solid;
	border-width: 14px 0 14px 24px;
	border-color: transparent transparent transparent #fff;
}

.ngw-item--video:hover .ngw-play,
.ngw-item--video:focus-visible .ngw-play {
	background: var(--nsimco-primary, #d52630);
	transform: translate(-50%, -50%) scale(1.08);
}

.ngw-empty {
	margin: 0;
	padding: 24px 16px;
	border-radius: var(--nsimco-radius-sm);
	background: var(--nsimco-table-bg);
	color: var(--nsimco-muted);
	font-size: var(--nsimco-text-sm);
	text-align: center;
}

/* ── Zoom viewer (slider) ── */
.ngw-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	flex-direction: column;
	background: rgba(12, 10, 12, 0.94);
	direction: rtl;
}

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

.ngw-lb-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	color: #fff;
	font-size: 14px;
	flex: 0 0 auto;
}

.ngw-lb-counter {
	padding: 2px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	font-weight: 600;
	direction: ltr;
}

.ngw-lb-caption {
	flex: 1 1 auto;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.ngw-lb-track {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior: contain;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.ngw-lb-track::-webkit-scrollbar {
	display: none;
}

.ngw-lb-track.is-dragging {
	scroll-snap-type: none;
	cursor: grabbing;
}

.ngw-lb-slide {
	flex: 0 0 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 64px 24px;
	box-sizing: border-box;
	scroll-snap-align: center;
	scroll-snap-stop: always;
}

.ngw-lb-slide img,
.ngw-lb-slide video {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: var(--nsimco-radius-md);
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
}

.ngw-lb-slide img {
	cursor: grab;
}

.ngw-lb-slide video {
	width: auto;
	background: #000;
}

.ngw-lb-btn {
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 26px;
	line-height: 44px;
	text-align: center;
	cursor: pointer;
	transition: background 0.2s ease;
}

.ngw-lb-btn:hover,
.ngw-lb-btn:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.ngw-lb-close {
	flex: 0 0 auto;
	margin-inline-start: auto;
}

.ngw-lb-prev,
.ngw-lb-next {
	position: absolute;
	top: 50%;
	margin-top: -22px;
}

.ngw-lb-prev {
	right: 12px;
}

.ngw-lb-next {
	left: 12px;
}

.ngw-lightbox.is-single .ngw-lb-prev,
.ngw-lightbox.is-single .ngw-lb-next,
.ngw-lightbox.is-single .ngw-lb-counter {
	display: none;
}

@media (max-width: 767px) {
	.ngw-card {
		padding: 16px;
	}

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

	.ngw-item {
		border-radius: 4px;
	}

	.ngw-play {
		width: 48px;
		height: 48px;
		border-width: 2px;
	}

	.ngw-play::before {
		margin: -9px 0 0 -5px;
		border-width: 9px 0 9px 16px;
	}

	/* Swipe replaces the arrows on touch screens. */
	.ngw-lb-prev,
	.ngw-lb-next {
		display: none;
	}

	.ngw-lb-slide {
		padding: 0 0 16px;
	}

	.ngw-lb-slide img,
	.ngw-lb-slide video {
		border-radius: 0;
	}
}
