/* a-nav — 왼쪽 공부 메뉴(2026-12-02, 사용자 승인 줄 1~4). 그리는 곳 again.js(navHTML · frame · home · journey), 움직임 js/a-nav.js.
   새 색 없이 상영관 토큰만(먹색 바탕 · 불빛 = 지금 자리). 그라데이션 · 빛 번짐 없음. 누르는 칸은 모두 44px 이상.
   PC(860 이상): 화면 왼쪽에 붙은 메뉴(240px, 860~1099 는 216px). 본문은 그 오른쪽(.an-main).
   휴대폰(859 이하): 맨 위 한 줄(.an-top) + 진행 막대, 누르면 같은 메뉴가 왼쪽 서랍으로. 아래에 '다음' 막대(#pill .an-next). */
:root { --nav-w: 240px; }
@media (min-width: 860px) and (max-width: 1099px) { :root { --nav-w: 216px; } }

/* ---------- 메뉴 안(PC · 서랍 같은 내용) ---------- */
.an-nav { display: flex; flex-direction: column; gap: 32px; background: var(--night); color: var(--on-night); font-family: var(--font-ko); }
.an-nav :focus-visible { outline: 2px solid var(--lamp); outline-offset: -2px; }
.an-bar { display: none; }
.an-head { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; }   /* 제목 왼쪽 끝 = 단계 이름 왼쪽 끝(68px) */
.an-head .bar-t { color: var(--on-night); line-height: 1.45; }
.an-head .bar-t small { margin-bottom: 4px; }
.an-head .bar-t small { flex-wrap: wrap; }
.an-k { display: flex; align-items: baseline; gap: 8px; margin: 0 0 20px; padding: 0 12px; font-size: 14px; color: var(--on-night-sub); }
.an-k b { font-size: 16px; font-weight: 500; color: var(--on-night); }
.an-g + .an-g { margin-top: 24px; }   /* 줄 간격 넓힘(사용자 2026-12-02 '줄간격이 너무 좁다') */
.an-gt { margin: 0 0 8px; padding: 0 12px; font-size: 14px; font-weight: 500; letter-spacing: .06em; color: var(--on-night-sub); }
.an-steps { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.an-steps a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  color: var(--on-night-sub); font-size: 16px; font-weight: 500; line-height: 1.25; text-decoration: none;
  transition: background-color var(--motion-t) var(--motion-e), color var(--motion-t) var(--motion-e); }
.an-steps a:hover { background: rgba(238, 228, 215, .06); color: var(--on-night); }
.an-steps .n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--night-line); border-radius: 50%;
  font-size: 14px; font-variant-numeric: tabular-nums; }
.an-steps .n .i { width: 14px; height: 14px; stroke-width: 2; color: var(--lamp); }
.an-steps li.done a { color: var(--on-night); }
.an-steps li.done .n { border-color: color-mix(in srgb, var(--lamp) 45%, transparent); }
.an-steps li.skip .n { border-color: var(--night-line); }
.an-steps .ring0 { display: inline-block; width: 10px; height: 10px; border: 1.5px solid var(--on-night-sub); border-radius: 50%; box-sizing: border-box; }
.an-steps .an-story .n { border-color: transparent; }
.an-steps .dot0 { width: 6px; height: 6px; border-radius: 50%; background: var(--on-night-sub); }
/* 지금 단계: 불빛 글자 + 아주 옅은 불빛 바탕, 번호 동그라미만 불빛으로 채움(예전 띠와 같은 표시) */
.an-steps li.on a { background: color-mix(in srgb, var(--lamp) 12%, transparent); color: var(--lamp); }
.an-steps li.on .n { border-color: var(--lamp); background: var(--lamp); color: var(--lamp-ink); }
.an-steps li.on .dot0 { background: var(--lamp-ink); }
.an-links { display: flex; flex-direction: column; gap: 0; margin: auto 0 0; padding: 16px 0 0; border-top: 1px solid var(--night-line); list-style: none; }
.an-links a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px;
  color: var(--on-night); font-size: 16px; font-weight: 500; text-decoration: none;
  transition: background-color var(--motion-t) var(--motion-e), color var(--motion-t) var(--motion-e); }
.an-links a:hover { background: rgba(238, 228, 215, .06); }
.an-links small { font-size: 14px; font-weight: 400; color: var(--on-night-sub); }
.an-links a[aria-current] { color: var(--lamp); }

