/* 기능 설명서·사용자 가이드 — 배치만. 색·글꼴 토큰은 styles.css 것을 쓴다. */

:root { --gold-bg: #f4e6bf; --gold-ink: #6a4a06; --gold-line: #dcc078; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --gold-bg: #3b3013; --gold-ink: #f0cf7a; --gold-line: #6b5720; }
}
:root[data-theme="dark"] { --gold-bg: #3b3013; --gold-ink: #f0cf7a; --gold-line: #6b5720; }

/* ---------- 상단: 좁은 화면에서도 설명서·가이드 링크는 남긴다 ---------- */
.docs-page .nav { border-bottom-color: var(--line); }
.docs-page .nav-links { display: flex; white-space: nowrap; }
.docs-page .nav-links a[aria-current="page"] { color: var(--ink); font-weight: 700; }
@media (max-width: 920px) { .docs-page .nav-home { display: none; } }
@media (max-width: 600px) {
  .docs-page .nav-inner { gap: 12px; }
  .docs-page .nav-links { gap: 14px; margin-left: 0; }
  .docs-page .nav-links a { font-size: 14px; }
  .docs-page .nav-right .btn { display: none; }
}
@media (max-width: 420px) { .docs-page .nav .brand span { display: none; } }

/* ---------- 틀: 목차 260px + 본문 최대 760px ---------- */
.docs { display: grid; grid-template-columns: 260px minmax(0, 760px); gap: 56px; align-items: start; padding-top: 44px; padding-bottom: 96px; }
.docs-single { grid-template-columns: minmax(0, 1080px); justify-content: center; }
.docs-main { min-width: 0; }

.docs-side { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow-y: auto; font-size: 15px; line-height: 1.5; }
.docs-toc > summary { display: none; }
.docs-toc .toc-group { margin: 22px 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--faint); }
.docs-toc .toc-group:first-child { margin-top: 0; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs-toc li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; }
.docs-toc li:has(a[aria-current="page"]) { border-left-color: var(--brand); }
.docs-toc a { text-decoration: none; color: var(--muted); }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a[aria-current="page"] { color: var(--brand); font-weight: 700; }

@media (max-width: 899px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; padding-bottom: 64px; }
  .docs-side { position: static; max-height: none; overflow: visible; }
  .docs-toc { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
  .docs-toc > summary { display: block; padding: 12px 16px; font-weight: 700; color: var(--ink); cursor: pointer; }
  .docs-toc > nav { padding: 4px 16px 16px; }
}

/* ---------- 제목 ---------- */
.docs-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.docs-title h1 { font-family: var(--font-serif); font-size: clamp(28px, 4.4vw, 38px); letter-spacing: -.015em; margin-right: 4px; }
.docs-head .lead { margin-top: 14px; font-size: 18px; color: var(--muted); }
.docs-head { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.docs-back { display: inline-block; margin-bottom: 16px; color: var(--brand); font-size: 14px; text-decoration: none; }
.docs-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.article-contents { margin-top: 24px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.article-contents p { color: var(--ink); font-weight: 700; }
.article-contents ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 10px 0 0; list-style: none; }
.article-contents a { display: block; padding: 4px 10px; border-radius: 6px; background: var(--bg-alt); color: var(--brand); font-size: 14px; text-decoration: none; }
.article-contents a:hover { text-decoration: underline; text-underline-offset: 3px; }
.docs-body h2[id], .docs-index-section[id] { scroll-margin-top: 88px; }

/* 회원 등급 표시: 무료 = 테두리만, Lite = 브랜드 옅은 바탕, Pro = 금빛 바탕 */
.tier, .badge {
  display: inline-block; vertical-align: middle; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent;
  font: 700 12px/1.35 var(--font-ui); letter-spacing: 0; white-space: nowrap;
}
.tier-free { border-color: var(--line-strong); color: var(--muted); }
.tier-lite { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 28%, transparent); }
.tier-pro { background: var(--gold-bg); color: var(--gold-ink); border-color: var(--gold-line); }
.badge { border-radius: 6px; background: var(--bg-alt); color: var(--muted); border-color: var(--line); }
.docs-ai-icon { flex: none; display: inline-block; vertical-align: middle; color: var(--brand); }

/* ---------- 본문 ---------- */
.docs-body { padding-top: 8px; }
.docs-body h2 { font-family: var(--font-serif); font-size: 26px; margin: 52px 0 0; letter-spacing: -.01em; }
.docs-body h3 { font-size: 19px; margin: 36px 0 0; }
.docs-body p, .docs-body ul, .docs-body ol, .docs-body pre, .docs-body blockquote,
.docs-body .table-wrap, .docs-body .shot, .docs-body .note, .docs-body .rules { margin: 18px 0 0; }
.docs-body a { color: var(--brand); text-underline-offset: 3px; }
.docs-body a:hover { color: var(--brand-hover); }
.docs-body strong { color: var(--ink); }
.docs-body ul { padding-left: 22px; }
.docs-body li + li { margin-top: 6px; }
.docs-body li > ul, .docs-body li > ol, .docs-body li > p { margin-top: 6px; }

/* 순서: 번호를 동그라미로 또렷하게 */
.docs-body ol { list-style: none; padding-left: 0; counter-reset: step; }
.docs-body ol > li { position: relative; padding-left: 40px; counter-increment: step; }
.docs-body ol > li + li { margin-top: 12px; }
.docs-body ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 2px; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font: 700 13px/1 var(--font-ui);
}

