/* ============================================================
   팩토리풍 반응형 티스토리 스킨 — style.css
   구조: 토큰 → 리셋 → 폰트 → 레이아웃 → 헤더/GNB → 사이드바
        → 홈(커버) → 글 → 목록/기타 → 푸터 → 반응형(7단)
   ============================================================ */

/* ── 디자인 토큰 ─────────────────────────────────────────── */
:root {
  --text: #333;
  --text-sub: #666;
  --text-weak: #999;
  --dark: #2c2c2c;
  --border: #e1e1e1;
  --border-soft: #ddd;
  --link: #0077cc;
  --bg-soft: #f5f5f5;
  --bg-softer: #fafafa;
  --radius-lg: 20px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --container: 1260px;
  --sidebar-w: 240px;
  --gap: 40px;
}

/* ── 리셋 ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: #fff;
  line-height: 1.6;
  font-size: 16px;
  word-break: keep-all;
}
img { max-width: 100%; height: auto; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--link); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; border: 0; background: none; cursor: pointer; padding: 0; color: inherit; }
input { font: inherit; color: inherit; }

/* ── 폰트 클래스 (스킨 옵션 font_family) ─────────────────── */
body.font-pretendard { font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif; }
body.font-gowun-dodum { font-family: "Gowun Dodum", sans-serif; }
body.font-gowun-batang { font-family: "Gowun Batang", serif; }
body.font-nanum-gothic { font-family: "Nanum Gothic", sans-serif; }
body.font-jua { font-family: "Jua", sans-serif; }

/* ── 레이아웃 ────────────────────────────────────────────── */
.cf-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px 20px 60px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

/* ── 모바일 상단바(기본 숨김, 700px 이하 표시) ───────────── */
.cf-mobile-bar, .cf-mobile-panel { display: none; }

/* ── 헤더 배너 ───────────────────────────────────────────── */
.cf-header {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background:
    url("./images/header-bg.svg?v=3") center / cover no-repeat,
    radial-gradient(circle at 50% 28%, #242e45 0%, #1a2233 50%, #10141d 100%);
}
.cf-header-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.cf-header-inner {
  position: relative;
  text-align: center;
  padding: 48px 20px;
}
.cf-blog-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 1px;
}
.cf-blog-title a:hover { color: #fff; opacity: 0.9; }

/* 검색창 */
.cf-search {
  margin: 22px auto 0;
  width: 280px;
  max-width: 90%;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 9px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.cf-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 14px;
}
.cf-search input::placeholder { color: var(--text-weak); }
.cf-search button { color: #555; font-size: 15px; line-height: 1; }
.cf-search button:hover { color: var(--link); }
.cf-search .cf-search-clear { color: #bbb; }

/* ── GNB ─────────────────────────────────────────────────── */
.cf-gnb { background: #fff; }
.cf-gnb-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.cf-gnb ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 42px;
}
.cf-gnb li a {
  display: block;
  padding: 15px 2px;
  font-size: 15px;
  color: var(--text);
}
.cf-gnb li a:hover { color: var(--link); }

/* GNB 카테고리 드롭다운 (script.js가 category_list에서 생성)
   메뉴 바 hover 시 전체 하위 메뉴가 패널 위에 한꺼번에 펼쳐진다 */
.cf-gnb { position: relative; }
.cf-gnb li { position: relative; }
.cf-gnb li.cf-has-sub > a::after {
  content: "\25be"; /* ▾ */
  margin-left: 5px;
  font-size: 11px;
  color: var(--text-weak);
}
.cf-gnb-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 18px 24px -14px rgba(0, 0, 0, 0.08);
  z-index: 49;
}
.cf-gnb ul.cf-gnb-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 100%;
  padding: 14px 8px 20px;
  z-index: 50;
}
.cf-gnb:hover .cf-gnb-panel,
.cf-gnb:focus-within .cf-gnb-panel,
.cf-gnb:hover ul.cf-gnb-sub,
.cf-gnb:focus-within ul.cf-gnb-sub { display: block; }
.cf-gnb .cf-gnb-sub a {
  padding: 9px 12px;
  font-size: 14px;
  white-space: nowrap;
  text-align: center;
  color: var(--text-sub);
}
.cf-gnb .cf-gnb-sub a:hover { color: var(--link); }

/* ── 사이드바 위젯 ───────────────────────────────────────── */
.cf-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 18px;
  margin-bottom: 18px;
}
.cf-widget > h3 {
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 프로필 */
.cf-profile { text-align: center; padding: 28px 18px; }
.cf-profile-img img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-md);
}
.cf-profile-name { display: block; margin-top: 14px; font-size: 16px; }
.cf-profile-desc { margin-top: 6px; font-size: 12px; color: var(--text-sub); }

