/* 문서 페이지 스타일. 색 · 글꼴 · 간격 · 모서리는 site/design-tokens.md 토큰 (소개 페이지 site.css 와 같은 밝은 바탕, 파란색 한 가지).
   작은 글씨는 --ink-subtle 이상 (흰 바탕 대비 4.5:1 이상) */
:root {
  --primary: #1b5be6; --primary-hover: #1447bd;   /* --primary-hover 는 링크 글자색 (흰 바탕 대비 7.6:1) */
  --ink: #191f28; --ink-muted: #333d4b; --ink-subtle: #5b6573; --ink-tertiary: #b0b8c1;
  --canvas: #ffffff; --surface-1: #f9fafb; --surface-2: #f2f4f6; --surface-3: #e9ecef;
  --hairline: #e5e8eb; --hairline-strong: #d1d6db;
  --success: #0b7d43; --danger: #d92d33;
  --font-display: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-text: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --nav-h: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .rtest { display: grid } 등이 hidden 속성을 덮지 않게 */
html { color-scheme: light; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink-muted);
  font-family: var(--font-text); font-size: 16px; line-height: 1.75; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: break-word;
}
a { color: inherit; }
:focus-visible { outline: 2px solid rgb(27 91 230 / 0.55); outline-offset: 2px; }
/* 용어 풀이 (glossary.js): 링크와 구분되게 글자색은 그대로, 점선 밑줄만. 마우스를 올리면 뜻이 뜬다 */
abbr[title] { text-decoration: underline dotted; text-decoration-color: var(--ink-subtle); text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: help; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 50; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: var(--r-md); }
.skip:focus { top: 12px; }

