/* 안내 페이지(사용법·예시·문법·소개·약관·개인정보) 공통 스타일.
   브랜드 토큰과 헤더·푸터는 index.html과 같게 유지한다. */
:root {
  --ground: #f5f8ff;
  --sheet: #ffffff;
  --out-bg: #f7f9ff;
  --ink: #0f1b3d;
  --ink-2: #5b6b8c;
  --line: #dce6fb;
  --line-strong: #b5c6ec;
  --blue: #2f6df6;
  --accent: #2150d8;
  --btn: #2150d8;
  --btn-hover: #1b45bf;
  --accent-tint: #e8efff;
  --amber: #a04a00;
  --amber-tint: #fdebd3;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0f1218;
  --sheet: #171b24;
  --out-bg: #13161e;
  --ink: #e7eaf1;
  --ink-2: #9ca5b8;
  --line: #272d3a;
  --line-strong: #3a4254;
  --blue: #6aa1ff;
  --accent: #93b6ff;
  --btn: #2f6df6;
  --btn-hover: #4a80f7;
  --accent-tint: rgba(106, 161, 255, 0.14);
  --amber: #f7b955;
  --amber-tint: rgba(247, 185, 85, 0.16);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", sans-serif;
  background: var(--ground);
  color: var(--ink);
  line-height: 1.7;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a { color: var(--accent); }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px 40px; }

/* ── 헤더 ── */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 0;
  /* 본문이 넓은 페이지에서도 헤더 폭은 모든 페이지와 같게 */
  max-width: 832px; margin: 0 auto;
  position: sticky; top: 0; z-index: 50;
  background: var(--ground);
  /* 배경을 wrap 폭 밖까지 늘려 스크롤된 본문이 옆으로 비치지 않게 한다 */
  box-shadow: 0 0 0 100vmax var(--ground);
  clip-path: inset(0 -100vmax -1px);
}
/* 스크롤되면 아래쪽에 전폭 구분선 */
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  /* 레이아웃 폭을 넓히면 가로 스크롤이 생기므로 그림자로만 전폭을 칠한다 */
  background: var(--line); box-shadow: 0 0 0 100vmax var(--line); clip-path: inset(0 -100vmax);
  opacity: 0; transition: opacity 0.15s;
}
.site-header.is-stuck::after { opacity: 1; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { display: block; width: 36px; height: 36px; }
.brand-name { font-size: 20px; font-weight: 800; color: var(--blue); }
.brand-sub { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.site-nav { display: flex; gap: 2px; margin-right: auto; margin-left: 8px; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px;
  border-radius: 8px; color: var(--ink-2); font-size: 15px; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: var(--accent-tint); color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--btn); color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: var(--btn-hover); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-2); font-weight: 600; padding: 0 10px; }
.btn.ghost:hover { background: var(--accent-tint); color: var(--accent); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.ext-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; margin-left: 4px;
  border-radius: 8px; background: var(--accent-tint); color: var(--accent);
  font-size: 14px; font-weight: 700; text-decoration: none; transition: background 0.15s;
}
.ext-btn:hover { background: var(--line); }
.theme-toggle { width: 40px; justify-content: center; padding: 0; }
.theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
/* 좁은 화면에선 메뉴를 둘째 줄로 내리고 넘치면 가로 스크롤 */
@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; row-gap: 4px; }
  .site-nav { order: 3; width: 100%; margin: 0 -10px; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) { .header-actions .hide-sm { display: none; } }
@media (max-width: 480px) { .brand-sub { display: none; } }

/* ── 본문 ── */
.hero { padding: 28px 0 24px; }
.hero h1 { margin: 0 0 10px; font-size: 36px; line-height: 1.22; font-weight: 800; letter-spacing: -0.025em; }
.hero p { margin: 0; max-width: 680px; font-size: 17px; line-height: 1.6; font-weight: 500; color: var(--ink-2); }
@media (max-width: 560px) { .hero h1 { font-size: 28px; } .hero p { font-size: 16px; } }

.panel {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 32px; margin-bottom: 16px;
}
@media (max-width: 560px) { .panel { padding: 22px 18px; } }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
/* 목차 이동 시 고정 헤더에 제목이 가리지 않게 */
section[id] { scroll-margin-top: 92px; }
@media (max-width: 900px) { section[id] { scroll-margin-top: 124px; } }
.panel h3 { margin: 26px 0 8px; font-size: 17px; font-weight: 700; }
.panel p, .panel li { font-size: 15.5px; }
.panel p { margin: 0 0 12px; }
.panel ul, .panel ol { margin: 0 0 12px; padding-left: 22px; }
.panel li { margin-bottom: 6px; }
.panel li::marker { color: var(--ink-2); }
.muted { color: var(--ink-2); }

code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--accent-tint); color: var(--ink);
  padding: 1px 6px; border-radius: 5px;
}
kbd {
  font-family: inherit; font-size: 0.85em; font-weight: 700;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  padding: 0 6px; background: var(--sheet);
}
pre.code {
  margin: 0 0 12px; padding: 12px 14px; overflow-x: auto;
  background: var(--out-bg); border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
pre.code code { background: none; padding: 0; font-size: inherit; }

/* 단계 목록 */
ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 38px; margin-bottom: 12px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent);
  font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

.callout {
  margin: 0 0 12px; padding: 12px 16px; border-radius: 10px;
  background: var(--accent-tint); font-size: 15px;
}
.callout.warn { background: var(--amber-tint); }
.callout > :last-child { margin-bottom: 0; }

/* 왼쪽 목차 사이드바: 현재 읽는 섹션을 살짝 표시 */
.doc-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 32px; align-items: start; }
/* 넓은 화면: 사이드바를 본문 왼쪽 바깥 여백으로 빼서 본문 폭을 다른 페이지와 맞춘다 */
@media (min-width: 1290px) {
  .doc-layout { width: calc(100% + 200px); margin-left: -200px; }
}
.side-toc { position: sticky; top: 96px; padding-top: 34px; max-height: calc(100vh - 112px); overflow-y: auto; scrollbar-width: none; }
.side-toc::-webkit-scrollbar { display: none; }
.side-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.side-toc a {
  display: block; margin-left: -1px; padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  color: var(--ink-2); font-size: 13.5px; line-height: 1.45; text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.side-toc a:hover { color: var(--ink); }
.side-toc a.active { color: var(--accent); font-weight: 700; border-left-color: var(--blue); }
@media (max-width: 960px) {
  .doc-layout { display: block; }
  .side-toc { display: none; }
}

/* 표 */
.table-wrap { overflow-x: auto; margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
td code { white-space: nowrap; }

/* 예시 카드 */
.ex { padding: 18px 0; border-top: 1px solid var(--line); }
.ex:first-of-type { border-top: 0; padding-top: 4px; }
.ex h3 { margin: 0 0 4px; }
.ex .render { padding: 10px 0 12px; overflow-x: auto; overflow-y: hidden; font-size: 17px; }
.ex .pair { display: grid; gap: 8px; }
.ex .row-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px;
}
.ex pre.code { margin: 0; }
.ex pre.hwp { background: var(--sheet); border-color: var(--line-strong); }

/* ── 푸터 ── */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 28px; font-size: 13px; color: var(--ink-2);
}
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .copy { margin-left: auto; }