/* 배너(스킨판매/전자책/네이버/브런치) */
.cf-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding: 16px 18px;
}
.cf-banner:hover { border-color: var(--link); color: var(--link); }
.cf-banner i { font-size: 20px; color: #6b7ba0; }
.cf-naver-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #03c75a;
  color: #fff;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cf-banner-brunch i { color: #454c53; }

/* 카테고리 트리 (티스토리 생성 마크업: tt_category) */
.cf-category .tt_category { font-size: 14px; }
.cf-category .link_tit {
  display: none; /* "분류 전체보기"는 원본처럼 숨기고 하위 목록만 노출 */
}
.cf-category .category_list > li { border-bottom: 1px solid #f0f0f0; position: relative; }
.cf-category .category_list > li:last-child { border-bottom: 0; }
.cf-category .category_list > li > a {
  display: block;
  padding: 10px 24px 10px 2px;
  color: var(--text);
}
.cf-category .category_list > li > a:hover { color: var(--link); }
.cf-category .c_cnt { color: var(--text-weak); font-size: 12px; }
.cf-category .cf-cat-toggle {
  position: absolute;
  top: 7px;
  right: 0;
  width: 26px;
  height: 26px;
  color: var(--text-weak);
  font-size: 12px;
  transition: transform 0.2s;
}
.cf-category li.cf-open > .cf-cat-toggle { transform: rotate(180deg); }
.cf-category .sub_category_list {
  display: none;
  padding: 2px 0 8px 12px;
}
.cf-category li.cf-open > .sub_category_list { display: block; }
.cf-category .sub_category_list a {
  display: block;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-sub);
}
.cf-category .sub_category_list a:hover { color: var(--link); }

/* 광고 슬롯 */
.cf-ad-slot { min-height: 60px; }

/* 최근 글/인기 글 */
.cf-side-posts li { margin-bottom: 12px; }
.cf-side-posts li:last-child { margin-bottom: 0; }
.cf-side-posts a { display: flex; gap: 10px; align-items: flex-start; }
.cf-side-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
}
.cf-side-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cf-side-post-body { min-width: 0; }
.cf-side-post-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
}
.cf-side-post-meta { display: block; margin-top: 3px; font-size: 11px; color: var(--text-weak); }

/* 최근 댓글 */
.cf-side-comments li { margin-bottom: 12px; }
.cf-side-comments li:last-child { margin-bottom: 0; }
.cf-side-comment-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
}
.cf-side-comment-desc i { color: var(--text-weak); margin-right: 2px; }
.cf-side-comment-meta { display: block; margin-top: 3px; font-size: 11px; color: var(--text-weak); }

