/* ==========================================================================
   LIFE SCORE — 측정 방법 영상 페이지 (tests.html · tests/<slug>.html)
   --------------------------------------------------------------------------
   페이지 전용 스타일. 접두사 .gw-* (디자인 시스템은 .ls-*, 영상 카드는 css/ds/guide-video.css)
   - 색·간격·서체는 DS 토큰(css/ds/tokens.css)만 쓴다. 원시 hex 금지.
   - 개념: 사용 가이드와 같은 '현장 매뉴얼' 문법. 영상이 맨 위에 크게, 옆(좁으면 아래)에 구간 목록을
     세로 눈금자로 두고 지금 재생 중인 구간을 ochre 측정선으로 표시한다(사용 가이드 목차와 같은 표시).
     본문은 46rem 읽기 폭.
   - 동작: js/pages/guide-watch.js (구간 이동 · 지금 구간 · 못 받았을 때 안내)
   ========================================================================== */

.gw .app-container { overflow-x: clip; }
.gw main:focus { outline: none; }
.gw [hidden] { display: none !important; }

.gw-wrap { padding-block: clamp(1.5rem, 1rem + 2vw, 2.5rem) clamp(4rem, 3rem + 4vw, 6rem); }

/* --------------------------------------------------------------------------
   1. 위치 · 머리
   -------------------------------------------------------------------------- */
.gw-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px var(--ls-space-2); margin: 0; font-size: var(--ls-text-sm); color: var(--ls-fg-muted); }
.gw-crumbs li { display: inline-flex; align-items: center; gap: var(--ls-space-2); min-width: 0; }
.gw-crumbs li + li::before { content: "/"; color: var(--ls-fg-subtle); }
.gw-crumbs a { color: var(--ls-fg-muted); text-decoration: none; }
.gw-crumbs a:hover { color: var(--ls-fg); text-decoration: underline; text-underline-offset: 3px; }
.gw-crumbs [aria-current] { color: var(--ls-fg); font-weight: var(--ls-weight-medium); }

.gw-head { display: grid; gap: var(--ls-space-3); max-width: 46rem; margin-block: var(--ls-space-6) var(--ls-space-8); }
.gw-head__title {
  margin: 0;
  font-size: var(--ls-text-h1);
  font-weight: var(--ls-weight-bold);
  line-height: var(--ls-leading-tight);
  letter-spacing: var(--ls-tracking-display);
  color: var(--ls-brand);
  text-wrap: balance;
}
.gw-head__lead { margin: 0; font-size: var(--ls-text-lg); line-height: var(--ls-leading-relaxed); color: var(--ls-fg-muted); text-wrap: pretty; }
@media (max-width: 639px) {
  .gw-head { margin-block: var(--ls-space-4) var(--ls-space-6); }
  .gw-head__lead { font-size: var(--ls-text-md); }
}

/* --------------------------------------------------------------------------
   2. 영상 + 구간 목록
   -------------------------------------------------------------------------- */
.gw-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ls-space-6);
  align-items: start;
}
@media (min-width: 1024px) {
  .gw-stage { grid-template-columns: minmax(0, 1fr) 15rem; gap: var(--ls-space-10); }
}

.gw-player { display: grid; gap: var(--ls-space-3); margin: 0; min-width: 0; }
.gw-player__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--ls-radius-lg);
  overflow: hidden;
  background: var(--ls-bg-inverse);
}
.gw-player__video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  background: var(--ls-bg-inverse);
}
.gw-player__cap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--ls-space-4);
  font-size: var(--ls-text-sm);
  color: var(--ls-fg-muted);
  font-variant-numeric: tabular-nums;
}
.gw-player__cap span:first-child { color: var(--ls-fg-brand); font-weight: var(--ls-weight-semibold); }
.gw-player__error {
  display: grid;
  gap: var(--ls-space-3);
  justify-items: start;
  padding: var(--ls-space-4);
  border: 1px solid var(--ls-warning-border);
  border-radius: var(--ls-radius-md);
  background: var(--ls-warning-bg);
  color: var(--ls-fg);
  font-size: var(--ls-text-sm);
}
.gw-player__error p { margin: 0; }

