/* CodePulse — 코딩 블로그 · 문서형 레이아웃 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --accent: #2563eb;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --code-bg: #f1f5f9;
  --code-fg: var(--text);
  --code-border: var(--border);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  /* Plus Jakarta: 라틴·숫자·UI, 고운돋움: 한글 본문 */
  --font-sans: "Plus Jakarta Sans", "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 280px;
  --content-max: 52rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --surface: #111827;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #1e293b;
    /* 코드 블록: 에디터/티스토리 기본 하이라이트는 밝은 배경용 색이라 어두운 배경과 겹치면 글자가 안 보임 */
    --code-bg: #eef2f7;
    --code-fg: #0f172a;
    --code-border: #cbd5e1;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #1e293b;
  --code-bg: #eef2f7;
  --code-fg: #0f172a;
  --code-border: #cbd5e1;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --code-bg: #f1f5f9;
  --code-fg: var(--text);
  --code-border: var(--border);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body.skin-codepulse {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  opacity: 0.92;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 10000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* 헤더 */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.site-header__inner {
  max-width: calc(var(--sidebar-w) + var(--content-max) + 4rem);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand__title {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-brand__desc {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 36rem;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.blog-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.blog-menu a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.blog-menu a:hover {
  color: var(--accent);
}

/* 레이아웃 */
.layout {
  max-width: calc(var(--sidebar-w) + var(--content-max) + 4rem);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static !important;
  }
}

.sidebar {
  position: sticky;
  top: 5.5rem;
}

.sidebar__profile {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.sidebar__avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent) 28%, var(--surface)),
    var(--code-bg)
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  border: none;
}

.sidebar__owner {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.sidebar__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sidebar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.sidebar__pill {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
}

.sidebar__pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 위젯 */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.widget__title {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.widget__body {
  font-size: 0.88rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
}

.search-row__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.search-row__btn {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.widget-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.widget-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.widget-list li:last-child {
  border-bottom: none;
}

.widget-list__link {
  display: block;
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
  text-decoration: none;
}

.widget-list__meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.widget-thumb img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.tag-cloud {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.tag-cloud__link {
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

.tag-cloud .cloud1 {
  font-weight: 700;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.tag-cloud .cloud2 {
  font-weight: 600;
}

.counter-widget__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
}

.counter-widget__row:last-child {
  border-bottom: none;
}

.counter-widget strong {
  font-variant-numeric: tabular-nums;
}

/* 비어 있는 사이드바 위젯 숨김 (태그 미사용 · 공지 없음) */
.widget--tags:not(:has(.tag-cloud > li)),
.widget--notice:not(:has(.widget-list > li)) {
  display: none;
}

/* 카테고리 트리 (티스토리 기본 마크업) */
.tt-category-wrap ul {
  list-style: none;
  margin: 0;
}

.tt-category-wrap > ul,
.tt-category-wrap .tt_category > ul {
  padding-left: 0;
}

/* 하위 카테고리: 들여쓰기 + 왼쪽 구분선 */
.tt-category-wrap li > ul {
  margin: 0.2rem 0 0.35rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--border);
}

.tt-category-wrap li {
  margin: 0.15rem 0;
}

.tt-category-wrap li > ul a {
  font-size: 0.82rem;
  color: var(--muted);
}

.tt-category-wrap a {
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
}

.tt-category-wrap a:hover,
.tt-category-wrap li > ul a:hover {
  color: var(--accent);
}

/* 메인 */
.main {
  min-width: 0;
}

.content-wrap {
  min-width: 0;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.sheet__head {
  margin-bottom: 1.5rem;
}

.sheet__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet__title {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.sheet__title a {
  color: inherit;
  text-decoration: none;
}

.sheet__title a:hover {
  color: var(--accent);
}

.sheet__count {
  font-weight: 600;
  font-size: 1rem;
  color: var(--muted);
}

.sheet__lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.sheet__category {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
}

.sheet__category a {
  font-weight: 600;
  text-decoration: none;
}

.sheet__meta {
  margin-top: 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.sheet__comments-link {
  font-weight: 500;
}

.dot {
  opacity: 0.5;
}

.sheet__cover {
  margin: 0 0 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.sheet__cover img {
  width: 100%;
  display: block;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.badge--notice {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.admin-bar a,
.admin-bar button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
}

.admin-bar button.danger {
  color: #dc2626;
}

/* 본문 타이포그래피 */
/* 본문 밖(목록·위젯 등)은 body 글꼴 상속. 글/.페이지 본문(.sheet__article)은 아래에서 산세리프로 통일. */
.prose {
  font-size: 1rem;
  overflow-wrap: break-word;
}

/* 글·페이지 본문: 티스토리/에디터 기본 명조·바탕류 제거 → 스킨 --font-sans (코드·키보드만 monospace) */
body.skin-codepulse .sheet__article.prose :where(
  p,
  ul,
  ol,
  li,
  blockquote,
  table,
  caption,
  td,
  th,
  dl,
  dt,
  dd,
  div,
  span,
  font,
  a,
  strong,
  em,
  b,
  i,
  u,
  s,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6
) {
  font-family: var(--font-sans) !important;
}

body.skin-codepulse .sheet__article.prose [style*="font-family"] {
  font-family: var(--font-sans) !important;
}

body.skin-codepulse .sheet__article.prose pre [style*="font-family"],
body.skin-codepulse .sheet__article.prose code[style*="font-family"] {
  font-family: var(--font-mono) !important;
}

body.skin-codepulse .sheet__article.prose pre,
body.skin-codepulse .sheet__article.prose pre *,
body.skin-codepulse .sheet__article.prose code,
body.skin-codepulse .sheet__article.prose kbd,
body.skin-codepulse .sheet__article.prose samp {
  font-family: var(--font-mono) !important;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.prose h2 {
  font-size: 1.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.15rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0.85rem 0;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.65rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--bg);
  color: var(--muted);
}

body.skin-codepulse .prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1.25rem 0;
  background: var(--surface);
  color: var(--text);
}

/* 에디터·본문 기본 스타일보다 우선: 칸마다 다른 인라인 배경 제거 */
body.skin-codepulse .prose th,
body.skin-codepulse .prose td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  color: var(--text) !important;
  background-color: var(--surface) !important;
}

body.skin-codepulse .prose th {
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface)) !important;
}

body.skin-codepulse .prose tbody tr:nth-child(even) td,
body.skin-codepulse .prose table > tr:nth-child(even) td {
  background-color: color-mix(in srgb, var(--bg) 48%, var(--surface)) !important;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.prose img {
  border-radius: 8px;
}

/* 코드 */
.prose code,
.prose kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  border: 1px solid var(--code-border);
}

.prose pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.prose pre code {
  font-size: inherit;
  padding: 0;
  border: none;
  background: none;
}

.hljs,
.prose pre[class*="language-"] {
  background: var(--code-bg);
  color: var(--code-fg);
}

/* 카드 (목록) — 썸네일 없을 때 빈 열 제거 */
.card-post {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-post:has(.card-post__lead) {
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 1.15rem;
}

@media (max-width: 520px) {
  .card-post:has(.card-post__lead) {
    grid-template-columns: 1fr;
  }
}

.card-post__lead {
  min-width: 0;
}

.card-post__thumb {
  display: block;
}

.card-post__thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.card-post__category {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-post__category a {
  text-decoration: none;
  color: var(--accent);
}

.card-post__title {
  margin: 0 0 0.45rem;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
}

.card-post__title a {
  color: inherit;
  text-decoration: none;
}

.card-post__title a:hover {
  color: var(--accent);
}

.card-post__body {
  min-width: 0;
}

/* 요약: padding과 line-clamp를 같은 요소에 두면 줄이 반만 잘림 → 박스는 바깥, clamp는 안쪽 */
.card-post__summary-box {
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--bg);
  border-left: 3px solid color-mix(in srgb, var(--accent) 50%, var(--border));
}

.card-post__summary {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

/* 요약 자동 정리(JS tidyCodingExcerpt) 후 문단형 가독성 */
.card-post__summary.excerpt-tidied,
.post-list__summary.excerpt-tidied {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.card-post__meta {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* 검색/카테고리 등 리스트 */
.list-hero {
  height: 120px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list__item {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.post-list__item:has(.post-list__thumb) {
  grid-template-columns: 6rem minmax(0, 1fr) 88px;
}

@media (max-width: 640px) {
  .post-list__item,
  .post-list__item:has(.post-list__thumb) {
    grid-template-columns: 1fr;
  }
}

.post-list__date {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-list__title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.post-list__title:hover {
  color: var(--accent);
}

.post-list__meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.post-list__meta a {
  color: var(--muted);
}

.post-list__summary-box {
  margin-top: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--bg);
  border-left: 3px solid color-mix(in srgb, var(--accent) 50%, var(--border));
}

.post-list__summary {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.post-list__thumb img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.post-list__empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

/* 페이징 */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.pager a {
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg);
}

.pager a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pager__nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.pager__num.paging-current,
.pager__num[class*="current"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 태그 트레일 */
.tag-trail {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.tag-trail__label {
  font-weight: 700;
  margin-right: 0.5rem;
  color: var(--muted);
}

.tag-trail__items a {
  margin-right: 0.35rem;
}

/* 이전·다음 */
.post-adj {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2rem;
}

@media (max-width: 640px) {
  .post-adj {
    grid-template-columns: 1fr;
  }
}

.post-adj__card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: inherit;
}

.post-adj__card:hover {
  border-color: var(--accent);
}

.post-adj__dir {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.post-adj__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.post-adj__date {
  font-size: 0.78rem;
  color: var(--muted);
}

.post-adj__card--next {
  text-align: right;
}

/* 관련 글 (티스토리 rep_type 기본 표 스타일이 겹치면 배경·글자색이 깨짐 → 스킨에서 덮어씀) */
.related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.related__title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.related__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.related .related__item {
  display: block !important;
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: none !important;
}

.related__item::marker {
  content: none;
}

.related__link {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text) !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}

.related__link:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border)) !important;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface)) !important;
}

.related__thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.related__text {
  display: flex !important;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.related__post-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text) !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related__post-date {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted) !important;
  white-space: nowrap;
}

.related__more {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.related__more:hover {
  text-decoration: underline;
}

/* 관련·카테고리 다른 글: 플랫폼 <table> → 표 겉모습 제거, 한 줄 카드 목록처럼 보이게 */
body.skin-codepulse section.related > table,
body.skin-codepulse section.related .related__list > table,
body.skin-codepulse section.related h2.related__title ~ table,
body.skin-codepulse section.related > *:not(.related__list) table {
  display: block;
  width: 100%;
  margin: 0;
  font-size: 0.92rem;
  border: none !important;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent !important;
  color: var(--text) !important;
  border-radius: 0;
  overflow: visible;
}

body.skin-codepulse section.related > table thead,
body.skin-codepulse section.related > table tbody,
body.skin-codepulse section.related .related__list > table thead,
body.skin-codepulse section.related .related__list > table tbody,
body.skin-codepulse section.related h2.related__title ~ table thead,
body.skin-codepulse section.related h2.related__title ~ table tbody,
body.skin-codepulse section.related > *:not(.related__list) table thead,
body.skin-codepulse section.related > *:not(.related__list) table tbody {
  display: block;
}

body.skin-codepulse section.related > table > tbody > tr,
body.skin-codepulse section.related > table > tr,
body.skin-codepulse section.related .related__list > table > tbody > tr,
body.skin-codepulse section.related .related__list > table > tr,
body.skin-codepulse section.related h2.related__title ~ table > tbody > tr,
body.skin-codepulse section.related h2.related__title ~ table > tr,
body.skin-codepulse section.related > *:not(.related__list) table > tbody > tr,
body.skin-codepulse section.related > *:not(.related__list) table > tr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface) !important;
  box-shadow: var(--shadow);
}

body.skin-codepulse section.related > table > tbody > tr:last-child,
body.skin-codepulse section.related > table > tr:last-child,
body.skin-codepulse section.related .related__list > table > tbody > tr:last-child,
body.skin-codepulse section.related h2.related__title ~ table > tbody > tr:last-child,
body.skin-codepulse section.related > *:not(.related__list) table > tbody > tr:last-child {
  margin-bottom: 0;
}

body.skin-codepulse section.related > table td,
body.skin-codepulse section.related > table th,
body.skin-codepulse section.related .related__list > table td,
body.skin-codepulse section.related .related__list > table th,
body.skin-codepulse section.related h2.related__title ~ table td,
body.skin-codepulse section.related h2.related__title ~ table th,
body.skin-codepulse section.related > *:not(.related__list) table td,
body.skin-codepulse section.related > *:not(.related__list) table th {
  display: block;
  flex: 0 1 auto;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  vertical-align: middle;
  text-align: inherit;
  width: auto !important;
}

body.skin-codepulse section.related > table td:first-child,
body.skin-codepulse section.related > table th:first-child,
body.skin-codepulse section.related .related__list > table td:first-child,
body.skin-codepulse section.related h2.related__title ~ table td:first-child,
body.skin-codepulse section.related > *:not(.related__list) table td:first-child {
  flex: 1;
  min-width: 0;
  color: var(--text) !important;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.skin-codepulse section.related > table td:last-child,
body.skin-codepulse section.related > table th:last-child,
body.skin-codepulse section.related .related__list > table td:last-child,
body.skin-codepulse section.related h2.related__title ~ table td:last-child,
body.skin-codepulse section.related > *:not(.related__list) table td:last-child {
  flex-shrink: 0;
  color: var(--muted) !important;
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body.skin-codepulse section.related > table a,
body.skin-codepulse section.related .related__list > table a,
body.skin-codepulse section.related h2.related__title ~ table a,
body.skin-codepulse section.related > *:not(.related__list) table a {
  color: var(--text) !important;
  text-decoration: none;
}

body.skin-codepulse section.related > table a:hover,
body.skin-codepulse section.related .related__list > table a:hover,
body.skin-codepulse section.related h2.related__title ~ table a:hover,
body.skin-codepulse section.related > *:not(.related__list) table a:hover {
  color: var(--accent) !important;
}

/* JS(table.codepulse-related-cards): 플랫폼 표 스타일·display 덮어쓰기 */
body.skin-codepulse table.codepulse-related-cards {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  font-size: 0.92rem !important;
  border: none !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text) !important;
}

body.skin-codepulse table.codepulse-related-cards colgroup {
  display: none !important;
}

body.skin-codepulse table.codepulse-related-cards thead,
body.skin-codepulse table.codepulse-related-cards tbody {
  display: block !important;
}

body.skin-codepulse table.codepulse-related-cards tr {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  margin: 0 0 0.5rem !important;
  padding: 0.65rem 0.9rem !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  box-shadow: var(--shadow) !important;
}

body.skin-codepulse table.codepulse-related-cards tbody tr:last-child,
body.skin-codepulse table.codepulse-related-cards > tr:last-child {
  margin-bottom: 0 !important;
}

body.skin-codepulse table.codepulse-related-cards td,
body.skin-codepulse table.codepulse-related-cards th {
  display: block !important;
  flex: 0 1 auto !important;
  border: none !important;
  background: transparent !important;
  background-color: transparent !important;
  padding: 0 !important;
  vertical-align: middle !important;
  text-align: inherit !important;
  width: auto !important;
  min-width: 0 !important;
}

body.skin-codepulse table.codepulse-related-cards td:first-child,
body.skin-codepulse table.codepulse-related-cards th:first-child {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  color: var(--text) !important;
  font-weight: 600 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.skin-codepulse table.codepulse-related-cards td:last-child,
body.skin-codepulse table.codepulse-related-cards th:last-child {
  flex: 0 0 auto !important;
  color: var(--muted) !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  font-variant-numeric: tabular-nums !important;
  white-space: nowrap !important;
}

body.skin-codepulse table.codepulse-related-cards a {
  color: var(--text) !important;
  text-decoration: none !important;
}

body.skin-codepulse table.codepulse-related-cards a:hover {
  color: var(--accent) !important;
}

/* 링크 안 중첩 표 — 위쪽 section.related table 규칙보다 구체적으로 덮어씀 */
body.skin-codepulse section.related .related__link table,
body.skin-codepulse section.related .related__item .related__link table {
  width: 100%;
  border-collapse: collapse;
  border: none !important;
  border-radius: 0;
  overflow: visible;
  background: transparent !important;
}

body.skin-codepulse section.related .related__link td,
body.skin-codepulse section.related .related__link th,
body.skin-codepulse section.related .related__item .related__link td,
body.skin-codepulse section.related .related__item .related__link th {
  border: none !important;
  padding: 0 !important;
  background-color: transparent !important;
  color: var(--text) !important;
  vertical-align: middle;
  text-align: inherit;
  width: auto;
  white-space: normal;
}

/* 댓글 영역 (티스토리 리액트 위젯 보조) */
.comments-region {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

[data-tistory-react-app="Comment"] .tt-comment-cont {
  border-radius: var(--radius);
}

.guestbook-react {
  margin-top: 1rem;
}

/* 보호글 */
.sheet--protected .protected-msg {
  color: var(--muted);
}

.protected-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
}

.protected-form__input {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.protected-form__btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* 푸터 */
.site-footer {
  margin-top: 2rem;
  padding: 1rem 0 2rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--muted);
}

/* 인덱스 · 글 상세 바디 보조 */
#tt-body-index .card-post:first-of-type {
  margin-top: 0;
}
