/* Pretendard 웹폰트 로드 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  /* 라이트 테마 변수 */
  --bg-color: #ffffff;
  --bg-sub: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  
  --primary: #0f172a;
  --primary-rgb: 15, 23, 42;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-hover: #1d4ed8;
  
  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --max-width: 1200px;
  --max-width-article: 780px;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 12px;
}

body.dark-mode {
  /* 다크 테마 변수 */
  --bg-color: #0b0f19;
  --bg-sub: #151b2c;
  --bg-card: #111827;
  --border-color: #1e293b;
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #64748b;
  
  --primary: #f8fafc;
  --primary-rgb: 248, 250, 252;
  --accent: #3b82f6;
  --accent-light: rgba(59, 130, 246, 0.1);
  --accent-hover: #60a5fa;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
}

/* 기본 리셋 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* 모바일 가로 스크롤 생김 방지 */
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, textarea {
  font-family: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* 레이아웃 */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* 헤더 & 네비게이션 */
.header {
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background-color: rgba(var(--primary-rgb), 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  height: 76px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .header {
  background-color: rgba(11, 15, 25, 0.8);
}

body:not(.dark-mode) .header {
  background-color: rgba(255, 255, 255, 0.8);
}

.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header__logo {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header__nav {
  display: flex;
  gap: 24px;
}

.header__link {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sub);
  position: relative;
  padding: 8px 4px;
}

.header__link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: var(--transition);
}

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

.header__link:hover::after {
  width: 100%;
}

.header__link.active {
  color: var(--accent);
}

.header__link.active::after {
  width: 100%;
}

/* 테마 토글 스위치 */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-sub);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--primary);
  background-color: var(--border-color);
  transform: rotate(15deg);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 히어로 섹션 */
.hero {
  padding: 56px 0 40px;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.hero__grid:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.hero__image-wrapper {
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  box-shadow: var(--shadow-sm);
}

.hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero__grid:hover .hero__image {
  transform: scale(1.04);
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-tag {
  align-self: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  background-color: var(--accent-light);
  padding: 6px 12px;
  border-radius: 6px;
  letter-spacing: 0.08em;
}

.hero__title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--primary);
  word-break: keep-all;
}

.hero__desc {
  font-size: 16px;
  color: var(--text-sub);
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero__meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 2단 구성 레이아웃 (메인 게시판 + 사이드바) */
.main-layout {
  display: grid;
  grid-template-columns: 2.8fr 1.2fr;
  gap: 40px;
  margin-top: 40px;
}

.main-content {
  min-width: 0; /* 그리드 레이아웃 내부 자식 넘침 방지 */
}

.sidebar {
  min-width: 0; /* 그리드 레이아웃 내부 자식 넘침 방지 */
}

/* 툴바 (필터 & 검색) */
.toolbar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px 24px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  border-radius: 20px;
  background-color: var(--bg-sub);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.filter-btn:hover {
  background-color: var(--border-color);
  color: var(--primary);
}

.filter-btn.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-sub);
  color: var(--text-main);
  border-radius: 20px;
  font-size: 14px;
  width: 240px;
  font-weight: 500;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  background-color: var(--bg-card);
  width: 280px;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* 포스트 그리드 */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-bottom: 56px;
}

.post-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.post-card__image-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border-color);
}

.post-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card__image {
  transform: scale(1.05);
}

.post-card__content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
}

.post-card__content .category-tag {
  align-self: flex-start;
}

.post-card__title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--primary);
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__desc {
  font-size: 14px;
  color: var(--text-sub);
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

/* 사이드바 */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden; /* 사이드바 내부 텍스트 넘침 방지 */
}

.sidebar-widget__title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-widget__title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* 사이드바 리스트 아이템 */
.widget-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.widget-item {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0; /* flex 자식 말줄임 작동 보장 */
}

.widget-item a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.widget-item a:hover {
  color: var(--accent);
}

.widget-item::before {
  content: "•";
  color: var(--accent);
  font-weight: bold;
}

/* 애드센스 광고 영역 스타일 */
.ad-container {
  display: none; /* 애드센스 승인 전까지 광고 영역 숨김 */
  margin: 32px 0;
  width: 100%;
  clear: both;
}