/* 상단 바 */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hairline);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }
.mark { position: relative; width: 22px; height: 22px; border-radius: 7px; background: var(--primary); }
.mark::after { content: ""; position: absolute; inset: 6px 5px; border: 2px solid #fff; border-top-width: 3px; border-radius: 3px 3px 6px 6px; }
.crumb { font-size: 13px; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home { margin-left: auto; font-size: 13px; color: var(--ink-subtle); text-decoration: none; padding: 4px 10px; border-radius: var(--r-md); white-space: nowrap; }
.home:hover { color: var(--ink); background: var(--surface-2); }
.src { font-size: 13px; color: var(--ink-subtle); text-decoration: none; border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 4px 10px; white-space: nowrap; }
.src:hover { color: var(--ink); border-color: var(--hairline-strong); }

/* 3단: 문서 목록 · 본문 · 이 문서 목차 */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 220px; gap: 48px; max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.side, .toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; max-height: calc(100vh - var(--nav-h) - 48px); max-height: calc(100dvh - var(--nav-h) - 48px); overflow: auto; padding: 24px 0; }
.side nav { display: grid; gap: 2px; }
.side a { display: block; padding: 6px 10px; border-radius: var(--r-md); font-size: 14px; line-height: 1.4; color: var(--ink-subtle); text-decoration: none; }
.side a:hover { color: var(--ink); background: var(--surface-1); }
.side a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--primary); }
.side a:first-child { color: var(--ink); font-weight: 500; margin-bottom: 8px; }
.toc .eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 500; letter-spacing: 0.4px; color: var(--ink-subtle); }
.toc a { display: block; padding: 4px 0; font-size: 13px; line-height: 1.4; color: var(--ink-subtle); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.l3 { padding-left: 12px; font-size: 12.5px; color: var(--ink-subtle); }

/* 본문 */
.doc { min-width: 0; max-width: 820px; padding: 40px 0 120px; }
.doc > :first-child { margin-top: 0; }
.doc h1, .doc h2, .doc h3, .doc h4 { position: relative; font-family: var(--font-display); color: var(--ink); text-wrap: balance; }
.doc h1 { font-size: 36px; font-weight: 600; line-height: 1.2; letter-spacing: -0.8px; margin: 0 0 24px; }
.doc h2 { font-size: 26px; font-weight: 600; line-height: 1.25; letter-spacing: -0.5px; margin: 64px 0 16px; padding-top: 24px; border-top: 1px solid var(--hairline); }
.doc h3 { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -0.3px; margin: 40px 0 12px; }
.doc h4 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.anchor { position: absolute; left: -24px; width: 20px; color: var(--ink-tertiary); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h1:hover .anchor, .doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; }
.doc p { margin: 0 0 16px; }
/* 마지막 줄에 낱말 하나만 남지 않게 (2026-11-23 줄바꿈 점검) */
.doc p, .doc li, .doc td, .doc .lead { text-wrap: pretty; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a { color: var(--primary-hover); text-decoration: underline; text-decoration-color: rgb(20 71 189 / 0.3); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: currentColor; }
.doc a.anchor { color: var(--ink-tertiary); text-decoration: none; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li::marker { color: var(--ink-tertiary); }
.doc hr { border: 0; border-top: 1px solid var(--hairline); margin: 40px 0; }
.doc img { display: block; max-width: 100%; height: auto; margin: 16px 0; border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface-1); }
/* README 첫머리의 버튼 그림(docs/images/readme/btn-*.svg)은 GitHub 처럼 한 줄에 나란히 */
.doc a > img[src*="readme/btn-"] { display: inline-block; margin: 4px 2px; border: 0; border-radius: 0; background: none; }

.doc blockquote { margin: 0 0 20px; padding: 14px 18px; background: var(--surface-1); border: 1px solid var(--hairline); border-left: 3px solid var(--primary); border-radius: var(--r-md); color: var(--ink-muted); }
.doc blockquote p:last-child { margin-bottom: 0; }
.doc blockquote.callout { border-left-width: 4px; }
.doc blockquote.callout-tip { border-color: #c7d8ff; border-left-color: var(--primary); background: #f3f7ff; }
.doc blockquote.callout strong { color: var(--ink); }
.doc .callout-title { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.4px; color: var(--ink-subtle); }
.doc .callout-tip .callout-title { color: var(--primary-hover); }

/* 코드 */
.doc code { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 5px; color: var(--ink); word-break: break-all; }
.doc pre.code { margin: 0 0 20px; padding: 16px 18px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: auto; line-height: 1.6; }
.doc pre.code code { background: none; border: 0; padding: 0; font-size: 13px; color: var(--ink-muted); word-break: normal; white-space: pre; }
.doc pre.mermaid { margin: 0 0 20px; padding: 20px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); text-align: center; overflow: auto; color: transparent; }
.doc pre.mermaid[data-processed] { color: inherit; }

/* 표: 가로로 넘치면 표만 스크롤 */
.doc .table { margin: 0 0 24px; overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-lg); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
/* 머리글도 줄을 바꾼다: 긴 머리글(예: '테스트 (smoke / sanity / regression)')을 한 줄로 두면 그 칸만 넓어지고
   나머지 칸이 한두 단어씩 끊긴다 (2026-11-21, 포트폴리오 4-2 표). 한글은 낱말 단위로만 바꾼다 */
.doc th { text-align: left; font-weight: 600; color: var(--ink); background: var(--surface-2); }
/* 두 칸짜리 표(이름 | 설명)는 설명이 길어 첫 칸이 눌린다. 이름이 한 줄에 들어가게 첫 칸에 최소 폭 (8-1 표) */
.doc table:has(thead th:nth-child(2):last-child) td:first-child { min-width: 8.5em; }
/* 첫 칸의 짧은 이름(build-docs 가 nw 를 붙인다)과 첫 칸 맨 앞의 굵은 이름은 한 줄로 */
.doc td.nw, .doc td:first-child > strong:first-child { white-space: nowrap; }
/* 칸이 4개 이상인 표의 둘째 칸(대개 설명)은 코드가 많은 옆 칸에 눌려 5~6줄로 접히지 않게 최소 폭 */
.doc table:has(thead th:nth-child(4)) td:nth-child(2) { min-width: 11em; }
/* 표 안의 긴 코드 이름(HVAC_TEMPERATURE_SET)은 글자 중간에서 자르지 않는다 */
.doc td code { word-break: keep-all; overflow-wrap: break-word; }   /* 코드 안의 한글(예: '기대값')도 낱말 중간에서 자르지 않는다 */
.doc th, .doc td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:hover td { background: var(--surface-1); }
.doc td img { margin: 0; }

/* 접기 */
.doc details { margin: 0 0 16px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); }
.doc summary { cursor: pointer; padding: 12px 16px; color: var(--ink); font-weight: 500; list-style-position: inside; }
.doc summary:hover { background: var(--surface-2); border-radius: var(--r-lg); }
.doc details[open] summary { border-bottom: 1px solid var(--hairline); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.doc details > :not(summary) { margin-left: 16px; margin-right: 16px; }
.doc details > :not(summary):first-of-type { margin-top: 16px; }

.ok { filter: saturate(0.9); }

/* 좁은 화면: 목차 숨김 → 문서 목록을 위로 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .layout { display: block; padding: 0 16px; }
  .side { position: static; max-height: none; padding: 16px 0 0; border-bottom: 1px solid var(--hairline); }
  .side nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; }
  .side a { white-space: nowrap; background: var(--surface-1); }
  .side a:first-child { margin-bottom: 0; }
  .doc { padding-top: 24px; }
  .doc h1 { font-size: 28px; }
  .doc h2 { font-size: 22px; margin-top: 48px; }
  .crumb { display: none; }
  .top { padding: 0 16px; }
}

/* ---------------- 문서 → 테스트 결과 링크 ---------------- */
.doc a.test-link { text-decoration: none; }
.doc a.test-link code { border-color: rgb(27 91 230 / 0.35); color: var(--primary-hover); }
.doc a.test-link:hover code { background: rgb(27 91 230 / 0.1); }

/* ---------------- 테스트 결과 페이지 ---------------- */
.layout.wide { grid-template-columns: 220px minmax(0, 1fr); }
.doc.results { max-width: none; container-type: inline-size; }
.doc.wide-doc { max-width: 1200px; }
.doc.wide-doc td code { white-space: nowrap; }
.jump { height: 32px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--hairline-strong); background: var(--surface-1); color: var(--ink-muted); font: 500 13px var(--font-text); }
.doc .lead { font-size: 17px; color: var(--ink-muted); max-width: 720px; }

.device-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 24px 0 28px; }
.device-card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px 20px; }
.device-card .eyebrow { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.4px; color: var(--ink-subtle); }
.device-model { margin: 2px 0 12px !important; font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); }
/* 실행·앱 / 시간·게이트를 두 줄로: 네 칸을 한 줄에 두면 좁은 카드에서 날짜와 버전이 꺾인다 */
.device-card dl { display: grid; grid-template-columns: repeat(2, max-content); gap: 10px 32px; margin: 14px 0 0; }
.device-note { margin: 12px 0 0 !important; font-size: 13px; line-height: 1.5; color: var(--ink-muted); }
.device-card dt { font-size: 12px; color: var(--ink-subtle); }
.device-card dd { margin: 0; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gate-pass { color: var(--success) !important; }
.gate-fail { color: var(--danger) !important; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 9999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-muted); border: 1px solid var(--hairline-strong); }
.pill.p-passed { background: #e7f6ed; color: #0b7d43; border-color: #b9e3c9; }
.pill.p-flaky, .pill.p-xpassed { background: #fff3df; color: #8a5000; border-color: #f5d49a; }
.pill.p-failed, .pill.p-error { background: #fdeeee; color: #c42127; border-color: #f5c2c4; }
.pill.p-xfailed { background: #ecf2ff; color: var(--primary-hover); border-color: #c7d8ff; }

.filters { position: sticky; top: var(--nav-h); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 8px; padding: 12px 0; background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hairline); }
.chip { height: 32px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--hairline-strong); background: var(--surface-1);
  color: var(--ink-muted); font: 500 13px var(--font-text); cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--ink-subtle); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.only-bad { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.only-bad input { accent-color: var(--primary); width: 16px; height: 16px; }
.filter-count { margin-left: auto; margin-right: 4px; font-size: 13px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.empty-note { color: var(--ink-subtle); padding: 32px 0; }

/* 첫 화면 요구 역량 목차에서 ?req= 로 들어왔을 때 */
.req-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin: 0 0 12px; padding: 18px 20px;
  border: 1px solid #c7d8ff; border-radius: var(--r-lg); background: #ecf2ff; scroll-margin-top: calc(var(--nav-h) + 16px); }
.req-copy { flex: 1 1 420px; min-width: 0; }
.doc .req-eyebrow { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.4px; color: var(--primary-hover); }
.doc .req-title { margin: 2px 0 6px; font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.doc .req-note { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-muted); }
.doc .req-note a { color: var(--primary-hover); }
.req-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.req-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--hairline-strong);
  background: var(--surface-1); color: var(--ink); font: 500 13px var(--font-text); text-decoration: none; white-space: nowrap; cursor: pointer; }
.req-btn:hover { border-color: var(--primary); }

.rfile { scroll-margin-top: calc(var(--nav-h) + 64px); }
.doc .rlead h2 { margin-top: 24px; font-family: var(--font-text); font-size: 18px; }
.doc .rfile h2 { margin-top: 48px; display: flex; align-items: baseline; gap: 10px; font-family: var(--font-mono); font-size: 20px; letter-spacing: 0; }
.rfile-count { font-family: var(--font-text); font-size: 13px; font-weight: 500; color: var(--ink-subtle); }
.doc .rfile-title { color: var(--ink-subtle); margin-bottom: 20px; }

.rtest { scroll-margin-top: calc(var(--nav-h) + 64px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: 12px 28px; padding: 20px 0 22px; border-top: 1px solid var(--hairline); }
.rtest-text { min-width: 0; }
.rtest.is-target { animation: target-flash 2.4s ease-out; border-radius: var(--r-lg); }
@keyframes target-flash { 0%, 30% { background: rgb(27 91 230 / 0.08); box-shadow: 0 0 0 12px rgb(27 91 230 / 0.08); } 100% { background: transparent; box-shadow: 0 0 0 12px transparent; } }
.rtest-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc .rtest-name { text-decoration: none; }
.doc .rtest-name code { font-size: 14px; color: var(--ink); background: none; border: 0; padding: 0; }
.doc .rtest-name:hover code { color: var(--primary-hover); }
.mark-chip { font-size: 11px; font-weight: 500; letter-spacing: 0.3px; color: var(--ink-subtle); border: 1px solid var(--hairline-strong); border-radius: 4px; padding: 1px 6px; }
.doc .rtest-doc { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-muted); }

.case + .case { margin-top: 14px; }
.doc .case-param { margin: 0 0 6px; }
.doc .case-param code { font-size: 12px; color: var(--ink-subtle); }
.case-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shot-cell { min-width: 0; }
.shot { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface-1); cursor: zoom-in; }
.shot-aaos { aspect-ratio: 4 / 3; }
.shot-mock { aspect-ratio: 16 / 10; }
.shot-fold { aspect-ratio: 2152 / 1536; }
/* 기기가 셋이면(폴드 추가) 화면 칸을 셋으로, 화면 열도 넓게 */
.rtest:has(.shot-cell:nth-child(3)) { grid-template-columns: minmax(0, 1fr) minmax(0, 780px); }
.case-shots:has(> .shot-cell:nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shot:hover { border-color: var(--primary); }
.doc .shot img { width: 100%; height: 100%; object-fit: cover; margin: 0; border: 0; border-radius: 0; }
.no-shot { display: grid; place-items: center; cursor: default; padding: 12px; }
.doc .no-shot p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-subtle); text-align: center; }
.cell-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
.cell-device { color: var(--ink-subtle); }
.cell-time { color: var(--ink-subtle); font-variant-numeric: tabular-nums; margin-left: auto; }
.doc .cell-measure { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.doc .cell-signals { margin: 4px 0 0; display: grid; gap: 2px; }
.doc .cell-signals code { font-size: 11px; color: var(--ink-muted); background: none; padding: 0; overflow-wrap: anywhere; }
.shot-cell.is-empty { display: grid; align-content: start; }
.doc .cell-note { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-subtle); }
.doc .generated { margin-top: 48px; font-size: 13px; color: var(--ink-subtle); }

