/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99;
  width: 100%;
  background: transparent;
  transition: background .2s ease, box-shadow .2s ease;
}

.header__layout {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 80px;
}

.header__logo {
  position: relative;
  z-index: 100;
}

.header__logo img {
  height: 42px;
  display: block;
}

.header__nav .header__gnb {
  display: flex;
  gap: 150px;
}

.header__nav a {
  color: #fff;
  font-weight: 600;
  transition: color .2s ease;
}

.header__util {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #fff;
  transition: color .2s ease;
}

.header__util .lang a {
  font-size: 14px;
  text-decoration: none;
  color: inherit;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 12px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 100;
}

.menu-btn span {
  display: block;
  height: 1px;
  background: #fff;
  border-radius: 2px;
  transform: translateY(0) rotate(0);
  transform-origin: center;
  transition: transform .22s ease, background .2s ease, opacity .2s ease;
}

/* ---------- Slim dropdown bar ---------- */
.header__sub {
  position: fixed;
  left: 0;
  right: 0;
  top: 80px;
  z-index: 99;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, .06);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  translate: 0 -6px;
  transition: opacity .15s ease, translate .15s ease, visibility 0s linear .15s;
}

.header.hovered .header__sub {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  translate: 0 0;
  transition: opacity .15s ease, translate .15s ease, visibility 0s;
}

.header__sub_wrap {
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
  height: 250px;
}

.header__sub_list {
  position: absolute;
  top: 12px;
  display: block;
  text-align: center;
}

.header__sub_list li a {
  display: block;
  padding: 8px 10px;
  color: #444;
  border-radius: 6px;
  white-space: nowrap;
}

/* gnb-서브 사이 버퍼 */
.header__gnb > li {
  position: relative;
}

.header__gnb > li::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 70px;
  height: 12px;
}

/* ---------- Hovered header styles ---------- */
.header.hovered {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

.header__logo .logo--dark {
  display: none;
}

.header.hovered .header__logo .logo--light {
  display: none;
}

.header.hovered .header__logo .logo--dark {
  display: block;
}

.header.hovered .header__nav a,
.header.hovered .header__util {
  color: #222;
}

.header.hovered .menu-btn span {
  background: #222;
}

/* ---------- GNB 파랑(#10258e) 처리 ---------- */
/* 직접 hover/포커스 */
.header .header__gnb > li > a:hover,
.header .header__gnb > li > a:focus-visible {
  color: #10258e;
}

/* active는 헤더가 hovered일 때만 파랑 보이도록 */
.header.hovered .header__gnb > li.active > a {
  color: #10258e;
}

/* 서브 항목 hover */
.header__sub_list li a:hover {
  color: #10258e;
}

/* ≤1599 (기준: 1600) */
@media (max-width: 1599px) {
  .header__layout {
    max-width: 1440px;
    padding: 0 22px;
  }

  .header__nav .header__gnb {
    gap: 120px;
  }

  .header__logo img {
    height: 40px;
  }
}

/* ≤1439 (기준: 1440) */
@media (max-width: 1439px) {
  .header__layout {
    max-width: 1280px;
    padding: 0 20px;
  }

  .header__nav .header__gnb {
    gap: 100px;
  }

  .header__logo img {
    height: 38px;
  }

  .header__layout {
    height: 78px;
  }

  .header__sub {
    top: 78px;
  }
}

/* ≤1279 (기준: 1280) */
@media (max-width: 1279px) {
  .header__layout {
    max-width: 1200px;
    padding: 0 20px;
  }

  .header__nav .header__gnb {
    gap: 72px;
  }

  .header__layout {
    height: 74px;
  }

  .header__sub {
    top: 74px;
  }
}

/* ≤1024 : GNB 숨김, 햄버거 사용 */
@media (max-width: 1024px) {
  .header__layout {
    max-width: 100%;
    padding: 0 18px;
    height: 68px;
  }

  .header__logo img {
    height: 36px;
  }

  /* GNB 숨김 */
  .header__nav {
    display: none;
  }

  /* 유틸/언어는 유지 (필요 시 줄이기) */
  .header__util {
    gap: 16px;
  }

  /* 호버 드롭다운 비활성(터치 기기 충돌 방지) */
  .header__sub {
    display: none;
  }
}

/* ≤768 */
@media (max-width: 768px) {
  .header__layout {
    padding: 0 16px;
    height: 64px;
  }

  .header__logo img {
    height: 34px;
  }

  .header__util {
    gap: 14px;
  }
}

/* ≤390 */
@media (max-width: 390px) {
  .header__layout {
    padding: 0 14px;
    height: 60px;
  }

  .header__logo img {
    height: 32px;
  }

  .header__util {
    gap: 12px;
  }
}

/* ---------- Sitemap (fullscreen overlay inside header) ---------- */
.sitemap {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  width: 100%;
  height: 100%;
  z-index: 99;
  display: none;
  visibility: hidden;
  pointer-events: none;
}

.sitemap__inner {
  width: 1600px;
  margin: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sitemap__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px;
  align-content: center;
  align-items: start;
  min-height: 100vh;
}

.sitemap__grid h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: #fff;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 6px;
}

