:root {
  --bg: #0b0c0f;
  --bg-soft: #111317;
  --bg-side: #0d0f13;
  --border: #1f232b;
  --text: #e6e8ec;
  --text-dim: #9aa3b2;
  --accent: #7c5cff;
  --accent-2: #4cc9f0;
  --code-bg: #14171d;
  --code-text: #e6e8ec;
  --max-w: 1480px;
  --focus: 0 0 0 2px var(--accent-2);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border-radius: 0 0 8px 0;
  z-index: 1000;
  font-weight: 600;
}
.skip-link:focus { left: 0; outline: none; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard",
    "Noto Sans KR", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

aside.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-side);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.25) transparent;
  scrollbar-gutter: stable;
}
aside.sidebar::-webkit-scrollbar { width: 8px; }
aside.sidebar::-webkit-scrollbar-track { background: transparent; }
aside.sidebar::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.18);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
aside.sidebar:hover::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.45);
  background-clip: padding-box;
}
aside.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 92, 255, 0.65);
  background-clip: padding-box;
}

main pre, main table {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.3) transparent;
}
main pre::-webkit-scrollbar, main table::-webkit-scrollbar { height: 8px; }
main pre::-webkit-scrollbar-thumb,
main table::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.3);
  border-radius: 8px;
}

a.brand, .brand {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}
a.brand:hover { text-decoration: none; color: var(--text); }
.brand .badge {
  background: #4c2dcf;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

nav.toc { font-size: 14px; }
nav.toc details { margin-bottom: 4px; }
nav.toc summary {
  cursor: pointer;
  padding: 8px 8px;
  border-radius: 6px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
nav.toc summary::-webkit-details-marker { display: none; }
nav.toc summary::before {
  content: "▸";
  color: var(--text-dim);
  font-size: 9px;
  transition: transform 0.15s ease;
  display: inline-block;
}
nav.toc details[open] > summary::before { transform: rotate(90deg); }
nav.toc summary:hover { color: var(--text); background: var(--bg-soft); }
nav.toc ul {
  list-style: none;
  padding: 4px 0 8px 14px;
  margin: 0 0 0 9px;
  border-left: 1px solid var(--border);
}
nav.toc li a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  border-left: 2px solid transparent;
  margin-left: -16px;
  padding-left: 14px;
}
nav.toc li a:hover { background: var(--bg-soft); color: var(--text); }
nav.toc li a.active {
  background: rgba(124, 92, 255, 0.14);
  color: #c4b8ff;
  font-weight: 600;
  border-left: 2px solid var(--accent);
}

main.content {
  padding: 56px 72px;
  max-width: 1180px;
  min-width: 0;
  margin: 0 auto;
  width: 100%;
}

main h1 {
  font-size: 36px;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
main h2 {
  font-size: 26px;
  margin: 48px 0 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
main h3 {
  font-size: 19px;
  margin: 32px 0 10px;
  color: var(--text);
  font-weight: 600;
}
main p {
  color: var(--text);
  margin: 14px 0;
}
main .lede {
  font-size: 18px;
  color: var(--text-dim);
  margin-top: 0;
  margin-bottom: 28px;
  line-height: 1.6;
}

main code {
  background: rgba(124, 92, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  color: #c4b8ff;
  border: 1px solid rgba(124, 92, 255, 0.2);
}
main pre {
  background: var(--code-bg);
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  line-height: 1.6;
  margin: 18px 0;
  position: relative;
}
main pre .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: -apple-system, "Pretendard", "Noto Sans KR", sans-serif;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 1;
}
main pre:hover .copy-btn,
main pre .copy-btn:focus-visible {
  opacity: 1;
}
main pre .copy-btn:hover {
  background: rgba(124, 92, 255, 0.18);
  color: var(--text);
  border-color: rgba(124, 92, 255, 0.4);
}
main pre .copy-btn.copied {
  background: rgba(76, 201, 240, 0.18);
  color: var(--accent-2);
  border-color: rgba(76, 201, 240, 0.4);
  opacity: 1;
}
main pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: var(--code-text);
  font-size: inherit;
}
main pre + pre { margin-top: 20px; }

main ul, main ol { padding-left: 22px; }
main li { margin: 6px 0; }

main blockquote {
  border-left: 3px solid var(--accent);
  margin: 16px 0;
  padding: 6px 16px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
}

main .callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: rgba(124, 92, 255, 0.06);
  padding: 14px 18px;
  border-radius: 8px;
  margin: 20px 0;
}
main .callout.tip {
  border-left-color: var(--accent-2);
  background: rgba(76, 201, 240, 0.06);
}
main .callout.warn {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.07);
}

main figure {
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
}
main figure + figure { margin-top: 32px; }
main figure img, main figure video {
  width: 100%;
  height: auto;
  display: block;
}
main img, main video { max-width: 100%; height: auto; }
main pre { max-width: 100%; }
main pre, main code { word-break: break-word; overflow-wrap: anywhere; }
main pre code { word-break: normal; overflow-wrap: normal; white-space: pre; }
main table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
main table thead th {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 2px solid rgba(255, 255, 255, 0.14);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
main table td {
  padding: 12px 16px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.6;
}
main table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}
main table tbody tr:hover td {
  background: rgba(124, 92, 255, 0.06);
}
main table tbody tr:last-child td { border-bottom: none; }
main table td code {
  white-space: nowrap;
  font-size: 0.88em;
}
main figcaption {
  padding: 10px 16px;
  color: var(--text-dim);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  font-style: italic;
  text-align: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
a.card, .card {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: block;
  color: var(--text);
  text-decoration: none;
}
a.card:hover, .card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
a.card strong, .card a { color: var(--text); font-weight: 600; display: block; }
.card p, a.card p { color: var(--text-dim); font-size: 14px; margin: 6px 0 0; }

nav.pager, .pager {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
nav.pager a, .pager a {
  flex: 0 1 calc(50% - 10px);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 14px 18px;
  border-radius: 10px;
  display: block;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  font-weight: 600;
}
nav.pager a:hover, .pager a:hover {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.06);
  text-decoration: none;
  transform: translateY(-1px);
}
nav.pager .label, .pager .label {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
nav.pager a[rel="next"], .pager a[rel="next"] { text-align: right; }
.pager-spacer { flex: 0 1 calc(50% - 10px); }

.menu-toggle { display: none; }
