/* headermenu-1128: 공통 헤더 메뉴 개편(학원소개 | 학습관리 | 설명회·컨설팅 | 입시센터 소개 | 모집요강 | 커뮤니티).
   기존 B 변수(--ink, --brand, --line, --mint)와 기존 헤더 규칙 위에 얹는다. 로고·「설명회 신청」·신청 버튼 규칙은 건드리지 않는다. */

/* 1) 최상위 독립 링크 「입시센터 소개」: 다른 탭(summary)과 같은 글자·여백 */
#b-menu > a.hm-top { display:block; padding:12px 0; color:var(--ink); font-size:15px; font-weight:600; line-height:1.5; text-decoration:none; white-space:nowrap }
#b-menu > a.hm-top:hover { color:var(--brand) }
#b-menu summary { white-space:nowrap }
#b-menu > a.hm-top:focus-visible, #b-menu summary:focus-visible { outline:2px solid var(--brand); outline-offset:3px; border-radius:2px }

/* 2) 현재 쪽 표시(headermenu-1128.js 가 붙인다): 탭은 색 + 밑줄, 펼친 목록 안 링크는 색 + 굵게 */
#b-menu > details[data-hm-current] > summary, #b-menu > a.hm-top[aria-current] { color:var(--brand); box-shadow:inset 0 -2px 0 currentColor }
#b-menu details a[aria-current] { color:var(--brand); font-weight:700 }

/* 3) 「설명회·컨설팅」 펼침: 두 묶음(설명회 / 컨설팅). 넓은 화면은 2열 */
#b-menu .hm-panel { display:flex; align-items:flex-start; gap:4px 14px; width:max-content; max-width:calc(100vw - 32px) }
#b-menu .hm-col { flex:0 0 auto; min-width:204px }
#b-menu .hm-col[hidden] { display:none !important }
#b-menu .hm-cap { margin:0 0 4px; padding:8px 10px 7px; border-bottom:1px solid var(--line); color:var(--brand); font-size:13px; font-weight:700; line-height:1.4; letter-spacing:.02em }
#b-menu .hm-col a { white-space:nowrap }

/* 4) 1023px 이하: 탭 6개가 한 줄에 들어가지 않으므로 「메뉴」 버튼으로 여닫는다.
      800px 이하는 기존 규칙과 같은 값이고, 801~1023px 는 이 블록이 같은 모양을 준다. 두 묶음은 세로로 쌓는다. */
@media (max-width:1023px) {
  .b-bar .b-toggle { display:block }
  .b-bar nav#b-menu { display:none; position:absolute; inset:100% 0 auto; background:white; padding:12px 20px 18px; border-bottom:1px solid var(--line); max-height:72vh; overflow:auto }
  .b-bar nav#b-menu.open { display:block }
  .b-bar nav#b-menu details > div { position:static; box-shadow:none; border:0; background:var(--mint) }
  #b-menu > details[data-hm-current] > summary, #b-menu > a.hm-top[aria-current] { box-shadow:none }
  #b-menu .hm-panel { display:block; width:auto; max-width:none }
  #b-menu .hm-col { min-width:0 }
  #b-menu .hm-col + .hm-col { margin-top:8px }
  #b-menu .hm-col a { white-space:normal }
}

/* ── hm-motion-1204: PC 헤더 하위 메뉴 「한 줄로 꿰는」 등장 모션 (1024px 이상만, 모바일 햄버거는 위 규칙 그대로)
   열림: 왼쪽 척추선(진녹→금)이 위에서 아래로 그어지고 → 카드가 그 선에서 오른쪽으로 걷히며 열리고 →
         항목마다 금색 눈금이 한 번 찍혔다 빠지며 글자가 30ms 시차로 제자리에 꽂힌다.
   메뉴 사이 이동: 카드가 이동 방향에서 짧게 밀려 들어오기만 한다(풀 모션은 처음 열 때만).
   닫힘: 카드가 척추선 쪽으로 접혀 들어간다. 항목 hover: 척추선에서 금색 눈금이 뻗어 나와 글자를 가리킨다. */
