/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Airbnb Color Palette */
  --color-brand: #ff385c;           /* Rausch Red */
  --color-brand-dark: #e00b41;      /* Deep Rausch */
  --color-talk: #6366f1;            /* Indigo for talks */
  --color-wip: #eab308;             /* Yellow for work-in-progress */
  --color-text: #222222;            /* Near Black (warm, not cold) */
  --color-text-secondary: #6a6a6a;  /* Secondary text */
  --color-text-light: #929292;      /* Light text */
  --color-bg: #ffffff;              /* Pure white */
  --color-surface: #f7f7f7;         /* Light surface */
  --color-border: #dddddd;          /* Border */

  /* Shadows (3-layer Airbnb system) */
  --shadow-card: rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.08) 0px 4px 12px;
  --shadow-hover: rgba(0,0,0,0.12) 0px 6px 16px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  /* Layout */
  --max-width: 720px;
  --spacing: 2rem;
}

body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  font-size: 16px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* ============================================================
   HEADER
============================================================ */
.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.3s ease-in-out;
}

.navbar {
  display: flex;
}

.site-header .navbar .container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center;
  width: 100%;
}

.site-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-title:hover {
  color: var(--color-brand);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.75rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--color-text);
}

.site-header.hidden {
  transform: translateY(-100%);
}

/* 읽기 진행률 바 — 헤더 하단에 붙어 스크롤에 따라 차오름 */
.reading-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}

.reading-progress-fill {
  width: 100%;
  height: 100%;
  background-color: var(--color-brand);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* ============================================================
   MAIN CONTENT
============================================================ */
.main-content {
  min-height: calc(100vh - 200px);
  padding: 4rem 0;
}

/* ============================================================
   HOME PAGE
============================================================ */
.page-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  margin-bottom: 3rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-list {
  list-style: none;
}

.post-item {
  margin-bottom: 1.25rem;
}

.post-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-card-link:hover .post-title {
  color: var(--color-text-secondary);
}

.post-card {
  background: transparent;
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.post-item:first-child .post-card {
  padding-top: 0;
}

.post-item:last-child .post-card {
  border-bottom: none;
  padding-bottom: 0;
}

.post-content-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.post-text {
  flex: 1;
  min-width: 0;
}

.post-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.post-external-badge,
.post-talk-badge,
.post-wip-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.1em 0.45em;
  letter-spacing: 0.02em;
  vertical-align: middle;
  line-height: 1.5;
  margin-right: 0.25rem;
  position: relative;
  top: -1px;
}

.post-external-badge {
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
}

.post-talk-badge {
  color: var(--color-talk);
  border: 1px solid var(--color-talk);
}

.post-wip-badge {
  color: var(--color-wip);
  border: 1px solid var(--color-wip);
}

/* post.html — 발표 타입 뱃지 (제목 인라인) */
.post-type-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-talk);
  border: 1px solid var(--color-talk);
  border-radius: 4px;
  padding: 0.15em 0.55em;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: 0.15em;
}

