:root {
  --h-header: 80px;
  --font-16: clamp(14px, 0.833vw, 16px);
  --font-18: clamp(16px, 0.9375vw, 18px);
}
#main-header {
}
#main-header > .container {
  display: grid;
  grid-template-columns: 230px 1fr 230px;
  align-items: center;
  height: var(--h-header, 80px);
  position: relative;
  z-index: 200;
}
#main-header .logo_container {
  position: initial;
  width: auto;
  height: auto;
}
#main-header .logo_container a {
  display: block;
}
#main-header nav#top-menu-nav,
#main-header #top-menu,
#main-header nav.et-menu-nav,
#main-header .et-menu {
  float: none;
}
#main-header #top-menu-nav,
#main-header #top-menu {
  line-height: 1;
}
#top-menu-nav {
  transition: opacity 300ms;
}
#main-header #top-menu {
  display: flex;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
}
#main-header #top-menu li {
  padding-right: 0;
}
#main-header #top-menu li a {
  font-size: var(--font-18);
  line-height: 1;
}
#main-header #top-menu > li {
  flex-grow: 1;
  flex-basis: 20%;
}
#main-header #top-menu .menu-item-has-children > a:first-child {
  padding-right: 0;
}
#main-header #top-menu .menu-item-has-children > a:first-child:after {
  display: none;
}
#main-header #top-menu .sub-menu {
  display: none !important;
}

/* white header */
body:has(.et_builder_inner_content > .et_pb_section.white:first-child) #page-container {
  padding-top: 0 !important;
}
body:has(.et_builder_inner_content > .et_pb_section.white:first-child) #main-header:not(.et-fixed-header) {
  background-color: transparent !important;
}
#main-header .logo-white {
  display: none;
}
body:has(.et_builder_inner_content > .et_pb_section.white:first-child) #main-header:not(.et-fixed-header) .logo-white {
  display: block;
}
body:has(.et_builder_inner_content > .et_pb_section.white:first-child) #main-header:not(.et-fixed-header) .logo-primary {
  display: none;
}
body:has(.et_builder_inner_content > .et_pb_section.white:first-child) #main-header:not(.et-fixed-header) #top-menu > li > a {
  color: #fff;
}

/* header:hover #megaMenuButton span,
.et-fixed-header #megaMenuButton span {
  background-color: #222;
}
.menu-opened .et-fixed-header #megaMenuButton span,
.menu-opened #megaMenuButton span:first-child,
.menu-opened #megaMenuButton span {
  background-color: #fff !important;
} */

