/* horee-grid 문서 사이트 */
:root {
  --font: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  --mono: ui-monospace, "D2Coding", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --bg: #ffffff;
  --bg-soft: #f7f8f9;
  --bg-code: #f6f8fa;
  --fg: #1c2024;
  --fg-soft: #545b64;
  --fg-faint: #8b929a;
  --line: #e4e7eb;
  --accent: #107c41;
  --accent-soft: #e7f4ec;
  --note: #2f6fdb;
  --warn: #b7791f;
  --t-k: #a626a4; --t-s: #2f7d32; --t-n: #b5521b; --t-c: #8b929a; --t-f: #2f6fdb; --t-ty: #b5521b; --t-p: #0d7a8a; --t-v: #a626a4;
  --top-h: 56px;
  --side-w: 248px;
  --toc-w: 208px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1215;
  --bg-soft: #161a1e;
  --bg-code: #161b21;
  --fg: #e6e9ec;
  --fg-soft: #a8b0b9;
  --fg-faint: #6b737c;
  --line: #262c33;
  --accent: #3ccf7f;
  --accent-soft: #12291c;
  --note: #6ea2ff;
  --warn: #e0a84a;
  --t-k: #d58bf0; --t-s: #8fd18f; --t-n: #f0a46a; --t-c: #6b737c; --t-f: #7fb0ff; --t-ty: #f0c36a; --t-p: #5fd0dc; --t-v: #d58bf0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.75 var(--font); -webkit-font-smoothing: antialiased; word-break: keep-all; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { font: 11px/1 var(--mono); padding: 3px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg-soft); color: var(--fg-soft); }

/* ── 머리 ── */
.top { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: var(--fg); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 20px; height: 20px; border-radius: 5px; background:
  linear-gradient(var(--bg) 0 0) 6px 0 / 1.5px 100% no-repeat, linear-gradient(var(--bg) 0 0) 12.5px 0 / 1.5px 100% no-repeat,
  linear-gradient(var(--bg) 0 0) 0 6px / 100% 1.5px no-repeat, linear-gradient(var(--bg) 0 0) 0 12.5px / 100% 1.5px no-repeat, var(--accent); }
.ver { font: 500 11px/1 var(--mono); color: var(--fg-soft); padding: 4px 6px; border: 1px solid var(--line); border-radius: 20px; }
.search-btn { margin-left: 12px; display: flex; align-items: center; gap: 28px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft); color: var(--fg-faint); font: inherit; font-size: 13px; cursor: pointer; }
.search-btn:hover { border-color: var(--fg-faint); }
.top-links { margin-left: auto; display: flex; gap: 22px; font-size: 14px; }
.top-links a { color: var(--fg-soft); }
.top-links a:hover { color: var(--fg); text-decoration: none; }
.theme-btn, .menu-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--fg-soft); cursor: pointer; font-size: 15px; }
.theme-btn::before { content: "☾"; }
[data-theme="dark"] .theme-btn::before { content: "☀"; }
.menu-btn { display: none; }

/* ── 틀 ── */
.shell { display: flex; }
.side { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); width: var(--side-w); flex: none; overflow-y: auto; padding: 24px 12px 40px 20px; border-right: 1px solid var(--line); }
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font-size: 12px; font-weight: 700; color: var(--fg); letter-spacing: 0.02em; margin: 0 0 6px 10px; }
.side a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--fg-soft); font-size: 14px; }
.side a:hover { color: var(--fg); background: var(--bg-soft); text-decoration: none; }
.side a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; justify-content: center; gap: 48px; padding: 0 32px; }
.doc { flex: 1; min-width: 0; max-width: 780px; padding: 40px 0 64px; }
.toc { position: sticky; top: var(--top-h); align-self: flex-start; width: var(--toc-w); flex: none; max-height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 44px 0 24px; font-size: 13px; }
.toc-title { font-weight: 700; margin-bottom: 8px; font-size: 12px; }
.toc a { display: block; padding: 3px 0 3px 12px; color: var(--fg-faint); border-left: 1px solid var(--line); line-height: 1.5; }
.toc a.lv3 { padding-left: 24px; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* ── 본문 ── */
.doc h1 { font-size: 34px; line-height: 1.25; letter-spacing: -0.025em; margin: 0 0 12px; }
.doc h2 { font-size: 23px; line-height: 1.35; letter-spacing: -0.015em; margin: 56px 0 14px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 17px; margin: 36px 0 8px; }
.doc h2, .doc h3 { position: relative; }
.anchor { position: absolute; left: -22px; color: var(--fg-faint); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; text-decoration: none; }
.doc h1 + p { font-size: 18px; color: var(--fg-soft); margin-top: 0; }
.doc p, .doc li { color: var(--fg); }
.doc ul, .doc ol { padding-left: 22px; }
.doc li + li { margin-top: 4px; }
.doc li > ul { margin: 4px 0; }
.doc :not(pre) > code { font: 0.86em var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--bg-code); border: 1px solid var(--line); white-space: nowrap; }
.doc strong { font-weight: 650; }

