/* ==========================================================================
   header.css
   사이트 공용 헤더(header.php) 전용 스타일. main.css에서 분리됨.
   색상/폰트 토큰은 main.css :root(--bg, --ink, --sub, --accent, --header-h)를 그대로 사용.
   ========================================================================== */

/* ---------------- Header ---------------- */

.site-header {
  position: fixed;
  /* 구글 번역 배너가 뜨면 js/translate.js가 --translate-banner-h(배너 높이)를 갱신해서
     헤더가 배너에 가리지 않고 그 아래로 내려오게 함 */
  top: var(--translate-banner-h, 0px);
  left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background-color: rgba(244, 238, 228, 0);
  color: #fff;
  transition: background-color .5s ease, color .5s ease, box-shadow .5s ease, top .2s ease;
}

/* 초기(풀스크린) 상태에서 헤더 글씨 가독성을 위한 하단으로 옅어지는 그라데이션 */
.site-header::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 100vh;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
  pointer-events: none;
  z-index: -1;
  opacity: 1;
  transition: opacity .5s ease;
}

.site-header.is-solid {
  color: var(--ink);
}

/* 배경색 + 하단 선: 히어로를 완전히 지난 뒤(다음 섹션부터)만 적용 */
.site-header.has-bg {
  background-color: var(--bg);
  box-shadow: 0 1px 0 rgba(43, 33, 24, 0.06);
}

.site-header.is-solid::before {
  opacity: 0;
}

.header-inner {
  max-width: 1520px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 24px;
}

.logo {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 32px;
  justify-self: start;
}

.logo-img {
  height: 32px;
  width: auto;
  display: block;
  transition: opacity .4s ease;
}

.logo-img--basic {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}

.site-header.is-solid .logo-img--white {
  opacity: 0;
}
.site-header.is-solid .logo-img--basic {
  opacity: 1;
}

.main-nav {
  justify-self: center;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

.main-nav > ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 35px;
  white-space: nowrap;
}

.main-nav a {
  font-size: 18px;
  opacity: 0.92;
  font-weight: 500;
  transition: opacity .2s ease;
}
.main-nav a:hover { opacity: 1; }

.main-nav > ul > li > a:not(.nav-event) {
  position: relative;
  padding-bottom: 10px;
}
.main-nav > ul > li > a:not(.nav-event)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform .25s ease;
}
.main-nav > ul > li > a:not(.nav-event):hover::after {
  transform: scaleX(1);
}

/* ---------------- GNB 드롭다운 (하이린소개) ---------------- */
.nav-has-sub {
  position: relative;
}
/* 모바일 아코디언 토글 버튼 - 1024px 이하에서만 노출(해당 media query 참고) */
.nav-sub-toggle {
  display: none;
}
/* position:fixed로 뷰포트 기준 좌표를 JS(header.php)가 계산해서 넣어줌.
   absolute로 두면 .main-nav의 overflow-x:auto 때문에(스펙상 overflow-y도 auto가 되어) 드롭다운이 잘려서 안 보임 */
.nav-sub {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  transform: translateX(-50%) translateY(-8px);
  min-width: 170px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 150;
}
.nav-has-sub:hover .nav-sub,
.nav-has-sub:focus-within .nav-sub {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-sub li + li {
  margin-top: 2px;
}
.nav-sub a {
  display: block;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  opacity: 1;
  white-space: nowrap;
  transition: background-color .15s ease;
}
.nav-sub a:hover {
  background: #f6efe6;
}
.nav-sub a.is-current {
  color: var(--accent);
  font-weight: 700;
}

/* 이벤트 메뉴만 헤더 상태(흰색/솔리드)와 무관하게 항상 버튼처럼 강조 */
.main-nav a.nav-event {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
    background: var(--accent);
  color: #fff;
  font-size: 18px;
  opacity: 1;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}
.main-nav a.nav-event:hover {
   background: #fff;
  color: var(--accent);
}

.lang-select {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100px;
    height: 40px;
    color: #fcfcfc;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    font-size: 15px;
    white-space: nowrap;
    padding: 12px 14px;
    transition: color .4s ease, border-color .4s ease;
}

.site-header.is-solid .lang-select {
  color: var(--ink);
  border-color: var(--ink);
}

.lang-select .arrow {
  display: inline-flex;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .25s ease;
}

.lang-select[aria-expanded="true"] .arrow {
  transform: rotate(180deg);
}

/* ---------------- 언어 선택 드롭다운 (Google 자동번역) ---------------- */

.lang-select-wrap {
  position: relative;
  z-index: 2;
  justify-self: end;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 200;
}

.lang-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--sub);
  font-size: 15px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color .15s ease;
}

.lang-dropdown-item:hover,
.lang-dropdown-item.is-active {
  background: #f6efe6;
}

.lang-dropdown-flag {
  width: 24px;
  height: 17px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Google 번역 위젯 기본 UI 숨김 (커스텀 드롭다운으로 대체) */
#google_translate_element {
  display: none !important;
}

body {
  top: 0 !important;
  position: static !important;
}