.docs-body code { font-family: var(--font-mono); font-size: .9em; padding: 2px 6px; border-radius: 5px; background: var(--bg-alt); border: 1px solid var(--line); overflow-wrap: anywhere; }
.docs-body pre { padding: 16px 18px; border-radius: 10px; background: var(--bg-alt); border: 1px solid var(--line); overflow-x: auto; line-height: 1.55; }
.docs-body pre code { padding: 0; border: 0; background: none; font-size: 14px; overflow-wrap: normal; }
.docs-body kbd {
  display: inline-block; min-width: 1.7em; padding: 2px 7px; text-align: center; white-space: nowrap;
  font: 700 .82em/1.4 var(--font-ui); color: var(--ink);
  background: var(--elevated); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
}
.docs-body blockquote { margin-left: 0; margin-right: 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.docs-body blockquote > :first-child, .docs-body .note > :first-child { margin-top: 0; }
.docs-body hr { margin: 40px 0 0; border: 0; border-top: 1px solid var(--line); }

/* 표는 제 상자 안에서만 옆으로 민다 */
.docs-body .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.docs-body table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.docs-body th, .docs-body td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.docs-body th { background: var(--elevated); color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.docs-body tbody tr:last-child > * { border-bottom: 0; }

/* 화면 그림: 다크·라이트 두 장 가운데 지금 테마에 맞는 한 장만 */
.shot { margin-left: 0; margin-right: 0; }
.shot-link { display: block; width: fit-content; max-width: 100%; margin-inline: auto; border-radius: 10px; cursor: zoom-in; }
.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--app-border); border-radius: inherit; box-shadow: var(--shadow); }
.shot-link:is(:hover, :focus-visible) img { border-color: var(--brand); }
.shot figcaption { margin-top: 10px; font-size: 15px; color: var(--text); text-align: center; }
.shot .shot-light { display: none; }
:root[data-theme="light"] .shot .shot-dark { display: none; }
:root[data-theme="light"] .shot .shot-light { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .shot .shot-dark { display: none; }
  :root:not([data-theme="dark"]) .shot .shot-light { display: block; }
}

.note { padding: 16px 20px; border-radius: 10px; background: var(--brand-soft); border-left: 3px solid var(--brand); font-size: 16px; }
.note .note-title { color: var(--ink); }
.note .note-title + * { margin-top: 6px; }

.rules { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 16px; }
.rules > summary { padding: 13px 18px; font-weight: 700; color: var(--ink); cursor: pointer; }
.rules[open] > summary { border-bottom: 1px solid var(--line); }
.rules > :not(summary) { margin-left: 18px; margin-right: 18px; }
.rules > :last-child { margin-bottom: 18px; }

/* ---------- 앞뒤 글, 기준 버전 ---------- */
.docs-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 64px; }
.docs-pager a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: var(--paper); }
.docs-pager a:hover { border-color: var(--brand); }
.docs-pager .next { grid-column: 2; text-align: right; }
.docs-pager span { display: block; font-size: 13px; color: var(--faint); }
.docs-pager strong { color: var(--ink); }
.docs-version { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--faint); }
.docs-ai-legend { display: flex; align-items: center; gap: 6px; margin-top: 32px; font-size: 13px; color: var(--muted); }
.docs-ai-legend + .docs-version { margin-top: 12px; }

/* ---------- 목록 쪽(/manual/, /guide/) ---------- */
.docs-index .docs-head {
  padding: clamp(22px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(130deg, var(--brand-soft), var(--paper) 80%);
}
.docs-index .docs-title h1 { font-size: clamp(31px, 5vw, 48px); }
.docs-index .lead { max-width: 42ch; }
.docs-index h2 { font-family: var(--font-serif); font-size: clamp(23px, 3vw, 30px); }
.docs-index-section { margin-top: clamp(32px, 5vw, 54px); }
.docs-grid { display: grid; gap: 14px; padding: 0; margin: 16px 0 0; list-style: none; }
.docs-topics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 22px; }
.docs-chapters, .docs-situations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.docs-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px;
  height: 100%; padding: 18px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; color: var(--ink); text-decoration: none;
}
.docs-card:is(:hover, :focus-visible) { border-color: var(--brand); }
.docs-card:hover strong { color: var(--brand); }
.docs-card:has(.docs-step) { grid-template-columns: auto minmax(0, 1fr) auto; }
.docs-step {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand); font: 700 18px/1 var(--font-ui);
}
.docs-card-copy { display: grid; align-content: start; gap: 5px; }
.docs-card-copy strong { font-size: 17px; line-height: 1.4; }
.docs-card-copy > span { color: var(--text); font-size: 16px; line-height: 1.55; }
.docs-card-arrow { color: var(--brand); font-weight: 700; }
.docs-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; list-style: none; margin: 12px 0 0; padding: 0; }
.docs-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.docs-list a { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: 4px; }
.docs-list a:hover { color: var(--brand); }
.docs-list .tier + .docs-ai-icon { margin-left: 5px; }
.docs-list p { margin-top: 4px; font-size: 16px; color: var(--text); }
.docs-empty { margin-top: 32px; color: var(--muted); }

@media (max-width: 899px) { .docs-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .docs-chapters, .docs-situations, .docs-list { grid-template-columns: minmax(0, 1fr); }
  .docs-topics { gap: 8px; }
  .docs-card { padding: 14px; gap: 8px; }
  .docs-body h2 { font-size: 23px; margin-top: 44px; }
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-pager .next { grid-column: auto; }
}
@media (max-width: 420px) { .docs-topics { grid-template-columns: minmax(0, 1fr); } }
