/* ══════════════════════════════════════
   사이트 헤더 (참조 테마 header.css 포팅 + 아동/성인 전환 스위처 추가)
══════════════════════════════════════ */

#site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	width: 100%;
}

#header-nav-wrap {
	background: #fff;
	border-bottom: 1px solid var(--hyoo-border);
	position: relative;
}

.header-inner {
	display: flex;
	align-items: stretch;
	gap: 20px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 16px;
	height: 72px;
}

/* ── 로고 ──────────────────────────────────── */
.site-logo {
	flex-shrink: 0;
	margin: 0;
	display: flex;
	align-items: center;
}

.site-logo a {
	display: block;
	line-height: 1;
}

.site-logo img {
	display: block;
	height: 44px;
	width: auto;
}

/* ── 아동/성인 전환 스위처 ─────────────────────
   로고 바로 옆에 배치. 현재 섹션은 비활성 상태(강조)로 표시,
   반대 섹션 클릭 시 해당 섹션 홈으로 이동. 라벨은 모든 화면폭에서
   "아동"/"성인" 짧은 표기 고정 — 360px 기준 header-right(CTA+햄버거)와
   한 줄에 같이 들어가야 하므로 공간을 최소화. */
.section-switch {
	display: flex;
	align-items: center;
	align-self: center;
	flex-shrink: 0;
	gap: 2px;
	padding: 3px;
	background: var(--hyoo-bg-soft);
	border: 1px solid var(--hyoo-border);
	border-radius: 50px;
}

.section-switch__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	height: 35px;
	padding: 0 14px;

	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.3px;

	color: var(--hyoo-text-muted);
	text-decoration: none;
	border-radius: 9999px;
	white-space: nowrap;
	transition: background 0.2s, color 0.2s;
}

.section-switch__item:hover {
	color: var(--hyoo-text);
}

.section-switch__item.is-current {
	background: var(--hyoo-accent);
	color: #fff;
	cursor: default;
	pointer-events: none;
}

/* ── 1-depth 네비 ─────────────────────────── */
.nav-depth1 {
	display: flex;
	align-items: stretch;
	list-style: none;
	padding: 0;
	margin: 0;
	flex: 1;
	justify-content: center;
}

.nav-depth1 > li {
	display: flex;
	align-items: stretch;
	position: static;
}

.nav-depth1 > li > a {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 14px;
	font-size: 14px;
	font-weight: 500;
	color: var(--hyoo-text);
	text-decoration: none;
	letter-spacing: -0.5px;
	white-space: nowrap;
	transition: color 0.2s;
}

.nav-depth1 > li > a:hover,
.nav-depth1 > li.is-active > a {
	color: var(--hyoo-accent);
}

/* 서브메뉴 화살표 */
.nav-depth1 > li.has-sub > a::after {
	content: '';
	display: inline-block;
	width: 5px;
	height: 5px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-1px);
	transition: transform 0.2s;
	flex-shrink: 0;
}

.nav-depth1 > li.has-sub.is-active > a::after {
	transform: rotate(-135deg) translateY(-1px);
}

/* ── 우측 영역 ────────────────────────────── */
.header-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	margin-left: auto;
}

/* CTA 버튼 — 상담 전환이 사이트 최우선 목표라 모바일에서도 완전히 숨기지 않고
   아이콘만 남겨 항상 노출한다(참조 소스는 480px 이하에서 CTA 자체를 숨겼었음). */
.header-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 22px;
	background: var(--hyoo-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.4px;
	text-decoration: none;
	border-radius: 50px;
	white-space: nowrap;
	transition: background 0.2s;
}

.header-cta:hover {
	background: var(--hyoo-accent-dark);
}

.header-cta__icon {
	display: none;
	flex-shrink: 0;
}

/* 로그인/로그아웃 — CTA보다 강조도를 낮춰서 상담 전환 CTA를 시각적으로 가리지 않는다. */
.header-login {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	color: var(--hyoo-text-muted);
	font-size: 13px;
	font-weight: 600;
	border: 1px solid var(--hyoo-border);
	border-radius: 50px;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	transition: color 0.2s, border-color 0.2s;
}

.header-login:hover {
	color: var(--hyoo-accent-dark);
	border-color: var(--hyoo-accent-dark);
}

.header-login__icon {
	display: none;
	flex-shrink: 0;
}

/* 햄버거 버튼 */
#mobile-menu-btn {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	width: 40px;
	height: 40px;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.hamburger {
	display: flex;
	flex-direction: column;
	gap: 5px;
	width: 24px;
}

.hamburger span {
	display: block;
	width: 100%;
	height: 2px;
	background: var(--hyoo-text);
	border-radius: 2px;
	transition: transform 0.25s, opacity 0.2s;
	transform-origin: center;
}

#mobile-menu-btn.is-open .hamburger span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

#mobile-menu-btn.is-open .hamburger span:nth-child(2) {
	opacity: 0;
}

