/**
 * NTV Theme — Block "Gallery ảnh" — style hiển thị ngoài site.
 * File riêng (không gộp vào main.css) vì chỉ enqueue trên trang thực sự dùng block này.
 */

.ntv-gallery {
	margin: 20px 0;
}

/* ---------- Chế độ Lưới (Grid) ----------
 * Dùng CSS multi-column ("masonry" không cần JS) thay vì CSS Grid cột đều — mỗi ảnh
 * giữ NGUYÊN tỉ lệ gốc, không bị crop (chiều cao mỗi ô tự thích ứng theo ảnh, giống
 * kiểu "adaptive height"). Thứ tự ảnh sẽ chạy dọc theo từng cột (trên xuống dưới, hết
 * cột mới sang cột kế) — đây là hành vi mặc định của kỹ thuật multi-column.
 */
.ntv-gallery__grid {
	column-count: var(--ntv-gallery-cols, 3);
	column-gap: 8px;
}
@media (max-width: 700px) {
	.ntv-gallery__grid {
		column-count: 2;
	}
}
.ntv-gallery__item {
	position: relative;
	display: block;
	width: 100%;
	background: #F0F0F0;
	overflow: hidden;
	border-radius: 4px;
	border: 0;
	padding: 0;
	margin: 0 0 8px;
	cursor: zoom-in;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
}
.ntv-gallery__item img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.2s ease;
}
.ntv-gallery__item:hover img {
	transform: scale(1.04);
}

/* ---------- Chế độ Slider (carousel 1 ảnh full-width, đúng như plugin Gallery Showcase
 * gốc) ----------
 * Track dùng flex + transform: translateX() để trượt từng slide (KHÔNG phải cuộn ngang
 * lộ nhiều ảnh cùng lúc) — mỗi lần chỉ hiện đúng 1 ảnh, full chiều rộng khung. Auto-play
 * + nút prev/next đều đổi index rồi dịch chuyển track, JS xử lý ở gallery.js. Click ảnh
 * vẫn mở lightbox xem full-size (không đổi hành vi này).
 *
 * KHÔNG ép tỉ lệ/crop ảnh (giống hành vi mặc định của plugin gốc — hiện ảnh theo đúng tỉ
 * lệ thật, không object-fit:cover) — chiều cao khung slider do JS đo đúng ảnh đang hiện
 * (gallery.js) rồi set trực tiếp, có transition mượt khi đổi ảnh có tỉ lệ khác nhau.
 */
.ntv-gallery__slider {
	position: relative;
	overflow: hidden;
	border-radius: 4px;
	background: #F0F0F0;
	transition: height 0.3s ease;
}
.ntv-gallery__slider-track {
	display: flex;
	align-items: flex-start;
	transition: transform 0.5s ease;
}
.ntv-gallery__slider-item {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	background: #F0F0F0;
	border: 0;
	padding: 0;
	cursor: zoom-in;
}
.ntv-gallery__slider-item img {
	display: block;
	width: 100%;
	height: auto;
}
.ntv-gallery__slider-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	color: #FFFFFF;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
}
.ntv-gallery__slider-nav:hover {
	background: rgba(0, 0, 0, 0.8);
}
.ntv-gallery__slider-nav--prev { left: 14px; }
.ntv-gallery__slider-nav--next { right: 14px; }
@media (max-width: 700px) {
	.ntv-gallery__slider-nav {
		width: 32px;
		height: 32px;
	}
}
/* Badge số lượng ảnh (icon máy ảnh + +N) — nằm ĐÈ lên trên track, không phải bên trong
 * từng nút slide (vì phải hiện xuyên suốt mọi slide, không riêng ảnh nào) — cần
 * pointer-events:none để không chặn click mở lightbox của ảnh phía dưới. Style dùng
 * chung class .ntv-gallery__badge với chế độ "1 ảnh đại diện" bên dưới.
 */
.ntv-gallery__slider .ntv-gallery__badge {
	pointer-events: none;
	z-index: 2;
}

