/* =============================================
   아레아소프트 블로그 - 메인 스타일
   blog.areasoft.co.kr
   ============================================= */

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

:root {
  --primary:      #1a56db;
  --primary-dark: #1440a8;
  --primary-light:#eff6ff;
  --text:         #111928;
  --text-sub:     #374151;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --bg:           #f9fafb;
  --card-bg:      #ffffff;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
}

/* -----------------------------------------------
   기본
----------------------------------------------- */
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* -----------------------------------------------
   헤더
----------------------------------------------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: -.02em;
}
.site-logo span { color: var(--text); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.site-nav a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--text-sub);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.site-nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* 모바일 햄버거 (JS로 toggle) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle svg { display: block; }

/* -----------------------------------------------
   히어로 (홈 상단 배너)
----------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #1a56db 0%, #0e9f6e 100%);
  color: #fff;
  padding: 56px 24px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -.03em;
}
.hero p {
  font-size: 1rem;
  opacity: .88;
  max-width: 520px;
  margin: 0 auto;
}

/* -----------------------------------------------
   메인 레이아웃 (목록 + 사이드바)
----------------------------------------------- */
.main-wrap {
  max-width: 1080px;
  margin: 40px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

/* -----------------------------------------------
   글 카드
----------------------------------------------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-card-thumb {
  flex-shrink: 0;
  width: 200px;
}
.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-card-thumb.no-thumb {
  width: 200px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-card-thumb.no-thumb svg {
  width: 48px;
  height: 48px;
  opacity: .25;
}

.post-card-body {
  padding: 20px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.post-card-cat {
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-title:hover { color: var(--primary); }
.post-card-excerpt {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 4px;
}
.post-card-meta svg { width: 13px; height: 13px; }

/* -----------------------------------------------
   사이드바
----------------------------------------------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.sidebar-widget {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.widget-title {
  padding: 14px 18px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.widget-body { padding: 14px 18px; }
.cat-list { list-style: none; }
.cat-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: .9rem;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
}
.cat-list li:last-child a { border-bottom: none; }
.cat-list li a:hover { color: var(--primary); }
.cat-count {
  background: var(--bg);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .75rem;
  color: var(--muted);
}

/* -----------------------------------------------
   페이지네이션
----------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-sub);
  background: #fff;
  transition: all .15s;
}
.pagination a:hover,
.pagination a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* -----------------------------------------------
   글 상세
----------------------------------------------- */
.post-wrap {
  max-width: 1080px;
  margin: 40px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}

.post-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.post-header {
  padding: 36px 40px 28px;
  border-bottom: 1px solid var(--border);
}
.post-cat-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}
.post-title {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}
.post-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: .82rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.post-meta-bar svg { width: 14px; height: 14px; }

.post-thumb-wrap {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
}
.post-thumb-wrap img { width: 100%; height: 420px; object-fit: cover; }

.post-body {
  padding: 36px 40px;
  font-size: 1rem;
  line-height: 1.95;
  color: var(--text-sub);
}
.post-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.post-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 10px;
}
.post-body p { margin-bottom: 18px; }
.post-body strong { color: var(--text); }
.post-body img.post-img {
  border-radius: var(--radius);
  margin: 20px 0;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}
.img-placeholder {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  margin: 16px 0;
}

.post-footer {
  padding: 24px 40px 32px;
  border-top: 1px solid var(--border);
}
.post-source {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 18px;
}
.post-source a { color: var(--primary); }
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.post-tags a {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .8rem;
  color: var(--muted);
  transition: all .15s;
}
.post-tags a:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.post-nav-link {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: .875rem;
  transition: border-color .15s, background .15s;
}
.post-nav-link:hover { border-color: var(--primary); background: var(--primary-light); }
.post-nav-label { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.post-nav-title { color: var(--text); font-weight: 600; line-height: 1.4; }
.post-nav-link.next { text-align: right; }

/* -----------------------------------------------
   404
----------------------------------------------- */
.error-page {
  text-align: center;
  padding: 100px 24px;
}
.error-page h1 {
  font-size: 5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}
.error-page p { color: var(--muted); margin-bottom: 24px; }
.btn-home {
  display: inline-block;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  transition: background .15s;
}
.btn-home:hover { background: var(--primary-dark); }

/* -----------------------------------------------
   푸터
----------------------------------------------- */
.site-footer {
  background: #1f2937;
  color: #9ca3af;
  padding: 36px 24px;
  margin-top: 60px;
  text-align: center;
  font-size: .875rem;
  line-height: 1.8;
}
.site-footer a { color: #d1d5db; }
.site-footer a:hover { color: #fff; }

/* -----------------------------------------------
   반응형
----------------------------------------------- */
@media (max-width: 900px) {
  .main-wrap { grid-template-columns: 1fr; }
  .post-wrap  { grid-template-columns: 1fr; }
  .sidebar    { display: none; } /* 모바일에서 사이드바 숨김 */
}

@media (max-width: 640px) {
  .site-header .inner { padding: 0 16px; }
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: var(--shadow-md);
  }
  .site-nav.open { display: flex; }
  .site-nav a { width: 100%; padding: 10px 12px; }

  .post-card { flex-direction: column; }
  .post-card-thumb,
  .post-card-thumb.no-thumb { width: 100%; height: 180px; }
  .post-card-body { padding: 16px; }

  .hero { padding: 40px 20px; }

  .post-header  { padding: 24px 20px 20px; }
  .post-body    { padding: 24px 20px; }
  .post-footer  { padding: 20px 20px 24px; }
  .post-thumb-wrap img { height: 220px; }
  .post-nav { grid-template-columns: 1fr; }

  .main-wrap, .post-wrap { padding: 0 16px; margin-top: 24px; }
}
