/**
 * modelhouse.css — 모델하우스 갤러리 (templates/template-modelhouse.php)
 *
 * 전체 폭 1400px 기준:
 *  - 가운데 이미지 슬라이더는 --mh-img-w(기본 1200px) 폭
 *  - 좌우 남는 공간(기본 각 100px)에 이전/다음 버튼 배치
 *  - --mh-img-w / --mh-img-h 는 단위 없는 숫자(px 기준)로 템플릿이 인라인 주입
 */

.mh-section {
	overflow: hidden;
}

.mh-intro {
	margin-bottom: 40px;
}

/* ── 전체 래퍼 (버튼 포함 1400px) ────────────────────────── */

.mh-gallery {
	--mh-total-w: 1400px;

	position: relative;
	width: 100%;
	max-width: var(--mh-total-w);
	margin: 0 auto;
}

/* ── 탭 메뉴 (세트 1개 = 탭 1개) ─────────────────────────── */

.mh-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	/* 상단 여백 — 서브헤더(짙은 띠)와 탭 사이 간격 */
	margin: 60px 0 36px;
	padding: 0 16px;
}

.mh-tab {
	min-height: 48px;
	padding: 0 30px;
	border: 1px solid var(--color-border, #DDD6CC);
	border-radius: var(--radius-full, 9999px);
	background: transparent;
	color: var(--color-text, #1A1A2E);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
	cursor: pointer;
	transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.mh-tab:hover,
.mh-tab:focus-visible {
	border-color: #0A2B32;
}

.mh-tab.is-active {
	border-color: #0A2B32;
	background: #0A2B32;
	color: #fff;
}

/* ── 세트 패널 ───────────────────────────────────────────── */

.mh-panel {
	position: relative;
	display: none;
}

.mh-panel.is-active {
	display: block;
}

/* ── 슬라이더 (이미지 영역) ──────────────────────────────── */

.mh-swiper {
	width: 100%;
	max-width: calc(var(--mh-img-w, 1200) * 1px);
	margin: 0 auto;
	border-radius: var(--radius-lg, 16px);
	overflow: hidden;
	background: var(--color-bg-alt, #F5F3EF);
}

.mh-slide__media {
	margin: 0;
	width: 100%;
	aspect-ratio: var(--mh-img-w, 1200) / var(--mh-img-h, 800);
}

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

/* ── 이전/다음 버튼 — 이미지(1200) 바깥, 1400 안 ─────────── */

.mh-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border: 1px solid var(--color-border, #DDD6CC);
	border-radius: 50%;
	background: #fff;
	color: var(--color-primary, #0B1B2B);
	font-size: 22px;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	transition: background var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.mh-nav:hover,
.mh-nav:focus-visible {
	background: var(--color-primary, #0B1B2B);
	color: #fff;
}

/* Swiper 가 루프 불가(1장) 등에서 붙이는 비활성 상태 */
.mh-nav.swiper-button-disabled {
	opacity: 0.35;
	pointer-events: none;
}

/* 좌우 여백((1400 - 이미지폭) / 2) 안에 가운데 배치.
   이미지폭이 전체폭에 가까워 여백이 부족하면 최소 16px 로 이미지 위에 겹친다. */
.mh-nav--prev {
	left: max(16px, calc((100% - var(--mh-img-w, 1200) * 1px) / 2 / 2 - 28px));
}

.mh-nav--next {
	right: max(16px, calc((100% - var(--mh-img-w, 1200) * 1px) / 2 / 2 - 28px));
}

/* ── 썸네일 내비게이션 (하단 작은 이미지 스트립) ─────────── */

.mh-thumbs {
	width: 100%;
	max-width: calc(var(--mh-img-w, 1200) * 1px);
	margin: 14px auto 0;
	overflow: hidden;
}

.mh-thumbs__slide {
	width: 108px;
	height: 72px;
	border: 2px solid transparent;
	border-radius: var(--radius-sm, 6px);
	overflow: hidden;
	opacity: 0.55;
	cursor: pointer;
	transition: opacity var(--transition-fast), border-color var(--transition-fast);
}

.mh-thumbs__slide:hover {
	opacity: 0.85;
}

/* 현재 슬라이드의 썸네일 강조 */
.mh-thumbs__slide.swiper-slide-thumb-active {
	opacity: 1;
	border-color: #0A2B32;
}

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

/* ── 현재 장수 표시 (1 / 12) ─────────────────────────────── */

.mh-count {
	margin-top: 16px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--color-text-light, #6B7280);
	font-variant-numeric: tabular-nums;
}

.mh-count:empty {
	display: none;
}

/* ── 편집자 안내 ─────────────────────────────────────────── */

.mh-empty-notice {
	padding: 24px;
	border: 1px dashed var(--color-border, #DDD6CC);
	border-radius: var(--radius-md, 8px);
	background: var(--color-bg-alt, #F5F3EF);
	color: var(--color-text-light, #6B7280);
}

/* ── 반응형 ──────────────────────────────────────────────── */

/* 화면이 1400 보다 좁아 좌우 여백이 부족하면 버튼을 이미지 위에 겹쳐 올린다 */
@media (max-width: 1420px) {
	.mh-nav {
		border-color: transparent;
		background: rgba(11, 27, 43, 0.55);
		color: #fff;
		backdrop-filter: blur(4px);
	}

	.mh-nav--prev {
		left: 16px;
	}

	.mh-nav--next {
		right: 16px;
	}
}

@media (max-width: 768px) {
	.mh-tabs {
		gap: 8px;
		margin-top: 32px;
		margin-bottom: 24px;
	}

	.mh-tab {
		min-height: 42px;
		padding: 0 20px;
		font-size: 14px;
	}

	.mh-nav {
		width: 44px;
		height: 44px;
		font-size: 18px;
	}

	.mh-nav--prev {
		left: 10px;
	}

	.mh-nav--next {
		right: 10px;
	}

	.mh-swiper {
		border-radius: var(--radius-md, 8px);
	}

	.mh-thumbs {
		padding: 0 10px;
	}

	.mh-thumbs__slide {
		width: 72px;
		height: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mh-tab,
	.mh-nav {
		transition: none;
	}
}