.sitemap__grid li + li {
  margin-top: 6px;
}

.sitemap__grid a {
  color: #ccc;
  text-decoration: none;
  transition: color .2s ease;
}

.sitemap__grid a:hover {
  color: #fff;
}

/* 열림 상태 */
html.menu-open .sitemap {
  display: block;
  visibility: visible;
  pointer-events: auto;
}

/* 햄버거 → X */
html.menu-open .menu-btn span:first-child {
  transform: translateY(5px) rotate(45deg);
}

html.menu-open .menu-btn span:last-child {
  transform: translateY(-5px) rotate(-45deg);
}

/* ---------- Responsive (sitemap) ---------- */
@media (max-width: 1600px) {
  .sitemap__inner {
    width: 1440px;
  }
}

@media (max-width: 1440px) {
  .sitemap__inner {
    width: 1280px;
  }
}

@media (max-width: 1280px) {
  .sitemap__inner {
    width: 1024px;
  }

  .sitemap__grid {
    gap: 32px;
  }
}

@media (max-width: 1024px) {
  .sitemap__inner {
    width: 768px;
    padding: 48px 32px;
  }

  .sitemap__grid {
    gap: 28px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sitemap__grid h3 {
    font-size: 19px;
  }
}

@media (max-width: 768px) {
  .sitemap__inner {
    width: min(640px, calc(100% - 32px));
    padding: 32px 24px;
  }

  .sitemap__grid {
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sitemap__grid h3 {
    font-size: 18px;
  }
}

@media (max-width: 390px) {
  .sitemap__inner {
    width: calc(100% - 24px);
    padding: 24px 16px;
  }

  .sitemap__grid {
    gap: 30px;
    grid-template-columns: 1fr;
  }

  .sitemap__grid h3 {
    font-size: 16px;
  }
}

/* =========================================
   Floating Side Rail – 연결형 라벨/아이콘
   색만 바꾸려면 --brand 수정
========================================= */
:root {
  --brand: #10258e;
  --rail-bg: #fff;
  --shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

/* ===== rail base ===== */
.side-rail {
  position: fixed;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  width: 36px;
  padding: 16px 0;
  background: var(--rail-bg);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== cell ===== */
.rail-btn {
  --circle: 32px;
  --label-w: 0px;

  position: relative;
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--rail-bg);
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: 0;
}

/* 단일 파란 배경(원 → 캡슐) */
.rail-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  height: var(--circle);
  width: 100px;
  /* 처음엔 '원' */
  background: var(--brand);
  border-radius: 999px;
  z-index: 1;
  opacity: 0;
  transition: width .22s ease, opacity .18s ease;
}

/* 아이콘 */
.rail-btn .ico {
  position: relative;
  z-index: 2;
  width: 22px;
  height: 22px;
  color: var(--brand);
  fill: var(--brand);
  transition: fill .18s ease;
}

/* 라벨 */
.rail-btn .label {
  position: absolute;
  top: 50%;
  right: calc(var(--circle));
  /* 캡슐 안쪽에서 왼쪽으로 */
  transform: translateY(-50%);
  z-index: 2;
  height: var(--circle);
  line-height: var(--circle);
  padding: 0 12px;
  background: transparent;
  /* 배경은 ::before가 담당 */
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

/* hover/focus: 단일 배경이 '캡슐'로 확장 + 아이콘 흰색 + 라벨 표시 */
.rail-btn:hover::before,
.rail-btn:focus-visible::before {
  opacity: 1;
  width: calc(var(--circle) + var(--label-w) + 80px);
}

.rail-btn:hover .ico,
.rail-btn:focus-visible .ico {
  fill: #fff;
  color: #fff;
}

.rail-btn:hover .label,
.rail-btn:focus-visible .label {
  opacity: 1;
}

/* 화살표는 파란 배경/라벨 비활성 */
/* 화살표: hover/focus에도 배경·라벨 없음 + 아이콘 색 유지 */
.rail-arrow .ico {
  width: 16px;
  height: 16px;
}

.rail-arrow::before {
  display: none;
}

.rail-arrow .label {
  display: none;
}

.rail-arrow:hover .ico,
.rail-arrow:focus-visible .ico {
  color: var(--brand);
  /* 흰색으로 바뀌지 않게 고정 */
}

/* 키보드 포커스 테두리 */
.rail-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 37, 142, .15);
}

/* ===== responsive ===== */
@media (max-width:1024px) {
  .side-rail {
    right: 16px;
    width: 36px;
  }
}

@media (max-width:768px) {

  /* 라벨 숨김 (기존 유지) */
  .rail-btn .label {
    display: none;
  }

  /* 파란 캡슐 배경 비활성 (hover/focus 포함) */
  .rail-btn::before {
    display: none !important;
  }

  /* 아이콘 색 고정 (hover/focus에서도 변경 안 함) */
  .rail-btn:hover .ico,
  .rail-btn:focus-visible .ico {
    color: var(--brand) !important;
    fill: var(--brand) !important;
  }
}

@media (max-width:390px) {
  .side-rail {
    right: 8px;
  }
}