@media (min-width:1024px) {
  #b-menu > details > div { padding-left:14px }
  #b-menu > details > div::before { content:""; position:absolute; left:6px; top:14px; bottom:14px; width:2px; border-radius:2px; background:linear-gradient(var(--brand), #d9b86d); transform-origin:50% 0; pointer-events:none }
  #b-menu > details > div a, #b-menu .hm-cap { position:relative }
  #b-menu > details > div a { --hm-tk:6px; transition:transform .22s cubic-bezier(.2,.8,.2,1), background-color .18s, color .18s }
  #b-menu > details > div a::after { content:""; position:absolute; left:calc(-1 * var(--hm-tk)); top:calc(50% - 1px); width:calc(var(--hm-tk) + 4px); height:2px; border-radius:0 2px 2px 0; background:#d9b86d; transform:scaleX(0); transform-origin:0 50%; transition:transform .22s cubic-bezier(.2,.8,.2,1); pointer-events:none }
  #b-menu > details > div a:hover, #b-menu > details > div a:focus-visible { transform:translateX(3px) }
  #b-menu > details > div a:hover::after, #b-menu > details > div a:focus-visible::after, #b-menu > details > div a[aria-current]::after { transform:scaleX(1) }
  #b-menu .hm-col + .hm-col { position:relative }
  #b-menu .hm-col + .hm-col::before { content:""; position:absolute; left:-8px; top:6px; bottom:6px; width:1px; background:var(--line); transform-origin:50% 0; pointer-events:none }
  #b-menu .hm-col + .hm-col a { --hm-tk:8px }

  /* 처음 열 때 */
  #b-menu > details[open] > div { animation:hm1204-wipe .34s cubic-bezier(.16,1,.3,1) .06s backwards }
  #b-menu > details[open] > div::before { animation:hm1204-spine .2s cubic-bezier(.2,.8,.2,1) backwards }
  #b-menu > details[open] > div a, #b-menu > details[open] .hm-cap { animation:hm1204-in .36s cubic-bezier(.16,1,.3,1) backwards; animation-delay:calc(.11s + var(--hm-i, 0) * .03s) }
  #b-menu > details[open] > div a:not([aria-current])::after { animation:hm1204-tick .42s cubic-bezier(.2,.8,.2,1); animation-delay:calc(.13s + var(--hm-i, 0) * .03s) }
  #b-menu > details[open] .hm-col + .hm-col::before { animation:hm1204-spine .26s cubic-bezier(.2,.8,.2,1) .14s backwards }

  /* 열린 채 옆 메뉴로 옮겨 갈 때(JS 가 data-hm-rove·data-hm-dir 을 붙인다) */
  #b-menu[data-hm-rove] > details[open] > div { animation:hm1204-rove .22s cubic-bezier(.16,1,.3,1) backwards }
  #b-menu[data-hm-rove][data-hm-dir="l"] > details[open] > div { --hm-dx:10px }
  #b-menu[data-hm-rove] > details[open] > div::before, #b-menu[data-hm-rove] > details[open] .hm-col + .hm-col::before, #b-menu[data-hm-rove] > details[open] > div a::after { animation:none }
  #b-menu[data-hm-rove] > details[open] > div a, #b-menu[data-hm-rove] > details[open] .hm-cap { animation:hm1204-fade .18s ease-out backwards; animation-delay:calc(var(--hm-i, 0) * .015s) }

  /* 닫힘: 척추선 쪽으로 접힌다 */
  #b-menu > details[open][data-hm-closing] > div { animation:hm1204-fold .16s cubic-bezier(.4,0,1,1) forwards }
  #b-menu > details[open][data-hm-closing] > div a, #b-menu > details[open][data-hm-closing] .hm-cap { animation:none }
}
@keyframes hm1204-wipe { from { clip-path:inset(0 calc(100% - 10px) 0 0 round 12px) } to { clip-path:inset(-30px -40px -60px -40px round 12px) } }
@keyframes hm1204-spine { from { transform:scaleY(0) } to { transform:scaleY(1) } }
@keyframes hm1204-in { from { opacity:0; transform:translateX(-10px) } to { opacity:1; transform:none } }
@keyframes hm1204-tick { 0% { transform:scaleX(0) } 45% { transform:scaleX(1) } 100% { transform:scaleX(0); transform-origin:100% 50% } }
@keyframes hm1204-rove { from { opacity:0; transform:translateX(var(--hm-dx, -10px)) } to { opacity:1; transform:none } }
@keyframes hm1204-fade { from { opacity:0 } to { opacity:1 } }
@keyframes hm1204-fold { from { clip-path:inset(-30px -40px -60px -40px round 12px); opacity:1 } to { clip-path:inset(0 calc(100% - 10px) 0 0 round 12px); opacity:.4 } }
@media (prefers-reduced-motion:reduce) {
  #b-menu > details > div, #b-menu > details > div::before, #b-menu > details > div a, #b-menu > details > div a::after, #b-menu .hm-cap, #b-menu .hm-col + .hm-col::before { animation:none !important; transition:none !important }
}

