/* 교재 스타일(textbook/assets/style.css)에서 본문 부품만 가져온 것. build.py 가 만든다. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1d1d1f;
  --muted: #5f6368;
  --border: #e2ded6;
  --accent: #2c5d8f;
  --accent-soft: #e6eef7;
  --warn: #a4501b;
  --warn-soft: #fbefe5;
  --ok: #2f6b3c;
  --ok-soft: #e8f2ea;
  --code-bg: #f6f4ef;
  --code-text: #24292f;
  --tok-comment: #6a737d;
  --tok-keyword: #a3195b;
  --tok-string: #1f6b3a;
  --tok-func: #6639ba;
  --tok-class: #8a4b08;
  --tok-number: #0b5c99;
  --tok-deco: #b3561d;
  --part-create: #2c5d8f;
  --part-struct: #2f6b3c;
  --part-behave: #8a3b6b;
  --ans-bg: #fbe28a;
  --radius: 10px;
  --font-body: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --font-head: "Noto Serif KR", "Noto Sans KR", serif;
  --font-code: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
.callout { border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; background: var(--surface-2); border: 1px solid var(--border); }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.ok { background: var(--ok-soft); border-color: transparent; }
.callout > :first-child { margin-top: 0; } .callout > :last-child { margin-bottom: 0; }
.callout .label { font-weight: 700; display: block; margin-bottom: 4px; }
/* 요약 판 ↔ 참고용 긴 버전 안내 줄 */
.callout.full-ref { background: var(--accent-soft); border-color: transparent; font-size: .95em; padding: 10px 16px; }
.callout.full-ref a { font-weight: 700; }
.principles { margin: 24px 0; padding: 16px 22px 18px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); }
.principles .label { display: block; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.principles ol { margin: 0; padding-left: 1.5em; }
.principles li { margin: 6px 0; font-weight: 700; font-size: 1.05em; }

/* 표 */
.table-wrap { overflow-x: auto; margin: 20px 0; }
table { border-collapse: collapse; width: 100%; font-size: .93em; }
th, td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }

/* ---- 코드 ---- */
figure { margin: 22px 0; }
figure.code { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--code-bg); }
figure.code figcaption {
  display: flex; align-items: center; gap: 8px; font: 12.5px/1.4 var(--font-code); color: var(--muted);
  padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
figure.code figcaption .copy {
  margin-left: auto; font: inherit; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer;
}
pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.65 var(--font-code); color: var(--code-text); tab-size: 4; }
pre code { font-size: inherit; background: none; padding: 0; }
.content > pre, .exercise pre:not(figure pre) { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); margin: 18px 0; }
.missing-src { border: 2px dashed var(--warn); color: var(--warn); padding: 12px; border-radius: var(--radius); }

/* 문법 강조 토큰 규칙(.token.*)은 pyrun.css 에 있다(교재·학습지 공용). 색 변수 --tok-* 는 위 :root 에서 정의한다. */

/* ---- UML 다이어그램 ---- */
figure.diagram { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
figure.diagram svg { width: 100%; height: auto; max-width: 720px; font-family: var(--font-code); }
figure.diagram figcaption, figure > figcaption.caption { color: var(--muted); font-size: .88em; margin-top: 10px; }
.uml-class rect { fill: var(--surface-2); stroke: var(--text); stroke-width: 1.2; rx: 4; }
.uml-class line { stroke: var(--text); stroke-width: 1; }
.uml-class.highlight rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.8; }
.uml-name { fill: var(--text); font-size: 14px; font-weight: 600; text-anchor: middle; }
.uml-abstract { font-style: italic; }
.uml-stereo { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.uml-member { fill: var(--text); font-size: 12px; }
.uml-assoc, .uml-inherit, .uml-dep, .uml-compose { fill: none; stroke: var(--text); stroke-width: 1.3; }
.uml-dep { stroke-dasharray: 5 4; }
.uml-impl { fill: none; stroke: var(--text); stroke-width: 1.3; stroke-dasharray: 5 4; }
.uml-note { fill: var(--muted); font-size: 12px; font-family: var(--font-body); }
.uml-label { fill: var(--muted); font-size: 11.5px; }
/* 코드 지도(긴 코드 앞 구조도): 클래스는 uml-class, 모듈 함수는 uml-func, 문제 지점은 .warn, 묶음은 uml-group, 읽는 순서는 uml-step */
.uml-class.warn rect { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.8; }
.uml-func rect { fill: var(--surface); stroke: var(--text); stroke-width: 1.2; rx: 16; }
.uml-func.highlight rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.8; }
.uml-func.warn rect { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.8; }
.uml-group rect { fill: none; stroke: var(--muted); stroke-width: 1.1; stroke-dasharray: 3 4; rx: 8; }
.uml-step circle { fill: var(--accent); }
.uml-step text { fill: var(--surface); font-size: 11px; font-weight: 700; text-anchor: middle; }
svg .marker-fill { fill: var(--text); stroke: var(--text); }
svg .marker-hollow { fill: var(--surface); stroke: var(--text); stroke-width: 1.2; }
dfn.term { font-style: normal; font-weight: 700; text-decoration: underline dotted var(--accent); text-underline-offset: 4px; cursor: help; }
dfn.term:target { background: var(--accent-soft); border-radius: 4px; }
/* ---- 읽기 질문의 답이 되는 본문 문구 <mark class="ans"> : 글자 아래쪽 절반만 옅게 칠한 형광펜 띠 + 약간 굵게 ---- */
mark.ans {
  background: linear-gradient(transparent 52%, var(--ans-bg) 52%, var(--ans-bg) 94%, transparent 94%);
  color: inherit; font-weight: 600; padding: 0 .1em; margin: 0 -.1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
mark.ans code { font-weight: 500; }
@media print { mark.ans { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