/* Header action */
.header-action {
  display: flex;
  justify-content: flex-end;
  --color-primary: #0041e1;
}
#main-header .header-action .wpml-ls {
  --background: #fff;
  --foregraound: #000;
  --duration: 300ms;
  --pd-y: 8px;
  --pd-x: 12px;
  border: none;
  padding: 0;
  align-self: center;
}
#main-header .header-action .wpml-ls:has(li:only-child) {
  display: none;
}
#main-header .header-action .wpml-ls ul {
  display: flex;
  align-items: center;
  font-size: 16px;
}
#main-header .header-action .wpml-ls ul:before {
  --icon-white: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='%23fff'%3E%3Cpath d='M12,24C5.4,24,0,18.6,0,12S5.4,0,12,0s12,5.4,12,12-5.4,12-12,12ZM12,1C5.9,1,1,5.9,1,12s4.9,11,11,11,11-4.9,11-11S18.1,1,12,1Z'/%3E%3Cpath d='M12,0C5.4,0,0,5.4,0,12s5.4,12,12,12,12-5.4,12-12S18.6,0,12,0ZM23,12c0,1.5-.3,2.9-.8,4.2l-1.2.3-2.3-1.7-3.3-1.2-.3-1.9-7-.2,1.5-4,5.4-1.6,2.5-3.4c3.3,1.9,5.5,5.4,5.5,9.5ZM1,12c0-.6,0-1.2.2-1.8l3.8.7,4.7,3.6.6,4.4.8,4.1c-5.6-.5-10-5.2-10-11Z'/%3E%3C/g%3E%3C/svg%3E");
  --icon-black: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='%23000'%3E%3Cpath d='M12,24C5.4,24,0,18.6,0,12S5.4,0,12,0s12,5.4,12,12-5.4,12-12,12ZM12,1C5.9,1,1,5.9,1,12s4.9,11,11,11,11-4.9,11-11S18.1,1,12,1Z'/%3E%3Cpath d='M12,0C5.4,0,0,5.4,0,12s5.4,12,12,12,12-5.4,12-12S18.6,0,12,0ZM23,12c0,1.5-.3,2.9-.8,4.2l-1.2.3-2.3-1.7-3.3-1.2-.3-1.9-7-.2,1.5-4,5.4-1.6,2.5-3.4c3.3,1.9,5.5,5.4,5.5,9.5ZM1,12c0-.6,0-1.2.2-1.8l3.8.7,4.7,3.6.6,4.4.8,4.1c-5.6-.5-10-5.2-10-11Z'/%3E%3C/g%3E%3C/svg%3E");
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  background: no-repeat center/contain;
  background-image: var(--icon-white);
  margin-right: 0.5em;
  transition: background;
  transition-duration: var(--duration);
}
#main-header .header-action .wpml-ls-item {
  display: none;
  overflow: hidden;
}
#main-header .header-action .wpml-ls a {
  display: flex;
  padding: var(--pd-y) var(--pd-x);
  background: var(--background);
  border: 1px solid var(--foregraound);
  border-radius: 5em;
  color: var(--foregraound);
  font-size: inherit;
  font-weight: 400;
  line-height: 1;
  position: relative;
  transition: background;
  transition-duration: var(--duration);
}
#main-header .header-action .wpml-ls-item a:hover {
  border-color: var(--color-primary);
  background: var(--color-primary);
}
#main-header .header-action .wpml-ls-item a::before {
  /* 배경 */
  content: '';
  display: block;
  height: calc(1em + (var(--pd-y) * 2));
  border-radius: 5em;
  background: var(--background);
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  transition: background, width;
  transition-duration: var(--duration);
}
#main-header .header-action .wpml-ls-item a::after {
  /* 원 */
  content: '';
  display: block;
  width: calc(1em + var(--pd-y));
  height: calc(1em + var(--pd-y));
  background: var(--foregraound);
  border-radius: 50%;
  position: absolute;
  top: calc(var(--pd-y) / 2);
  transition: right;
  transition-duration: var(--duration);
  z-index: 3;
}
#main-header .header-action .wpml-ls-item span {
  position: relative;
  z-index: 2;
}
/* 국문 */
html[lang='ko-KR'] #main-header .wpml-ls-item-en {
  display: flex;
}
#main-header .header-action .wpml-ls-item-en a::before {
  width: calc(1em + (var(--pd-y) * 2));
}
#main-header .header-action .wpml-ls-item-en a::after {
  right: calc((var(--pd-y) / 2) - 1px);
}
#main-header .header-action .wpml-ls-item-en span {
  color: var(--background);
}
#main-header .header-action .wpml-ls-item-en span::before {
  content: 'KOR';
  color: var(--foregraound);
}
#main-header .header-action .wpml-ls-item-en a:hover::before {
  width: 100%;
  background-color: var(--color-primary);
}
#main-header .header-action .wpml-ls-item-en a:hover::after {
  right: calc(100% - 1em - (var(--pd-y) * 1.5));
  background-color: var(--background);
}
#main-header .header-action .wpml-ls-item-en a:hover span::before {
  color: var(--color-primary);
}
/* 영문 */
html[lang='en-US'] #main-header .wpml-ls-item-ko {
  display: flex;
}
#main-header .header-action .wpml-ls-item-ko a::before {
  width: calc(1em + (var(--pd-y) * 2));
}
#main-header .header-action .wpml-ls-item-ko a::after {
  right: calc(100% - 1em - (var(--pd-y) * 1.5));
}
#main-header .header-action .wpml-ls-item-ko span {
  color: var(--background);
}
#main-header .header-action .wpml-ls-item-ko span::after {
  content: 'ENG';
  color: var(--foregraound);
}
#main-header .header-action .wpml-ls-item-ko a:hover::before {
  width: 100%;
  background-color: var(--color-primary);
}
#main-header .header-action .wpml-ls-item-ko a:hover::after {
  right: calc((var(--pd-y) / 2) - 1px);
  background-color: var(--background);
}
#main-header .header-action .wpml-ls-item-ko a:hover span::after {
  color: var(--color-primary);
}
/* 메가 메뉴 */
#megaMenuButton {
  width: 46px;
  height: 46px;
  align-self: center;
  justify-self: flex-end;
  border: none;
  background: none;
  position: relative;
  z-index: 99998;
  cursor: pointer;
  display: none;
}
#megaMenuButton span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background-color: #fff;
  margin: 8px auto;
  transition: background-color 0.3s, transform 0.3s, height 0.3s, margin 0.3s;
}
#megaMenuButton:hover span {
  animation: megaButton 0.6s 1;
}
#megaMenuButton:hover span:nth-child(2) {
  animation-delay: 0.2s;
}
#megaMenuButton:hover span:nth-child(3) {
  animation-delay: 0.4s;
}
.menu-opened #megaMenuButton span {
  animation: none;
  margin: 0;
}
.menu-opened #megaMenuButton span:nth-child(1) {
  /* transform: rotate(45deg) translateY(1px); */
  animation: megaButtonRotate1 0.3s 1 forwards;
  animation-delay: 0.3s;
}
.menu-opened #megaMenuButton span:nth-child(2) {
  height: 0;
}
.menu-opened #megaMenuButton span:nth-child(3) {
  /* transform: rotate(-45deg) translateY(-1px); */
  animation: megaButtonRotate2 0.3s 1 forwards;
  animation-delay: 0.3s;
}

