/* ==========================================================================
   lkr-tistory-skin — "Technical Precision" (DESIGN.md 기반)
   모노크롬 · 헤어라인 보더 · Geist + JetBrains Mono · 다크 기본
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 디자인 토큰 (다크 = 기본)
   -------------------------------------------------------------------------- */
:root {
  /* surface 계층 (DESIGN.md) */
  --bg: #131315;                /* surface / background */
  --card: #0e0e10;              /* surface-container-lowest */
  --surface-1: #1c1b1d;         /* surface-container-low (hover/row) */
  --surface-2: #201f22;         /* surface-container (chip) */
  --surface-3: #2a2a2c;         /* surface-container-high (placeholder) */

  --border: #444748;            /* outline-variant */
  --border-strong: #8e9192;     /* outline (hover) */
  --separator: #2a2a2c;         /* 리스트 구분선 */

  --heading: #ffffff;           /* primary */
  --text: #e5e1e4;              /* on-surface */
  --text-sub: #c4c7c8;          /* on-surface-variant */
  --text-muted: #8e9192;        /* outline */

  /* 반전 요소 (버튼 등) */
  --inverse-bg: #ffffff;
  --inverse-text: #131315;

  /* 코드 블록 — 양쪽 모드 공통 다크 */
  --code-bg: #0e0e10;
  --code-border: #2a2a2c;
  --code-text: #d6d3d6;

  /* 콜아웃 — 저채도 파스텔 (DESIGN.md: dimmed palette) */
  --co-info: #c6c6cf;
  --co-warn: #d3bd8e;
  --co-success: #a3c2a8;
  --co-danger: #ffb4ab;

  --dot: rgba(255, 255, 255, 0.05);

  /* 치수 (DESIGN.md spacing/rounded) */
  --header-h: 64px;
  --container: 1200px;
  --content-max: 720px;
  --sidebar-w: 300px;
  --gutter: 24px;
  --section-gap: 64px;
  --radius: 4px;                /* 카드 */
  --radius-sm: 2px;             /* 태그/칩 */
  --radius-lg: 8px;             /* 입력/큰 요소 */

  --font: Geist, "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR",
    sans-serif;
  --font-mono: "JetBrains Mono", "Nanum Gothic Coding", "SF Mono", Menlo,
    Consolas, monospace;
}

/* 라이트 토큰 — DESIGN.md: "invert precisely" */
[data-theme="light"] {
  --bg: #ffffff;
  --card: #ffffff;
  --surface-1: #f4f4f5;
  --surface-2: #ededee;
  --surface-3: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #a1a1aa;
  --separator: #ececee;
  --heading: #09090b;
  --text: #18181b;
  --text-sub: #52525b;
  --text-muted: #71717a;
  --inverse-bg: #09090b;
  --inverse-text: #ffffff;
  --co-warn: #a3854e;
  --co-success: #5d8465;
  --co-danger: #b3564e;
  --co-info: #52525b;
  --dot: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --card: #ffffff;
    --surface-1: #f4f4f5;
    --surface-2: #ededee;
    --surface-3: #e4e4e7;
    --border: #e4e4e7;
    --border-strong: #a1a1aa;
    --separator: #ececee;
    --heading: #09090b;
    --text: #18181b;
    --text-sub: #52525b;
    --text-muted: #71717a;
    --inverse-bg: #09090b;
    --inverse-text: #ffffff;
    --co-warn: #a3854e;
    --co-success: #5d8465;
    --co-danger: #b3564e;
    --co-info: #52525b;
    --dot: rgba(0, 0, 0, 0.06);
  }
}

/* --------------------------------------------------------------------------
   2. 베이스
   -------------------------------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Material Symbols */
.msi {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  vertical-align: -3px;
  font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
  user-select: none;
}

/* 모노 라벨 공통 */
.label { font-family: var(--font-mono); font-size: 12px; line-height: 1.2; }

/* --------------------------------------------------------------------------
   3. 읽기 진행바 + 헤더
   -------------------------------------------------------------------------- */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--heading);
  z-index: 200;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--heading);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 24px;
  margin-right: auto;
}
.site-nav a {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 21px 0 19px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--heading); }
.site-nav a.active { color: var(--heading); border-bottom-color: var(--heading); }

