/* Layout: three columns (pages · article · on-this-page) on the same stone ground as the landing page; screenshots rest on glaze. */
:root {
  --stone: #e9e7e2;
  --paper: #f4f2ee;
  --ink: #1c1b19;
  --dim: #5f5c56;
  --faint: #66635c;
  --line: #d3cfc7;
  --celadon: #3f6b5c;
  --code-bg: #f1efea;
  --sans: "Pretendard", "Hiragino Sans", "PingFang SC", "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 84px; background: var(--stone); }
body { margin: 0; background: var(--stone); color: var(--ink); font: 400 16px/1.72 var(--sans); -webkit-font-smoothing: antialiased; }
html[lang="ko"] .doc { word-break: keep-all; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--celadon); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 20; background: var(--stone); }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--stone) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 22px; height: 60px; max-width: 1440px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); font-size: 14px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand img { width: 24px; height: 24px; }
.brand span { font-weight: 400; color: var(--faint); margin-left: 2px; }
.top-links { display: flex; gap: 20px; margin-right: auto; }
.top-links a { text-decoration: none; color: var(--dim); }
.top-links a[aria-current] { color: var(--ink); }
.top-right { display: flex; gap: 10px; align-items: center; }
.lang { position: relative; display: flex; align-items: center; }
.lang svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--dim); pointer-events: none; }
.lang select { appearance: none; -webkit-appearance: none; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font: 500 13px/1 var(--sans); padding: 8px 12px 8px 30px; cursor: pointer; }
.btn { background: var(--ink); color: var(--paper); text-decoration: none; font: 600 13px/1 var(--sans); padding: 9px 13px; border-radius: 8px; white-space: nowrap; }
.menu-btn { display: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; place-items: center; }
.menu-btn svg { width: 18px; height: 18px; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; gap: 56px; max-width: 1440px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.side { position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); align-self: start; max-height: calc(100vh - 60px); overflow-y: auto; padding-block: 36px; }
.side ul { list-style: none; margin: 0 0 24px; padding: 0; }
.nav-group { margin: 0 0 8px; font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.side a { display: block; text-decoration: none; color: var(--dim); font-size: 14.5px; padding: 5px 10px; border-radius: 6px; }
.side a:hover { color: var(--ink); background: color-mix(in srgb, var(--paper) 70%, transparent); }
.side a.on { color: var(--ink); background: var(--paper); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }

.main { min-width: 0; padding-block: 44px 96px; }
.doc { max-width: 72ch; }
.doc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.chip-tile { position: relative; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; flex: none; isolation: isolate; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .45); }
.chip-tile .glaze-canvas, .plate .glaze-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; }
.crumb { margin: 0; font: 500 10.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.crumb b { display: block; color: var(--dim); font-weight: 500; }
.doc h1 { font-weight: 600; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.15; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.doc .desc { font-size: 18px; line-height: 1.6; color: var(--dim); margin: 14px 0 36px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.doc h2 { font-weight: 600; font-size: 23px; line-height: 1.3; letter-spacing: -.012em; margin: 52px 0 12px; text-wrap: balance; }
.doc h3 { font-weight: 600; font-size: 17.5px; line-height: 1.4; margin: 32px 0 8px; }
.doc :is(h2, h3) a.hl { opacity: 0; margin-left: 8px; color: var(--faint); text-decoration: none; font-weight: 400; }
.doc :is(h2, h3):hover a.hl { opacity: 1; }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 18px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--faint); }
.doc a { color: var(--celadon); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--celadon) 35%, transparent); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--celadon); }
.doc strong { font-weight: 600; }
.doc code { font: 400 .86em/1.5 var(--mono); background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: .08em .38em; }
.doc pre { position: relative; background: #1d1a17; color: #efe8dd; border-radius: 10px; padding: 16px 18px; overflow-x: auto; margin: 0 0 20px; }
.doc pre code { background: none; border: 0; padding: 0; font-size: 13.5px; line-height: 1.65; color: inherit; }
.doc pre .cp { position: absolute; top: 8px; right: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #e7dfd3; border-radius: 6px; font: 500 11.5px/1 var(--sans); padding: 6px 8px; cursor: pointer; }
.doc .table { overflow-x: auto; margin: 0 0 22px; border-top: 1px solid var(--ink); }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 11px 14px 11px 0; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 600; white-space: nowrap; font-size: 13px; color: var(--dim); }
.doc blockquote { margin: 0 0 20px; padding: 14px 18px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); }
.doc blockquote.callout { border-left: 3px solid var(--celadon); }
.doc blockquote p:last-child { margin-bottom: 0; }
.doc .shot { margin: 6px 0 34px; }
.doc .shot .plate { position: relative; overflow: hidden; border-radius: 6px; isolation: isolate; padding: 6% 6% 0; background: #2a1d15; }
.doc .shot img { width: 100%; height: auto; display: block; border-radius: 5px 5px 0 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 24px 40px -18px rgba(0, 0, 0, .55); }
.doc .shot figcaption { margin-top: 8px; font: 400 11.5px/1.4 var(--mono); color: var(--faint); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.pn { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none !important; color: var(--ink) !important; font-weight: 600; font-size: 16px; background: var(--paper); }
.pn:hover { border-color: var(--faint); }
.pn small { font: 500 12px/1 var(--sans); color: var(--faint); }
.pn.next { text-align: right; }

.toc { position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); align-self: start; padding-block: 48px; max-height: calc(100vh - 60px); overflow-y: auto; }
.toc-h { margin: 0 0 10px; font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; text-decoration: none; color: var(--faint); font-size: 13.5px; line-height: 1.45; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 1px solid transparent; }
.toc a.sub { padding-left: 24px; }
.toc a.on { color: var(--ink); border-left-color: var(--ink); }
.toc a:hover { color: var(--ink); }

.foot { border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; max-width: 1440px; margin: 0 auto; padding: 28px max(20px, env(safe-area-inset-right, 0px)) 40px max(20px, env(safe-area-inset-left, 0px)); color: var(--faint); font-size: 14px; }
.foot-in p { margin: 0; }
.foot-in nav { display: flex; gap: 18px; }
.foot-in a { color: var(--dim); text-decoration: none; }

@media (max-width: 1180px) { .layout { grid-template-columns: 220px minmax(0, 1fr); gap: 44px; } .toc { display: none; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .menu-btn { display: grid; }
  .top-links, .brand span, .top-right .btn { display: none; }
  .top-in { gap: 12px; }
  .top-right { margin-left: auto; }
  .side { position: fixed; z-index: 9; top: calc(60px + env(safe-area-inset-top, 0px)); left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; padding: 24px 20px 24px max(20px, env(safe-area-inset-left, 0px)); background: var(--stone); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .25s ease; }
  .side.open { transform: none; box-shadow: 20px 0 40px rgba(0, 0, 0, .15); }
  .main { padding-block: 28px 64px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

.doc :not(pre) > code { overflow-wrap: anywhere; }
