/* =========================================================
   세미오터에듀 공통 내비게이션 스타일
   색상은 회사 로고에서 추출한 값입니다. 상단 변수만 고치면
   사이트 전체의 색조를 한 번에 바꿀 수 있습니다.
   ========================================================= */

:root {
  --so-navy:   #12303f;  /* 로고 외곽선 */
  --so-blue:   #2e7a9e;  /* 로고 테두리 원 */
  --so-sky:    #c5e4f2;  /* 로고 배경 */
  --so-cream:  #faf6d2;  /* 수달 얼굴 */
  --so-accent: #e8175d;  /* 포인트 */

  --so-text:   #1b2a33;
  --so-muted:  #5b6b75;
  --so-line:   #dde5ea;
  --so-bg:     #ffffff;
  --so-hover:  #f2f7fa;

  --so-nav-h:  68px;
  --so-radius: 10px;
  --so-shadow: 0 12px 28px rgba(18, 48, 63, .13);
  --so-font:   "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Malgun Gothic", sans-serif;
}

/* ---------- 접근성 보조 ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  padding: 10px 18px; border-radius: 0 0 var(--so-radius) var(--so-radius);
  background: var(--so-navy); color: #fff;
  font: 600 14px/1 var(--so-font); text-decoration: none;
  transition: top .18s ease;
}
.skip-link:focus { top: 0; }

/* ---------- 헤더 골격 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--so-bg);
  border-bottom: 1px solid var(--so-line);
  font-family: var(--so-font);
}
.site-header.is-stuck { box-shadow: 0 2px 14px rgba(18, 48, 63, .09); }

.nav-wrap {
  display: flex; align-items: center; gap: 20px;
  max-width: 1200px; min-height: var(--so-nav-h);
  margin: 0 auto; padding: 0 20px;
}

/* ---------- 로고 ---------- */
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--so-navy); flex-shrink: 0;
}
.brand-mark { display: block; width: 40px; height: 40px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-text em {
  font-style: normal; font-size: 10px; font-weight: 600;
  /* 자간이 .1em 이던 자리다. 문구가 "SEMI OTTER EDU" 에서 법인명까지 붙어
     24자로 길어졌고, 내비게이션이 가로로 펼쳐지는 901px 부근에서 브랜드
     블록이 그만큼 넓어진다. 자간을 줄여 그 증가를 덜어 낸다. */
  letter-spacing: .04em; color: var(--so-blue);
}

/* ---------- 메뉴 목록 ---------- */
.primary-nav {
  display: flex; align-items: center; justify-content: space-between;
  flex: 1; gap: 20px;
}
.nav-list {
  display: flex; align-items: center; gap: 4px;
  margin: 0; padding: 0; list-style: none;
}
.nav-item { position: relative; }

.nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 14px; border: 0; border-radius: 8px;
  background: none; color: var(--so-text);
  font: 600 15.5px/1 var(--so-font); letter-spacing: -.01em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.nav-link:hover  { background: var(--so-hover); color: var(--so-blue); }
.nav-link:focus-visible { outline: 2px solid var(--so-blue); outline-offset: 2px; }

/* 현재 보고 있는 메뉴 (nav.js 가 붙여 줍니다) */
.nav-item.is-current > .nav-link { color: var(--so-blue); }
.nav-item.is-current > .nav-link::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--so-blue);
}

