/* ============================================================
   blog.css — Blog Home (Dark + Emerald, Figma-inspired layout)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { line-height: 1.15; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ── 1. Custom Properties ─────────────────────────────────── */
:root {
  --bg-dark:       #0a0a0a;
  --bg-surface:    #111111;
  --bg-hover:      #181818;
  --text-main:     #f3f4f6;
  --text-muted:    #9ca3af;
  --text-faint:    #858b98;
  --accent:        #34d399;
  --accent-dim:    rgba(52, 211, 153, 0.10);
  --accent-border: rgba(52, 211, 153, 0.25);
  --border:        #27272a;
  --border-hover:  #3f3f46;
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── 1b. Light Theme Override ────────────────────────────── */
[data-theme="light"] {
  --bg-dark:       #f8f9fa;
  --bg-surface:    #ffffff;
  --bg-hover:      #f1f3f5;
  --text-main:     #111111;
  --text-muted:    #4b5563;
  --text-faint:    #667085;
  --accent:        #059669;
  --accent-dim:    rgba(5, 150, 105, 0.08);
  --accent-border: rgba(5, 150, 105, 0.22);
  --border:        #e5e7eb;
  --border-hover:  #d1d5db;
}

[data-theme="light"] body { background-color: var(--bg-dark); color: var(--text-main); }
[data-theme="light"] .blog-nav {
  background: rgba(248, 249, 250, 0.92);
  border-color: var(--border);
}

/* ── Light: Hero ── */

/* ── Light: Cards ── */

/* ── Light: Magazine Cards ── */

/* ── 2. Base ─────────────────────────────────────────────── */
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
}

a { color: inherit; text-decoration: none; }
li { list-style: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 10px 14px; background: var(--text-main); color: var(--bg-dark); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* ── 3. Top Navigation Bar ───────────────────────────────── */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 60px;
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.blog-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.blog-nav-brand .brand-accent {
  color: var(--accent);
}

.blog-nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.blog-nav-links a {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

.blog-nav-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bg-dark) !important;
  background: var(--accent);
  padding: 7px 18px;
  border-radius: 8px;
  transition: opacity 0.2s;
}

.blog-nav-cta:hover { opacity: 0.85; }

/* ── 4. Container ────────────────────────────────────────── */

/* ── 4b. Three-Column Layout ────────────────────────────── */

/* ── Sidebar Shared ─────────────────────────────────────── */

/* ── Left: Category List ────────────────────────────────── */

/* ── Right: Stats Grid ──────────────────────────────────── */

/* ── Right: Recent Posts ────────────────────────────────── */

/* ── Right: Tag Cloud ───────────────────────────────────── */

/* ── 5. Hero / Featured Post ─────────────────────────────── */
/* ── 5a. Hero — Typewriter Identity ─────────────────────── */
@keyframes twBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── 5b. Hero — Featured Post (legacy) ─────────────────── */

/* ── 6. Section Header ───────────────────────────────────── */

/* ── 7. Tag Filter ───────────────────────────────────────── */

/* ── 8. Post Grid ────────────────────────────────────────── */

/* ── Magazine Hybrid Layout ── */

/* Magazine shared text styles */

/* 다음 페이지 (좌로 슬라이드) */

/* 이전 페이지 (우로 슬라이드) */

/* ── Magazine Hybrid Layout ──────────────────────────────── */

/* Featured Card */

/* Side Cards */

/* Bottom Row */

@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Card Image */

/* Card Body */

.post-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ── 9. Empty State ──────────────────────────────────────── */
/* Post Paging */

/* ── 9b. All Posts — Card Decks ───────────────────────── */

/* Deck Grid — 4-column */

/* Single Deck (category) */

/* All Posts — flat grid (no stacking) */

/* Deck card uses shared classes from demo:
   .post-img   — 180px, border-radius:12px, object-fit:cover
   .post-tags  — flex, gap:6px
   .post-tag   — accent pill
   .post-title — 1rem, 700
   .post-excerpt — 0.82rem, 3-line clamp
   .post-meta  — 0.72rem, faint, dot separator
*/


/* ── 9c. Post Side Panel ──────────────────────────────── */

/* Drag resize handle */

/* 세로 줄 */

/* 그립 핸들 */

/* 그립 내부 줄무늬 (box-shadow로 표현) */

/* Hover */

/* Panel body — master-detail flex */

/* Detail pane — 숨김 기본, 패널이 넓어지면 표시 */

/* 좁을 때 master가 전체 폭 차지 */

/* Panel header */

/* Panel list view */

/* 패널 내부에서 포스트 스타일 재사용 */

/* 넓어지면 콘텐츠 중앙 정렬 */

/* ── 9d. Side Projects Section ─────────────────────────── */

/* Slide Track */

/* Star / Fork Stats */

/* GitHub Corner */

