/* Lưới ảnh — ghi đè bố cục flex mặc định của block Gallery để số cột lấy theo Cài đặt plugin. */
.wp-block-gallery.gpi-gallery {
	display: grid !important;
	grid-template-columns: repeat(var(--gpi-cols, 3), minmax(0, 1fr));
	gap: 12px;
	margin: 0 0 1.75em;
	padding: 0;
}
.wp-block-gallery.gpi-gallery > figure.wp-block-image {
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	flex: none !important;
	display: block;
}
.gpi-gallery figure > a {
	display: block;
	overflow: hidden;
	border-radius: 8px;
	background: #eef0f3;
	cursor: zoom-in;
}
.gpi-gallery figure img {
	display: block;
	width: 100% !important;
	height: auto;
	aspect-ratio: var(--gpi-ratio, 9/16);
	object-fit: cover !important;
	transition: transform .25s ease;
}
.gpi-gallery figure > a:hover img { transform: scale(1.04); }

@media (max-width: 600px) {
	.wp-block-gallery.gpi-gallery {
		grid-template-columns: repeat(var(--gpi-cols-m, 2), minmax(0, 1fr));
		gap: 8px;
	}
}

/* Lightbox */
.gpi-lb {
	position: fixed; inset: 0; z-index: 999999;
	display: flex; align-items: center; justify-content: center;
	background: rgba(10, 12, 16, .94);
	opacity: 0; transition: opacity .2s ease;
	touch-action: pan-y;
}
.gpi-lb.is-open { opacity: 1; }
.gpi-lb__img {
	max-width: 94vw; max-height: 84vh;
	object-fit: contain; border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	user-select: none;
}
.gpi-lb__bar {
	position: absolute; left: 0; right: 0; bottom: 0;
	display: flex; align-items: center; justify-content: center; gap: 16px;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	color: #e8eaed; font: 14px/1.4 system-ui, sans-serif;
}
.gpi-lb__cap { opacity: .85; text-align: center; }
.gpi-lb__dl {
	color: #111 !important; background: #fff; text-decoration: none !important;
	padding: 7px 14px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.gpi-lb button {
	position: absolute; border: 0; cursor: pointer;
	width: 46px; height: 46px; border-radius: 50%;
	background: rgba(255, 255, 255, .12); color: #fff;
	font: 26px/46px system-ui, sans-serif; padding: 0;
}
.gpi-lb button:hover { background: rgba(255, 255, 255, .25); }
.gpi-lb__close { top: 14px; right: 14px; }
.gpi-lb__prev { left: 14px; top: 50%; transform: translateY(-50%); }
.gpi-lb__next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
	.gpi-lb__prev, .gpi-lb__next { display: none; } /* Điện thoại: vuốt trái/phải */
	.gpi-lb__img { max-width: 100vw; max-height: 80vh; border-radius: 0; }
}

