/* 아일로 공용 — 2단 메뉴 기본 드롭다운 (inc/ailo.lib.php ailo_submenu() 와 짝, 동작은 js/ailo-g5.js 4절)
 * 원래 디자인에 2단 메뉴가 없는 테마에 붙는다(docs/08-theme-contract.md 9절). 색·글꼴은 테마 토큰을 따른다.
 * 마크업:  <a …>1차</a><ul class="ailo-sub" data-ailo-submenu><li><a …>2차</a></li>…</ul>   (1차 링크 바로 뒤 형제)
 *   - 데스크톱: 1차 링크에 마우스·키보드 초점이 오면 링크 바로 아래에 뜬다(position: fixed — 부모 overflow 에 잘리지 않음, 위치는 JS)
 *   - 모바일 메뉴(.ailo-mnav) 안·대시보드 사이드바([data-ailo-sub-inline])는 항상 펼친 들여쓰기 목록
 *   - JS 가 없으면: 초점·마우스가 오면 링크 아래(문서 흐름)에 펼침
 * 테마 CSS 가 같은 클래스를 덮어써도 된다(이 파일은 테마 style.css 보다 먼저 읽힌다 — head.sub.bottom.php: ailo-base → ailo-g5 → 이 파일 → 테마).
 *
 * [링크 글자 규칙의 우선순위] 테마의 헤더 메뉴 규칙(.hd__nav a { color:#fff; font-size:… } · 밑줄 효과 · 여백 · 번호 장식)은 드롭다운 안 링크에도 번진다.
 *   그래서 아래 링크 규칙에는 `:not(#_)` (ID 하나만큼의 우선순위, 값 없음)를 붙여 테마 메뉴 규칙(클래스 선택자)보다 먼저 이기게 했다.
 *   테마가 드롭다운 모양을 일부러 바꾸려면 같은 `:not(#_)` 를 붙여 자기 css/g5.css 에서 덮어쓴다(테마 CSS 가 뒤에 읽히므로 이김).
 */
.ailo-sub {
  --_bg: var(--ailo-bg, #fff); --_fg: var(--ailo-fg, #111); --_line: var(--ailo-line, rgba(0,0,0,.12));
  --_accent: var(--ailo-accent, #2f5bff);
  display: none; list-style: none; margin: 0; padding: 6px; min-width: 180px; max-width: min(320px, 90vw);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14); font: inherit; font-size: 14px; line-height: 1.4; text-align: left;
  z-index: 1300;
}
.ailo-sub > li { margin: 0; padding: 0; list-style: none; }
.ailo-sub a {
  display: block; padding: 9px 12px; border-radius: 6px; color: inherit; text-decoration: none; white-space: normal;
  font-weight: 500; letter-spacing: normal; text-transform: none; background: none;
}
.ailo-sub a:hover, .ailo-sub a:focus-visible, .ailo-sub a[aria-current="page"] {
  background: color-mix(in srgb, var(--_accent) 12%, transparent); color: inherit;
}
.ailo-sub a:focus-visible { outline: 2px solid var(--_accent); outline-offset: -2px; }
.ailo-sub a::before, .ailo-sub a::after { content: none !important; }
/* JS 없을 때 */
:is(a, button):hover + .ailo-sub, :is(a, button):focus + .ailo-sub, .ailo-sub:hover, .ailo-sub:focus-within { display: block; }
/* JS 가 붙으면 열림 표시로만 */
html.ailo-dd-js .ailo-sub { display: none; position: fixed; top: 0; left: 0; }
html.ailo-dd-js .ailo-sub.is-open { display: block; }
/* 1차 링크 옆 작은 꺾쇠(JS 가 aria-expanded 를 붙인 링크) */
html.ailo-dd-js [data-ailo-dd-parent]::after {
  content: ""; display: inline-block; width: .38em; height: .38em; margin-left: .38em; vertical-align: .18em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: .6;
}
/* 모바일 메뉴·사이드바: 항상 펼친 목록 */
.ailo-mnav .ailo-sub, [data-ailo-sub-inline] .ailo-sub,
html.ailo-dd-js .ailo-mnav .ailo-sub, html.ailo-dd-js [data-ailo-sub-inline] .ailo-sub {
  display: block; position: static; min-width: 0; max-width: none; margin: 0 0 6px; padding: 0 0 0 14px;
  background: none; color: inherit; border: 0; border-left: 1px solid var(--_line); border-radius: 0; box-shadow: none; font-size: .92em;
}
.ailo-mnav .ailo-sub a, [data-ailo-sub-inline] .ailo-sub a { padding: 6px 8px; opacity: .85; }
html.ailo-dd-js .ailo-mnav [data-ailo-dd-parent]::after, html.ailo-dd-js [data-ailo-sub-inline] [data-ailo-dd-parent]::after { content: none; }
/* 드롭다운 링크: 테마 메뉴 링크 규칙(색·글꼴·밑줄·여백·움직임)을 끊고 하위 항목답게 */
.ailo-sub a:not(#_) {
  display: block; padding: 9px 12px; border: 0; border-radius: 6px; background: none; opacity: 1;
  color: var(--_fg); font-family: inherit; font-size: 14px; font-weight: 500; font-style: normal; line-height: 1.4;
  letter-spacing: normal; text-transform: none; white-space: normal; transform: none; min-height: 0;
}
.ailo-sub a:not(#_):is(:hover, :focus-visible, [aria-current="page"]) {
  color: var(--_fg); background: color-mix(in srgb, var(--_accent) 12%, transparent); padding-left: 12px;
}
/* 모바일 메뉴·사이드바 안 펼친 목록: 색은 테마 메뉴를 따르고 크기·여백만 하위 항목답게(1차 항목용 큰 글꼴·밑줄·번호 장식을 물려받지 않게) */
.ailo-mnav .ailo-sub a:not(#_), [data-ailo-sub-inline] .ailo-sub a:not(#_) {
  display: block; padding: 6px 8px; border: 0; border-radius: 0; background: none; min-height: 0; opacity: .85;
  color: inherit; font-size: 15px; font-weight: 500; font-style: normal; line-height: 1.4; letter-spacing: normal; text-transform: none;
}
.ailo-mnav .ailo-sub a:not(#_):is(:hover, :focus-visible, [aria-current="page"]),
[data-ailo-sub-inline] .ailo-sub a:not(#_):is(:hover, :focus-visible, [aria-current="page"]) {
  color: inherit; opacity: 1; background: color-mix(in srgb, var(--_accent) 12%, transparent); padding-left: 8px;
}
@media (prefers-reduced-motion: no-preference) {
  html.ailo-dd-js .ailo-sub.is-open { animation: ailo-sub-in .14s ease-out; }
  @keyframes ailo-sub-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}
@media print { .ailo-sub { display: none !important; } }
