/* ========== 전역 변수 ========== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #10b981;
  --warning: #f59e0b;
}

/* ========== 기본 스타일 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a2332 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== 헤더 ========== */
.header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 2rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

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

/* ========== 메인 컨테이너 ========== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* ========== 히어로 섹션 ========== */
.hero-section {
  text-align: center;
  margin-bottom: 4rem;
  padding: 2rem 0;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

/* ========== 게시글 컨테이너 ========== */
.posts-container {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* ========== 섹션 타이틀 ========== */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

/* ========== 최신 게시글 섹션 ========== */
.latest-posts-section {
  margin-bottom: 2rem;
}

.latest-posts-section .section-title {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom-color: var(--primary);
}

/* ========== 아카이브 섹션 ========== */
.archive-posts-section {
  background: rgba(51, 65, 85, 0.3);
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid var(--border);
}

.archive-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-item {
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
  transition: all 0.2s ease;
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item:hover {
  background: rgba(99, 102, 241, 0.05);
  padding-left: 0.5rem;
  border-radius: 8px;
}

.archive-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.archive-link:hover {
  color: var(--primary);
}

.archive-title {
  font-weight: 500;
  flex: 1;
}

.archive-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 1rem;
}

/* ========== 게시글 그리드 ========== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.post-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  position: relative;
}

.post-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -12px rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
}

.post-rank {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  z-index: 10;
}

.post-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.post-content {
  padding: 1.5rem;
}

.post-title a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s ease;
  display: block;
  margin-bottom: 0.75rem;
}

.post-title a:hover {
  color: var(--primary);
}

.post-date {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.post-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.post-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.keyword {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.read-more {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.read-more:hover {
  transform: translateX(4px);
}

.no-posts {
  text-align: center;
  font-size: 1.25rem;
  color: var(--text-muted);
  padding: 4rem 0;
}

/* ========== 게시글 상세 ========== */
.post-article {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 3rem;
  border: 1px solid var(--border);
}

.post-header {
  margin-bottom: 2rem;
}

.post-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.post-article .post-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.post-meta {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.post-hero-image {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.post-article .post-content {
  padding: 0;
}

.post-article .post-content h1,
.post-article .post-content h2,
.post-article .post-content h3 {
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.post-article .post-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
}

.post-article .post-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.post-article .post-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.post-article .post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.original-link,
.back-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.3s ease;
  display: inline-block;
}

.original-link:hover,
.back-link:hover {
  transform: translateX(4px);
}

.back-link:hover {
  transform: translateX(-4px);
}

/* ========== 푸터 ========== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 4rem;
}

.footer p {
  margin: 0.5rem 0;
}

.last-updated {
  font-size: 0.875rem;
  opacity: 0.7;
}

/* ========== 반응형 ========== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-article {
    padding: 2rem 1.5rem;
  }

  .post-article .post-title {
    font-size: 2rem;
  }

  .nav-container {
    flex-direction: column;
    text-align: center;
  }

  .nav-links {
    margin-top: 1rem;
  }

  .nav-links a {
    margin: 0 1rem;
  }

  .archive-posts-section {
    padding: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .archive-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .archive-date {
    margin-left: 0;
  }
}

/* ========== 애드센스 컨테이너 ========== */
.ad-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-header {
  margin-top: 1rem;
  margin-bottom: 0;
}

.ad-content-bottom {
  margin-top: 3rem;
  margin-bottom: 2rem;
}

.ad-footer {
  margin-top: 0;
  margin-bottom: 2rem;
}

/* 애드센스 플레이스홀더 (개발/테스트용) */
.ad-placeholder {
  background: rgba(71, 85, 105, 0.2);
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  min-height: 100px;
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .ad-container {
    padding: 0 1rem;
  }

  .ad-placeholder {
    min-width: 250px;
    min-height: 80px;
  }
}

/* ========== 전체 게시글 보기 버튼 ========== */
.view-all-container {
  text-align: center;
  margin: 3rem 0;
}

.view-all-button {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.view-all-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -2px rgba(99, 102, 241, 0.4);
}

/* ========== 심플 리스트 (list.html) ========== */
.list-container {
  max-width: 900px;
  margin: 0 auto;
}

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

.simple-list-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.simple-list-item:last-child {
  border-bottom: none;
}

.simple-list-item:hover {
  background: rgba(99, 102, 241, 0.05);
}

.simple-list-link {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem;
  text-decoration: none;
  gap: 1rem;
}

.simple-list-content {
  flex: 1;
}

.simple-list-rank {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.simple-list-title {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0.5rem 0;
  transition: color 0.3s ease;
}

.simple-list-link:hover .simple-list-title {
  color: var(--primary);
}

.simple-list-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0.5rem 0 0 0;
  line-height: 1.5;
}

.simple-list-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  align-self: center;
}

@media (max-width: 768px) {
  .simple-list-link {
    flex-direction: column;
  }

  .simple-list-date {
    align-self: flex-start;
  }

  .view-all-button {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }
}

/* ========== 관련 기사 섹션 ========== */
.related-articles-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

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

.related-articles-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.related-article-item {
  background: rgba(51, 65, 85, 0.3);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.related-article-item:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  transform: translateX(4px);
}

.related-article-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  text-decoration: none;
  gap: 1rem;
}

.related-article-title {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  transition: color 0.3s ease;
}

.related-article-item:hover .related-article-title {
  color: var(--primary);
}

.related-article-source {
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  padding: 0.25rem 0.75rem;
  background: rgba(71, 85, 105, 0.3);
  border-radius: 6px;
}

@media (max-width: 768px) {
  .related-article-link {
    flex-direction: column;
    align-items: flex-start;
  }

  .related-article-source {
    align-self: flex-start;
  }
}