/*
 * Metric Horizon Media - galleries, plans and unified lightbox.
 * Uses --mh-* tokens from mh-core.
 */

/* ============ shared icon buttons (SVG via mask) ============ */
.mh-gallery-card__nav,
.mh-plans__nav,
.mh-lb__nav,
.mh-lb__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
	transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.mh-gallery-card__nav::before,
.mh-plans__nav::before,
.mh-lb__nav::before,
.mh-lb__close::before {
	content: "";
	display: block;
	width: 42%;
	height: 42%;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.is-prev::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18 9 12l6-6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18 9 12l6-6'/%3E%3C/svg%3E");
}

.is-next::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}

.mh-lb__close::before {
	width: 40%;
	height: 40%;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

/* ============ card slider (catalog / featured) ============ */
.mh-gallery-card {
	position: relative;
	border-radius: var(--mh-radius-m, 16px);
	overflow: hidden;
	background: var(--mh-surface, #f4f6fa);
}

.mh-gallery-card__viewport {
	overflow: hidden;
}

.mh-gallery-card__track {
	display: flex;
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.mh-gallery-card__slide {
	flex: 0 0 100%;
	aspect-ratio: 3 / 2;
}

.mh-gallery-card__slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mh-gallery-card__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.9);
	color: var(--mh-primary, #0a1b4d);
	box-shadow: 0 6px 18px rgba(10, 27, 77, 0.18);
	opacity: 0;
}

.mh-gallery-card:hover .mh-gallery-card__nav {
	opacity: 1;
}

.mh-gallery-card__nav.is-prev {
	left: 12px;
}

.mh-gallery-card__nav.is-next {
	right: 12px;
}

.mh-gallery-card__nav:hover {
	background: #fff;
	transform: translateY(-50%) scale(1.06);
}

.mh-gallery-card__counter {
	position: absolute;
	right: 12px;
	bottom: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(10, 27, 77, 0.62);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	backdrop-filter: blur(4px);
}

.mh-gallery-card__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	display: flex;
	justify-content: center;
	gap: 6px;
}

.mh-gallery-card__dot {
	width: 7px;
	height: 7px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	cursor: pointer;
	transition: background 0.2s ease, width 0.2s ease;
}

.mh-gallery-card__dot.is-active {
	background: #fff;
	width: 18px;
	border-radius: 999px;
}

/* ============ hero gallery (single object) ============ */
.mh-gallery {
	display: grid;
	grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr);
	gap: 12px;
}

.mh-gallery__main {
	position: relative;
	display: block;
	padding: 0;
	border: 0;
	cursor: zoom-in;
	border-radius: var(--mh-radius-m, 16px);
	overflow: hidden;
	aspect-ratio: 16 / 11;
	background: var(--mh-surface, #f4f6fa);
}

.mh-gallery__main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.mh-gallery__main:hover img {
	transform: scale(1.03);
}

.mh-gallery__count {
	position: absolute;
	left: 14px;
	bottom: 14px;
	padding: 5px 12px;
	border-radius: 999px;
	background: rgba(10, 27, 77, 0.62);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	backdrop-filter: blur(4px);
}

.mh-gallery__side {
	display: grid;
	grid-template-rows: 1fr 1fr;
	gap: 12px;
}

.mh-gallery__thumb {
	position: relative;
	display: block;
	padding: 0;
	border: 0;
	cursor: pointer;
	border-radius: var(--mh-radius-m, 16px);
	overflow: hidden;
	background: var(--mh-surface, #f4f6fa);
}

.mh-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.mh-gallery__thumb:hover img {
	transform: scale(1.04);
}

.mh-gallery__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 27, 77, 0.5);
	color: #fff;
	font-family: "Manrope", sans-serif;
	font-size: 22px;
	font-weight: 700;
	backdrop-filter: blur(2px);
}

@media (max-width: 767px) {
	.mh-gallery {
		grid-template-columns: 1fr;
	}
	.mh-gallery__side {
		grid-template-rows: none;
		grid-template-columns: 1fr 1fr;
	}
}

/* ============ plans slider ============ */
.mh-plans {
	position: relative;
}

.mh-plans__title {
	text-align: center;
	margin: 0 0 24px;
}

.mh-plans__viewport {
	overflow: hidden;
}

.mh-plans__track {
	display: flex;
	gap: 20px;
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.mh-plans__item {
	flex: 0 0 calc((100% - (var(--cols, 3) - 1) * 20px) / var(--cols, 3));
	padding: 0;
	border: 1px solid var(--mh-border, #e1e5ee);
	border-radius: var(--mh-radius-m, 16px);
	overflow: hidden;
	cursor: zoom-in;
	background: var(--mh-white, #fff);
	aspect-ratio: 4 / 3;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.mh-plans[data-columns="2"] .mh-plans__track { --cols: 2; }
.mh-plans[data-columns="3"] .mh-plans__track { --cols: 3; }
.mh-plans[data-columns="4"] .mh-plans__track { --cols: 4; }

.mh-plans__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mh-plans__item:hover {
	box-shadow: 0 14px 34px rgba(10, 27, 77, 0.12);
	transform: translateY(-2px);
}

.mh-plans__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	background: var(--mh-white, #fff);
	color: var(--mh-primary, #0a1b4d);
	box-shadow: 0 8px 22px rgba(10, 27, 77, 0.16);
}

.mh-plans__nav.is-prev { left: -10px; }
.mh-plans__nav.is-next { right: -10px; }

.mh-plans__nav:hover {
	color: var(--mh-primary-hover, #0d3b8e);
	transform: translateY(-50%) scale(1.06);
}

@media (max-width: 991px) {
	.mh-plans__item { flex-basis: calc((100% - 20px) / 2); }
}

@media (max-width: 575px) {
	.mh-plans__item { flex-basis: 100%; }
}

/* ============ unified lightbox ============ */
.mh-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4vmin;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}

.mh-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.mh-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(6, 12, 30, 0.9);
	backdrop-filter: blur(6px);
	cursor: zoom-out;
}

.mh-lb__stage {
	position: relative;
	max-width: min(1200px, 92vw);
	max-height: 88vh;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: scale(0.97);
	transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mh-lb.is-open .mh-lb__stage {
	transform: scale(1);
}

.mh-lb__img {
	max-width: 92vw;
	max-height: 88vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--mh-radius-l, 24px);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
	display: block;
}

.mh-lb__nav {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	backdrop-filter: blur(6px);
}

.mh-lb__nav:hover {
	background: rgba(255, 255, 255, 0.26);
}

.mh-lb__nav.is-prev { left: 3vmin; }
.mh-lb__nav.is-next { right: 3vmin; }

.mh-lb__close {
	position: fixed;
	top: 3vmin;
	right: 3vmin;
	width: 46px;
	height: 46px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	backdrop-filter: blur(6px);
}

.mh-lb__close:hover {
	background: rgba(255, 255, 255, 0.28);
}

.mh-lb__counter {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 3vmin;
	text-align: center;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.04em;
}

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

@media (max-width: 575px) {
	.mh-lb__nav { width: 44px; height: 44px; }
	.mh-lb__nav.is-prev { left: 8px; }
	.mh-lb__nav.is-next { right: 8px; }
	.mh-lb__img { border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.mh-gallery-card__track,
	.mh-plans__track,
	.mh-lb,
	.mh-lb__stage,
	.mh-gallery__main img,
	.mh-gallery__thumb img {
		transition: none;
	}
}
