/* Astra Header Builder child extensions only. */
.site-logo-img {
	position: relative;
	overflow: visible;
}

/*
 * Astra Logo 1 remains the layout reference and keeps Astra's native width.
 * Logo 2 is an absolute visual alternate inside the same home link, so a
 * larger/longer secondary image cannot change header height or menu position.
 */
.site-logo-img > .custom-logo-link.md-astra-dual-active {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	overflow: visible;
}

.site-logo-img > .custom-logo-link.md-astra-dual-active > img.custom-logo:not(.md-astra-secondary-logo) {
	display: block;
	position: relative;
	z-index: 2;
	opacity: 1 !important;
	transition: opacity .22s ease;
}

.site-logo-img > .custom-logo-link.md-astra-dual-active > .md-astra-secondary-logo {
	display: block;
	position: absolute;
	left: 0;
	top: 50%;
	z-index: 1;
	width: var(--md-logo2-width-desktop) !important;
	max-width: none !important;
	height: auto;
	transform: translateY(-50%);
	transform-origin: left center;
	object-fit: contain;
	object-position: left center;
	opacity: 0 !important;
	pointer-events: none;
	transition: opacity .22s ease;
}

.site-logo-img.md-astra-show-secondary > .custom-logo-link.md-astra-dual-active > img.custom-logo:not(.md-astra-secondary-logo) {
	opacity: 0 !important;
}

.site-logo-img.md-astra-show-secondary > .custom-logo-link.md-astra-dual-active > .md-astra-secondary-logo {
	opacity: 1 !important;
}

/*
 * Astra itself decides whether the front page is transparent. We only style
 * the background after Astra has marked the page as transparent, so there is
 * no competing position:absolute/offset implementation in the child theme.
 */
body.home.ast-theme-transparent-header #masthead,
body.home.ast-theme-transparent-header #masthead .ast-primary-header-bar,
body.home.ast-theme-transparent-header #masthead .ast-above-header-bar,
body.home.ast-theme-transparent-header #masthead .ast-below-header-bar,
body.home.ast-theme-transparent-header #masthead .site-primary-header-wrap,
body.home.ast-theme-transparent-header #masthead .ast-builder-grid-row-container {
	background: transparent !important;
	border-bottom-color: transparent !important;
}

body:not(.home) #masthead,
body:not(.home) #masthead .ast-primary-header-bar,
body:not(.home) #masthead .ast-above-header-bar,
body:not(.home) #masthead .ast-below-header-bar,
body:not(.home) #masthead .site-primary-header-wrap,
body:not(.home) #masthead .ast-builder-grid-row-container {
	background: #fff !important;
}

/* Desktop mega-menu open state: temporarily turn a transparent front-page
 * header into a normal white visual surface. Closing the mega menu removes
 * the class and the original transparent state immediately returns. */
body:not(.ast-header-break-point) #masthead.md-astra-mega-open,
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-primary-header-bar,
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-above-header-bar,
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-below-header-bar,
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .site-primary-header-wrap,
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-builder-grid-row-container {
	background: var(--md-mega-bg, #fff) !important;
	border-bottom-color: rgba(0,0,0,.08) !important;
}

/* Color actual text descendants only. Do not color their shared ancestors:
 * logo SVGs using currentColor must retain their original inherited color.
 * SVG fill/stroke are applied by JS from a CLOSED-state paint snapshot. */
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-primary-header-bar *:not(:has(.site-logo-img, .custom-logo-link)):not(:where(.site-logo-img, .site-logo-img *, .custom-logo-link, .custom-logo-link *, .md-astra-mega-panel, .md-astra-mega-panel *, .md-astra-mega-column, .md-astra-mega-column *)),
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-above-header-bar *:not(:has(.site-logo-img, .custom-logo-link)):not(:where(.site-logo-img, .site-logo-img *, .custom-logo-link, .custom-logo-link *, .md-astra-mega-panel, .md-astra-mega-panel *, .md-astra-mega-column, .md-astra-mega-column *)),
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-below-header-bar *:not(:has(.site-logo-img, .custom-logo-link)):not(:where(.site-logo-img, .site-logo-img *, .custom-logo-link, .custom-logo-link *, .md-astra-mega-panel, .md-astra-mega-panel *, .md-astra-mega-column, .md-astra-mega-column *)),
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .site-primary-header-wrap *:not(:has(.site-logo-img, .custom-logo-link)):not(:where(.site-logo-img, .site-logo-img *, .custom-logo-link, .custom-logo-link *, .md-astra-mega-panel, .md-astra-mega-panel *, .md-astra-mega-column, .md-astra-mega-column *)),
body:not(.ast-header-break-point) #masthead.md-astra-mega-open .ast-builder-grid-row-container *:not(:has(.site-logo-img, .custom-logo-link)):not(:where(.site-logo-img, .site-logo-img *, .custom-logo-link, .custom-logo-link *, .md-astra-mega-panel, .md-astra-mega-panel *, .md-astra-mega-column, .md-astra-mega-column *)) {
	color: var(--md-mega-header-color, #111827) !important;
}

/*
 * Preserve the already-approved homepage edge-to-edge layout independently
 * from the retired MD Elementor header stylesheet.
 */
/* Astra's standard header.php opens #content > .ast-container. Keep the
 * Elementor homepage edge-to-edge without changing subpage container rules. */
body.home #content > .ast-container {
	display: block;
	width: 100%;
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

body.home #primary.md-elementor-front-page {
	width: 100%;
	margin-top: 0 !important;
}

