/* ================= 글 상세 전용: cat으로 연 파일처럼 보이는 머리말, 터미널 목차 ================= */
.term-vars {
  --t-bg: rgba(13, 17, 23, .92); --t-bar: #161b22; --t-line: #30363d; --t-fg: #c9d1d9; --t-dim: #6e7681;
  --t-green: #3fb950; --t-blue: #58a6ff; --t-yellow: #d29922; --t-purple: #bc8cff; --t-red: #ff7b72; --t-cyan: #39c5cf;
}
.post-hero {
  position: relative; overflow: hidden;
  margin-top: calc(var(--top-h) * -1);
  padding: calc(var(--top-h) + 56px) 0 64px;
  background: var(--hero-bg); color: var(--hero-fg);
}
.post-hero::before, .post-hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; pointer-events: none;
}
.post-hero::before { width: 520px; height: 520px; background: #7c3aed; top: -180px; right: -120px; }
.post-hero::after { width: 420px; height: 420px; background: #06b6d4; bottom: -220px; left: -100px; }
.grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.post-hero .wrap { position: relative; z-index: 1; }

.term {
  max-width: 920px; margin: 0 auto;
  border-radius: 14px; overflow: hidden;
  background: var(--t-bg); color: var(--t-fg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 30px 80px rgba(0,0,0,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-family: var(--mono), "Pretendard Variable", sans-serif; font-size: 13.5px; line-height: 1.7;
}
.t-bar {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; background: var(--t-bar); border-bottom: 1px solid var(--t-line);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
.t-bar .title { position: absolute; left: 50%; transform: translateX(-50%); color: var(--t-dim); font-size: 12px; white-space: nowrap; }
.screen { padding: 18px 24px 22px; }
.ps1 { color: var(--t-green); font-weight: 700; }
.ps1 .path { color: var(--t-blue); }
.dim { color: var(--t-dim); }
.fm { margin: 6px 0 0; }
.fm .k { color: var(--t-yellow); }
.fm .v { color: #a5d6ff; }
.fm a { color: var(--t-cyan); }
.fm a:hover { text-decoration: underline; text-underline-offset: 3px; }
.term h1 {
  margin: 18px 0 6px;
  font-family: "Pretendard Variable", Pretendard, sans-serif;
  font-size: clamp(26px, 3.6vw, 42px); line-height: 1.3; letter-spacing: -0.035em; font-weight: 800; color: #f8fafc;
}
.term h1::before { content: "# "; font-family: var(--mono); color: var(--t-purple); font-weight: 700; }
.term .lead { margin: 0 0 14px; font-family: "Pretendard Variable", Pretendard, sans-serif; font-size: 16.5px; color: var(--hero-muted); }
.t-caret { display: inline-block; width: .6em; height: 1.1em; background: var(--t-green); vertical-align: -0.2em; animation: blink 1s steps(1) infinite; }
.t-status {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 14px; font-size: 11.5px; background: var(--t-green); color: #0d1117;
}
.t-status b { font-weight: 700; }
/* 부팅 연출: 명령어를 친 뒤 출력이 나타남 (내용은 처음부터 DOM에 있음). JS가 없으면(.js 없음) 처음부터 보인다 */
.js .boot .out { visibility: hidden; }
.js .boot.done .out { visibility: visible; animation: pop .35s ease both; }

/* 본문: 제목 앞에 마크다운 기호 */
.prose h2 { border-bottom: 1px dashed var(--line); }
.prose h2::before, .prose h3::before { font-family: var(--mono); color: var(--accent); font-weight: 700; margin-right: .35em; }
.prose h2::before { content: "##"; }
.prose h3::before { content: "###"; }
.prose .anchor { display: none; }
/* 표 칸 정렬: 마크다운의 ---: / :---: 가 만든 align 속성을 따른다 (숫자 칸은 디자인의 .num과 같은 모양) */
.prose th[align="right"], .prose td[align="right"] { text-align: right; font-family: var(--mono); font-size: 14px; }
.prose th[align="center"], .prose td[align="center"] { text-align: center; }

/* ---------- Mermaid 다이어그램 (post.js가 그림으로 바꾼다) ---------- */
.mermaid-box { margin: 0 0 1.6em; padding: 20px; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; text-align: center; }
.mermaid-box svg { max-width: 100%; height: auto; }
.mermaid-error { margin: 0 0 8px; color: #ef4444; font-weight: 700; text-align: left; }
.mermaid-box pre { margin: 0; text-align: left; white-space: pre-wrap; font-family: var(--mono); font-size: 13px; }

/* 본문 이미지: 본문 폭을 넘지 않게 줄이고(비율 유지), 문단과 간격을 둔다 (디자인에는 본문 이미지가 없다) */
.prose img { display: block; max-width: 100%; height: auto; margin: 0 auto 1.5em; border-radius: 12px; }

/* ---------- 강조 상자 (> [!종류], 디자인 .callout에 종류별 색·제목·접기를 더한다) ---------- */
.callout.callout-note { --c: var(--muted); }
.callout.callout-info { --c: #3b82f6; }
.callout.callout-warning { --c: #f59e0b; }
.callout.callout-error { --c: #ef4444; }
.callout.callout-summary { --c: #10b981; }
/* callout-tip은 디자인 기본색(--accent-2) 그대로 */

.callout-body { min-width: 0; flex: 1; }
.callout-body > * + * { margin-top: .6em; }   /* 디자인은 문단 하나라 margin 0, 여러 문단·목록이면 사이를 띄운다 */
.callout-body > :last-child { margin-bottom: 0; }   /* 목록·코드로 끝나도 아래 여백이 위와 같게 */
.callout-title { font-weight: 700; }
.callout .codeblock, .callout pre { margin-bottom: 0; }

/* 접이식: details는 세로로 쌓고, 펼치는 줄(summary)에 아이콘과 제목 */
details.callout { display: block; }
details.callout > summary {
  display: flex; gap: 12px; align-items: center;
  cursor: pointer; font-weight: 700; list-style: none;
}
details.callout > summary::-webkit-details-marker { display: none; }
details.callout > summary::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.callout[open] > summary::after { transform: rotate(90deg); }
details.callout[open] > summary { margin-bottom: .6em; }

.post-grid { display: grid; grid-template-columns: minmax(0, 720px) 240px; gap: 56px; justify-content: center; }
.post-body { padding-top: 56px; min-width: 0; }
.post-body > #series { margin-bottom: 40px; }
.toc-side { padding-top: 56px; }
.toc-side .term { position: sticky; top: calc(var(--top-h) + 32px); font-size: 12.5px; box-shadow: 0 0 0 1px rgba(255,255,255,.06), var(--shadow); }
.toc-side .t-bar { height: 30px; }
.toc-side .dot { width: 10px; height: 10px; }
.toc-side .screen { padding: 12px 14px 14px; }
.toc-side .toc ol { margin-top: 6px; }
.toc-side .toc a {
  display: flex; gap: 1ch; padding: 1px 0; border: 0;
  color: var(--t-fg); font-family: "Pretendard Variable", Pretendard, sans-serif; font-size: 13px; font-weight: 400;
}
.toc-side .toc a::before { content: "├─"; flex: none; white-space: pre; font-family: var(--mono); color: var(--t-dim); }
.toc-side .toc li:last-child a::before { content: "└─"; }
.toc-side .toc a.h3 { padding-left: 0; font-size: 12.5px; color: var(--t-dim); }
.toc-side .toc a.h3::before { content: "│  ├─"; }
.toc-side .toc a:hover { color: var(--t-blue); }
.toc-side .toc a.on { color: var(--t-green); }
.toc-side .toc a.on::after { content: "◀"; margin-left: auto; font-size: 10px; color: var(--t-green); }
.toc-side .t-status { font-size: 11px; }
.toc-inline { display: none; }

.post-end { display: grid; gap: 28px; margin-top: 56px; padding-top: 40px; border-top: 1px dashed var(--line); }
.eof { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.eof b { color: var(--accent); }
.pn b { font-size: 15.5px; }
.pn .cmd { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn .cmd::before { content: "$ "; color: var(--accent); font-weight: 700; }

main > section.wrap.more { padding-top: 104px; }

/* 좁은 화면용 이동 버튼 (맨 위, 글 끝): 사이드바 서랍(z 25~)보다 아래, 상단바(z 20)보다 위 */
.jump { display: none; }
@media (max-width: 860px) {
  .jump {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 22;
    display: flex; flex-direction: column; gap: 8px;
    opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s, transform .2s, visibility .2s;
  }
  .jump.show { opacity: 1; visibility: visible; transform: none; }
  .jump button {
    width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
    font-family: var(--mono); font-size: 16px; cursor: pointer;
  }
  .jump button:active { color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) { .jump { transition: none; } }

@container (max-width: 1040px) {
  .post-grid { grid-template-columns: minmax(0, 720px); }
  .toc-side { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 600px) {
  .post-hero { padding: calc(var(--top-h) + 28px) 0 40px; }
  .term { font-size: 12px; }
  .screen { padding: 14px 16px 18px; }
  .t-bar .title { display: none; }
  .post-body { padding-top: 36px; }
}
