/* CGF Portal onboarding manual.
 *
 * Served behind the same Access gate as the portal (/guide/). Uses the portal's design tokens
 * (/tokens.css) so the manual looks like the product it describes. The portal CSP forbids inline
 * styles, so every rule lives here. No raw hex, no hardcoded font sizes — scripts/check.mjs only
 * scans styles.css, but the design-system rules apply here all the same. */

html { background: var(--surface-sunken); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: var(--font-size-200);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
* { box-sizing: border-box; }
a { color: var(--text-info); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--background-brand-bold); }
code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--font-size-100);
  background: var(--background-neutral);
  border-radius: var(--radius-small);
  padding: 1px 5px;
}
kbd { border: 1px solid var(--border); box-shadow: 0 1px 0 var(--border); }

/* Layout: sticky table of contents on the left, article on the right. */
.guide-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.guide-toc {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  padding: var(--space-300) var(--space-200); border-right: 1px solid var(--border); background: var(--surface);
}
.guide-toc .brand { display: flex; align-items: center; gap: var(--space-100); margin-bottom: var(--space-300); text-decoration: none; color: inherit; }
.guide-toc .brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-medium);
  background: var(--background-brand-bold); color: var(--color-text-inverse); font-weight: var(--font-weight-bold);
}
.guide-toc .brand strong { display: block; font-size: var(--font-size-200); line-height: var(--line-tight); }
.guide-toc .brand small { display: block; color: var(--color-text-subtlest); font-size: var(--font-size-025); }
.guide-toc h2 { margin: var(--space-200) 0 var(--space-050); font-size: var(--font-size-025); font-weight: var(--font-weight-semibold); color: var(--color-text-subtlest); letter-spacing: 0.04em; text-transform: uppercase; }
.guide-toc ol { list-style: none; margin: 0; padding: 0; }
.guide-toc li a { display: block; padding: 5px var(--space-100); border-radius: var(--radius-medium); color: var(--color-text-subtle); text-decoration: none; font-size: var(--font-size-100); line-height: 1.45; }
.guide-toc li a:hover { background: var(--surface-hovered); color: var(--color-text); }
.guide-toc li a.active { background: var(--background-selected); color: var(--color-text-selected); font-weight: var(--font-weight-medium); }
.guide-toc li ol { margin-left: var(--space-150); }
.guide-toc li ol a { font-size: var(--font-size-050); padding-top: 3px; padding-bottom: 3px; }
.guide-toc-open { display: none; }
.guide-toc.open { display: block; }

.guide-main { padding: var(--space-400) var(--space-400) 120px; max-width: 980px; }
.guide-main > header.cover { margin-bottom: var(--space-400); }
.cover .eyebrow { color: var(--background-brand-bold); font-weight: var(--font-weight-semibold); font-size: var(--font-size-100); letter-spacing: 0.06em; }
.cover h1 { margin: var(--space-050) 0 var(--space-150); font-size: var(--font-size-500); line-height: var(--line-tight); letter-spacing: -0.01em; }
.cover .lede { font-size: var(--font-size-300); line-height: 1.55; color: var(--color-text-subtle); margin: 0 0 var(--space-200); max-width: 46em; }
.cover .meta { display: flex; flex-wrap: wrap; gap: var(--space-100) var(--space-300); color: var(--color-text-subtlest); font-size: var(--font-size-100); margin: 0; padding: 0; list-style: none; }

section.chapter { padding-top: var(--space-300); margin-top: var(--space-400); border-top: 1px solid var(--border); }
section.chapter > h2 { font-size: var(--font-size-400); line-height: var(--line-tight); margin: 0 0 var(--space-100); letter-spacing: -0.01em; }
section.chapter > h2 .num { color: var(--color-text-subtlest); font-weight: var(--font-weight-regular); margin-right: var(--space-100); }
section.chapter > .chapter-lede { color: var(--color-text-subtle); margin: 0 0 var(--space-300); max-width: 44em; }
h3 { font-size: var(--font-size-300); line-height: var(--line-tight); margin: var(--space-400) 0 var(--space-150); }
h4 { font-size: var(--font-size-200); margin: var(--space-300) 0 var(--space-100); }
p { margin: 0 0 var(--space-150); max-width: 44em; }
ul, ol { padding-left: 1.4em; margin: 0 0 var(--space-200); max-width: 44em; }
li { margin-bottom: var(--space-050); }
li > ul, li > ol { margin-top: var(--space-050); margin-bottom: var(--space-050); }