#mobile-menu-btn.is-open .hamburger span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ── 2-depth 드롭다운 (데스크탑: 헤더 콘텐츠 폭에 맞춰 중앙 정렬) */
.nav-sub {
	display: none;
	position: absolute;
	top: 72px;
	left: 50%;
	width: 100%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.98);
	border-top: 2px solid var(--hyoo-accent);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
	z-index: 900;
}

.nav-depth1 > li.is-active > .nav-sub {
	display: block;
}

.nav-sub-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 28px 16px;
}

.nav-sub ul {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	padding: 0;
	margin: 0;
}

.nav-sub li {
	width: 200px;
	height: 40px;
	line-height: 40px;
	text-align: center;
}

.nav-sub a {
	display: block;
	font-size: 14px;
	color: var(--hyoo-text);
	text-decoration: none;
	letter-spacing: -0.3px;
	transition: color 0.15s;
}

.nav-sub a:hover {
	color: var(--hyoo-accent);
}

/* 현재 보고 있는 페이지와 일치하는 메뉴 항목 표시(사용자 요청, 2026-08-28
   "메뉴에 해당 링크면 색상을 표시해줘") — header.php에서 is-current 클래스 부여. */
.nav-sub a.is-current {
	color: var(--hyoo-accent);
	font-weight: 700;
}

/* ── 1025~1280px: 메뉴 폰트 소폭 축소 */
@media (max-width: 1280px) {
	.nav-depth1 > li > a {
		font-size: 13px;
		padding: 0 10px;
		letter-spacing: -0.5px;
	}
}

/* ── 모바일 (≤1024px): 햄버거 전환 ── */
@media (max-width: 1024px) {

	.header-inner {
		height: 60px;
		gap: 10px;
		justify-content: space-between;
		align-items: center;
	}

	.site-logo img {
		height: 36px;
	}

	.section-switch__item {
		height: 32px;
		padding: 0 11px;
		font-size: 12px;
	}

	/* 네비 숨김 → 햄버거로 전환. nav-depth1이 absolute로 떠서
	   li 내부 nav-sub가 함께 움직인다. 스위처는 헤더 상단 줄에 계속 노출. */
	.nav-depth1 {
		display: none;
		position: absolute;
		top: 60px;
		left: 0;
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		background: #fff;
		border-top: 1px solid var(--hyoo-border);
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
		z-index: 800;
		max-height: calc(100vh - 60px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.nav-depth1.is-open {
		display: flex;
	}

	.nav-depth1 > li {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		border-bottom: 1px solid var(--hyoo-border);
	}

	.nav-depth1 > li > a {
		line-height: 1;
		padding: 16px 20px;
		font-size: 14px;
		letter-spacing: -0.3px;
		color: var(--hyoo-text);
	}

	.nav-depth1 > li.has-sub > a::after {
		transform: rotate(45deg) translateY(-1px);
	}

	.nav-depth1 > li.has-sub.is-active > a::after {
		transform: rotate(-135deg) translateY(1px);
	}

	/* 서브메뉴: absolute 해제 → 인라인 아코디언.
	   데스크톱 규칙의 transform: translateX(-50%)(가운데 정렬용)를 여기서 안 지워서,
	   모바일에서도 계속 적용돼 서브메뉴 전체가 자기 너비의 절반만큼 왼쪽으로 밀려나
	   화면 밖으로 잘려 보이던 버그가 있었음(2026-07-24 발견) — transform: none으로 해제. */
	.nav-sub {
		position: static;
		top: auto;
		left: auto;
		width: 100%;
		transform: none;
		background: var(--hyoo-bg-soft);
		border-top: none;
		box-shadow: none;
		z-index: auto;
	}

	.nav-sub-inner {
		max-width: none;
		margin: 0;
		padding: 6px 0;
	}

	.nav-sub ul {
		flex-direction: column;
	}

	.nav-sub li {
		width: 100%;
		height: auto;
		line-height: 1;
	}

	.nav-sub a {
		padding: 11px 32px;
		font-size: 13px;
		color: var(--hyoo-text-muted);
	}

	/* CTA: 텍스트 숨기고 아이콘만 노출(공간 절약, 완전히 없애지는 않음) */
	.header-cta {
		padding: 10px;
		border-radius: 50%;
	}

	.header-cta__text {
		display: none;
	}

	.header-cta__icon {
		display: block;
	}

	/* 로그인/로그아웃도 CTA와 동일하게 아이콘만 노출(공간 절약) */
	.header-login {
		padding: 8px;
		border-radius: 50%;
	}

	.header-login__text {
		display: none;
	}

	.header-login__icon {
		display: block;
	}

	#mobile-menu-btn {
		display: inline-flex;
	}
}

@media (max-width: 360px) {
	.header-inner {
		padding: 0 12px;
		gap: 6px;
	}

	.site-logo img {
		height: 32px;
	}

	.section-switch__item {
		height: 30px;
		padding: 0 9px;
		font-size: 11px;
	}
}