.chev {
  width: 10px; height: 6px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s ease; flex-shrink: 0;
}
.nav-link[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------- 하위 메뉴 (데스크톱) ---------- */
.sub-panel {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 268px; padding: 8px;
  background: var(--so-bg);
  border: 1px solid var(--so-line); border-radius: var(--so-radius);
  box-shadow: var(--so-shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .17s ease, transform .17s ease, visibility .17s;
}
.nav-link[aria-expanded="true"] + .sub-panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.sub-list { margin: 0; padding: 0; list-style: none; }
.sub-list a {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 7px;
  text-decoration: none; transition: background-color .14s ease;
}
.sub-list a:hover { background: var(--so-hover); }
.sub-list a:focus-visible { outline: 2px solid var(--so-blue); outline-offset: -2px; }
.sub-title { font-size: 15px; font-weight: 700; color: var(--so-text); }
.sub-desc  { font-size: 12.5px; font-weight: 500; color: var(--so-muted); }
.sub-list a:hover .sub-title { color: var(--so-blue); }

/* ---------- 우측 액션 ---------- */
.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.btn-quote {
  padding: 10px 18px; border-radius: 999px;
  background: var(--so-navy); color: #fff;
  font: 700 14.5px/1 var(--so-font); text-decoration: none; white-space: nowrap;
  transition: background-color .16s ease, transform .16s ease;
}
.btn-quote:hover { background: var(--so-blue); transform: translateY(-1px); }
.btn-quote:focus-visible { outline: 2px solid var(--so-accent); outline-offset: 2px; }

.lang-toggle {
  padding: 8px 12px; border: 1px solid var(--so-line); border-radius: 7px;
  color: var(--so-muted); font: 700 13px/1 var(--so-font);
  letter-spacing: .04em; text-decoration: none;
  transition: border-color .16s ease, color .16s ease;
}
.lang-toggle:hover { border-color: var(--so-blue); color: var(--so-blue); }

/* ---------- 햄버거 단추 ---------- */
.nav-toggle {
  display: none; margin-left: auto;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--so-line); border-radius: 9px;
  background: var(--so-bg); cursor: pointer;
}
.nav-toggle:focus-visible { outline: 2px solid var(--so-blue); outline-offset: 2px; }
.nav-toggle-box { display: block; position: relative; width: 20px; height: 14px; margin: 0 auto; }
.nav-toggle-box i {
  position: absolute; left: 0; width: 100%; height: 2px;
  border-radius: 2px; background: var(--so-navy);
  transition: transform .22s ease, opacity .16s ease, top .22s ease;
}
.nav-toggle-box i:nth-child(1) { top: 0; }
.nav-toggle-box i:nth-child(2) { top: 6px; }
.nav-toggle-box i:nth-child(3) { top: 12px; }
.nav-toggle[aria-expanded="true"] i:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] i:nth-child(3) { top: 6px; transform: rotate(-45deg); }

.nav-scrim {
  position: fixed; inset: var(--so-nav-h) 0 0; z-index: 90;
  background: rgba(18, 48, 63, .38);
}

/* =========================================================
   모바일 / 태블릿
   ========================================================= */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-scrim[hidden] { display: none; }

  .primary-nav {
    position: fixed; inset: var(--so-nav-h) 0 auto 0; z-index: 95;
    display: block; max-height: calc(100dvh - var(--so-nav-h));
    padding: 8px 20px 24px; overflow-y: auto;
    background: var(--so-bg); border-bottom: 1px solid var(--so-line);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .primary-nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }

  .nav-list { display: block; }
  .nav-item { border-bottom: 1px solid var(--so-line); }
  .nav-link {
    width: 100%; justify-content: space-between;
    padding: 15px 4px; border-radius: 0; font-size: 16.5px;
  }
  .nav-link:hover { background: none; }
  .nav-item.is-current > .nav-link::after { display: none; }
  .nav-item.is-current > .nav-link { color: var(--so-blue); }

  /* 하위 메뉴는 아코디언으로 펼칩니다 */
  .sub-panel {
    position: static; min-width: 0; padding: 0 0 8px 4px;
    border: 0; border-radius: 0; box-shadow: none;
    opacity: 1; visibility: visible; transform: none;
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows .24s ease;
  }
  .nav-link[aria-expanded="true"] + .sub-panel { grid-template-rows: 1fr; }
  .sub-list { overflow: hidden; }
  .sub-list a { padding: 11px 10px; border-left: 2px solid var(--so-sky); }

  .nav-actions {
    display: grid; grid-template-columns: 1fr auto;
    gap: 10px; padding-top: 18px;
  }
  .btn-quote { text-align: center; padding: 14px 18px; }
  .lang-toggle { display: grid; place-items: center; padding: 0 16px; }
}

@media (max-width: 380px) {
  .brand-text em { display: none; }
}

/* 움직임을 줄이도록 설정한 사용자를 배려합니다 */
@media (prefers-reduced-motion: reduce) {
  .site-header *, .primary-nav, .sub-panel { transition: none !important; }
}