/* Screen names appear exactly as on screen, inside 「」. Give them a subtle chip so a reader can
 * scan for "where do I click" without the text turning into a sea of quotes. */
.ui { font-weight: var(--font-weight-medium); color: var(--color-text); white-space: nowrap; }

/* Workstream tags — colour carries the workstream meaning, text always accompanies it. */
.tag { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: var(--radius-pill); font-size: var(--font-size-050); font-weight: var(--font-weight-semibold); line-height: 1.6; vertical-align: middle; }
.tag-a1 { background: var(--accent-a1-soft); color: var(--accent-a1); }
.tag-a2 { background: var(--accent-a2-soft); color: var(--accent-a2); }
.tag-a3 { background: var(--accent-a3-soft); color: var(--accent-a3); }
.tag-org { background: var(--accent-org-soft); color: var(--accent-org); }
.tag-neutral { background: var(--background-neutral); color: var(--color-text-subtle); }
.tag-warn { background: var(--background-warning); color: var(--text-warning); }
.tag-ok { background: var(--background-success); color: var(--text-success); }
.tag-danger { background: var(--background-danger); color: var(--text-danger); }

/* Figures: flow charts and screen captures. */
figure { margin: var(--space-300) 0; }
figure.chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-large); padding: var(--space-200); overflow-x: auto; }
figure.chart img { display: block; max-width: 100%; height: auto; min-width: 720px; }
figure.capture { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-large); overflow: hidden; box-shadow: var(--shadow-card); }
figure.capture img { display: block; width: 100%; height: auto; }
figure figcaption { font-size: var(--font-size-100); color: var(--color-text-subtle); padding: var(--space-100) var(--space-150); border-top: 1px solid var(--border); line-height: 1.5; }
figure.chart figcaption { border-top: 0; padding: var(--space-150) 0 0; }
figure figcaption strong { color: var(--color-text); }

/* Step cards for 「어느 메뉴 → 어느 탭 → 무엇을 누르면 → 무엇이 나온다」. */
ol.steps { list-style: none; padding: 0; margin: var(--space-200) 0 var(--space-300); max-width: none; counter-reset: step; }
ol.steps > li { counter-increment: step; display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "num where" "num result"; column-gap: var(--space-150); row-gap: 2px; padding: var(--space-150) 0; border-top: 1px solid var(--border); }
ol.steps > li:last-child { border-bottom: 1px solid var(--border); }
ol.steps > li::before { grid-area: num; content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--background-brand-bold); color: var(--color-text-inverse); font-weight: var(--font-weight-semibold); font-size: var(--font-size-100); margin-top: 2px; }
ol.steps .step-where { grid-area: where; font-weight: var(--font-weight-semibold); display: block; }
ol.steps .step-result { grid-area: result; color: var(--color-text-subtle); display: block; }
ol.steps .step-result::before { content: "→ "; color: var(--color-text-subtlest); }
.path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.path > span { background: var(--background-neutral); border-radius: var(--radius-small); padding: 0 6px; font-weight: var(--font-weight-medium); font-size: var(--font-size-100); line-height: 1.7; }
.path > span + span::before { content: "›"; margin-right: 6px; color: var(--color-text-subtlest); font-weight: var(--font-weight-regular); }

