/* limjt 정적 사본의 화면 스타일. `print-style.ts` 와 같은 클래스(export/html.ts 가 내는 것)를
   화면용으로 다시 칠한다 — 종이용 규칙(@page·break-*)은 여기 뜻이 없어서 공유하지 않는다. */

:root {
  --bg: #ffffff;
  --bg-soft: #fafaf9;
  --bg-code: #f5f5f4;
  --fg: #1c1917;
  --fg-soft: #57534e;
  --fg-mute: #78716c;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --link: #1d4ed8;
  --notice-bg: #f5f5f4;
  --current: #e7e5e4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1917;
    --bg-soft: #232020;
    --bg-code: #292524;
    --fg: #e7e5e4;
    --fg-soft: #c4bfbb;
    --fg-mute: #a8a29e;
    --line: #3a3532;
    --line-strong: #4a4440;
    --link: #93b4ff;
    --notice-bg: #292524;
    --current: #3a3532;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1917;
  --bg-soft: #232020;
  --bg-code: #292524;
  --fg: #e7e5e4;
  --fg-soft: #c4bfbb;
  --fg-mute: #a8a29e;
  --line: #3a3532;
  --line-strong: #4a4440;
  --link: #93b4ff;
  --notice-bg: #292524;
  --current: #3a3532;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: break-word;
}
code, pre { font-family: "D2Coding", ui-monospace, SFMono-Regular, Menlo, monospace; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- 틀 ---------------------------------------------------------------- */

.notice {
  padding: 0.5rem 1rem;
  background: var(--notice-bg);
  border-bottom: 1px solid var(--line);
  color: var(--fg-mute);
  font-size: 0.82rem;
  text-align: center;
}

.shell {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}
.side {
  flex: none;
  width: 260px;
  padding: 1.5rem 0.75rem 3rem 1rem;
  border-right: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.5;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}
.side ul { list-style: none; margin: 0; padding: 0; }
.side ul ul { padding-left: 0.9rem; }
.side li { margin: 1px 0; }
.side a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 0.35rem;
  color: var(--fg-soft);
}
.side a:hover { background: var(--bg-code); text-decoration: none; }
.side a[aria-current="page"] { background: var(--current); color: var(--fg); font-weight: 600; }
.side summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.side summary::-webkit-details-marker { display: none; }
.side summary::before {
  content: "▸";
  flex: none;
  width: 1rem;
  color: var(--fg-mute);
  font-size: 0.75rem;
}
.side details[open] > summary::before { content: "▾"; }
.side summary > a { flex: 1; min-width: 0; }
.side li:not(:has(details)) > a { margin-left: 1rem; }

.side-toggle { display: none; }

.doc {
  flex: 1;
  min-width: 0;
  max-width: 820px;
  padding: 2rem 2.5rem 5rem;
}

@media (max-width: 860px) {
  .shell { display: block; }
  .side {
    position: static;
    width: auto;
    max-height: none;
    padding: 0.5rem 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .side-tree { display: none; }
  .side-toggle { display: block; }
  .side-toggle > summary { padding: 0.4rem 0; font-weight: 600; color: var(--fg-soft); }
  .side-toggle > summary::before { content: "☰"; width: 1.4rem; font-size: 0.9rem; }
  .side-toggle[open] > summary::before { content: "✕"; }
  .doc { padding: 1.25rem 16px 4rem; }
}

/* --- 본문 (export/html.ts 의 출력) -------------------------------------- */

h1, h2, h3, h4, h5, h6 { line-height: 1.35; margin: 1.6em 0 0.5em; }
h1 { font-size: 1.9rem; margin-top: 0; padding-bottom: 0.3em; border-bottom: 1px solid var(--line); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4, h5, h6 { font-size: 1rem; }
p { margin: 0.6em 0; }

ul, ol { margin: 0.6em 0; padding-left: 1.6rem; }
li { margin: 0.2em 0; }
li > p { margin: 0.2em 0; }

blockquote { margin: 0.9em 0; padding: 0.1em 0 0.1em 1rem; border-left: 3px solid var(--line-strong); color: var(--fg-soft); }
hr { border: none; border-top: 1px solid var(--line-strong); margin: 1.6em 0; }

code { background: var(--bg-code); border-radius: 0.25rem; padding: 0.1em 0.35em; font-size: 0.88em; }
pre {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }

.doc table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.93rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line-strong); padding: 0.4rem 0.6rem; vertical-align: top; text-align: left; }
th { background: var(--bg-code); font-weight: 600; }
table p { margin: 0; }

figure { margin: 1.2em 0; text-align: center; }
img { max-width: 100%; height: auto; border-radius: 0.3rem; }
figcaption { margin-top: 0.4em; font-size: 0.85rem; color: var(--fg-mute); }
.image-missing { padding: 0.5rem 0.75rem; border: 1px dashed var(--line-strong); border-radius: 0.4rem; color: var(--fg-mute); font-size: 0.88rem; }

.mermaid-block { margin: 1.2em 0; text-align: center; overflow-x: auto; }
.mermaid-block svg { max-width: 100%; height: auto; }
.mermaid-block pre.mermaid { text-align: left; background: none; border-style: dashed; }
.mermaid-block[data-rendered="1"] pre.mermaid { display: none; }

.card { margin: 1em 0; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--bg-soft); }
.card-label { font-size: 0.75rem; font-weight: 600; color: var(--fg-mute); margin-bottom: 0.4rem; }
.childpages-list { margin: 0; padding-left: 1.1rem; }
.childpages-list li { margin: 0.15rem 0; }
.link-title, .file-name { font-weight: 600; }
.link-desc { color: var(--fg-soft); font-size: 0.9rem; }
.link-url, .file-url, .file-meta { font-size: 0.78rem; color: var(--fg-mute); overflow-wrap: anywhere; }

.fold { margin: 1.2em 0; border: 1px solid var(--line); border-radius: 0.5rem; }
.fold-summary { padding: 0.5rem 0.9rem; background: var(--bg-code); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 0.92rem; }
.fold-body { padding: 0.6rem 0.9rem; }

sup.fn-ref a::before { content: "["; }
sup.fn-ref a::after { content: "]"; }
ol.footnotes { list-style: none; margin-top: 2em; padding: 1em 0 0; border-top: 1px solid var(--line-strong); font-size: 0.86rem; color: var(--fg-soft); }
ol.footnotes li { display: flex; gap: 0.4rem; }
ol.footnotes p { margin: 0; }

.byline { margin: 0.2em 0 1.6em; font-size: 0.85rem; color: var(--fg-mute); }