/* 태그 */
.cf-side-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-side-tags a {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  padding: 4px 10px;
}
.cf-side-tags a:hover { background: var(--dark); color: #fff; }

/* 공지/보관함/링크 공용 리스트 */
.cf-side-list li { border-bottom: 1px solid #f0f0f0; }
.cf-side-list li:last-child { border-bottom: 0; }
.cf-side-list a {
  display: block;
  padding: 8px 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-side-list i { color: var(--text-weak); font-size: 12px; margin-right: 4px; }
.cf-side-list .cf-cnt { color: var(--text-weak); font-size: 12px; }

/* 달력 (티스토리 생성 마크업: tt-calendar/cal_*) */
.cf-calendar table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cf-calendar .cal_month { margin-bottom: 8px; font-size: 13px; caption-side: top; }
.cf-calendar .cal_month a { padding: 0 6px; color: var(--text-sub); }
.cf-calendar th { padding: 6px 0; color: var(--text-sub); font-weight: 400; }
.cf-calendar th.cal_week2 { color: #e05d5d; }
.cf-calendar td { text-align: center; padding: 5px 0; color: var(--text-sub); }
.cf-calendar td a { color: var(--link); font-weight: 700; }
.cf-calendar td.cal_today {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius-sm);
}

/* 방문자 수 — Total 큰 숫자(Anton) + Today/Yesterday 인라인 */
.cf-visitor-total { margin-bottom: 12px; }
.cf-visitor-label { display: block; font-size: 13px; color: var(--text-sub); }
.cf-visitor-num {
  display: block;
  margin-top: 2px;
  font-family: "Anton", Pretendard, sans-serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0.5px;
  color: var(--text);
}
.cf-visitor-list li {
  padding: 3px 0;
  font-size: 13px;
  color: var(--text-sub);
}
.cf-visitor-list b {
  font-family: "Anton", Pretendard, sans-serif;
  font-weight: 400;
  letter-spacing: 0.3px;
  color: var(--text);
}

/* ── 홈 (body_id 분기) ───────────────────────────────────── */
.cf-home { display: none; }
#tt-body-index .cf-home { display: block; }

.cf-home-section { margin-bottom: 44px; position: relative; }
.cf-section-title {
  font-size: 20px;
  font-weight: 700;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

/* 공지 카드 그리드 (3열) */
.cf-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.cf-card { display: block; min-width: 0; }
.cf-card-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-soft);
}
.cf-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.cf-card:hover .cf-card-thumb img { transform: scale(1.04); }
.cf-card-meta, .cf-item-meta {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-weak);
}
.cf-card-meta em, .cf-item-meta em { font-style: normal; color: var(--text-sub); }
.cf-sep { margin: 0 7px; color: var(--border-soft); }
.cf-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 700;
}
.cf-card:hover .cf-card-title { color: var(--link); }

/* 최신 글 공통 항목 */
.cf-item { display: flex; gap: 24px; min-width: 0; }
.cf-item-thumb {
  flex: none;
  display: block;
  width: 200px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-soft);
}
.cf-item-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.cf-item:hover .cf-item-thumb img { transform: scale(1.04); }
.cf-item-body { min-width: 0; flex: 1; }
.cf-item-meta { margin-top: 0; }
.cf-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
}
.cf-item:hover .cf-item-title { color: var(--link); }
.cf-item-summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.65;
}

/* 홈 최신 글 커버 배치 — 홈(tt-body-index)에서만 적용, 카테고리 등 목록은 기본 리스트형 유지 */
/* 커버 1: 리스트형(썸네일 좌) — 기본(.cf-list-posts 스타일 그대로), 우측 배치만 분기 */
#tt-body-index.cover-list-right .cf-posts .cf-item { flex-direction: row-reverse; }

/* 커버 2: 카드형(3열) */
#tt-body-index.cover-card .cf-posts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 24px;
}
#tt-body-index.cover-card .cf-posts .cf-item { flex-direction: column; gap: 0; padding: 0; border-bottom: 0; }
#tt-body-index.cover-card .cf-posts .cf-item-thumb { width: 100%; }
#tt-body-index.cover-card .cf-posts .cf-item-meta { margin-top: 12px; }
#tt-body-index.cover-card .cf-posts .cf-item-title { font-size: 15px; }
#tt-body-index.cover-card .cf-posts .cf-item-summary { display: none; }

/* 커버 4: 슬라이드형 */
#tt-body-index.cover-slide .cf-posts {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 12px;
}
#tt-body-index.cover-slide .cf-posts::-webkit-scrollbar { height: 6px; }
#tt-body-index.cover-slide .cf-posts::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 3px; }
#tt-body-index.cover-slide .cf-posts .cf-item {
  flex: none;
  width: 300px;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-bottom: 0;
  scroll-snap-align: start;
}
#tt-body-index.cover-slide .cf-posts .cf-item-thumb { width: 100%; }
#tt-body-index.cover-slide .cf-posts .cf-item-meta { margin-top: 12px; }
#tt-body-index.cover-slide .cf-posts .cf-item-title { font-size: 15px; }
#tt-body-index.cover-slide .cf-posts .cf-item-summary { display: none; }

/* 슬라이드 화살표 (홈 슬라이드형에서만) */
.cf-slide-arrow { display: none; }
#tt-body-index.cover-slide .cf-list .cf-slide-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 46%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: var(--text-sub);
  z-index: 2;
}
body.cover-slide .cf-slide-prev { left: -14px; }
body.cover-slide .cf-slide-next { right: -14px; }
body.cover-slide .cf-slide-arrow:hover { color: var(--link); border-color: var(--link); }