#viewer { max-width: min(1200px, 94vw); width: 100%; padding: 0; border: 1px solid var(--hairline-strong); border-radius: var(--r-lg); background: var(--surface-1); color: var(--ink); }
#viewer::backdrop { background: rgb(0 0 0 / 0.78); }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--hairline); }
.viewer-bar p { margin: 0; flex: 1; font-size: 13px; color: var(--ink-muted); }
.viewer-close { height: 32px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--hairline-strong); background: var(--surface-2); color: var(--ink); font: 500 13px var(--font-text); cursor: pointer; }
#viewer img { display: block; width: 100%; height: auto; max-height: calc(94vh - 60px); object-fit: contain; margin: 0; border: 0; border-radius: 0; background: #0a0a0a; }

@container (max-width: 860px) {
  .rtest { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 1100px) {
  .rtest:has(.shot-cell:nth-child(3)) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  /* 손가락으로 누르는 화면에서는 필터 칩, 이동, 역량 항목 버튼, 닫기를 44px 로 (데스크톱 32px) */
  .jump, .chip, .req-btn, .viewer-close { height: 44px; }
  .case-shots, .case-shots:has(> .shot-cell:nth-child(3)) { grid-template-columns: 1fr; }
  .filters { top: var(--nav-h); }
  .filter-count { margin-left: 0; width: 100%; }
}