.header-tools { display: flex; align-items: center; gap: 12px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface-1) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  width: 230px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--heading); }
.search-box .msi { font-size: 16px; color: var(--text-muted); }
.search-box input {
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  color: var(--text-sub);
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--heading); }
.icon-btn .msi { font-size: 20px; }

/* --------------------------------------------------------------------------
   4. 레이아웃
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: var(--gutter);
  padding: 48px 0 var(--section-gap);
  align-items: start;
}

main { display: flex; flex-direction: column; gap: 48px; min-width: 0; }
main > * { margin: 0; }

/* --------------------------------------------------------------------------
   5. 커버(홈) — 인사말 + 통계
   -------------------------------------------------------------------------- */
.hero {
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin-bottom: 12px;
}
.hero .hero-sub {
  color: var(--text-sub);
  font-size: 16px;
  margin-bottom: 32px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat-badge {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: color-mix(in srgb, var(--surface-1) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}
.stat-badge:hover { border-color: var(--border-strong); }
.stat-badge .stat-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-badge .stat-label .msi { font-size: 16px; }
.stat-badge .stat-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}
.stat-badge .stat-value small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

/* --------------------------------------------------------------------------
   6. 섹션 공통
   -------------------------------------------------------------------------- */
.section { display: flex; flex-direction: column; gap: 24px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.section-head h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head h2 .msi { font-size: 20px; }
.section-head .more {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.section-head .more:hover { color: var(--heading); }
.section-head .more .msi { font-size: 14px; }

/* --------------------------------------------------------------------------
   7. 인기 카테고리 타일
   -------------------------------------------------------------------------- */
.category-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.category-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  padding: 24px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: border-color 0.2s;
}
.category-tile:hover { border-color: var(--border-strong); }
.category-tile .tile-icon {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 36px;
  color: var(--text-muted);
  opacity: 0.25;
  transition: opacity 0.2s;
}
.category-tile:hover .tile-icon { opacity: 1; }
.category-tile .rank {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.category-tile .tile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
}
.category-tile .tile-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   8. 글 카드
   -------------------------------------------------------------------------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
}

.post-card {
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, background 0.2s;
}
.post-card:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-1) 80%, transparent);
}

.post-thumb {
  aspect-ratio: 16 / 9;
  background: color-mix(in srgb, var(--surface-3) 55%, transparent);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.post-thumb .msi {
  font-size: 40px;
  color: var(--text-muted);
  opacity: 0.4;
}
.post-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.post-card:hover .post-thumb img,
.post-row:hover .post-thumb img { opacity: 1; }

.post-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.post-card-title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--heading);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card:hover .post-card-title,
.post-row:hover .post-card-title {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--border-strong);
}

.post-card-excerpt {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   9. 글 목록 페이지 (가로형 리스트)
   -------------------------------------------------------------------------- */
.list-header {
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}
.list-header .list-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.list-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.list-header .list-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.post-rows { display: flex; flex-direction: column; gap: 16px; }

.post-row {
  display: flex;
  gap: 20px;
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s, background 0.2s;
}
.post-row:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-1) 80%, transparent);
}

.post-row .post-thumb {
  width: 200px;
  min-width: 200px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
}
.post-row .post-thumb .msi { font-size: 32px; }

.post-row-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; padding: 4px 4px 4px 0; }
.post-row-body .post-card-title { font-size: 18px; }