/* Callouts. */
.callout { border-left: 3px solid var(--border); background: var(--surface); border-radius: var(--radius-medium); padding: var(--space-150) var(--space-200); margin: var(--space-200) 0; max-width: 46em; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout strong.label { display: block; font-size: var(--font-size-050); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: var(--space-050); }
.callout.tip { border-left-color: var(--background-brand-bold); } .callout.tip .label { color: var(--text-success); }
.callout.warn { border-left-color: var(--text-warning); background: var(--background-warning); } .callout.warn .label { color: var(--text-warning); }
.callout.info { border-left-color: var(--text-info); background: var(--background-info); } .callout.info .label { color: var(--text-info); }

/* Tables. */
table { border-collapse: collapse; width: 100%; margin: var(--space-200) 0 var(--space-300); font-size: var(--font-size-100); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-medium); }
th, td { text-align: left; vertical-align: top; padding: var(--space-100) var(--space-150); border-top: 1px solid var(--border); line-height: 1.55; }
thead th { background: var(--surface-sunken); color: var(--color-text-subtle); font-weight: var(--font-weight-semibold); border-top: 0; font-size: var(--font-size-050); letter-spacing: 0.02em; }
tbody tr:nth-child(even) td { background: var(--surface-sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compact td, table.compact th { padding: var(--space-050) var(--space-100); }
/* Column hints: without them the browser gives a 5-column table five near-equal slices and the
 * short label columns wrap two or three syllables per line. */
table.tasks th:nth-child(1), table.tasks td:nth-child(1) { white-space: nowrap; }
table.tasks th:nth-child(2), table.tasks td:nth-child(2) { min-width: 9.5em; }
table.tasks th:nth-child(3), table.tasks td:nth-child(3) { min-width: 16em; }
table.tasks th:nth-child(4), table.tasks td:nth-child(4) { min-width: 11em; }
table.tasks th:nth-child(5), table.tasks td:nth-child(5) { min-width: 8em; }
table.outcomes th:nth-child(1), table.outcomes td:nth-child(1) { white-space: nowrap; }
table.outcomes th:nth-child(3), table.outcomes td:nth-child(3) { min-width: 14em; }
table.sources th:nth-child(1), table.sources td:nth-child(1) { min-width: 11em; }
table.sources th:nth-child(3), table.sources td:nth-child(3) { min-width: 9em; }
table.sources .tag { display: block; width: max-content; margin-bottom: 4px; }
table.login th:nth-child(1), table.login td:nth-child(1) { min-width: 13em; }
table.login .phrase { white-space: normal; }
table.states th:nth-child(1), table.states td:nth-child(1) { white-space: nowrap; }
.phrase { font-weight: var(--font-weight-medium); white-space: nowrap; }

/* Persona scenario header. */
.persona { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--space-200); align-items: start; margin: var(--space-200) 0 var(--space-300); padding: var(--space-200); border-radius: var(--radius-large); border: 1px solid var(--border); background: var(--surface); }
.persona .avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: var(--font-weight-bold); font-size: var(--font-size-300); }
.persona .avatar.a1 { background: var(--accent-a1-soft); color: var(--accent-a1); }
.persona .avatar.a2 { background: var(--accent-a2-soft); color: var(--accent-a2); }
.persona .avatar.a3 { background: var(--accent-a3-soft); color: var(--accent-a3); }
.persona .avatar.org { background: var(--accent-org-soft); color: var(--accent-org); }
.persona h4 { margin: 0 0 var(--space-050); font-size: var(--font-size-200); }
.persona p { margin: 0; color: var(--color-text-subtle); font-size: var(--font-size-100); }
.persona .goal { color: var(--color-text); font-weight: var(--font-weight-medium); margin-top: var(--space-050); }

/* Menu map grid. */
.menu-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-150); margin: var(--space-200) 0 var(--space-300); }
.menu-map section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-large); padding: var(--space-150) var(--space-200); }
.menu-map h4 { margin: 0 0 var(--space-050); font-size: var(--font-size-050); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-subtlest); }
.menu-map ul { list-style: none; padding: 0; margin: 0; }
.menu-map li { padding: 3px 0; font-size: var(--font-size-100); display: flex; justify-content: space-between; gap: var(--space-100); }
.menu-map li small { color: var(--color-text-subtlest); text-align: right; }

/* Troubleshooting phrase table rows. */
.fix dt { font-weight: var(--font-weight-semibold); margin-top: var(--space-150); }
.fix dd { margin: 2px 0 0; color: var(--color-text-subtle); max-width: 44em; }

footer.guide-footer { margin-top: var(--space-400); padding-top: var(--space-200); border-top: 1px solid var(--border); color: var(--color-text-subtlest); font-size: var(--font-size-100); }

@media (max-width: 900px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-toc { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .guide-main { padding: var(--space-300) var(--space-200) 80px; }
  figure.chart img { min-width: 640px; }
  ol.steps > li { grid-template-columns: 30px minmax(0, 1fr); }
}
@media print {
  .guide-toc { display: none; }
  .guide-shell { display: block; }
  .guide-main { max-width: none; padding: 0; }
  section.chapter { break-before: page; }
  figure { break-inside: avoid; }
}
