/* t.laboratory — Vanilla CSS. 외부 폰트 없음 (시스템 폰트로 CLS·로딩 비용 0) */
:root {
  --bg: #fbfbfa; --surface: #ffffff; --text: #1f2328; --muted: #5f6670; --line: #e3e5e8;
  --accent: #0f766e; --accent-soft: #e6f4f2; --code-bg: #f4f5f7; --code-text: #24292f;
  --warn-bg: #fff7e6; --warn-line: #f0c36d;
  --radius: 10px; --measure: 46rem; --wide: 72rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", Meiryo, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #151b23; --text: #e6edf3; --muted: #9198a1; --line: #2a313c;
    --accent: #3fb9a8; --accent-soft: #11302c; --code-bg: #161b22; --code-text: #e6edf3;
    --warn-bg: #2b2210; --warn-line: #7a5b1c;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.8 var(--font); overflow-wrap: anywhere; }
:lang(ja) body, body:lang(ja) { line-height: 1.9; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: 6px 10px; }
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }
.muted, small { color: var(--muted); }
.preview-bar { background: #b91c1c; color: #fff; text-align: center; font-size: 13px; padding: 4px; }
.todo { background: #fde68a; color: #7c2d12; padding: 0 4px; border-radius: 4px; }

/* header / footer */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30; }
.progress > i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; flex: none; }
.brand-mark.big { width: 48px; height: 48px; font-size: 26px; border-radius: 12px; }
.site-nav { display: flex; gap: 14px; margin-left: auto; font-size: 15px; }
.site-nav a, .lang-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .lang-nav a:hover { color: var(--accent); }
.lang-nav { display: flex; gap: 8px; font-size: 13px; }
.lang-nav a[aria-current] { color: var(--accent); font-weight: 700; }
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-nav a { color: var(--muted); }
.to-top { position: fixed; right: 16px; bottom: 16px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); text-decoration: none; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 24px; }
@media (min-width: 1080px) {
  .layout { grid-template-columns: minmax(0, var(--measure)) 16rem; justify-content: center; }
  .sidebar { position: sticky; top: 76px; align-self: start; }
}
@media (max-width: 1079px) { .sidebar { display: none; } }

/* article */
.breadcrumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 8px; }
.breadcrumb a { color: var(--muted); }
.post-head h1, .page-title { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.35; margin: 8px 0 12px; letter-spacing: -0.01em; }
.page-title small { font-size: .5em; font-weight: 400; margin-left: 6px; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 12px; }
.post-meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.notice { background: var(--warn-bg); border-left: 4px solid var(--warn-line); padding: 10px 14px; border-radius: 6px; font-size: 15px; }
.post-body h2 { font-size: 1.45rem; line-height: 1.4; margin: 2.4em 0 .7em; padding-bottom: .3em; border-bottom: 2px solid var(--line); }
.post-body h3 { font-size: 1.18rem; margin: 1.8em 0 .5em; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 1.2em; }
.post-body li { margin: .25em 0; }
.post-body blockquote { margin: 1.4em 0; padding: .6em 1em; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; }
.post-body blockquote p:last-child { margin: 0; }
h2.plain { border: 0; font-size: 1.2rem; }

