/* =====================================================
   header.css — 헤더 / GNB / 모바일 메뉴 스킨 CSS
   ===================================================== */

/* ── 헤더 공통 ─────────────────────────────────────── */
#site-header {
  position: sticky; top: 0; z-index: 1000;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  transition: box-shadow .2s;
}
#site-header.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

/* ── 헤더 내부 레이아웃 ────────────────────────────── */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

/* ── 로고 ──────────────────────────────────────────── */
.site-logo {
  font-size: 1.4rem; font-weight: 800;
  color: var(--primary); text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.site-logo img { height: 40px; width: auto; display: inline-block; }
.site-logo:hover { color: var(--primary-d); text-decoration: none; }

/* ── PC GNB ────────────────────────────────────────── */
.gnb {
  display: flex; list-style: none; gap: 4px;
  margin: 0; padding: 0;
}
.gnb > li { position: relative; }
.gnb > li > a {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: .92rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  transition: color .15s ease;
  white-space: nowrap;
}

.gnb > li > a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .18s ease;
}

.gnb > li > a:hover,
.gnb > li > a.active,
.gnb > li.is-current > a {
  color: var(--primary);
}
.gnb > li > a:hover::after,
.gnb > li > a.active::after,
.gnb > li.is-current > a::after {
  transform: scaleX(1);
}

.gnb-caret {
  font-size: .7rem;
  opacity: .6;
  transform: translateY(-1px);
}

/* ── 드롭다운 ──────────────────────────────────────── */
.gnb .dropdown {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  position: absolute;
  /* 메뉴바 하단 라인 아래에서 펼쳐지도록 */
  top: calc(100% + 10px);
  left: 0;
  transform: translate(0, 8px);
  min-width: 240px;
  background: #2d72b3;
  border-radius: 0;
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
  z-index: 200;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

/* hover 브릿지: 메뉴와 드롭다운 사이 마우스 이탈 방지 */
.gnb > li.has-children > a::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 18px;
}

.gnb > li:hover .dropdown,
.gnb > li:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, 0);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear 0s;
}

.gnb .dropdown li a {
  display: block;
  padding: 11px 18px;
  font-size: .9rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
  text-align: center;
}
.gnb .dropdown li a:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
}

/* ── 헤더 우측 버튼 ────────────────────────────────── */
.header-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* ── 헤더 아이콘 버튼 (검색/로그인) ───────────────────────── */
.header-icon-btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease;
  color: #0b2239;
}
.header-icon-btn:hover{ background: rgba(15,59,99,.08); }
.header-icon-btn svg{
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.header-icon-login .header-icon-label{
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, visibility 0s linear .12s;
}
.header-icon-login:hover .header-icon-label{
  opacity: 1;
  visibility: visible;
  transition: opacity .12s ease, visibility 0s linear 0s;
}

/* ── 헤더 모달 (로그인/검색) ─────────────────────────────── */
.header-modal{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.header-modal.active{ display: block; }
.header-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  animation: fadeIn .18s ease;
}
.header-modal-dialog{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
  padding: 24px 22px;
  animation: popIn .18s ease;
}
.header-modal-x{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  background: #f3f4f6;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  color: #111827;
}
.header-modal-title{
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
  margin: 4px 0 18px;
  color: #0b2239;
}
.header-modal-form .form-group{ margin-bottom: 12px; }
.header-modal-links{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  font-size: .88rem;
}
.header-modal-links a{ color: var(--text-muted); text-decoration: none; }
.header-modal-links a:hover{ color: var(--primary); }
.header-modal-links .sep{ color: #e5e7eb; }

@keyframes popIn{
  from{ opacity: 0; transform: translate(-50%,-48%) scale(.98); }
  to{ opacity: 1; transform: translate(-50%,-50%) scale(1); }
}

/* ── 모바일 메뉴 버튼 ──────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--text); padding: 4px;
  line-height: 1;
}

/* ── 모바일 내비게이션 ─────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; inset: 0; z-index: 1100;
  pointer-events: none;
}
.mobile-nav.active { display: block; pointer-events: auto; }

.mobile-nav-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  animation: fadeIn .2s;
}
.mobile-nav-panel {
  position: absolute; top: 0; right: 0;
  width: 280px; height: 100%;
  background: var(--white);
  padding: 24px 20px;
  overflow-y: auto;
  animation: slideIn .25s;
  box-shadow: -6px 0 30px rgba(0,0,0,.15);
}
.mobile-nav-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: #f3f4f6; border: none; border-radius: 6px;
  cursor: pointer; font-size: 1rem; color: var(--text);
  margin-bottom: 20px; margin-left: auto;
}
.mobile-nav-list {
  list-style: none; margin: 0; padding: 0;
}
.mobile-nav-list li {
  border-bottom: 1px solid var(--border);
  position: relative;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 8px;
  font-size: 1rem;
  font-weight: 800;
  color: #0b2239;
  text-decoration: none;
}
.mobile-nav-link.active,
.mobile-nav-list li.is-current > .mobile-nav-link {
  color: var(--primary);
}

.mobile-sub-toggle {
  position: absolute;
  top: 8px;
  right: 4px;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.mobile-sub-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(11,34,57,.55);
  border-bottom: 2px solid rgba(11,34,57,.55);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.mobile-nav-list li.sub-open > .mobile-sub-toggle::after {
  transform: rotate(-135deg) translate(1px, 1px);
}

.mobile-submenu {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0 0 10px 12px;
  display: none;
}
.mobile-nav-list li.sub-open > .mobile-submenu,
.mobile-nav-list li.is-current > .mobile-submenu {
  display: block;
}
.mobile-submenu li a {
  display: block;
  padding: 10px 8px;
  font-size: .95rem;
  font-weight: 600;
  color: rgba(11,34,57,.75);
  text-decoration: none;
}
.mobile-submenu li a.active {
  color: var(--primary);
  font-weight: 800;
}
.mobile-submenu li a:hover { color: var(--primary); }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ── 반응형 ────────────────────────────────────────── */
@media (max-width: 768px) {
  .gnb         { display: none; }
  .header-right .btn:not(.mobile-menu-btn) { display: none; }
  .mobile-menu-btn { display: block; }
}
@media (max-width: 480px) {
  .site-logo { font-size: 1.15rem; }
}