/* 광고 박스 */
.cf-ad { margin: 28px 0; }
.cf-ad-main { margin-top: 0; }

/* ── 글 상세 ─────────────────────────────────────────────── */
.cf-post { min-width: 0; }
.cf-post-head {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  padding: 30px 28px;
  margin: 14px 0 34px;
  position: relative;
}
.cf-post-cat {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  background: var(--dark);
  color: #fff;
  font-size: 12px;
  border-radius: var(--radius-lg);
  padding: 5px 14px;
  white-space: nowrap;
}
.cf-post-cat:hover { color: #fff; opacity: 0.85; }
.cf-post-title {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.45;
  font-weight: 700;
}
.cf-post-meta {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-weak);
  display: flex;
  justify-content: center;
  gap: 16px;
}
.cf-post-admin {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 12px;
  color: var(--text-weak);
  display: flex;
  gap: 10px;
}

/* 본문 타이포그래피 */
.cf-post-body { line-height: 1.85; }
.cf-post-body p { margin: 0 0 1.15em; }
.cf-post-body h2 { font-size: 24px; margin: 1.7em 0 0.7em; padding-bottom: 0.35em; border-bottom: 1px solid var(--border); }
.cf-post-body h3 { font-size: 20px; margin: 1.5em 0 0.6em; }
.cf-post-body h4 { font-size: 17px; margin: 1.3em 0 0.5em; }
.cf-post-body a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.cf-post-body img { border-radius: var(--radius-sm); }
.cf-post-body ul, .cf-post-body ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.cf-post-body ul { list-style: disc; }
.cf-post-body ol { list-style: decimal; }
.cf-post-body li { margin: 0.3em 0; }
.cf-post-body blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--dark);
  background: var(--bg-softer);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-sub);
}
.cf-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 0.95em;
}
.cf-post-body th, .cf-post-body td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
}
.cf-post-body th { background: var(--bg-soft); font-weight: 700; }
.cf-post-body tr:nth-child(even) td { background: var(--bg-softer); }

