/* 구글 폰트 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --text-dark: #1E293B;
  --text-gray: #64748B;
  --text-light: #94A3B8;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: #212529;
  line-height: 1.9;
  font-size: 18px;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ── 헤더 ── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-logo {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
  white-space: nowrap;
}
.site-logo span { color: var(--text-dark); }

.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.main-nav a {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-gray);
  white-space: nowrap;
  transition: all 0.2s;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 16px;
  min-width: 200px;
}
.search-form input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  color: var(--text-dark);
}
.search-form button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

/* ── 레이아웃 ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

/* ── 히어로 배너 ── */
.hero {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #0891B2 100%);
  color: white;
  padding: 60px 20px;
  text-align: center;
}
.hero h1 { font-size: 32px; font-weight: 900; margin-bottom: 12px; }
.hero p { font-size: 16px; opacity: 0.9; margin-bottom: 28px; }
.hero-search {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  background: white;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-search input {
  flex: 1;
  border: none;
  padding: 14px 20px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  color: var(--text-dark);
}
.hero-search button {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.2s;
}
.hero-search button:hover { background: #4338CA; }

/* ── 카테고리 카드 그리드 ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.cat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.cat-icon { font-size: 32px; margin-bottom: 8px; }
.cat-name { font-size: 13px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.cat-desc { font-size: 11px; color: var(--text-light); }

/* ── 섹션 헤더 ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-more {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}
.section-more:hover { text-decoration: underline; }

/* ── 포스트 카드 ── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.post-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.post-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 16px; }
.post-cat-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--primary-light);
  color: var(--primary);
}
.post-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--text-dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-title:hover { color: var(--primary); }
.post-summary {
  font-size: 12px;
  color: var(--text-gray);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
  margin-bottom: 10px;
}
.post-meta {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 리스트형 포스트 ── */
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-list-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.post-list-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.post-list-num {
  min-width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}
.post-list-body { flex: 1; }
.post-list-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
  line-height: 1.4;
}
.post-list-title:hover { color: var(--primary); }
.post-list-meta { font-size: 11px; color: var(--text-light); }

/* ── 사이드바 ── */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.sidebar-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.widget-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.widget-post-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.widget-post-item:last-child { border-bottom: none; }
.widget-post-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-dark);
  flex: 1;
}
.widget-post-title:hover { color: var(--primary); }
.widget-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-gray);
  margin: 3px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.widget-tag:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── 포스트 상세 ── */
.post-header { margin-bottom: 32px; }
.post-header-cat {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 12px;
}
.post-header h1 {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--text-dark);
}
.post-header-meta {
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  gap: 16px;
  align-items: center;
}
.post-content {
  font-size: 19px;
  line-height: 2.2;
  color: #333;
  word-break: keep-all;
  letter-spacing: -0.01em;
}
.post-content h2 { font-size: 20px; font-weight: 800; margin: 28px 0 12px; }
.post-content h3 { font-size: 17px; font-weight: 700; margin: 20px 0 10px; }
.post-content p { margin-bottom: 14px; }
.post-content ul, .post-content ol { padding-left: 24px; margin-bottom: 14px; }
.post-content li { margin-bottom: 6px; }
.post-content table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.post-content th, .post-content td { padding: 10px 14px; border: 1px solid var(--border); font-size: 14px; }
.post-content th { background: var(--bg); font-weight: 700; }
.post-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
  color: var(--text-gray);
}
.source-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-gray);
  margin-top: 32px;
}

/* ── 광고 자리 ── */
.ad-slot {
  background: #F1F5F9;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin: 20px 0;
}

/* ── 페이지네이션 ── */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 32px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-dark);
  transition: all 0.2s;
}
.pagination a:hover, .pagination .active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── 푸터 ── */
.site-footer {
  background: var(--text-dark);
  color: #94A3B8;
  padding: 40px 20px;
  margin-top: 60px;
  font-size: 13px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-inner p { margin-bottom: 6px; }
.footer-inner a { color: #64748B; }
.footer-inner a:hover { color: white; }

/* ── 반응형 ── */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .post-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
  .main-nav { display: none; }
  .search-form { min-width: auto; flex: 1; }
}