.an-top, .an-scrim, .an-menu-btn { display: none; }
#pill .an-next .i { width: 18px; height: 18px; }

/* 60일 여정 화면: 첫 화면 아래에 있던 덩어리를 맨 위로 옮겨 왔으니 위 여백은 머리말 다음 한 칸만 */
.home.jr .journey { margin-top: 16px; }

/* ---------- PC: 왼쪽에 붙은 메뉴 ---------- */
@media (min-width: 860px) {
  .an-shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); align-items: start; min-height: 100svh; }
  .an-nav { position: sticky; top: 0; height: 100svh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    padding: 16px; border-right: 1px solid var(--night-line); }
  .an-main { min-width: 0; }
  body.kh-on .an-nav { height: calc(100svh - 44px); }   /* keyhub 돌아가기 띠(44px, 흐름 안)가 위에 있을 때도 메뉴 아래 끝(처음 화면)이 첫 화면에 */
}

/* ---------- 휴대폰: 맨 위 한 줄 + 왼쪽 서랍 + 아래 '다음' 막대 ---------- */
@media (max-width: 859px) {
  .an-nav { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; display: none; width: min(86vw, 320px); height: 100dvh;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
    border-right: 1px solid var(--night-line); transform: translateX(-100%); transition: transform var(--motion-t) var(--motion-e); }
  .an-shell.an-show .an-nav { display: flex; }
  .an-shell.an-on .an-nav { transform: none; }
  .an-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; margin-bottom: -8px; }
  .an-bar-t { margin: 0; padding-left: 12px; font-size: 14px; color: var(--on-night-sub); }
  .an-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--night-line); border-radius: 50%;
    background: transparent; color: var(--on-night); cursor: pointer; }
  .an-close:hover { background: var(--night-2); }
  .an-scrim { display: block; position: fixed; z-index: 59; inset: 0; background: rgb(0 0 0 / .55); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--motion-t) var(--motion-e), visibility 0s linear var(--motion-t); }
  .an-shell.an-on .an-scrim { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--motion-t) var(--motion-e); }
  html.an-lock, html.an-lock body { overflow: hidden; }

  /* 맨 위 한 줄: 'N일째 · 익히기 3/9 핵심 표현' — 줄 전체가 메뉴 여는 단추 */
  .an-top { display: block; position: relative; background: var(--night); box-shadow: 0 1px 0 var(--night-line); }
  .an-top .an-open { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin: 0; padding: 4px 8px 4px 16px; border: 0;
    background: transparent; color: var(--on-night); font-family: var(--font-ko); font-size: 16px; font-weight: 500; line-height: 1.25; text-align: left; cursor: pointer; }
  .an-top .an-open:focus-visible { outline: 2px solid var(--lamp); outline-offset: -3px; }
  .an-sum { flex: 1; display: flex; align-items: baseline; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
  .an-sum b { flex: none; font-weight: 500; }
  .an-sep, .an-where { flex: none; font-weight: 400; color: var(--on-night-sub); font-variant-numeric: tabular-nums; }
  .an-cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--lamp); }
  .an-mi { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--night-line); border-radius: 50%; }
  .an-mi .i { width: 20px; height: 20px; }
  .an-top .today-line { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }

  /* 첫 화면 · 60일 여정: 머리말 오른쪽 끝의 메뉴 단추 */
  .an-home .top { gap: 10px; }
  .an-home .top .streak { flex: 1; min-width: 0; text-align: right; }
  .an-menu-btn { display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--night-line); border-radius: 50%;
    background: transparent; color: var(--on-night); cursor: pointer; }
  .an-menu-btn:hover { background: var(--night-2); }

  /* 아래 '다음' 막대: 화면 안의 앞으로 가는 단추 하나를 비춘다(화면 안 그 단추는 숨김 — 두 번 보이지 않게) */
  #pill:has(.an-next):not([hidden]) { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--night); box-shadow: 0 -1px 0 var(--night-line); }
  #pill .an-next { flex: 1; min-width: 0; min-height: 48px; }
  #pill .an-next span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  [data-an-src] { display: none !important; }
  html.an-has-next .an-shell.view { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  html.an-has-next .view .pager, html.an-has-next .view .row, html.an-has-next .view .btn { scroll-margin-bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .an-nav, .an-scrim, .an-shell.an-on .an-scrim, .an-steps a, .an-links a { transition: none; }
}
@media print { .an-nav, .an-top, #pill { display: none !important; } }