body.home #primary.md-elementor-front-page > .elementor > .e-con.e-parent,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section-wrap > .e-con.e-parent,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section-wrap > .elementor-section {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

body.home #primary.md-elementor-front-page > .elementor > .e-con.e-parent:first-child,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section:first-child,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section-wrap:first-child > .e-con.e-parent:first-child,
body.home #primary.md-elementor-front-page > .elementor > .elementor-section-wrap:first-child > .elementor-section:first-child {
	padding-top: 0 !important;
}

/*
 * Desktop mega menu follows Astra's own responsive state. Astra adds/removes
 * .ast-header-break-point on <body>, so this stays aligned even if the theme
 * breakpoint is changed later.
 */
body:not(.ast-header-break-point) #masthead .main-header-menu .menu-item-has-children > a .ast-icon,
body:not(.ast-header-break-point) #masthead .main-header-menu .menu-item-has-children > a .dropdown-menu-toggle,
body:not(.ast-header-break-point) #masthead .main-header-menu .menu-item-has-children > .ast-menu-toggle,
body:not(.ast-header-break-point) #masthead .ast-nav-menu .menu-item-has-children > a .ast-icon,
body:not(.ast-header-break-point) #masthead .ast-nav-menu .menu-item-has-children > a .dropdown-menu-toggle,
body:not(.ast-header-break-point) #masthead .ast-nav-menu .menu-item-has-children > .ast-menu-toggle {
	display: none !important;
}

body:not(.ast-header-break-point) #masthead.md-astra-mega-ready .main-header-menu > .menu-item > .sub-menu,
body:not(.ast-header-break-point) #masthead.md-astra-mega-ready .ast-nav-menu > .menu-item > .sub-menu {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
}

.md-astra-mega-panel {
	display: none;
}

/* Keep Astra's own transparent-header positioning intact.
 * Normal desktop headers need a positioned anchor for the mega panel, but on
 * transparent pages Astra already positions #masthead itself.
 */
body:not(.ast-header-break-point) #masthead {
	overflow: visible;
}

body:not(.ast-header-break-point):not(.ast-theme-transparent-header) #masthead {
	position: relative;
}