/* ── hm-mobile-1204: 1023px 이하 햄버거 메뉴 모션 (PC 의 「한 줄로 꿰는」 모션과 같은 말씨)
   메뉴 열림: 패널이 헤더 아래로 두루마리처럼 풀려 내려오고(clip-path), 그 사이 왼쪽에 금색 실이 한 번 지나가며
             메뉴 줄이 35ms 시차로 꽂힌다. 묶음 펼침: 제목 옆 꺾쇠가 돌고, 민트 상자가 위에서 풀리며 척추선이 그어지고
             하위 항목이 차례로 들어온다. 닫힘은 기존처럼 즉시(눌렀는데 늦게 닫히는 느낌을 피한다). */
@media (max-width:1023px) {
  .b-bar nav#b-menu.open { animation:hm1204m-unroll .34s cubic-bezier(.16,1,.3,1) backwards }
  .b-bar nav#b-menu.open > * { animation:hm1204-in .38s cubic-bezier(.16,1,.3,1) backwards; animation-delay:calc(.08s + var(--hm-mi, 0) * .035s) }
  .b-bar nav#b-menu > * { position:relative }
  .b-bar nav#b-menu > *::before { content:""; position:absolute; left:-12px; top:calc(1.5em - 4px); width:3px; height:3px; border-radius:50%; background:#d9b86d; opacity:0; pointer-events:none }
  .b-bar nav#b-menu.open > *::before { animation:hm1204m-bead .5s ease-out backwards; animation-delay:calc(.1s + var(--hm-mi, 0) * .035s) }
  .b-bar nav#b-menu > details > summary { display:flex; align-items:center; justify-content:space-between; gap:12px }
  .b-bar nav#b-menu > details > summary::after { content:""; flex:0 0 auto; width:7px; height:7px; margin-right:4px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:translateY(-2px) rotate(45deg); transition:transform .3s cubic-bezier(.2,.8,.2,1); opacity:.7 }
  .b-bar nav#b-menu > details[open] > summary::after { transform:translateY(2px) rotate(225deg) }
  .b-bar nav#b-menu > details > div { position:relative; padding-left:16px }
  .b-bar nav#b-menu > details > div::before { content:""; position:absolute; left:7px; top:12px; bottom:12px; width:2px; border-radius:2px; background:linear-gradient(var(--brand), #d9b86d); transform-origin:50% 0; pointer-events:none }
  .b-bar nav#b-menu > details[open] > div { animation:hm1204m-fold-out .32s cubic-bezier(.16,1,.3,1) backwards }
  .b-bar nav#b-menu > details[open] > div::before { animation:hm1204-spine .3s cubic-bezier(.2,.8,.2,1) .05s backwards }
  .b-bar nav#b-menu > details[open] > div a, .b-bar nav#b-menu > details[open] .hm-cap { animation:hm1204-in .34s cubic-bezier(.16,1,.3,1) backwards; animation-delay:calc(.08s + var(--hm-i, 0) * .03s) }
}
@keyframes hm1204m-unroll { from { clip-path:inset(0 0 100% 0) } to { clip-path:inset(0 0 0 0) } }
@keyframes hm1204m-fold-out { from { clip-path:inset(0 0 100% 0 round 6px); opacity:.3 } to { clip-path:inset(0 0 0 0 round 6px); opacity:1 } }
@keyframes hm1204m-bead { 0% { opacity:0; transform:translateY(-14px) } 35% { opacity:1; transform:none } 100% { opacity:0; transform:translateY(8px) } }
@media (prefers-reduced-motion:reduce) {
  .b-bar nav#b-menu, .b-bar nav#b-menu > *, .b-bar nav#b-menu > *::before, .b-bar nav#b-menu > details > summary::after { animation:none !important; transition:none !important }
  .b-bar nav#b-menu > details > div, .b-bar nav#b-menu > details > div::before, .b-bar nav#b-menu > details > div a, .b-bar nav#b-menu .hm-cap { animation:none !important }
}