.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon,
.goog-tooltip,
.goog-tooltip:hover {
  display: none !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

/* 모바일 메뉴가 열려있는 동안 배경 스크롤 잠금 */
html.nav-open-lock {
  overflow: hidden;
}

/* ---------------- 햄버거 버튼 (1024px 이하에서만 노출) ---------------- */
.menu-toggle {
  display: none;
  position: relative;
  z-index: 2;
  justify-self: end;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
}

.menu-toggle-bar {
  width: 22px;
  height: 2px;
  background: #fff;
  transition: background-color .3s ease, transform .3s ease, opacity .3s ease;
}

.site-header.is-solid .menu-toggle-bar,
.site-header.nav-open .menu-toggle-bar {
  background: var(--ink);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 메뉴가 열려있는 동안은 스크롤 위치와 무관하게 헤더를 솔리드 상태로 고정 */
.site-header.nav-open {
  background-color: var(--bg);
  color: var(--ink);
}
.site-header.nav-open::before {
  opacity: 0;
}
.site-header.nav-open .logo-img--white {
  opacity: 0;
}
.site-header.nav-open .logo-img--basic {
  opacity: 1;
}
.site-header.nav-open .lang-select {
  color: var(--ink);
  border-color: var(--ink);
}

/* ========================================================================
   반응형 — 1400 / 1024 / 768 / 425
   ======================================================================== */

/* ---------------- 1400px: 데스크탑 레이아웃 유지, 여백/폰트 축소 ---------------- */
@media (max-width: 1400px) {
  .header-inner {
    column-gap: 18px;
  }

  .main-nav > ul {
    gap: 24px;
  }

  .main-nav a {
    font-size: 16px;
  }

  .main-nav a.nav-event {
    height: 38px;
    padding: 0 16px;
    font-size: 16px;
  }

  .lang-select {
    width: 90px;
    height: 38px;
    font-size: 14px;
    padding: 0 12px;
  }
}

/* ---------------- 1024px: 햄버거 + 전체화면 드롭다운으로 전환 ---------------- */
@media (max-width: 1024px) {
  .header-inner {
    column-gap: 14px;
  }

  .menu-toggle {
    display: flex;
  }

  /* 데스크탑 gnb를 전체화면 드롭다운 패널로 전환 */
  .main-nav {
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    overflow-x: hidden;
    overflow-y: auto;
    justify-self: auto;
    background: var(--bg);
    padding: calc(var(--header-h) + 16px) 24px 40px;
    transform: translateX(100%);
    transition: transform .35s ease;
  }

  .main-nav.is-open {
    transform: translateX(0);
  }

  .main-nav > ul {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    white-space: normal;
  }

  .main-nav > ul > li > a:not(.nav-event) {
    display: block;
    padding: 16px 0;
  }
  .main-nav > ul > li > a:not(.nav-event)::after {
    display: none;
  }

  .main-nav a.nav-event {
        margin-bottom: 20px;
        width: 100%;
        border-radius: 5px;
  }

  /* 하이린 소개(하위메뉴 보유) 항목: 아코디언 */
  .nav-has-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  .nav-has-sub .nav-parent {
    flex: 1;
    border-bottom: none;
  }

  .nav-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .nav-sub-toggle::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: rotate(45deg);
    transition: transform .25s ease;
  }
  .nav-has-sub.is-sub-open .nav-sub-toggle::after {
    transform: rotate(-135deg);
  }

  .nav-sub {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    transform: none;
    transition: max-height .3s ease;
  }
  .nav-has-sub.is-sub-open .nav-sub {
    max-height: 320px;
    padding: 2px 0 14px;
  }
  .nav-sub a {
    padding: 12px 14px;
    font-size: 16px;
    color: var(--sub);
  }

  /* 데스크탑 hover/focus-within 규칙(specificity가 더 높음)이 모바일에서
     transform을 다시 이동시키는 걸 막음 - 모바일은 max-height 아코디언으로만 열고 닫음 */
  .nav-has-sub:hover .nav-sub,
  .nav-has-sub:focus-within .nav-sub {
    transform: none;
  }

  .lang-select {
    width: auto;
    padding: 0 12px;
  }
}

/* ---------------- 768px: 모바일 세부 조정 ---------------- */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    column-gap: 10px;
  }

  .logo,
  .logo-img {
    height: 26px;
  }

  .menu-toggle {
    width: 34px;
    height: 34px;
  }

  .lang-select {
    height: 36px;
    font-size: 13px;
    gap: 4px;
  }

  .main-nav {
    padding: calc(var(--header-h) + 12px) 20px 32px;
  }

  .lang-dropdown {
    min-width: 200px;
  }
}

/* ---------------- 425px: 소형 모바일 ---------------- */
@media (max-width: 425px) {
  .header-inner {
    padding: 0 14px;
    column-gap: 6px;
  }

  .logo,
  .logo-img {
    height: 22px;
  }

  .menu-toggle {
    width: 16px;
    height: 30px;
  }
  .menu-toggle-bar {
    width: 20px;
  }

  .lang-select {
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    margin-right: 10px;
  }
  .lang-select .globe-icon svg {
    width: 13px;
    height: 13px;
  }

  .main-nav {
    padding: calc(var(--header-h) + 10px) 16px 28px;
  }
  .main-nav > ul > li > a:not(.nav-event) {
    padding: 13px 0;
  }
  .nav-sub a {
    font-size: 14px;
    padding: 10px 12px;
  }
 .lang-dropdown-item{font-size: 14px; padding: 10px;}

}