/* 태그 */
.cf-tags {
  margin: 30px 0 6px;
  font-size: 13px;
  color: var(--text-weak);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.cf-tags a {
  color: var(--text-sub);
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  padding: 4px 12px;
}
.cf-tags a:hover { background: var(--dark); color: #fff; }

/* 같은 카테고리의 다른 글 — 티스토리가 본문 끝에 자동 삽입하는 기본 블록은
   숨기고(중복), 스킨의 cf-related 박스만 사용한다 */
.another_category { display: none; }
.cf-related {
  margin: 30px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 20px 22px 10px;
}
.cf-related-title {
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cf-related-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}
.cf-related-list li:last-child a { border-bottom: 0; }
.cf-related-list i { flex: none; color: var(--text-weak); }
.cf-related-post {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-related-list li a:hover .cf-related-post { color: var(--link); }
.cf-related-date { flex: none; font-size: 12px; color: var(--text-weak); }

/* 보호글 */
.cf-protected {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 44px 20px;
  text-align: center;
  color: var(--text-sub);
}
.cf-protected-form { margin-top: 16px; display: inline-flex; gap: 8px; }
.cf-protected-form input {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
}
.cf-protected-form input:focus { border-color: var(--link); }
.cf-protected-form button {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
}

/* ── Mac 스타일 코드블록 ─────────────────────────────────── */
.cf-codeblock {
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #24292e;
}
.cf-code-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #1b1f23;
}
.cf-code-dots { display: inline-flex; gap: 6px; }
.cf-code-dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.cf-code-dots i:nth-child(1) { background: #f5655b; }
.cf-code-dots i:nth-child(2) { background: #f6bd3b; }
.cf-code-dots i:nth-child(3) { background: #43c465; }
.cf-code-lang {
  font-size: 12px;
  color: #8b949e;
  text-transform: lowercase;
  letter-spacing: 0.5px;
}
.cf-code-copy {
  margin-left: auto;
  font-size: 12px;
  color: #8b949e;
}
.cf-code-copy:hover { color: #fff; }
.cf-codeblock pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
}
.cf-codeblock code {
  font-family: "D2Coding", Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.65;
  background: none;
}
.cf-post-body code:not(.cf-codeblock code) {
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.88em;
  font-family: Consolas, "Courier New", monospace;
  color: #c7254e;
}
.cf-codeblock pre::-webkit-scrollbar { height: 8px; }
.cf-codeblock pre::-webkit-scrollbar-thumb { background: #444c56; border-radius: 4px; }

/* ── 댓글(티스토리 기본 댓글 tt-* 오버라이드) ────────────── */
.cf-comments { margin-top: 40px; }
.cf-comments .tt-box-total {
  font-size: 17px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cf-comments .tt-box-total .tt_num_g { color: var(--link); margin-left: 4px; }
.cf-comments .tt-list-reply { margin-top: 4px; }
.cf-comments .tt-item-reply {
  padding: 18px 0;
  border-bottom: 1px solid #f0f0f0;
  list-style: none;
}
.cf-comments .tt-wrap-cmt { display: flex; gap: 12px; }
.cf-comments .tt-box-thumb { flex: none; }
.cf-comments .tt-thumbnail {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-soft) center/cover;
}
.cf-comments .tt-box-content { flex: 1; min-width: 0; }
.cf-comments .tt-link-user { font-weight: 700; font-size: 14px; }
.cf-comments .tt_desc { margin: 6px 0 0; font-size: 14px; line-height: 1.7; }
.cf-comments .tt_date { font-size: 12px; color: var(--text-weak); }
.cf-comments .tt-wrap-info { margin-top: 6px; }
.cf-comments .tt-area-write {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.cf-comments .tt_wrap_write { flex: 1; }
.cf-comments .tt-box-textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 72px;
}
.cf-comments .tt-cmt { outline: none; min-height: 48px; font-size: 14px; }
.cf-comments .tt-box-write {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-sub);
}
.cf-comments .tt-btn_register {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
}
.cf-comments .tt-btn_register:hover { opacity: 0.85; }

/* ── 목록 페이지 ─────────────────────────────────────────── */
/* 홈에서는 '최신 글' 제목, 그 외 목록 페이지에서는 '카테고리명 (N)' 제목 */
.cf-list { position: relative; margin-bottom: 44px; }
.cf-list-title-home { display: none; }
#tt-body-index .cf-list-title-home { display: block; }
#tt-body-index .cf-list-title-page { display: none; }
/* 홈: 공지 글이 없으면 공지 섹션(빈 제목) 숨김 */
#tt-body-index .cf-home-notice:not(:has(.cf-card)) { display: none; }
.cf-list-count { color: var(--text-weak); font-weight: 400; font-size: 15px; }
.cf-list-posts .cf-item { padding: 22px 0; border-bottom: 1px solid #f0f0f0; }
.cf-list-posts .cf-item:first-child { padding-top: 4px; }
.cf-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--text-weak);
}

/* 홈: 인기 글 — 액자형 카드 그리드 (홈에서만, 항목이 있을 때만 노출) */
.cf-home-popular { display: none; }
#tt-body-index .cf-home-popular:has(.cf-popular-card) {
  display: block;
  margin-top: 44px;
}
.cf-popular-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.cf-popular-card {
  display: block;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.cf-popular-card:hover {
  border-color: var(--border-soft);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.cf-popular-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
}
.cf-popular-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.cf-popular-card:hover .cf-popular-thumb img { transform: scale(1.04); }
.cf-popular-meta {
  display: block;
  margin-top: 12px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-weak);
}
.cf-popular-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  padding: 0 4px 4px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 700;
}
.cf-popular-card:hover .cf-popular-title { color: var(--link); }

/* 페이징 */
.cf-paging {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 36px 0 8px;
}
.cf-page-btn, .cf-page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-sub);
}
.cf-page-btn:hover, .cf-page-num:hover { border-color: var(--link); color: var(--link); }
.cf-page-num em, .cf-page-num strong {
  font-style: normal;
  font-weight: 700;
  color: var(--link);
}
.cf-paging .no-more-prev, .cf-paging .no-more-next {
  pointer-events: none;
  opacity: 0.4;
}
.cf-page-nums { display: inline-flex; gap: 6px; }

