/*
 * 한 페이지 교재의 챕터 보이기·숨기기 — AI Course·영어 교재(public/js/course-chapters.js). SONUB-SSOT.md 23절 "교재".
 * 목차(.course-toc)와 챕터(.course-chapter)가 한 HTML 에 있고, 주소의 해시가 고른 것만 보인다.
 * - JS 전: :target 이 고른다 — 해시가 챕터면 그 챕터만, 아니면 목차만(첫 그림부터 맞는 챕터가 보이고 JS 가 없어도 동작한다).
 * - JS 뒤(.is-routed): 스크립트가 붙인 .is-current 챕터만, 챕터가 없으면(.show-toc) 목차만.
 */
.course-chapters:not(.is-routed) .course-chapter:not(:target),
.course-chapters.is-routed .course-chapter:not(.is-current),
.course-chapters:not(.is-routed):has(.course-chapter:target) .course-toc,
.course-chapters.is-routed:not(.show-toc) .course-toc {
	display: none;
}

/* 챕터·목차로 옮겨 갈 때 위쪽 고정 막대에 가리지 않게 */
.course-chapters .course-chapter,
.course-chapters .course-toc {
	scroll-margin-block-start: calc(var(--bar-height, 3.5rem) + var(--wa-space-m));
}

.course-chapters .course-chapter:focus {
	outline: none;
}
.course-chapters .course-chapter:focus-visible {
	outline: 2px solid var(--wa-color-brand-fill-loud);
	outline-offset: var(--wa-space-xs);
	border-radius: var(--wa-border-radius-m);
}