/* 구간 목록 — 사용 가이드 목차와 같은 세로 눈금자. 지금 구간(aria-current)은 ochre 측정선 */
.gw-chapters__title {
  margin: 0 0 var(--ls-space-3);
  font-size: var(--ls-text-sm);
  font-weight: var(--ls-weight-semibold);
  color: var(--ls-fg);
}
.gw-chapters .gw-chapters__list {
  position: relative;
  margin: 0;
  padding-left: var(--ls-space-4);
  background:
    linear-gradient(var(--ls-border), var(--ls-border)) left top / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--ls-border-control) 0 1px, transparent 1px 60px) left top / 9px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--ls-border-strong) 0 1px, transparent 1px 12px) left top / 5px 100% no-repeat;
}
.gw-chapters__list a {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  align-items: baseline;
  gap: var(--ls-space-2);
  min-height: 40px;
  padding: 8px 0;
  font-size: var(--ls-text-sm);
  line-height: 1.4;
  color: var(--ls-fg-muted);
  text-decoration: none;
  transition: color var(--ls-dur-fast) var(--ls-ease-out);
}
.gw-chapters__list a:hover { color: var(--ls-fg); }
.gw-chapters__time { font-variant-numeric: tabular-nums; color: var(--ls-fg-subtle); }
.gw-chapters__list a[aria-current] { color: var(--ls-fg); font-weight: var(--ls-weight-semibold); }
.gw-chapters__list a[aria-current] .gw-chapters__time { color: var(--ls-fg-brand); }
.gw-chapters__list a[aria-current]::before {
  content: "";
  position: absolute;
  left: calc(var(--ls-space-4) * -1 - 1px);
  top: 50%;
  width: 3px;
  height: 22px;
  margin-top: -11px;
  border-radius: 2px;
  background: var(--ls-accent);
}
/* 좁은 화면: 영상 바로 아래 두 줄 칸으로 (스크롤 없이 눌러 볼 수 있게) */
@media (max-width: 1023px) {
  .gw-chapters .gw-chapters__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    column-gap: var(--ls-space-6);
  }
}

/* --------------------------------------------------------------------------
   3. 본문 (측정 순서 · 내레이션 전문)
   -------------------------------------------------------------------------- */
.gw-body { display: grid; gap: var(--ls-space-10); max-width: 46rem; margin-top: var(--ls-space-10); }

.gw-h2 {
  margin: 0;
  font-size: var(--ls-text-h3);
  font-weight: var(--ls-weight-bold);
  line-height: var(--ls-leading-snug);
  letter-spacing: var(--ls-tracking-heading);
  color: var(--ls-fg);
}
.gw-h3 {
  margin: 0;
  font-size: var(--ls-text-lg);
  font-weight: var(--ls-weight-semibold);
  line-height: var(--ls-leading-snug);
  color: var(--ls-fg);
}
.gw-section { display: grid; gap: var(--ls-space-4); }
.gw-section__lead { margin: 0; font-size: var(--ls-text-sm); color: var(--ls-fg-muted); }

.gw-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-block: 1px solid var(--ls-border);
}
.gw-facts > div { display: grid; gap: 4px; align-content: start; padding: var(--ls-space-4) var(--ls-space-4) var(--ls-space-4) 0; }
.gw-facts > div + div { padding-left: var(--ls-space-4); border-left: 1px solid var(--ls-border); }
.gw-facts dt { font-size: var(--ls-text-xs); font-weight: var(--ls-weight-semibold); color: var(--ls-fg-muted); }
.gw-facts dd { margin: 0; font-size: var(--ls-text-sm); line-height: var(--ls-leading-normal); color: var(--ls-fg); }
@media (max-width: 639px) {
  .gw-facts { grid-template-columns: minmax(0, 1fr); }
  .gw-facts > div { padding: var(--ls-space-3) 0; }
  .gw-facts > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--ls-border); }
}

.gw-item { display: grid; gap: var(--ls-space-3); }
.gw-item + .gw-item { margin-top: var(--ls-space-4); }

/* 측정 순서 — 실제로 순서가 있는 글이라 번호를 크게 */
.gw-steps { margin: 0; padding: 0; list-style: none; counter-reset: gw-step; display: grid; gap: var(--ls-space-3); }
.gw-steps li {
  counter-increment: gw-step;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--ls-space-3);
  align-items: baseline;
  line-height: var(--ls-leading-relaxed);
}
.gw-steps li::before {
  content: counter(gw-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ls-bg-brand-soft);
  color: var(--ls-fg-brand);
  font-size: var(--ls-text-sm);
  font-weight: var(--ls-weight-bold);
  font-variant-numeric: tabular-nums;
  transform: translateY(-1px);
  align-self: start;
}

.gw-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--ls-radius-sm);
  background: var(--ls-warning-bg);
  font-size: var(--ls-text-sm);
  color: var(--ls-fg);
}
.gw-note .ls-icon { --ls-icon-size: 16px; flex: none; margin-top: 3px; color: var(--ls-warning-fg); }
.gw-note strong { margin-right: 4px; color: var(--ls-warning-fg); font-weight: var(--ls-weight-semibold); }