.table { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
th { text-align: left; font-weight: 650; background: var(--bg-soft); color: var(--fg-soft); font-size: 12.5px; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td:first-child code { color: var(--accent); }

.code { position: relative; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-code); overflow: hidden; }
.code-title { font: 12px/1 var(--mono); color: var(--fg-faint); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13px/1.7 var(--mono); tab-size: 2; }
.copy { position: absolute; top: 7px; right: 8px; padding: 3px 9px; font: 12px var(--font); border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg-soft); cursor: pointer; opacity: 0; transition: opacity .15s; }
.code:hover .copy, .copy:focus { opacity: 1; }
.copy.done { color: var(--accent); border-color: var(--accent); }
.t-k { color: var(--t-k); } .t-s { color: var(--t-s); } .t-n { color: var(--t-n); } .t-c { color: var(--t-c); font-style: italic; }
.t-f { color: var(--t-f); } .t-ty { color: var(--t-ty); } .t-p { color: var(--t-p); } .t-v { color: var(--t-v); }

.callout { margin: 20px 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--note); background: var(--bg-soft); }
.callout.warn { border-left-color: var(--warn); }
.callout.tip { border-left-color: var(--accent); }
.callout-label { font-size: 12px; font-weight: 700; color: var(--note); margin-bottom: 2px; }
.callout.warn .callout-label { color: var(--warn); }
.callout.tip .callout-label { color: var(--accent); }
.callout p { margin: 4px 0; }

/* ── 예제 ── */
.example { margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ex-bar:empty { display: none; }
.ex-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-soft); font-size: 13px; }
.ex-bar button { font: inherit; font-size: 13px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); cursor: pointer; }
.ex-bar button:hover { border-color: var(--accent); color: var(--accent); }
.ex-bar .ex-out { margin-left: auto; color: var(--fg-soft); font-family: var(--mono); font-size: 12px; }
.ex-live { padding: 12px; background: var(--bg); }
.ex-live > .hg { height: 100%; }
.example figcaption .code { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.example figcaption pre { max-height: 420px; }
[data-theme="dark"] .ex-live .hg {
  --hg-bg: #14181c; --hg-fg: #e6e9ec; --hg-line: #2a3037; --hg-head-bg: #1b2026; --hg-head-fg: #c3cad2;
  --hg-sel: #17352a; --hg-hover: #1a222a; --hg-accent: #3ccf7f;
}

/* ── 첫 화면 ── */
.hero { margin: 8px 0 36px; }
.hero .eyebrow { display: inline-block; font: 600 12px/1 var(--mono); color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 20px; margin-bottom: 18px; }
.hero h1 { font-size: 44px; line-height: 1.15; letter-spacing: -0.035em; margin: 0 0 16px; }
.hero p { font-size: 18px; color: var(--fg-soft); margin: 0 0 24px; max-width: 640px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; border: 1px solid var(--line); color: var(--fg); }
.btn:hover { text-decoration: none; border-color: var(--fg-faint); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { opacity: .88; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 28px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stats div { padding: 16px 18px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--fg-soft); }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0; font-size: 14px; color: var(--fg-soft); line-height: 1.65; }
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--accent); }

/* ── 아래 ── */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 64px; }
.pager a { flex: 1; max-width: 48%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); font-weight: 600; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager span { display: block; font-size: 12px; font-weight: 400; color: var(--fg-faint); }
.pager .next { text-align: right; margin-left: auto; }
.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--fg-faint); }

/* ── 검색 ── */
.search { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 14, .45); display: flex; justify-content: center; padding-top: 12vh; }
.search[hidden] { display: none; }
.search-box { width: min(620px, 92vw); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.25); overflow: hidden; }
.search-box input { border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font: inherit; font-size: 16px; background: transparent; color: var(--fg); outline: none; }
.search-list { overflow-y: auto; padding: 6px; }
.search-list a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--fg); }
.search-list a small { display: block; color: var(--fg-faint); font-size: 12px; }
.search-list a.on, .search-list a:hover { background: var(--accent-soft); text-decoration: none; }
.search-list .none { padding: 18px; color: var(--fg-faint); text-align: center; }
.search-hint { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-faint); }

/* ── 좁은 화면 ── */
@media (max-width: 1180px) { .toc { display: none; } }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .top-links, .search-btn span { display: none; }
  .search-btn { gap: 0; margin-left: auto; }
  .side { position: fixed; z-index: 40; left: 0; top: var(--top-h); background: var(--bg); transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .main { padding: 0 18px; }
  .hero h1 { font-size: 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .cards { grid-template-columns: 1fr; }
}