/* ── 10. Footer ──────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 20px;
}

.blog-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blog-footer-copy {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.blog-footer-links {
  display: flex;
  gap: 24px;
}

.blog-footer-links a {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-faint);
  transition: color 0.2s;
}

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

/* ── 11. Theme Toggle Button ─────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }

/* ── 12. Reading Progress Bar ───────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ── 13. Post Page — Layout ─────────────────────────────── */
.post-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 48px;
  align-items: start;
}

.post-main {
  min-width: 0;
  padding: 48px 0 80px;
}

/* ── 13a. Post Header ───────────────────────────────────── */
.post-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

/* Breadcrumb (inside header) */
.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
}

.post-breadcrumb a {
  color: var(--accent);
  transition: opacity 0.2s;
}

.post-breadcrumb a:hover {
  opacity: 0.75;
}

.post-breadcrumb .breadcrumb-sep {
  font-size: 0.65rem;
  color: var(--text-faint);
}

.post-breadcrumb .breadcrumb-current {
  color: var(--text-muted);
}

.post-main h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-main);
  margin: 0 0 16px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.post-meta span + span::before {
  content: '·';
  margin-right: 12px;
  color: var(--text-faint);
}

.post-meta .reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.post-meta .reading-time svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-faint);
}

.post-summary {
  margin: 20px 0 0;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── 13c. Post Content (Prose) ──────────────────────────── */
.post-content {
  line-height: 1.85;
}

.post-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 56px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}

.post-content h2:first-child {
  margin-top: 0;
}

.post-content h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 36px 0 12px;
  scroll-margin-top: 80px;
}

.post-content p {
  margin: 0 0 20px;
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.85;
}

.post-content ul {
  margin: 0 0 20px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 10px;
  font-size: 0.95rem;
  line-height: 1.75;
  list-style: disc;
}

.post-content li::marker {
  color: var(--accent);
}

.post-content strong {
  font-weight: 700;
  color: var(--text-main);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

/* Inline Code */

/* Code Block */

/* ── 13d. Callout Variants ──────────────────────────────── */
.post-callout {
  position: relative;
  padding: 20px 24px 20px 52px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.75;
  margin: 24px 0;
  color: var(--text-main);
}

.post-callout::before {
  position: absolute;
  left: 20px;
  top: 20px;
  font-size: 1.1rem;
  line-height: 1;
}

/* Default / Info */
.post-callout {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
}

.post-callout::before {
  content: '💡';
}

/* Tip */

/* Warning */

/* Error / Danger */

/* ── 13e. Table ─────────────────────────────────────────── */

/* ── 14. TOC Sidebar ────────────────────────────────────── */
.post-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  padding: 32px 0 48px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: none;
}

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

.post-toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.post-toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid var(--border);
  padding-left: 0;
}

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

.post-toc-link {
  display: block;
  padding: 5px 16px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.post-toc-link:hover {
  color: var(--text-muted);
}

.post-toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.post-toc-link[data-depth="3"] {
  padding-left: 28px;
  font-size: 0.74rem;
}

/* ── 15. Post Footer Navigation ─────────────────────────── */

/* ── 16. Post Tags Footer ───────────────────────────────── */
.post-tags-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.post-tags-footer .post-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.post-tags-footer .post-tag:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* ── 17. Responsive — Tablet ─────────────────────────────── */
@media screen and (max-width: 1024px) {
  .blog-nav  { padding: 0 32px; }
  .blog-footer-inner { padding: 0 32px; }

  /* Post page tablet */
  .post-layout {
    grid-template-columns: 1fr;
    padding: 0 32px;
    gap: 0;
  }
  .post-main { padding: 32px 0 60px; }
  .post-toc {
    position: static;
    padding: 0 0 24px;
    max-height: none;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
  }
  .post-toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    gap: 4px;
  }
  .post-toc-link {
    border-left: none;
    margin-left: 0;
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    font-size: 0.72rem;
  }
  .post-toc-link.is-active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
  }
  .post-toc-link[data-depth="3"] {
    padding-left: 12px;
  }
}

/* ── 18. Responsive — Mobile ─────────────────────────────── */
@media screen and (max-width: 640px) {
  .blog-nav {
    padding: 0 20px;
    height: 52px;
  }

  .blog-nav-links { gap: 16px; }
  .blog-nav-links a { font-size: 0.75rem; }
  .blog-nav-cta { display: none; }

  .blog-footer-inner {
    padding: 0 20px;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  /* Post page mobile */
  .post-layout { padding: 0 20px; }
  .post-main { padding: 24px 0 60px; }
  .post-main h1 { font-size: 1.6rem; }
  .post-content h2 { font-size: 1.2rem; margin-top: 36px; }
  .post-content h3 { font-size: 1rem; margin-top: 28px; }

  /* Side panel mobile — 전체 화면 */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
