/* OriginSeal 설명서 — 위키형 레이아웃
   규칙: 인라인 style 0건(CSP style-src 'self') · 라이트/다크 · 사이드바 목차 + 검색 + 앵커
*/

:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #EFEBE2;
  --ink: #102A56;
  --text: #16202E;
  --muted: #55606F;
  --line: #D9D3C7;
  --line-strong: #BFB6A5;
  --accent: #0B5B54;
  --accent-text: #FFFFFF;
  --accent-soft: #DBEDE8;
  --brand-mark: #0A1A3A;
  --bad: #8E2D22;
  --bad-soft: #F6E1DD;
  --warn: #7A4A10;
  --warn-soft: #F7EBD5;
  --shadow: 0 1px 2px rgba(16, 42, 86, .06), 0 12px 32px rgba(16, 42, 86, .06);
  --radius: 16px;
  --radius-sm: 8px;
  --sans: "Paperlogy", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --head-h: 72px;
}

html[data-theme="dark"] {
  --bg: #0A1017;
  --surface: #111A22;
  --surface-2: #16222C;
  --ink: #F7F5F0;
  --text: #E9EEF4;
  --muted: #A3AFBE;
  --line: #22303C;
  --line-strong: #35485A;
  --accent: #6FD8C4;
  --accent-text: #06231F;
  --accent-soft: #123330;
  --brand-mark: #FFFFFF;
  --bad: #F08A7E;
  --bad-soft: #341714;
  --warn: #E8B665;
  --warn-soft: #2B2314;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .32);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }
code { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 0; padding: 12px 16px; background: var(--accent); color: var(--accent-text); border-radius: var(--radius-sm); z-index: 99; }
.skip:focus { left: 16px; top: 16px; }

.shell { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 32px; }

/* ── 헤더(랜딩과 동일한 톤) ─────────────────────────────────── */
.site-head { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; gap: 24px; min-height: var(--head-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 700; letter-spacing: -0.02em; }
.brand svg { width: 28px; height: 28px; color: var(--brand-mark); flex: none; }
.brand-name { font-size: 18px; line-height: 1.2; }
.brand-sub { font-size: 12px; font-weight: 400; color: var(--muted); padding-top: 4px; }
.head-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.head-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; font-size: 14px; color: var(--muted); border-radius: var(--radius-sm); }
.head-nav a:hover { color: var(--text); background: var(--surface-2); }
.head-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; font-size: 14px; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.docs-menu-btn { display: none; width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }

/* ── 2단 레이아웃 ────────────────────────────────────────────── */
.docs-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 32px; }

.docs-side { position: sticky; top: calc(var(--head-h) + 16px); align-self: start; max-height: calc(100vh - var(--head-h) - 40px); overflow-y: auto; padding-right: 8px; border-right: 1px solid var(--line); }

.docs-search { position: relative; margin-bottom: 20px; }
.docs-search input {
  width: 100%; min-height: 42px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.docs-search input::placeholder { color: var(--muted); }
.docs-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.docs-hits { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 60vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.docs-hits a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.docs-hits a:last-child { border-bottom: 0; }
.docs-hits a:hover, .docs-hits a:focus { background: var(--surface-2); }
.docs-hits b { display: block; font-size: 14px; color: var(--ink); }
.docs-hits span { display: block; font-size: 12px; color: var(--muted); }
.docs-hits .is-empty { padding: 12px; font-size: 13px; color: var(--muted); }

.docs-nav-h { margin: 18px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.docs-pages, .docs-toc { list-style: none; display: grid; gap: 2px; }
.docs-pages a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); border-left: 2px solid transparent; }
.docs-pages a span { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.docs-pages a small { display: block; font-size: 12px; color: var(--muted); }
.docs-pages a:hover { background: var(--surface-2); }
.docs-pages a[aria-current="page"] { background: var(--accent-soft); border-left-color: var(--accent); }
.docs-pages a[aria-current="page"] span { color: var(--accent); }
.docs-toc a { display: block; padding: 5px 10px; font-size: 13.5px; color: var(--muted); border-radius: 6px; border-left: 1px solid var(--line); }
.docs-toc a:hover { color: var(--text); background: var(--surface-2); }

/* ── 본문 ────────────────────────────────────────────────────── */
.docs-main { min-width: 0; padding-bottom: 72px; }
.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--accent); font-weight: 600; }
.crumbs b { color: var(--text); font-weight: 600; }