/* 내레이션 전문 — 글은 고르고 복사하기 쉽게 그냥 글로 두고, 시각만 누르는 버튼 */
.gw-script { margin: 0; display: grid; gap: 2px; }
.gw-script li {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: var(--ls-space-2);
  align-items: baseline;
  padding: 6px var(--ls-space-2) 6px 0;
  border-radius: var(--ls-radius-sm);
  line-height: var(--ls-leading-relaxed);
  transition: background-color var(--ls-dur-fast);
}
.gw-script li[aria-current] { background: var(--ls-bg-brand-soft); }
.gw-script__t {
  justify-self: start;
  min-height: 32px;
  margin: -4px 0;
  padding: 0 var(--ls-space-2);
  border: 0;
  border-radius: var(--ls-radius-xs);
  background: transparent;
  color: var(--ls-fg-brand);
  font: inherit;
  font-size: var(--ls-text-sm);
  font-weight: var(--ls-weight-semibold);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.gw-script__t:hover { text-decoration: underline; text-underline-offset: 3px; }
.gw-script__text { color: var(--ls-fg); }

/* --------------------------------------------------------------------------
   3-2. 질문형 소제목과 답 · 기준표 · 참고 문헌 (보강 편 — guide-pages.mjs ENRICH)
   질문(H2) 바로 아래 첫 문단이 답이다. 답은 조금 크게·진하게, 왼쪽에 브랜드 눈금선 — 훑어볼 때 답만 읽어도 되게.
   -------------------------------------------------------------------------- */
.gw-qa { gap: var(--ls-space-3); scroll-margin-top: calc(var(--ls-header-h, 64px) + var(--ls-space-4)); }
.gw-qa__answer {
  margin: 0;
  padding-left: var(--ls-space-4);
  border-left: 3px solid var(--ls-brand);
  font-size: var(--ls-text-lg);
  font-weight: var(--ls-weight-medium);
  line-height: var(--ls-leading-relaxed);
  color: var(--ls-fg);
  text-wrap: pretty;
}
.gw-qa__p { margin: 0; line-height: var(--ls-leading-relaxed); color: var(--ls-fg); text-wrap: pretty; }
.gw-qa__src { margin: 0; font-size: var(--ls-text-xs); line-height: var(--ls-leading-normal); color: var(--ls-fg-muted); }
.gw-qa__more { margin: 0; font-size: var(--ls-text-sm); }
@media (max-width: 639px) {
  .gw-qa__answer { font-size: var(--ls-text-md); padding-left: var(--ls-space-3); }
}

/* 기준표 — 성별마다 표 하나. 좁은 화면에서는 표 틀 안에서만 옆으로 밀린다(페이지는 가로로 밀리지 않는다) */
.gw-table { display: grid; gap: var(--ls-space-3); margin: var(--ls-space-2) 0 0; min-width: 0; }
.gw-table__cap { font-size: var(--ls-text-sm); font-weight: var(--ls-weight-semibold); color: var(--ls-fg); }
.gw-table__wrap { max-width: 100%; }
.gw-table__t { border-collapse: collapse; font-variant-numeric: tabular-nums; }
/* 숫자 기준표는 한 줄로, 글로 된 표(기록 읽는 법)는 낱말 단위로 줄을 바꾼다 */
.gw-table__t th, .gw-table__t td { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; vertical-align: top; }
.gw-table--norms .gw-table__t :is(th, td) { white-space: nowrap; vertical-align: middle; }
.gw-table__t tbody th { font-weight: var(--ls-weight-semibold); color: var(--ls-fg); background: transparent; border-bottom: 1px solid var(--ls-border-subtle); }
.gw-table__t tbody tr:last-child th { border-bottom: 0; }
.gw-table__sub {
  caption-side: top;
  padding: 10px 16px;
  text-align: left;
  font-size: var(--ls-text-sm);
  font-weight: var(--ls-weight-bold);
  color: var(--ls-fg-brand);
  border-bottom: 1px solid var(--ls-border);
}
.gw-table__notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: var(--ls-text-xs); line-height: var(--ls-leading-normal); color: var(--ls-fg-muted); }
.gw-table__notes li { position: relative; padding-left: 0.9em; }
.gw-table__notes li::before { content: "·"; position: absolute; left: 0; color: var(--ls-fg-subtle); }
@media (max-width: 639px) {
  .gw-table__t th, .gw-table__t td { padding: 9px 10px; font-size: var(--ls-text-xs); }
  .gw-table__sub { padding: 8px 10px; }
  /* 기준표: 폰 폭에 들어가게 — 등급 이름은 두 줄까지, 칸의 '이상·미만'은 표 제목 규칙에 맡긴다(마지막 칸 '매우 부족'만 남긴다) */
  .gw-table--norms .gw-table__t th, .gw-table--norms .gw-table__t td { padding: 8px 6px; }
  .gw-table--norms .gw-table__t thead th { white-space: normal; word-break: keep-all; vertical-align: bottom; }
  .gw-table--norms .gw-table__t :is(th, td):first-child { padding-left: 10px; }
  .gw-table--norms .gw-table__t td:not(:last-child) .gw-table__rel { display: none; }
}