/* 페이지네이션 */
.paging {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.paging > a, .paging > span {
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-sub);
  transition: border-color 0.2s, color 0.2s;
}
.paging > a:hover { border-color: var(--border-strong); color: var(--heading); }
.paging .msi { font-size: 16px; }
.paging .current {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 700;
}
.paging .no-more-prev, .paging .no-more-next {
  opacity: 0.35;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   10. 사이드바 위젯
   -------------------------------------------------------------------------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.widget {
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.widget-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-title .msi { font-size: 17px; color: var(--text-sub); }
.widget-body { padding: 16px; }

/* 프로필 */
.profile .widget-body {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
}
.profile .avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface-3) 55%, transparent);
  border: 1px solid var(--border);
}
.profile .avatar .msi { font-size: 36px; color: var(--text-sub); }
.profile .profile-name { font-size: 18px; font-weight: 700; color: var(--heading); }
.profile .profile-desc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.7;
}
.profile-links { display: flex; justify-content: center; gap: 16px; margin-top: 4px; }
.profile-links a,
.profile-links button { color: var(--text-sub); transition: color 0.2s; cursor: pointer; }
.profile-links a:hover,
.profile-links button:hover { color: var(--heading); }
.profile-links .msi { font-size: 20px; }
.profile-links .copied { color: var(--co-success); }

/* 카테고리 트리 */
.cat-tree { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 13px; }
.cat-group { border-bottom: 1px solid var(--separator); }
.cat-group:last-child { border-bottom: none; }
.cat-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.cat-group-head:hover { background: color-mix(in srgb, var(--surface-1) 55%, transparent); color: var(--heading); }
.cat-group-head .chevron { font-size: 16px; color: var(--text-muted); transition: transform 0.2s; }
.cat-group.open .cat-group-head { color: var(--heading); }
.cat-group.open .chevron { transform: rotate(90deg); }
.cat-children {
  display: none;
  padding: 4px 0 8px;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
}
.cat-group.open .cat-children { display: block; }
.cat-children a {
  display: flex;
  justify-content: space-between;
  padding: 7px 16px 7px 40px;
  font-size: 12px;
  color: var(--text-sub);
  transition: color 0.15s;
}
.cat-children a:hover { color: var(--heading); }
.cat-children .count { color: var(--text-muted); }

/* 인기글 */
.hot-posts { display: flex; flex-direction: column; }
.hot-posts a {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--separator);
  transition: background 0.15s;
}
.hot-posts a:last-child { border-bottom: none; }
.hot-posts a:hover { background: color-mix(in srgb, var(--surface-1) 55%, transparent); }
.hot-posts .hot-rank {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
  min-width: 16px;
}
.hot-posts .hot-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hot-posts a:hover .hot-title { text-decoration: underline; text-underline-offset: 2px; }
.hot-posts .hot-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* 최근 댓글 */
.recent-comments { display: flex; flex-direction: column; }
.recent-comments a {
  padding: 14px 16px;
  border-bottom: 1px solid var(--separator);
  transition: background 0.15s;
}
.recent-comments a:last-child { border-bottom: none; }
.recent-comments a:hover { background: color-mix(in srgb, var(--surface-1) 55%, transparent); }
.recent-comments .rc-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-comments .rc-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* 태그 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tag-cloud a:hover {
  color: var(--heading);
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   11. 글 상세
   -------------------------------------------------------------------------- */
.article-wrap {
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
}
.article-inner { max-width: var(--content-max); margin: 0 auto; }

.article-head { margin-bottom: 40px; }
.article-head .badge { margin-bottom: 16px; }
.article-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--heading);
  margin-bottom: 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.article-meta .msi { font-size: 15px; margin-right: 4px; }

/* 본문 타이포 */
.article-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  word-break: keep-all;
}
.article-body > * + * { margin-top: 1.15em; }
.article-body h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin-top: 2.5em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--heading);
  margin-top: 2em;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body a {
  color: var(--heading);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color 0.15s;
}
.article-body a:hover { text-decoration-color: var(--heading); }
.article-body strong { font-weight: 700; color: var(--heading); }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body ul { list-style: square; }
.article-body ol { list-style: decimal; }
.article-body li + li { margin-top: 0.4em; }
.article-body li::marker { color: var(--text-muted); }

.article-body blockquote {
  border-left: 2px solid var(--border-strong);
  padding: 4px 0 4px 20px;
  color: var(--text-sub);
}

/* 인라인 코드 */
.article-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border: 1px solid var(--border);
  color: var(--heading);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

