/* ===== CSS Variables ===== */
:root {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #6b7280;
  --color-border: #e5e7eb;
  --color-primary: #3b82f6;

  --color-langchain: #10b981;
  --color-cs-study: #6366f1;
  --color-spring-boot: #f59e0b;
  --color-infra: #ef4444;
  --color-wil: #8b5cf6;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);

  --radius: 12px;
  --max-width: 1100px;
}

/* ===== Ad Banner (마우스 추적 플로팅, 2x 사이즈) ===== */

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Base ===== */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  /*background-color: var(--color-bg);*/
  color: var(--color-text);
  line-height: 1.7;
}

.site-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== Site Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.site-header__logo:hover {
  text-decoration: none;
}

.site-header__nav {
  display: flex;
  gap: 1rem;
}

.site-header__nav a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero__title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.hero__desc {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
}

/* ===== Category Filter ===== */
.category-filter {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 1.5rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.category-filter__btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}

.category-filter__btn:hover,
.category-filter__btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Card ===== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.card__link {
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card__link:hover {
  text-decoration: none;
}

/* ===== Category Tag ===== */
.category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
  width: fit-content;
}

.category-tag--langchain {
  background: #d1fae5;
  color: #065f46;
}
.category-tag--os{
  background: #d1fae5;
  color: #065f07;
}
.category-tag--etc {
  background: #d1fae5;
  color: #f06548;
}
.category-tag--cs-study {
  background: #e0e7ff;
  color: #3730a3;
}

.category-tag--spring-boot {
  background: #fef3c7;
  color: #92400e;
}

.category-tag--infra {
  background: #fee2e2;
  color: #991b1b;
}

.category-tag--Loopers {
  background: #000000;
  color: #ffffff;
}

.category-tag--wil {
  background: #ede9fe;
  color: #5b21b6;
}

.card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.card__excerpt {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
}

.card__date {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

/* ===== Post Wrapper (2-column layout) ===== */
.post-wrapper {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  align-items: flex-start;
}

/* ===== Post Detail ===== */
.post-detail {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 950px;
  padding: 2rem 0 4rem;
}

.post-detail__header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.post-detail__title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0.75rem 0 0.5rem;
}

.post-detail__date {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.post-detail__tags {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ===== Post Content ===== */
.post-detail__content {
  font-size: 1.05rem;
  line-height: 1.5;
}

.post-detail__content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

.post-detail__content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}

.post-detail__content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.post-detail__content p {
  margin-bottom: 1.2rem;
}

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

.post-detail__content li {
  margin-bottom: 0.4rem;
}

.post-detail__content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}

.post-detail__content th,
.post-detail__content td {
  border: 1px solid var(--color-border);
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.post-detail__content th {
  background: var(--color-bg);
  font-weight: 600;
}

/* ===== Code Blocks ===== */
.post-detail__content code {
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.highlighter-rouge,
.post-detail__content .highlighter-rouge,
.post-detail__content .highlight,
.post-detail__content pre {
  background: #f8f8f8 !important;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.highlighter-rouge .highlight,
.post-detail__content .highlighter-rouge .highlight {
  background: transparent !important;
  border: none;
  margin-bottom: 0;
}

.highlighter-rouge pre,
.post-detail__content pre,
.post-detail__content .highlight pre,
.post-detail__content .highlight pre.highlight {
  background: #f8f8f8 !important;
  color: #1a1a2e !important;
  border: none;
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 0;
  line-height: 1.5;
  max-width: 100%;
}

.highlighter-rouge pre code,
.post-detail__content pre code,
.post-detail__content .highlight pre code {
  background: none !important;
  padding: 0;
  color: #1a1a2e;
  font-size: 0.88rem;
}

/* ===== Rouge Syntax Highlighting (Light Theme - IntelliJ style) ===== */
.highlight pre.highlight code span.k,
.highlight pre.highlight code span.kd,
.highlight pre.highlight code span.kn,
.highlight pre.highlight code span.kp,
.highlight pre.highlight code span.kr,
.highlight pre.highlight code span.kt { color: #0033b3 !important; font-weight: bold; } /* keywords */
.highlight pre.highlight code span.nd { color: #9876aa !important; } /* annotations: @Retry */
.highlight pre.highlight code span.nc { color: #1a1a2e !important; font-weight: bold; } /* class names */
.highlight pre.highlight code span.nf { color: #00627a !important; } /* function/method names */
.highlight pre.highlight code span.na { color: #871094 !important; } /* attributes */
.highlight pre.highlight code span.n { color: #1a1a2e !important; } /* names */
.highlight pre.highlight code span.s,
.highlight pre.highlight code span.s1,
.highlight pre.highlight code span.s2,
.highlight pre.highlight code span.se,
.highlight pre.highlight code span.sh,
.highlight pre.highlight code span.sx { color: #067d17 !important; } /* strings */
.highlight pre.highlight code span.c,
.highlight pre.highlight code span.c1,
.highlight pre.highlight code span.cm,
.highlight pre.highlight code span.cp,
.highlight pre.highlight code span.cs { color: #8c8c8c !important; font-style: italic; } /* comments */
.highlight pre.highlight code span.mi,
.highlight pre.highlight code span.mf,
.highlight pre.highlight code span.mh,
.highlight pre.highlight code span.mo,
.highlight pre.highlight code span.il { color: #1750eb !important; } /* numbers */
.highlight pre.highlight code span.o,
.highlight pre.highlight code span.p { color: #1a1a2e !important; } /* operators */
.highlight pre.highlight code span.nt { color: #0033b3 !important; } /* tags */
.highlight pre.highlight code span.nv,
.highlight pre.highlight code span.vi,
.highlight pre.highlight code span.vg { color: #871094 !important; } /* variables */
.highlight pre.highlight code span.no { color: #871094 !important; font-weight: bold; } /* constants */
.highlight pre.highlight code span.ni,
.highlight pre.highlight code span.ne,
.highlight pre.highlight code span.nl { color: #1a1a2e !important; } /* other names */

/* ===== Post Footer ===== */
.post-detail__footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.back-link {
  font-weight: 500;
  color: var(--color-primary);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1.5rem 3rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.pagination__btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination__btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.pagination__btn--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ===== Site Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

/* ===== TOC Sidebar ===== */
.toc-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 1rem 0;
}

.toc-sidebar__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.toc-sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar__item {
  margin-bottom: 0.15rem;
}

.toc-sidebar__item--sub {
  padding-left: 1rem;
}

.toc-sidebar__link {
  display: block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

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

.toc-sidebar__item--active > .toc-sidebar__link {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

/* Hide TOC on small screens */
@media (max-width: 768px) {
  .post-wrapper {
    display: block;
  }

  .post-detail {
    max-width: 100%;
    padding: 2rem 0 4rem;
  }

  .toc-sidebar {
    display: none;
  }
}

@media (min-width: 769px) {
  .site-header__inner,
  .hero,
  .category-filter,
  .card-grid,
  .pagination,
  .post-wrapper,
  .site-footer__inner {
    margin-left: 450px;
  }
}