.doc { max-width: 760px; }
.doc h1 { font-size: 40px; line-height: 1.15; letter-spacing: -0.03em; color: var(--ink); }
.doc-lead { margin: 14px 0 8px; font-size: 18px; color: var(--muted); }
.doc h2 { margin: 44px 0 14px; padding-top: 20px; font-size: 26px; line-height: 1.3; letter-spacing: -0.025em; color: var(--ink); border-top: 1px solid var(--line); }
.doc h3 { margin: 28px 0 10px; font-size: 19px; line-height: 1.4; color: var(--ink); }
.doc p { margin: 12px 0; }
.doc p strong, .doc li strong { color: var(--ink); }
.doc ul, .doc ol { margin: 12px 0; padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc ul li::marker { color: var(--accent); }
.doc ol li::marker { color: var(--accent); font-weight: 700; }
.doc code { padding: 2px 6px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc a:hover { text-decoration-thickness: 2px; }
.anchor { margin-left: 8px; font-weight: 400; color: var(--line-strong); text-decoration: none; opacity: 0; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus { opacity: 1; }

.code { margin: 14px 0; padding: 16px 18px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.code code { padding: 0; color: var(--text); background: none; font-size: 13.5px; line-height: 1.7; white-space: pre; }

.table-wrap { margin: 16px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
thead th { position: sticky; top: 0; padding: 12px 14px; text-align: left; font-size: 13px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--ink); font-weight: 600; }

.steps { list-style: none; padding-left: 0; counter-reset: step; display: grid; gap: 10px; margin: 16px 0; }
.steps li { position: relative; padding: 14px 16px 14px 52px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 14px; display: grid; place-items: center; width: 24px; height: 24px; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent); border-radius: 50%; }
.steps b { display: block; font-size: 15px; color: var(--ink); }
.steps span { display: block; font-size: 14.5px; color: var(--muted); }

.callout { margin: 18px 0; padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.callout-h { font-weight: 700; color: var(--ink); }
.callout p { margin: 4px 0; font-size: 14.5px; }
.callout.is-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.is-warn .callout-h { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.card { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card b { display: block; font-size: 15.5px; color: var(--ink); }
.card span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.card:hover { border-color: var(--accent); }

.kv { display: grid; gap: 8px; margin: 16px 0; }
.kv > div { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.kv dt { font-size: 14px; font-weight: 700; color: var(--ink); }
.kv dd { font-size: 14.5px; color: var(--text); }

.qa { margin: 10px 0; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.qa summary { position: relative; padding: 14px 32px 14px 0; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa-plus { position: absolute; right: 0; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); }
.qa-plus::before, .qa-plus::after { content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; background: var(--muted); border-radius: 2px; }
.qa-plus::after { transform: rotate(90deg); transition: transform .18s ease; }
.qa[open] .qa-plus::after { transform: rotate(0deg); }
.qa-body { padding: 0 0 14px; }
.qa-body p { margin: 0; font-size: 14.5px; color: var(--text); }

.doc-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc-pn { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.doc-pn small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc-pn b { display: block; margin-top: 2px; font-size: 15px; color: var(--ink); }
.doc-pn.is-next { text-align: right; }
.doc-pn:hover { border-color: var(--accent); }

:target { scroll-margin-top: 96px; }

/* ── 반응형 ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .docs-shell { grid-template-columns: 236px minmax(0, 1fr); gap: 32px; padding: 24px; }
  .head-nav a { padding: 0 8px; }
}

@media (max-width: 860px) {
  .shell { padding: 0 20px; }
  .head-nav { display: none; }
  .docs-menu-btn { display: inline-flex; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 0; }
  .docs-side {
    position: fixed; inset: var(--head-h) 0 auto 0; z-index: 35; max-height: calc(100vh - var(--head-h));
    padding: 16px 20px 28px; background: var(--bg); border-right: 0; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
  }
  body.docs-nav-open .docs-side { transform: translateY(0); opacity: 1; pointer-events: auto; }
  body.docs-nav-open { overflow: hidden; }
  .doc h1 { font-size: 31px; }
  .doc h2 { font-size: 22px; margin-top: 34px; }
  .doc-lead { font-size: 16px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .table-wrap table { min-width: 540px; }   /* 좁은 화면에서는 표를 가로 스크롤한다 */
  .kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-pager { grid-template-columns: minmax(0, 1fr); }
  .doc-pn.is-next { text-align: left; }
  .head-cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .docs-side, .qa-plus::after { transition: none; }
}