/* code */
:not(pre) > code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .12em .38em; border-radius: 5px; }
pre { position: relative; font-family: var(--mono); font-size: 14px; line-height: 1.6; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 0 0 1.4em; tab-size: 2; }
pre code { font-family: inherit; background: none; padding: 0; }
pre .copy { position: absolute; top: 6px; right: 6px; font: 12px var(--font); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
pre:hover .copy, pre .copy:focus { opacity: 1; }
@media (hover: none) { pre .copy { opacity: 1; } }
/* Prism tokens (GitHub 계열) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6e7781; font-style: italic; }
.token.keyword, .token.selector, .token.important, .token.atrule { color: #cf222e; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #0a3069; }
.token.function, .token.class-name { color: #8250df; }
.token.number, .token.boolean, .token.constant, .token.symbol { color: #0550ae; }
.token.operator, .token.punctuation { color: #57606a; }
.token.property, .token.tag, .token.builtin { color: #116329; }
.token.deleted { color: #82071e; background: #ffebe9; } .token.inserted { color: #116329; background: #dafbe1; }
@media (prefers-color-scheme: dark) {
  .token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8b949e; }
  .token.keyword, .token.selector, .token.important, .token.atrule { color: #ff7b72; }
  .token.string, .token.char, .token.attr-value, .token.regex { color: #a5d6ff; }
  .token.function, .token.class-name { color: #d2a8ff; }
  .token.number, .token.boolean, .token.constant, .token.symbol { color: #79c0ff; }
  .token.operator, .token.punctuation { color: #c9d1d9; }
  .token.property, .token.tag, .token.builtin { color: #7ee787; }
  .token.deleted { color: #ffdcd7; background: #67060c; } .token.inserted { color: #aff5b4; background: #033a16; }
}

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--code-bg); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

/* toc */
.toc, .side-toc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; margin: 20px 0; font-size: 15px; }
.toc-title { font-weight: 700; margin: 0 0 6px; }
.toc ol, .side-toc ol { margin: 0; padding-left: 1.2em; }
.toc a, .side-toc a { color: var(--text); text-decoration: none; }
.side-toc a.current, .toc a.current { color: var(--accent); font-weight: 600; }
.side-toc { font-size: 14px; max-height: calc(100vh - 120px); overflow: auto; }

/* faq / tags / author / pager */
.faq details { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; background: var(--surface); }
.faq summary { font-weight: 600; cursor: pointer; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.tags li { background: var(--code-bg); border-radius: 999px; padding: 2px 10px; color: var(--muted); }
.other-langs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14px; margin: 24px 0; }
.other-langs span { color: var(--muted); }
.author-box { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); margin: 32px 0; font-size: 15px; }
.author-box p { margin: 0 0 6px; }
.author-name { font-weight: 700; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 32px 0; }
.pager a { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--text); font-size: 14px; background: var(--surface); }
.pager a span { display: block; color: var(--muted); font-size: 12px; }
.pager .next { text-align: right; grid-column: 2; }

/* lists */
.hero-block { padding: 40px 0 16px; }
.hero-block h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.3; margin: 0 0 8px; }
.hero-block p { color: var(--muted); margin: 4px 0; }
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.cat-nav a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; font-size: 14px; color: var(--text); background: var(--surface); }
.search input { width: 100%; max-width: 28rem; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; margin: 8px 0 20px; }
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.card a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .15s; }
.card a:hover { border-color: var(--accent); }
.card-cat { font-size: 12px; color: var(--accent); font-weight: 600; }
.card-title { font-weight: 700; line-height: 1.45; }
.card-desc { font-size: 14px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-date { font-size: 12px; color: var(--muted); margin-top: auto; }

/* root / apps / legal */
.lang-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); margin: 24px 0; }
.lang-card { display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.lang-card strong { font-size: 1.2rem; } .lang-card span { color: var(--muted); font-size: 14px; } .lang-card em { font-style: normal; font-size: 14px; color: var(--accent); }
.support-box { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); padding: 8px 18px; margin: 24px 0; }
.app-grid { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.app-grid a, .app-item { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); font-size: 15px; }
.app-grid small { font-size: 13px; line-height: 1.5; }
.app-links { font-size: 14px; margin-top: 6px; }
.lang-tabs { display: flex; gap: 8px; margin: 12px 0 8px; position: sticky; top: 56px; background: var(--bg); padding: 6px 0; z-index: 5; }
.lang-tabs a { border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; text-decoration: none; font-size: 14px; }
.legal section { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 8px; }
.legal h3 { font-size: 1.05rem; margin: 1.4em 0 .4em; }
.legal li { margin: .3em 0; }
.faq-list dt { font-weight: 600; margin-top: .8em; } .faq-list dd { margin: .2em 0 0 0; color: var(--muted); }
.store-links { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 6px 14px; border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; font-size: 14px; }
.btn.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }

/* ads — 자리만 확보 (CLS 방지). 슬롯이 없으면 요소 자체가 출력되지 않는다 */
.ad { margin: 24px 0; min-height: 100px; }
.ad-side { min-height: 250px; }