.ad-placeholder {
  background-color: var(--bg-sub);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.ad-placeholder::before {
  content: "SPONSORED ADVERTISEMENT";
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.ad-placeholder__desc {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.ad-placeholder:hover {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

.ad-placeholder:hover::before {
  color: var(--accent);
}

/* 사이드바 고정 배너 광고 */
.sidebar-ad {
  min-height: 250px;
}

/* 본문 레이아웃 */
.article-header {
  padding: 64px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.article-header__container {
  max-width: var(--max-width-article);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.article-header__title {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--primary);
  word-break: keep-all;
}

.article-header__meta {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 500;
}

.article-body {
  max-width: var(--max-width-article);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.article-body__content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-sub);
}

.article-body__content p {
  margin-bottom: 24px;
  word-break: keep-all;
}

.article-body__content h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 48px 0 20px;
  color: var(--primary);
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  line-height: 1.3;
}

.article-body__content h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 36px 0 16px;
  color: var(--primary);
}

.article-body__content blockquote {
  border-left: 4px solid var(--accent);
  background-color: var(--bg-sub);
  padding: 20px 24px;
  margin: 32px 0;
  font-style: italic;
  font-weight: 500;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  color: var(--text-main);
}

.article-body__content img {
  border-radius: var(--border-radius);
  margin: 32px auto;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.article-body__content ul, 
.article-body__content ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.article-body__content li {
  margin-bottom: 10px;
  font-weight: 500;
}

.article-body__content hr {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 48px 0;
}

.article-body__content code {
  font-family: Consolas, Monaco, monospace;
  background-color: var(--bg-sub);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
  font-weight: 600;
}

.article-body__content pre {
  background-color: var(--bg-sub);
  padding: 20px;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin-bottom: 28px;
  border: 1px solid var(--border-color);
}

.article-body__content pre code {
  color: var(--text-main);
  background-color: transparent;
  padding: 0;
  font-size: 0.9em;
  font-weight: normal;
}

.article-body__content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 600;
}

.article-body__content a:hover {
  color: var(--accent-hover);
}

/* 법적 문서 전용 스타일 (Privacy Policy 등) */
.legal-content {
  font-size: 15px;
  line-height: 1.75;
}

.legal-content h2 {
  font-size: 20px;
  margin: 32px 0 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.legal-content h3 {
  font-size: 16px;
  margin: 24px 0 12px;
}

/* 기사 하단 푸터 */
.article-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 32px;
  margin-top: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-to-home {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-to-home:hover {
  color: var(--accent);
}

/* 푸터 */
.footer {
  background-color: var(--bg-sub);
  border-top: 1px solid var(--border-color);
  padding: 56px 0;
  color: var(--text-sub);
  font-size: 14px;
  margin-top: 80px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer__logo {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer__logo::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  background-color: var(--accent);
  border-radius: 50%;
}

.footer__desc {
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

.footer__nav-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer__nav-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.footer__nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer__nav-link {
  color: var(--text-muted);
  font-weight: 500;
}

.footer__nav-link:hover {
  color: var(--accent);
}

.footer__bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer__copyright {
  color: var(--text-muted);
  font-weight: 500;
}

/* 반응형 미디어 쿼리 */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  
  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
  
  .sidebar-ad {
    grid-column: span 2;
    min-height: 150px;
  }
}

@media (max-width: 768px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px;
  }
  
  .hero__title {
    font-size: 26px;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .sidebar {
    grid-template-columns: 1fr;
  }
  
  .sidebar-ad {
    grid-column: span 1;
  }
  
  .article-header {
    padding: 40px 0 24px;
  }
  
  .article-header__title {
    font-size: 28px;
  }
  
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 576px) {
  .header__actions {
    gap: 16px;
  }
  
  .header__nav {
    display: none; /* 모바일 헤더 간소화 */
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  
  .search-input {
    width: 100%;
  }
  
  .search-input:focus {
    width: 100%;
  }
}

/* 페이지네이션 스타일 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px 0 56px;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

.page-btn.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