.talk-review-note {
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  border-left: 3px solid var(--color-brand);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.talk-review-note strong {
  color: var(--color-text);
  font-weight: 600;
}

.talk-review-note a {
  color: inherit;
  text-decoration: none;
}

.talk-review-note a strong {
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.talk-review-note a:hover strong {
  color: var(--color-brand);
  text-decoration-color: var(--color-brand);
}

.post-excerpt {
  color: var(--color-text-secondary);
  line-height: 1.6;
  font-size: 0.875rem;
  margin-top: 0.375rem;
  margin-bottom: 0.75rem;
  font-weight: 400;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-light);
  flex-wrap: wrap;
  font-weight: 500;
}

.post-thumbnail {
  flex-shrink: 0;
  width: 140px;
  height: 96px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tags */
.post-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.tag {
  background-color: transparent;
  color: var(--color-text-secondary);
  padding: 0.0625rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tag:hover {
  color: var(--color-brand, #ff385c);
  border-color: var(--color-brand, #ff385c);
  text-decoration: none;
}

.reading-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 400;
}

/* 태그 필터 (목록 상단 가로 칩) — 우측 사이드바는 상세 페이지 목차(TOC) 자리라 역할을 분리 */
.home {
  position: relative;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag-filter-btn {
  background-color: transparent;
  color: var(--color-text-secondary);
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.tag-filter-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

.tag-filter-btn.active {
  color: #ffffff;
  background-color: var(--color-text);
  border-color: var(--color-text);
}

.post-item.hidden {
  display: none;
}

/* ============================================================
   POST PAGE
============================================================ */
.post {
  max-width: 660px;
  margin: 0 auto;
}

.post .page-heading {
  display: none !important;
}

.post-header {
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.post-talk .post-header {
  margin-bottom: 2rem;
  padding-bottom: 0;
  border-bottom: none;
}

.post-header .post-title {
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
  line-height: 1.4;
  letter-spacing: -0.03em;
}

.post-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
  font-weight: 400;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.post-content h1 { font-size: 1.375rem; line-height: 1.4; }
.post-content h2 { font-size: 1.25rem; line-height: 1.4; font-weight: 600; }
.post-content h3 { font-size: 1.125rem; line-height: 1.5; font-weight: 600; }
.post-content h4 { font-size: 1rem; line-height: 1.5; font-weight: 600; }

/* 헤딩 앵커 링크 복사 버튼 — 데스크톱은 hover 시 노출, 터치 기기는 옅게 상시 노출 */
.post-content .heading-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-left: 0.4rem;
  padding: 0.15rem;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  opacity: 0;
  vertical-align: -0.1em;
  transition: opacity 0.15s, color 0.15s;
}

.post-content h1:hover .heading-anchor,
.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content h5:hover .heading-anchor,
.post-content .heading-anchor:focus-visible,
.post-content .heading-anchor.copied {
  opacity: 1;
}

.post-content .heading-anchor:hover {
  color: var(--color-brand);
}

@media (hover: none) {
  .post-content .heading-anchor {
    opacity: 0.4;
  }
}

.post-content .heading-anchor .anchor-icon-check { display: none; }
.post-content .heading-anchor.copied .anchor-icon-link { display: none; }
.post-content .heading-anchor.copied .anchor-icon-check {
  display: block;
  color: var(--color-brand);
}

.post-content .heading-anchor.copied::after {
  content: '링크 복사됨';
  position: absolute;
  left: calc(100% + 0.4rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-text-secondary);
  letter-spacing: normal;
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content a {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.post-content a:hover {
  color: var(--color-brand-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.25rem auto 0.35rem;
  display: block;
}

/* 이미지 문단 바로 앞 문단·소제목은 하단 여백을 줄여 본문-이미지를 붙인다 */
.post-content p:has(+ p > img),
.post-content h1:has(+ p > img),
.post-content h2:has(+ p > img),
.post-content h3:has(+ p > img),
.post-content h4:has(+ p > img) {
  margin-bottom: 0.5rem;
}

/* 캡션: 이미지와 같은 <p> (빈 줄 없음) */
.post-content img + em,
/* 캡션: 이미지 다음 <p> (빈 줄 있음) */
.post-content p:has(> img) + p > em {
  display: block;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  font-style: normal;
  margin-top: 0.25rem;
  /* 이미지 주변 여백은 캡션 아래에 몰아준다 (이미지-캡션은 한 덩어리) */
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* 이미지 <p>가 캡션 <p>로 이어지면 사이 간격 제거 */
.post-content p:has(> img):has(+ p > em) {
  margin-bottom: 0;
}
.post-content p:has(> img) + p:has(> em) {
  margin-top: 0;
  margin-bottom: 0;
}

.post-content img.center-image {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.post-content blockquote {
  border-left: 3px solid var(--color-brand);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: var(--color-text-secondary);
  font-style: normal;
  background-color: transparent;
}

.post-content details {
  margin: 2.5rem 0;
}

.post-content details[open] {
  margin-bottom: 2.75rem;
}

.post-content summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}

.post-content details[open] summary {
  margin-bottom: 0.85rem;
}

.post-content summary::marker {
  color: var(--color-brand);
}

.post-content details > :last-child {
  margin-bottom: 0;
}

.post-content code {
  background-color: var(--color-surface);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: 'Source Code Pro', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.post-content pre {
  background-color: var(--color-surface);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--color-border);
  font-size: 0.875em;
  line-height: 1.5;
  font-family: 'Source Code Pro', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
  border: none;
}

.post-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 2rem 0;
}

.post-content thead th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  padding: 0.625rem 0.875rem;
  border-bottom: 2px solid var(--color-text);
  white-space: nowrap;
}

.post-content tbody td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  vertical-align: top;
}

.post-content tbody td:first-child {
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
}

/* KaTeX */
.katex { font-size: 0.8em; }
.post-content .katex { font-size: 0.95rem; }
.post-content .katex-display {
  margin: 2rem auto !important;
  text-align: center;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}
.post-content .katex-display > .katex {
  text-align: left;
  display: inline-block;
}

/* LinkedIn 원문 출처 표기 */
.post-origin-note {
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.post-origin-note a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.post-origin-note a:hover {
  color: var(--color-brand);
}

/* Related Posts */
.related-posts {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.related-posts h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.related-posts .post-item:first-child .post-card {
  padding-top: 0;
}

/* Comments (giscus) */
.post-comments {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   ABOUT PAGE
============================================================ */
.about-page {
  max-width: 660px;
  margin: 0 auto;
}

.profile-image-wrapper {
  width: 180px;
  height: 180px;
  margin: 0 auto 1.75rem;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  box-shadow: var(--shadow-card);
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-content { font-size: 0.9375rem; }
.about-content > p:first-of-type { margin-top: 0; margin-bottom: 0.25rem; }
.about-content p:nth-of-type(2) { margin-top: 0; margin-bottom: 1.75rem; }
.about-content p { margin-bottom: 0.25rem; }

.about-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 0.25rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.about-content h2:first-of-type { margin-top: 3rem; }

.about-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.25rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
  text-transform: none;
}

.about-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.about-content li { margin-bottom: 0.125rem; padding-left: 0; }

.about-content > ul:first-of-type { margin-top: 0; margin-bottom: 2rem; }
.about-content > ul:first-of-type li { margin-bottom: 0.25rem; }
.about-content > ul:first-of-type li::before { content: "* "; }

.about-content a {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.about-content a:hover {
  color: var(--color-brand-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Education */
.education-item { margin-bottom: 1.75rem; }
.education-item:last-child { margin-bottom: 0; }

.education-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.education-header strong { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.education-fullname { font-size: 0.875rem; font-weight: 400; color: var(--color-text-secondary); }
.education-date { font-size: 0.875rem; color: var(--color-text-secondary); font-weight: 400; white-space: nowrap; }
.education-details { padding-left: 0; }
.education-details > div { margin-bottom: 0.125rem; font-size: 0.875rem; line-height: 1.5; }
.education-note { font-size: 0.875rem; color: var(--color-text-secondary); font-style: italic; margin-top: 0.125rem; }

/* Experience */
.experience-company { margin-bottom: 1.75rem; margin-top: 0; }
h2 + .experience-company { margin-top: 0; }
.about-content h2 + h3 { margin-top: 0; }
.experience-company:last-child { margin-bottom: 0; }

.experience-company h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0;
  color: var(--color-text);
  letter-spacing: -0.01em;
  text-transform: none;
}
.experience-item { margin-bottom: 1rem; }
.experience-item:last-child { margin-bottom: 0; }

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.experience-header strong { font-size: 0.9375rem; font-weight: 500; color: #444444; }
.experience-date { font-size: 0.875rem; color: var(--color-text-secondary); font-weight: 400; white-space: nowrap; }
.experience-details { padding-left: 0; }
.experience-details ul { list-style: disc; padding-left: 1.5rem; margin-top: 0; margin-bottom: 0; }
.experience-details li { margin-bottom: 0.125rem; font-size: 0.9375rem; line-height: 1.5; }
.experience-details li.muted { font-weight: 300; color: var(--color-text-secondary); }
.experience-details ul ul { list-style: circle; margin-top: 0.125rem; margin-bottom: 0; }

/* Publication */
.publication-item { margin-bottom: 1rem; }
.publication-item:last-child { margin-bottom: 0; }

.publication-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.125rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.publication-header strong { font-size: 0.9375rem; font-weight: 400; color: var(--color-text); flex: 1; min-width: 0; line-height: 1.4; }
.publication-date { font-size: 0.875rem; color: var(--color-text-secondary); font-weight: 400; white-space: nowrap; }
.publication-details { padding-left: 0; }
.publication-details > div { font-size: 0.875rem; line-height: 1.5; color: var(--color-text-secondary); font-style: italic; }
.publication-details > .publication-links { font-style: normal; margin-top: 0.125rem; }
.publication-links a { color: var(--color-text-secondary); text-decoration: none; margin-right: 0.375rem; }
.publication-links a:hover { color: var(--color-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
  background-color: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 3rem 0;
  margin-top: 6rem;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
}

.footer-links {
  margin-top: 0.875rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--color-brand); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  /* 태그 필터: 한 줄 가로 스크롤 (edge-to-edge인 .home 안이라 좌우 패딩 추가) */
  .tag-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 var(--spacing);
    margin-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tag-filter::-webkit-scrollbar {
    display: none;
  }

  :root {
    --spacing: 1.25rem;
  }

  /* 포스트 목록: edge-to-edge */
  .home {
    margin: 0 calc(-1 * var(--spacing));
  }

  /* 추천 글도 홈 목록처럼 edge-to-edge, 제목만 본문 정렬 유지 */
  .related-posts {
    margin-left: calc(-1 * var(--spacing));
    margin-right: calc(-1 * var(--spacing));
  }

  .related-posts h3 {
    padding: 0 var(--spacing);
  }

  .post-item {
    margin-bottom: 0;
  }

  .post-card {
    padding: 1.5rem var(--spacing);
  }

  .post-item:first-child .post-card {
    padding-top: 0;
  }

  .main-content { padding: 2.5rem 0; }

  .site-header {
    padding: 1rem 0;
    position: static;
  }

  .navbar { flex-direction: row; align-items: center; }
  .site-header .navbar .container { display: flex !important; justify-content: space-between !important; }
  .nav-links { gap: 1.25rem; }

  .page-heading { margin-bottom: 2rem; }

  .post-item { margin-bottom: 0; }

  .post-card { padding: 0.875rem var(--spacing); }

  .post-content-wrapper { gap: 0.75rem; }

  .post-thumbnail {
    display: none;
  }

  .post-title { font-size: 1rem; }

  .post-header { margin-bottom: 2.5rem; }
  .post-header .post-title { font-size: 1.375rem; }
  .post-content { font-size: 0.9375rem; }

  .profile-image-wrapper { width: 140px; height: 140px; margin-bottom: 1.75rem; }

  .about-content h2 { font-size: 1.125rem; }
  .about-content h3 { font-size: 1rem; }
  .experience-company h3 { font-size: 1rem; }

  .footer-links { flex-direction: column; gap: 0.75rem; }
  .site-footer { padding: 2.5rem 0; margin-top: 4rem; }

  .education-header,
  .experience-header,
  .publication-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .education-date,
  .experience-date,
  .publication-date { margin-top: 0.125rem; }
}

/* ============================================================
   TAGS PAGE
============================================================ */
.tags-page {
  padding: 2rem 0;
}

.tags-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.tags-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.tagged-post-list {
  list-style: none;
}

.tagged-post-list .post-item {
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 0;
}

.tagged-post-list .post-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--color-text);
}

.tagged-post-list .post-link:hover .post-title {
  color: var(--color-brand, #ff385c);
}

.tagged-post-list .post-title {
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.15s;
}

.tagged-post-list .post-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   POST HERO IMAGE
============================================================ */
.post-hero {
  margin-bottom: 3rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface);
}

.post-hero-image {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

/* ============================================================
   POST BODY LAYOUT (content + TOC sidebar)
============================================================ */
.post-body {
  position: relative;
}

/* ============================================================
   TABLE OF CONTENTS (TOC)
   — 데스크탑(1200px+): 우측 고정 사이드바
   — 그 아래: 숨김 (헤딩 앵커만 남김)
============================================================ */
.post-toc {
  display: none; /* 기본 숨김 — 1200px+ 에서만 표시 */
}

@media (min-width: 1200px) {
  .post-toc {
    display: block;
    position: fixed;
    /* 콘텐츠 우측 바깥: container max-width 720px + padding 32px = 752px 절반이 중앙 */
    /* 뷰포트 중앙에서 720/2 + 32 + 16 = 408px 떨어진 위치 */
    left: calc(50% + 380px);
    top: 120px;
    width: 200px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    /* 스크롤바 숨김 */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .post-toc::-webkit-scrollbar {
    display: none;
  }
}

.toc-header {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc-link {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-light);
  text-decoration: none;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.625rem;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-link.toc-depth-1 {
  padding-left: 1.25rem;
  font-size: 0.75rem;
}

.toc-link.toc-depth-2 {
  padding-left: 1.875rem;
  font-size: 0.75rem;
}

.toc-link:hover {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.toc-link.toc-active {
  color: var(--color-brand, #ff385c);
  border-left-color: var(--color-brand, #ff385c);
  font-weight: 500;
}

.pdf-viewer {
  margin-bottom: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg);
}

.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.pdf-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pdf-control-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.pdf-control-btn:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

.pdf-control-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.pdf-control-btn[data-action="fullscreen"] {
  min-width: 88px;
  justify-content: center;
}

.pdf-page-indicator {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 0.4rem 0.2rem;
  min-width: 4.5rem;
  text-align: center;
}

.pdf-stage {
  position: relative;
  background: var(--color-surface);
}

.pdf-viewer [hidden] {
  display: none !important;
}

.pdf-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.pdf-poster-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdf-canvas-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-bg);
}

.pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
}

.pdf-loading,
.pdf-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
  padding: 1.5rem;
}

.pdf-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-brand);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-brand);
  transition: background-color 0.15s, color 0.15s;
}

.pdf-download-btn:hover {
  background-color: var(--color-brand);
  color: #fff;
}

.pdf-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 56, 92, 0.2);
  border-top-color: var(--color-brand);
  animation: pdf-spin 0.9s linear infinite;
}

.pdf-fallback-link {
  color: var(--color-brand);
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--color-text);
}

@keyframes pdf-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .pdf-toolbar {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .pdf-toolbar-actions {
    justify-content: flex-start;
  }

  .pdf-page-indicator {
    min-width: auto;
  }
}

/* 코드 블록 복사 버튼 */
.post-content pre {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-family: "Pretendard", -apple-system, sans-serif;
  color: var(--color-text-secondary);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.post-content pre:hover .code-copy-btn,
.code-copy-btn:focus-visible {
  opacity: 1;
}

.code-copy-btn.copied {
  color: var(--color-brand);
  border-color: var(--color-brand);
}

@media (max-width: 768px) {
  .code-copy-btn {
    opacity: 1;
  }
}

/* 404 페이지 */
.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found-code {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-brand);
  margin-bottom: 1rem;
}

.not-found h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.not-found p {
  color: var(--color-text-secondary);
}

.not-found-links {
  margin-top: 1.75rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.not-found-links a {
  color: var(--color-brand);
  text-decoration: none;
}

.not-found-links a:hover {
  text-decoration: underline;
}
