/* 블로그 공개 화면 — 모바일 퍼스트, 시스템 다크모드 대응 */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1f2937;
  --text-soft: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --radius: 10px;
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --bg-soft: #1f2937;
    --text: #e5e7eb;
    --text-soft: #9ca3af;
    --line: #374151;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  word-break: keep-all;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 헤더 ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
}

.site-logo { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.site-logo:hover { text-decoration: none; color: var(--accent); }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: 0.88rem; }
.site-nav a {
  color: var(--text-soft);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.search-form { margin-left: auto; }
.search-form input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.88rem;
  background: var(--bg-soft);
  color: var(--text);
  width: 130px;
}
.search-form input:focus { outline: 2px solid var(--accent); width: 180px; transition: width 0.2s; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; flex-direction: column; }
  .site-nav.open { display: flex; }
  .search-form { margin-left: 0; width: 100%; }
  .search-form input { width: 100%; }
  .search-form input:focus { width: 100%; }
}

/* ---------- 목록 ---------- */
.page-head { padding: 2rem 0 0.5rem; }
.page-head h1 { margin: 0 0 0.3rem; font-size: 1.7rem; }
.page-desc { color: var(--text-soft); margin: 0; }

.post-list { display: flex; flex-direction: column; }

.post-card { padding: 1.3rem 0; border-bottom: 1px solid var(--line); }

/* 썸네일이 있는 카드: 본문 + 우측 썸네일 */
.post-card.has-thumb { display: flex; gap: 1rem; align-items: flex-start; }
.post-card.has-thumb .post-card-body { flex: 1; min-width: 0; }
.post-card-thumb {
  flex: 0 0 120px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.3rem;
}
.post-card-thumb img { width: 120px; height: 84px; object-fit: cover; display: block; }
@media (max-width: 480px) {
  .post-card-thumb { flex-basis: 96px; }
  .post-card-thumb img { width: 96px; height: 72px; }
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}
.badge:hover { text-decoration: none; }

.post-card-title { margin: 0.45rem 0 0.3rem; font-size: 1.18rem; line-height: 1.45; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty { color: var(--text-soft); padding: 2rem 0; }

/* ---------- 페이지네이션 ---------- */
.pagination { display: flex; gap: 0.4rem; justify-content: center; padding: 1.5rem 0; }
.pagination a {
  min-width: 2.1rem;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}
.pagination a.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination a:hover { text-decoration: none; border-color: var(--accent); }

/* ---------- 포스트 ---------- */
.breadcrumb { font-size: 0.82rem; color: var(--text-soft); padding-top: 1.2rem; }
.breadcrumb a { color: var(--text-soft); }

.post-header h1 { font-size: 1.75rem; line-height: 1.4; margin: 0.6rem 0 0.4rem; }
.post-meta { font-size: 0.85rem; color: var(--text-soft); margin-bottom: 1rem; }

/* AEO 핵심 요약 박스 — 답변엔진이 인용하는 첫 화면 요약 */
.answer-box {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}
.answer-box-title { margin: 0 0 0.5rem; font-size: 1rem; }
.answer-box ul { margin: 0; padding-left: 1.2rem; }
.answer-box li { margin: 0.3rem 0; font-size: 0.95rem; }

/* 대표 이미지 & 본문 이미지 */
.featured-image { margin: 1.2rem 0; }
.featured-image img,
.post-body figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}
.post-body figure { margin: 1.5rem 0; }
.post-body figcaption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 0.4rem;
}

.post-body { font-size: 1.02rem; }
.post-body h2 {
  font-size: 1.35rem;
  margin: 2.2rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
.post-body h3 { font-size: 1.12rem; margin: 1.6rem 0 0.5rem; }
.post-body ul { padding-left: 1.3rem; }
.post-body li { margin: 0.35rem 0; }

/* ---------- FAQ (AEO) ---------- */
.faq { margin: 2.5rem 0; }
.faq h2 { font-size: 1.3rem; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0.5rem 0;
  padding: 0.7rem 1rem;
  background: var(--bg-soft);
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.6rem 0 0.2rem; color: var(--text-soft); }

/* ---------- 관련 글 ---------- */
.related {
  margin: 2rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
}
.related h2 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.related ul { margin: 0; padding-left: 1.2rem; }
.related li { margin: 0.35rem 0; }

/* ---------- 광고 슬롯 ---------- */
.ad-slot { margin: 1.5rem 0; text-align: center; min-height: 90px; }
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 0.8rem;
  background: var(--bg-soft);
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 1.1rem;
  color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-bottom: 0.6rem; }
.footer-nav a { color: var(--text-soft); }
