/* 디자인 토큰: www/index.html과 같은 값 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Nanum+Gothic+Coding&display=swap");
:root {
  --bg: #f6f7fb; --bg-elev: #ffffff; --surface: #eef1f7; --border: #d6dce8;
  --text: #141a26; --text-dim: #566178; --text-faint: #8a93a8;
  --accent: #0a84c6; --accent-soft: rgba(10, 132, 198, 0.12);
  --accent-2: #7a4ce0; --accent-2-soft: rgba(122, 76, 224, 0.12);
  --radius: 14px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --bg-elev: #121826; --surface: #171f30; --border: #273248;
    --text: #e6ebf5; --text-dim: #9aa6bf; --text-faint: #69748c;
    --accent: #38b6f5; --accent-soft: rgba(56, 182, 245, 0.14);
    --accent-2: #a585ff; --accent-2-soft: rgba(165, 133, 255, 0.14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --bg-elev: #121826; --surface: #171f30; --border: #273248;
  --text: #e6ebf5; --text-dim: #9aa6bf; --text-faint: #69748c;
  --accent: #38b6f5; --accent-soft: rgba(56, 182, 245, 0.14);
  --accent-2: #a585ff; --accent-2-soft: rgba(165, 133, 255, 0.14);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--nav-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.75; word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--bg-elev); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; color: var(--text); }
.skip-link:focus { top: 12px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-size: 18px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 28px; height: 28px; flex: none; }
.crumb { color: var(--text-faint); font-family: var(--mono); font-size: 14px; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }

/* layout */
.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 32px; padding: 0 24px; }
.side, .toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; padding: 24px 0; }
.side-h { font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px 10px; font-size: 15px; }
.docnav { display: flex; flex-direction: column; gap: 4px; }
.docnav a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; color: var(--text); border: 1px solid transparent; }
.docnav a:hover { text-decoration: none; background: var(--surface); }
.docnav a[aria-current="page"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.docnav a[aria-current="page"] .lab { color: var(--accent); }
.docnav .lab { font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.docnav .desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.4; }
.toc-h { font-size: 12.5px; font-weight: 700; color: var(--text-faint); margin-bottom: 8px; }
.toc a { display: block; font-size: 13px; line-height: 1.45; padding: 4px 0 4px 10px; color: var(--text-dim); border-left: 2px solid var(--border); }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }

/* content */
.content { min-width: 0; padding: 40px 0 64px; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; color: var(--accent); font-weight: 600; }
.page-title { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.2; letter-spacing: -0.03em; margin: 8px 0 24px; }
.doc h2 { font-size: 24px; letter-spacing: -0.02em; margin: 48px 0 14px; padding-top: 20px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 19px; letter-spacing: -0.01em; margin: 32px 0 10px; }
.doc h4 { font-size: 16.5px; margin: 24px 0 8px; }
.doc h2:first-child { margin-top: 8px; border-top: 0; padding-top: 0; }
.doc h2, .doc h3 { position: relative; }
.doc .anchor { position: absolute; left: -0.9em; opacity: 0; color: var(--text-faint); font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; text-decoration: none; }
.doc p, .doc ul, .doc ol { margin: 10px 0; }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin: 3px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }
.doc strong { font-weight: 700; color: color-mix(in srgb, var(--text) 92%, var(--accent)); }
.doc hr { border: 0; border-top: 1px dashed var(--border); margin: 40px 0; }
.doc hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }
.doc blockquote { margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--accent-2); background: var(--accent-2-soft); border-radius: 0 10px 10px 0; color: var(--text); }
.doc blockquote p { margin: 4px 0; }
.doc code { font-family: var(--mono); font-size: .86em; background: var(--surface); padding: 1px 6px; border-radius: 6px; }
.doc pre { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
/* 한글이 섞인 ASCII 그림 정렬: 한글이 영문의 정확히 2배 폭인 고정폭 글꼴 사용 */
.doc pre code { background: none; padding: 0; font-size: 13px; white-space: pre; font-family: "Nanum Gothic Coding", var(--mono); }
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.55; }
.doc th, .doc td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; min-width: 90px; }
.doc th { background: var(--surface); font-weight: 700; white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }
.doc td:first-child { font-weight: 600; }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pn { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--text); font-weight: 700; }
.pn small { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.pn:hover { border-color: var(--accent); text-decoration: none; }
.pn.next { text-align: right; grid-column: 2; }
.foot { margin-top: 32px; color: var(--text-faint); font-size: 13px; }
.foot code { font-family: var(--mono); font-size: 12px; }

/* responsive */
@media (max-width: 1280px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 880px) {
  .layout { display: block; padding: 0 16px; }
  .side { position: static; max-height: none; overflow: visible; padding: 16px 0 0; }
  .side-h { display: none; }
  .docnav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: thin; }
  .docnav a { flex: none; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-elev); }
  .docnav .desc { display: none; }
  .docnav .lab { font-size: 13.5px; white-space: nowrap; }
  .content { padding-top: 20px; }
  .crumb { display: none; }
}