/* ── 방명록 (tt-body-guestbook에서만) ────────────────────── */
.cf-guestbook-page { display: none; }
#tt-body-guestbook .cf-guestbook-page { display: block; }
.cf-guestbook { margin-top: 0; }

/* ── 태그 클라우드 ───────────────────────────────────────── */
.cf-tagcloud-list { display: flex; flex-wrap: wrap; gap: 10px; }
.cf-tag {
  background: var(--bg-soft);
  color: var(--text-sub);
  border-radius: var(--radius-lg);
  padding: 6px 14px;
  font-size: 13px;
}
.cf-tag:hover { background: var(--dark); color: #fff; }
.cf-tag.cloud1 { font-size: 15px; font-weight: 700; }
.cf-tag.cloud2 { font-size: 14px; }
.cf-tag.cloud3 { font-size: 13px; }
.cf-tag.cloud4, .cf-tag.cloud5 { font-size: 12px; }

/* ── 푸터 ────────────────────────────────────────────────── */
.cf-footer {
  border-top: 1px solid var(--border);
  padding: 28px 20px;
  text-align: center;
  color: var(--text-weak);
  font-size: 13px;
}

/* ============================================================
   반응형 7단: 1919 / 1420 / 1220 / 1100 / 700 / 560 / 500
   ============================================================ */

/* 1단: ~1919px — 대형 모니터 유지(예약 구간) */
@media screen and (max-width: 1919px) {
  .cf-header { max-width: var(--container); }
}

/* 2단: ~1420px — 컨테이너 폭 축소 */
@media screen and (max-width: 1420px) {
  :root { --container: 1180px; --gap: 34px; }
}

/* 3단: ~1220px — 사이드바 폭 축소 */
@media screen and (max-width: 1220px) {
  :root { --container: 1040px; --sidebar-w: 220px; --gap: 28px; }
  .cf-item-thumb { width: 180px; }
}

/* 4단: ~1100px — 1열 전환, 사이드바 하단 이동 */
@media screen and (max-width: 1100px) {
  .cf-container { grid-template-columns: minmax(0, 1fr); }
  .cf-sidebar { order: 2; }
  .cf-main { order: 1; }
  .cf-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    align-items: start;
  }
}

/* 5단: ~700px — 모바일 전환(다크 상단바 + 햄버거) */
@media screen and (max-width: 700px) {
  .cf-header, .cf-gnb { display: none; }

  .cf-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--dark);
    color: #fff;
    padding: 0 16px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .cf-mobile-logo { font-size: 17px; font-weight: 700; }
  .cf-mobile-logo:hover { color: #fff; }
  .cf-hamburger { color: #fff; font-size: 19px; padding: 6px; }

  .cf-mobile-panel {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    position: sticky;
    top: 52px;
    z-index: 19;
  }
  .cf-mobile-panel.cf-open { display: block; }
  .cf-search-mobile { margin: 0 0 12px; width: 100%; border: 1px solid var(--border); box-shadow: none; }
  .cf-mobile-menu ul { display: block; }
  .cf-mobile-menu li a {
    display: block;
    padding: 11px 4px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
  }
  .cf-mobile-menu li:last-child a { border-bottom: 0; }

  .cf-container { padding: 20px 16px 40px; gap: 24px; }
  .cf-sidebar { grid-template-columns: minmax(0, 1fr); }

  .cf-card-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .cf-popular-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  #tt-body-index.cover-card .cf-posts { grid-template-columns: minmax(0, 1fr); }
  .cf-section-title { font-size: 18px; }

  .cf-post-head { padding: 26px 18px; }
  .cf-post-title { font-size: 21px; }
}

/* 6단: ~560px — 항목 축소 */
@media screen and (max-width: 560px) {
  .cf-item { gap: 14px; }
  .cf-item-thumb { width: 128px; aspect-ratio: 1 / 1; }
  .cf-item-title { font-size: 15px; }
  .cf-item-summary { -webkit-line-clamp: 2; font-size: 12px; }
  .cf-post-body { font-size: 15px; }
}

/* 7단: ~500px — 최소 레이아웃 */
@media screen and (max-width: 500px) {
  .cf-item-thumb { width: 104px; }
  .cf-item-meta .cf-sep { margin: 0 4px; }
  .cf-post-title { font-size: 19px; }
  .cf-blog-title { font-size: 24px; }
  .cf-paging { gap: 4px; }
}