/* 코드 블록 — 양쪽 모드 공통 다크 */
.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  position: relative;
}
.article-body pre code { font-family: var(--font-mono); }
.code-lang {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #6e7273;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
/* 저채도 신택스 팔레트 (DESIGN.md: dimmed palette) */
pre .tk-kw { color: #c6c6cf; font-weight: 500; }
pre .tk-fn { color: #ffffff; }
pre .tk-str { color: #a3b8a3; }
pre .tk-cm { color: #6e7273; font-style: italic; }
pre .tk-num { color: #b4b4bd; }

/* 표 */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--border);
}
.article-body th {
  font-family: var(--font-mono);
  font-size: 12px;
  background: color-mix(in srgb, var(--surface-1) 70%, transparent);
  color: var(--heading);
  font-weight: 500;
  text-align: left;
}
.article-body th, .article-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--separator);
}
.article-body tr:last-child td { border-bottom: none; }

/* 콜아웃 — 플랫, 1px 보더 + 좌측 2px 액센트 */
.callout {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  border-left-width: 2px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-1) 45%, transparent);
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.7;
}
.callout .msi { font-size: 18px; margin-top: 3px; }
.callout.info    { border-left-color: var(--co-info); }
.callout.info    .msi { color: var(--co-info); }
.callout.warn    { border-left-color: var(--co-warn); }
.callout.warn    .msi { color: var(--co-warn); }
.callout.success { border-left-color: var(--co-success); }
.callout.success .msi { color: var(--co-success); }
.callout.danger  { border-left-color: var(--co-danger); }
.callout.danger  .msi { color: var(--co-danger); }

/* 이미지 + 캡션 */
.article-body figure img { border: 1px solid var(--border); border-radius: var(--radius); }
.article-body figcaption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* 태그 + 푸터 */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.article-tags a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: color 0.15s, border-color 0.15s;
}
.article-tags a:hover { color: var(--heading); border-color: var(--border-strong); }

/* 작성자 카드 */
.author-card {
  display: flex;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-1) 45%, transparent);
  padding: 20px 24px;
  margin-top: 24px;
}
.author-card .avatar {
  width: 56px; height: 56px;
  min-width: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface-3) 55%, transparent);
  border: 1px solid var(--border);
}
.author-card .avatar .msi { font-size: 26px; color: var(--text-sub); }
.author-card .author-name { font-weight: 700; font-size: 16px; color: var(--heading); }
.author-card .author-desc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.6;
}

/* 이전/다음 글 */
.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.post-nav a {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color 0.2s, background 0.2s;
}
.post-nav a:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-1) 55%, transparent);
}
.post-nav .nav-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.05em; }
.post-nav .nav-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-nav .next { text-align: right; }

/* --------------------------------------------------------------------------
   12. TOC
   -------------------------------------------------------------------------- */
.toc { display: flex; flex-direction: column; padding: 8px 0; }
.toc a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 16px;
  border-left: 2px solid transparent;
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
}
.toc a.depth-3 { padding-left: 32px; }
.toc a:hover { color: var(--heading); }
.toc a.active {
  color: var(--heading);
  border-left-color: var(--heading);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   13. 댓글 / 방명록
   -------------------------------------------------------------------------- */
.comments-wrap {
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
}
.comments-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.comments-title .count { font-family: var(--font-mono); color: var(--text-muted); font-size: 16px; }

.comment { display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--separator); }
.comment:last-of-type { border-bottom: none; }
.comment .avatar {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1px solid var(--border);
}
.comment .avatar .msi { font-size: 20px; color: var(--text-sub); }
.comment.reply { margin-left: 54px; position: relative; }
.comment.reply::before {
  content: "subdirectory_arrow_right";
  font-family: "Material Symbols Outlined";
  font-size: 16px;
  position: absolute;
  left: -28px; top: 30px;
  color: var(--text-muted);
}
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comment-head .name { font-weight: 700; font-size: 14px; color: var(--heading); }
.comment-head .name.owner::after {
  content: "OWNER";
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 5px;
  margin-left: 8px;
  vertical-align: 2px;
  letter-spacing: 0.05em;
}
.comment-head .date { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.comment-text { font-size: 14.5px; margin-top: 6px; line-height: 1.7; }
.comment-actions { margin-top: 8px; }
.comment-actions button {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0;
  transition: color 0.15s;
}
.comment-actions button:hover { color: var(--heading); }

/* 댓글 폼 */
.comment-form { margin-top: 8px; padding-top: 20px; }
.comment-form .form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.comment-form input[type="text"],
.comment-form input[type="password"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.comment-form textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  line-height: 1.6;
  transition: border-color 0.2s;
}
.comment-form input::placeholder,
.comment-form textarea::placeholder { color: var(--text-muted); }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--heading); }
.comment-form .form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}
.comment-form .secret-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* 버튼 — DESIGN.md: primary = 반전(흰 배경 + 검정 텍스트) */
.btn-primary {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius);
  padding: 10px 24px;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