@keyframes megaButton {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes megaButtonRotate1 {
  0% {
    transform: rotate(0) translateY(0);
  }
  100% {
    transform: rotate(45deg) translateY(1px);
  }
}
@keyframes megaButtonRotate2 {
  0% {
    transform: rotate(0) translateY(0);
  }
  100% {
    transform: rotate(-45deg) translateY(-2px);
  }
}
/* 메가메뉴 */
#megaMenu {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: calc(var(--wp-admin--admin-bar--height, 0px) + var(--h-header) + 24px) 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(15px);
  z-index: 100;
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: clip-path 0.6s;
}
.menu-opened #megaMenu {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
#megaMenu .container {
  height: auto;
  color: #000;
}
#mega-menu {
  font-size: clamp(22px, 1.8vw, 34px);
  line-height: 1;
  overflow: auto;
}
#mega-menu a {
  color: #000;
}
#mega-menu > li > a {
  font-weight: 500;
  line-height: 1;
}
#mega-menu .sub-menu {
  margin-top: 16px;
}
#mega-menu .sub-menu > li > a {
  display: inline-block;
  font-size: 16px;
  vertical-align: middle;
  transition: color 0.3s;
  font-weight: 400;
  padding: 8px 0;
}
#mega-menu .sub-menu > li:hover > a {
  color: var(--color-primary);
}
@media (min-width: 1281px) {
  /* menu opened */
  body:has(.et_builder_inner_content > .et_pb_section.white:first-child) .menu-opened #main-header:not(.et-fixed-header) {
    background-color: transparent !important;
  }
  body:has(.et_builder_inner_content > .et_pb_section.white:first-child) .menu-opened #main-header:not(.et-fixed-header) .logo-white {
    display: none;
  }
  body:has(.et_builder_inner_content > .et_pb_section.white:first-child) .menu-opened #main-header:not(.et-fixed-header) .logo-primary {
    display: block;
  }
  body:has(.et_builder_inner_content > .et_pb_section.white:first-child) .menu-opened #main-header:not(.et-fixed-header) #top-menu > li > a {
    color: #000;
  }
  .menu-opened #main-header {
    background-color: #fff !important;
    border-bottom: 1px soli #eee;
  }
  body:has(:not(.et_builder_inner_content > .et_pb_section.white:first-child)) #main-header .header-action .wpml-ls ul:before,
  #main-header.et-fixed-header .header-action .wpml-ls ul:before,
  .menu-opened #main-header .header-action .wpml-ls ul:before {
    background-image: var(--icon-black);
  }
  #megaMenu {
    padding-top: var(--h-header);
    height: auto;
    background-color: #fff;
  }
  .menu-opened #megaMenu {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    border-bottom: 1px solid #eee;
  }
  #mega-menu {
    display: flex;
    padding: 24px 246px;
  }
  #mega-menu li a {
    padding: 8px 0;
  }
  #mega-menu > li {
    flex-grow: 1;
    text-align: center;
    flex-basis: 20%;
  }
  #mega-menu > li > a {
    display: none;
  }
}
@media (max-width: 1280px) {
  :root {
    --h-header: 60px;
  }
  #main-header {
    background-color: #000;
  }
  #main-header > .container {
    grid-template-columns: 140px 1fr;
  }
  .et_fixed_nav #main-header {
    position: fixed;
  }
  .menu-opened #main-header .logo-white {
    display: block;
  }
  #main-header .logo-white {
    display: block;
  }
  .menu-opened .logo-primary,
  #main-header .logo-primary {
    display: none;
  }
  .menu-opened #top-menu-nav {
    opacity: 0;
    pointer-events: none;
  }
  #top-menu-nav {
    display: none;
  }
  .menu-opened #main-header .header-action .wpml-ls ul:before {
    background-image: var(--icon-white);
  }
  .menu-opened #megaMenuButton,
  #megaMenuButton {
    display: block;
  }
  #megaMenu .container {
    color: #fff;
  }
  #mega-menu {
    height: 100%;
    scrollbar-width: none;
  }
  #mega-menu > li {
    margin-bottom: 2em;
  }
  #mega-menu a {
    color: #fff;
  }
  #mega-menu .sub-menu {
    padding-left: 16px;
  }
  #mega-menu .sub-menu a {
    opacity: 0.8;
  }
  #mega-menu .sub-menu a:hover {
    opacity: 1;
  }
}
@media (max-width: 980px) {
  .et_fixed_nav #main-header {
    position: fixed;
  }
  #megaMenu .container {
    height: 100%;
    grid-template-columns: 100%;
    gap: 0;
  }
  #megaGnb {
    padding: 24px 0;
  }
  #megaGnb::-webkit-scrollbar {
    display: none;
  }
}
@media (max-width: 767px) {
  body.admin-bar.et_fixed_nav #main-header.et-fixed-header {
    top: 0 !important;
  }
}