/* ---------- Chế độ 1 ảnh đại diện + badge số lượng ----------
 * Không ép tỉ lệ/crop — ảnh hiển thị đầy đủ theo tỉ lệ gốc, chiều cao khung tự thích
 * ứng theo ảnh (badge vẫn đặt góc dưới-phải nhờ wrapper position:relative).
 */
.ntv-gallery__featured {
	position: relative;
	display: block;
	width: 100%;
	background: #F0F0F0;
	overflow: hidden;
	border-radius: 4px;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: zoom-in;
}
.ntv-gallery__featured img {
	display: block;
	width: 100%;
	height: auto;
}
.ntv-gallery__badge {
	position: absolute;
	right: 14px;
	bottom: 14px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #F7941D;
	color: #FFFFFF;
	padding: 10px 18px;
	border-radius: 6px;
	font-size: 17px;
	font-weight: 800;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

/* ---------- Lightbox (dùng chung, tạo động qua JS, gắn vào <body>) ---------- */
.ntv-gallery-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
}
.ntv-gallery-lightbox[hidden] {
	display: none;
}
.ntv-gallery-lightbox__toolbar {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	gap: 8px;
	z-index: 2;
}
.ntv-gallery-lightbox__btn {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.12);
	color: #FFFFFF;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}
.ntv-gallery-lightbox__btn:hover {
	background: rgba(255, 255, 255, 0.25);
}
.ntv-gallery-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.12);
	color: #FFFFFF;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
}
.ntv-gallery-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.25);
}
.ntv-gallery-lightbox__prev { left: 16px; }
.ntv-gallery-lightbox__next { right: 16px; }

.ntv-gallery-lightbox__stage {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: auto;
	padding: 60px 80px;
	box-sizing: border-box;
}
.ntv-gallery-lightbox__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: transform 0.2s ease;
	transform-origin: center center;
	cursor: zoom-in;
}
.ntv-gallery-lightbox__stage.is-zoomed {
	cursor: grab;
}
.ntv-gallery-lightbox__stage.is-zoomed .ntv-gallery-lightbox__img {
	cursor: default;
}

.ntv-gallery-lightbox__caption {
	position: absolute;
	left: 16px;
	bottom: 14px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	background: rgba(0, 0, 0, 0.5);
	padding: 4px 10px;
	border-radius: 3px;
	max-width: 70%;
}

@media (max-width: 700px) {
	.ntv-gallery-lightbox__stage {
		padding: 60px 50px;
	}
	.ntv-gallery-lightbox__nav {
		width: 38px;
		height: 38px;
	}
}

/* ---------- Chrome kiểu "bar" (chế độ 1 ảnh đại diện) — mặc định ẩn ---------- */
.ntv-gallery-lightbox__topbar,
.ntv-gallery-lightbox__bottombar {
	display: none;
}

.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__toolbar,
.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__nav,
.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__caption {
	display: none;
}
.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__topbar,
.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__bottombar {
	display: flex;
}

.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__stage {
	padding: 64px 20px 96px;
	cursor: default;
}
.ntv-gallery-lightbox--bar .ntv-gallery-lightbox__img {
	cursor: default;
}

.ntv-gallery-lightbox__topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 52px;
	align-items: center;
	justify-content: center;
	background: #000000;
	z-index: 2;
}
.ntv-gallery-lightbox__counter {
	color: #FFFFFF;
	font-size: 15px;
	font-weight: 700;
}
.ntv-gallery-lightbox__close-bar {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: #FFFFFF;
	border: 0;
	cursor: pointer;
}

.ntv-gallery-lightbox__bottombar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 14px 16px 20px;
	background: rgba(0, 0, 0, 0.85);
	z-index: 2;
}
.ntv-gallery-lightbox__caption-bar {
	margin: 0;
	color: #FFFFFF;
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	max-width: 900px;
}
.ntv-gallery-lightbox__arrows {
	display: flex;
	gap: 16px;
}
.ntv-gallery-lightbox__bar-nav {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.15);
	color: #FFFFFF;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}
.ntv-gallery-lightbox__bar-nav:hover {
	background: rgba(255, 255, 255, 0.3);
}