/* --------------------------------------------------------------------------
   14. 푸터
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  padding: 40px 0;
  margin-top: var(--section-gap);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .footer-logo {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
}
.site-footer .footer-copy { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.site-footer .footer-links { display: flex; gap: 16px; }
.site-footer .footer-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.site-footer .footer-links a:hover { color: var(--heading); }

/* --------------------------------------------------------------------------
   15. 스킨 전용 (skin.html에서만 쓰이는 요소)
   -------------------------------------------------------------------------- */
/* 홈 전용 요소 — tt-body-index에서만 표시 */
.home-only { display: none; }
#tt-body-index .hero.home-only { display: block; }
#tt-body-index .section.home-only { display: flex; }

/* JS가 트리로 재구성하기 전의 원본 카테고리 출력은 숨긴다 */
.cat-source { display: none; }

/* 광고 슬롯 */
.revenue-slot { min-height: 0; }
.revenue-slot:not(:empty) { margin-top: 16px; }

/* 썸네일 셀 안에서 아이콘(폴백)과 이미지를 겹쳐 쌓는다 */
.post-thumb > * { grid-area: 1 / 1; }
.profile .avatar { position: relative; overflow: hidden; }
.profile .avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* 빈 목록 */
.list-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.list-empty .msi { font-size: 32px; }

/* 보호글 */
.protected-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-1) 45%, transparent);
  padding: 40px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.protected-box .msi { font-size: 32px; color: var(--text-muted); }
.protected-box p { font-family: var(--font-mono); font-size: 13px; color: var(--text-sub); }
.protected-box .form-row { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.protected-box input[type="password"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.protected-box input[type="password"]:focus { border-color: var(--heading); }

/* 인덱스(아카이브)에서 반복되는 글 카드 간격 — main의 gap을 상쇄 */
main > .index-item + .index-item { margin-top: -32px; }

/* 목록 페이지(카테고리/검색/태그/아카이브)에서는 s_list와 글 요약이
   동시에 출력되어 게시물이 중복으로 보이므로 글 요약 쪽을 숨긴다 */
#tt-body-category .index-item,
#tt-body-search .index-item,
#tt-body-tag .index-item,
#tt-body-archive .index-item,
#tt-body-location .index-item { display: none; }

/* 태그 클라우드 페이지의 빈도 클래스 — 크기 대신 명도로 표현 */
.tag-cloud .cloud5 { color: var(--heading); border-color: var(--border-strong); }
.tag-cloud .cloud4 { color: var(--text); }
.tag-cloud .cloud1, .tag-cloud .cloud2 { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   16. 반응형
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { order: 2; }
  .toc-widget { display: none; }
}

@media (max-width: 767px) {
  .container { padding: 0 16px; }
  .site-nav { display: none; }
  .site-header .container { gap: 12px; }
  .site-logo { font-size: 16px; }
  .header-tools { flex: 1; min-width: 0; justify-content: flex-end; }
  .search-box { flex: 1; min-width: 0; width: auto; max-width: 220px; }
  .layout { padding-top: 24px; }
  main { gap: 40px; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-badge { padding: 12px; }
  .category-tiles { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .post-row { flex-direction: column; }
  .post-row .post-thumb { width: 100%; min-width: 0; }
  .article-wrap { padding: 28px 20px; }
  .article-title { font-size: 24px; }
  .comments-wrap { padding: 24px 18px; }
  .post-nav { grid-template-columns: 1fr; }
  .site-footer .container { flex-direction: column; }
}