body:not(.ast-header-break-point) .md-astra-mega-panel {
	display: block;
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 1000;
	background: var(--md-mega-bg, #fff);
	box-shadow: 0 12px 28px rgba(0,0,0,.10);
	border-top: 1px solid rgba(0,0,0,.06);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(-6px);
	transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

body:not(.ast-header-break-point) #masthead.md-astra-mega-open .md-astra-mega-panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0);
}

.md-astra-mega-inner {
	position: relative;
	display: block;
	min-height: var(--md-mega-min-height, 230px);
	box-sizing: border-box;
	padding-top: var(--md-mega-v-padding, 28px);
	padding-bottom: var(--md-mega-v-padding, 28px);
}

.md-astra-mega-column,
.md-astra-mega-list,
.md-astra-mega-sublist {
	margin: 0;
	padding: 0;
	list-style: none;
}

.md-astra-mega-column {
	position: absolute;
	top: var(--md-mega-v-padding, 28px);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
	white-space: nowrap;
}

.md-astra-mega-list,
.md-astra-mega-sublist {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	width: 100%;
}

.md-astra-mega-title {
	display: inline-block;
	margin-bottom: 14px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
	color: var(--md-mega-title-color, #111827) !important;
}

.md-astra-mega-list > li + li {
	margin-top: var(--md-mega-item-gap, 9px);
}

.md-astra-mega-sublist {
	margin-top: 7px;
	padding-left: 14px;
}

.md-astra-mega-sublist > li + li {
	margin-top: 6px;
}

.md-astra-mega-sublist a {
	font-size: 13px;
}

.md-astra-mega-list a {
	display: inline-block;
	font-size: 14px;
	line-height: 1.5;
	text-decoration: none;
	color: var(--md-mega-link-color, #1f2937) !important;
}

.md-astra-mega-list a:hover,
.md-astra-mega-list a:focus,
.md-astra-mega-sublist a:hover,
.md-astra-mega-sublist a:focus {
	color: var(--md-mega-link-color, #1f2937) !important;
}

@media (prefers-reduced-motion: reduce) {
	.site-logo-img > .custom-logo-link,
	.md-astra-mega-panel {
		transition: none;
	}
}

/* Reuse Astra Primary Menu submenu width for desktop mega columns only. */
body:not(.ast-header-break-point) #masthead .md-astra-mega-column {
	width: var(--md-mega-column-width, 240px);
}
/* Activate the existing "상위메뉴 폭" only when its value is greater than 0.
 * At 0 the class is removed, so Astra's original automatic menu sizing remains untouched. */
body:not(.ast-header-break-point) #masthead.md-astra-mega-top-width-active #ast-desktop-header .main-header-menu > .menu-item,
body:not(.ast-header-break-point) #masthead.md-astra-mega-top-width-active #ast-desktop-header .ast-nav-menu > .menu-item {
	flex: 0 0 var(--md-mega-top-width);
	width: var(--md-mega-top-width);
	box-sizing: border-box;
}
body:not(.ast-header-break-point) #masthead.md-astra-mega-top-width-active #ast-desktop-header .main-header-menu > .menu-item > .menu-link,
body:not(.ast-header-break-point) #masthead.md-astra-mega-top-width-active #ast-desktop-header .ast-nav-menu > .menu-item > .menu-link {
	width: 100%;
	box-sizing: border-box;
	justify-content: center;
}

/* Desktop mega text follows the same center axis as its parent menu link. */
body:not(.ast-header-break-point) #masthead .md-astra-mega-column,
body:not(.ast-header-break-point) #masthead .md-astra-mega-list,
body:not(.ast-header-break-point) #masthead .md-astra-mega-sublist {
	align-items: center;
	text-align: center;
}
body:not(.ast-header-break-point) #masthead .md-astra-mega-sublist {
	padding-left: 0;
}

/* Header representative phone: desktop = icon + number, mobile = icon only. */
.md-astra-header-phone {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--md-astra-phone-gap, 10px);
	margin-left: 20px;
	color: var(--md-astra-phone-color, inherit);
	font-size: var(--md-astra-phone-font-size, 26px);
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	flex: 0 0 auto;
	transform: translate(var(--md-astra-phone-offset-x, 0), var(--md-astra-phone-offset-y, 0));
	position: relative;
	z-index: 4;
}

.md-astra-header-phone:hover,
.md-astra-header-phone:focus {
	color: var(--md-astra-phone-color, inherit);
	text-decoration: none;
}

.md-astra-header-phone-icon {
	display: block;
	width: var(--md-astra-phone-icon-size, 30px);
	height: var(--md-astra-phone-icon-size, 30px);
	color: currentColor;
	flex: 0 0 auto;
	overflow: visible;
}

/* Filled handsets inherit the phone color; outline/circle SVGs keep no fill. */
.md-astra-header-phone-icon:not([fill="none"]) {
	fill: currentColor;
}
.md-astra-header-phone-icon[fill="none"] {
	fill: none;
}

.md-astra-header-phone-icon [stroke] {
	stroke: currentColor;
}

#ast-mobile-header .md-astra-header-phone,
.ast-mobile-header-wrap .md-astra-header-phone {
	margin-left: 10px;
	margin-right: 10px;
	font-size: 0;
	gap: 0;
	min-width: 32px;
	min-height: 32px;
}

#ast-mobile-header .md-astra-header-phone-text,
.ast-mobile-header-wrap .md-astra-header-phone-text {
	display: none !important;
}

#ast-mobile-header .md-astra-header-phone-icon,
.ast-mobile-header-wrap .md-astra-header-phone-icon {
	width: var(--md-astra-phone-mobile-icon-size, 28px);
	height: var(--md-astra-phone-mobile-icon-size, 28px);
}

/* Avoid inherited Astra button/icon transforms from changing our selected icon. */
.md-astra-header-phone .md-astra-header-phone-icon {
	transform: none;
}