/* 8자 보행 코스 배치도 (components/Figure8Course.astro) */
.gw-course { display: grid; gap: var(--ls-space-2); margin: var(--ls-space-2) 0 0; padding: var(--ls-space-4); border: 1px solid var(--ls-border); border-radius: var(--ls-radius-lg); background: var(--ls-surface); }
.gw-course__svg { display: block; width: 100%; max-width: 30rem; height: auto; margin-inline: auto; overflow: visible; }
.gw-course__route { fill: none; stroke: var(--ls-fg-brand); stroke-width: 1.5; stroke-dasharray: 4 5; opacity: 0.5; }
.gw-course__base { stroke: var(--ls-border-strong); stroke-width: 1.5; stroke-dasharray: 2 4; }
.gw-course__dim { stroke: var(--ls-fg); stroke-width: 1.5; }
.gw-course__cone { fill: var(--ls-accent); }
.gw-course__chair { fill: var(--ls-brand); }
.gw-course__chair-back { fill: var(--ls-brand-active); }
.gw-course__tagbg { fill: var(--ls-surface); }
.gw-course__tag { fill: var(--ls-fg); font-size: 17px; font-weight: var(--ls-weight-bold); font-variant-numeric: tabular-nums; }
.gw-course__label { fill: var(--ls-fg-muted); font-size: 15px; }
.gw-course__cap { font-size: var(--ls-text-sm); line-height: var(--ls-leading-normal); color: var(--ls-fg-muted); }

.gw-refs { gap: var(--ls-space-3); padding-top: var(--ls-space-6); border-top: 1px solid var(--ls-border); }
.gw-refs__list { margin: 0; padding-left: 1.4em; display: grid; gap: var(--ls-space-2); font-size: var(--ls-text-sm); line-height: var(--ls-leading-normal); color: var(--ls-fg-muted); overflow-wrap: anywhere; }
.gw-refs__meta { margin: 0; font-size: var(--ls-text-xs); color: var(--ls-fg-muted); }
.gw-refs__meta code { font-family: var(--ls-font-mono); font-size: inherit; color: var(--ls-fg); }

/* --------------------------------------------------------------------------
   4. 다른 영상 · 함께 볼 곳
   -------------------------------------------------------------------------- */
.gw-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ls-space-3); }
.gw-pager__link {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: var(--ls-space-3) var(--ls-space-4);
  border: 1px solid var(--ls-border);
  border-radius: var(--ls-radius-md);
  background: var(--ls-surface);
  color: var(--ls-fg);
  text-decoration: none;
  transition: border-color var(--ls-dur-fast);
}
.gw-pager__link:hover { border-color: var(--ls-border-strong); }
.gw-pager__link--next { grid-column: 2; text-align: right; }
.gw-pager__dir { font-size: var(--ls-text-xs); color: var(--ls-fg-muted); }
.gw-pager__name { font-size: var(--ls-text-sm); font-weight: var(--ls-weight-semibold); word-break: keep-all; }

.gw-more { display: grid; gap: var(--ls-space-3); padding-top: var(--ls-space-6); border-top: 1px solid var(--ls-border); }
.gw-more ul { margin: 0; display: grid; gap: var(--ls-space-2); }
.gw-more a { font-size: var(--ls-text-sm); }

/* --------------------------------------------------------------------------
   5. 모음 페이지 (tests.html)
   -------------------------------------------------------------------------- */
.gw-hub .gw-head { margin-bottom: var(--ls-space-6); }
.gw-hub__group { display: grid; gap: var(--ls-space-4); margin-top: var(--ls-space-8); }
.gw-hub__head { display: grid; gap: var(--ls-space-2); max-width: 46rem; }
.gw-hub .gw-more { margin-top: var(--ls-space-12); max-width: 46rem; }


/* --------------------------------------------------------------------------
   6. 인쇄 — 영상·구간·링크는 빼고 순서·내레이션만
   -------------------------------------------------------------------------- */
@media print {
  .gw-stage, .gw-pager, .gw-more, .gw-crumbs, .gw-script__t { display: none !important; }
  .gw-script li { grid-template-columns: minmax(0, 1fr); }
}
