/* =========================================
   모 초상현상 연구소 — style.css
   ========================================= */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700;800&family=Noto+Sans+KR:wght@400;500&family=Noto+Serif+KR:wght@400;500;700&display=swap');

/* ─── CSS Variables ─── */
:root {
  --bg:          #1a1710;
  --bg-header:   #13120e;
  --bg-card:     #1f1d17;
  --bg-sidebar:  #1c1a14;
  --border:      #3a3528;
  --border-light:#2c2a20;

  --text:        #d4ccb8;
  --text-dim:    #8a8070;
  --text-muted:  #5a5448;
  --text-link:   #c89a50;
  --text-link-hover: #e0b870;
  --text-title:  #e8dfc8;

  --accent:      #8b2020;
  --accent-soft: rgba(139, 32, 32, 0.15);

  /* 한국어 폰트: 나눔명조(본문 명조), Noto Serif KR(보조), Noto Sans KR(고딕) */
  --font-serif:  'Nanum Myeongjo', 'Noto Serif KR', serif;
  --font-sans:   'Noto Sans KR', sans-serif;

  --max-width:   980px;
  --sidebar-w:   240px;
  --gap:         2rem;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.9;       /* 한글 가독성을 위해 일본어보다 약간 넓게 */
  word-break: keep-all;   /* 한글 줄바꿈 자연스럽게 */
  min-height: 100vh;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--text-link-hover); }

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

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* =========================================
   HEADER
   ========================================= */
#site-header {
  background: var(--bg-header);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;  /* 한글은 자간을 좁게 */
  line-height: 1.2;
}

.site-title a {
  color: var(--text-title);
  text-decoration: none;
}
.site-title a:hover { color: #fff; }

.site-catchphrase {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

/* 검색 폼 */
.search-form {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.search-form input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.45rem 0.8rem;
  width: 180px;
}
.search-form input::placeholder { color: var(--text-muted); }

.search-form button {
  background: var(--border-light);
  border: none;
  color: var(--text-dim);
  padding: 0 0.75rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}
.search-form button:hover {
  background: var(--accent);
  color: #fff;
}

/* =========================================
   HAMBURGER (모바일에서만 표시)
   ========================================= */
.hamburger {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  width: 48px;
  height: 48px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.25s;
}

/* =========================================
   OVERLAY (모바일)
   ========================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 250;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-overlay.is-visible {
  opacity: 1;
}

/* =========================================
   PAGE WRAPPER + LAYOUT
   ========================================= */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: var(--gap);
  align-items: start;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
  min-width: 0; /* grid overflow 방지 */
}

/* ─── 게시물 카드 ─── */
.post-card {
  padding: 1.5rem 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.02em;
}

.post-category a {
  background: var(--accent-soft);
  color: #c08040;
  border: 1px solid rgba(139, 32, 32, 0.3);
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}
.post-category a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.post-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.65;
  margin-bottom: 0.7rem;
}

.post-title a {
  color: var(--text-title);
}
.post-title a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-excerpt {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.95;
  margin-bottom: 0.9rem;
}

.read-more {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-link);
  letter-spacing: 0.02em;
}
.read-more:hover { color: var(--text-link-hover); }

.post-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0;
}

/* ─── 페이지네이션 ─── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.page-current {
  background: var(--accent);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
}

.page-link {
  color: var(--text-dim);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.2s;
}
.page-link:hover {
  border-color: var(--accent);
  color: var(--text-link-hover);
}

.page-dots { color: var(--text-muted); }

.page-next {
  margin-left: auto;
  color: var(--text-link);
  font-size: 0.78rem;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-close {
  display: none; /* 데스크탑에서는 숨김 */
}

/* ─── 위젯 ─── */
.widget {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  padding: 1.1rem 1.2rem;
}

.widget-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

/* 프로필 */
.profile-avatar {
  font-size: 2.2rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.7rem;
  opacity: 0.5;
}

.profile-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.9;
  word-break: keep-all;
}

/* 리스트 계열 */
.widget-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.widget-list a {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: block;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: color 0.2s, padding-left 0.2s;
  word-break: keep-all;
}
.widget-list a:hover {
  color: var(--text-link-hover);
  padding-left: 0.4rem;
}

.widget-list li:last-child a {
  border-bottom: none;
}

.count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* 태그 클라우드 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  transition: all 0.2s;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--text-link-hover);
  background: var(--accent-soft);
}

/* =========================================
   FOOTER
   ========================================= */
#site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.footer-note {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: #3a3528;
}

/* =========================================
   RESPONSIVE — 모바일 (768px 이하)
   ========================================= */
@media (max-width: 768px) {

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .search-form input {
    width: 100%;
  }

  /* 그리드를 1컬럼으로 */
  .page-wrapper {
    grid-template-columns: 1fr;
    padding: 1.2rem 1rem;
  }

  /* 햄버거 표시 */
  .hamburger {
    display: flex;
  }

  /* 사이드바는 드로어로 */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    z-index: 260;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    gap: 1.2rem;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  /* 닫기 버튼 표시 */
  .sidebar-close {
    display: block;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.9rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    align-self: flex-end;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
  }
  .sidebar-close:hover {
    border-color: var(--accent);
    color: var(--text-link-hover);
  }

  .post-title { font-size: 1rem; }
}

/* =========================================
   RESPONSIVE — 중간 (769px~900px)
   ========================================= */
@media (min-width: 769px) and (max-width: 900px) {
  :root {
    --sidebar-w: 200px;
  }

  .site-title { font-size: 1.1rem; }
  .search-form input { width: 140px; }
}

/* =========================================
   CATEGORY PAGE
   ========================================= */

/* 브레드크럼 */
.category-breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.category-breadcrumb a {
  color: var(--text-muted);
}
.category-breadcrumb a:hover {
  color: var(--text-link);
}
.breadcrumb-sep {
  opacity: 0.5;
}

/* 카테고리 헤더 블록 */
.category-header {
  padding: 1.5rem 0 1.8rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.category-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 0.6rem;
  letter-spacing: 0.01em;
  position: relative;
  padding-left: 0.9rem;
}

/* 제목 왼쪽에 붉은 세로선 */
.category-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.1em;
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
}

.category-desc {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.8;
  word-break: keep-all;
  padding-left: 0.9rem;
}

/* =========================================
   POST PAGE
   ========================================= */

/* 게시물 헤더 */
.post-header {
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.post-header-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-title);
  line-height: 1.55;
  margin: 0.8rem 0 1rem;
  letter-spacing: 0.01em;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-header-cat a {
  background: var(--accent-soft);
  color: #c08040;
  border: 1px solid rgba(139,32,32,0.3);
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
}
.post-header-cat a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 본문 */
.post-body {
  font-size: 0.97rem;
  line-height: 2;
  color: var(--text);
  margin-bottom: 3rem;
  word-break: keep-all;
}

.post-body p {
  margin-bottom: 1.4rem;
}

.post-body h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-title);
  margin: 2.2rem 0 0.8rem;
  padding-left: 0.8rem;
  border-left: 3px solid var(--accent);
}

.post-body ul,
.post-body ol {
  padding-left: 1.4rem;
  margin-bottom: 1.4rem;
  color: var(--text-dim);
}

.post-body li {
  margin-bottom: 0.4rem;
  line-height: 1.85;
}

.post-body blockquote {
  margin: 1.6rem 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-style: italic;
}

.post-body blockquote p {
  margin-bottom: 0;
}

.post-body strong {
  color: var(--text-title);
  font-weight: 700;
}

/* 이전/다음 글 내비게이션 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  transition: border-color 0.2s, background 0.2s;
}
.post-nav-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.post-nav-next {
  text-align: right;
}

.nav-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-title {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: keep-all;
}
.post-nav-item:hover .nav-title {
  color: var(--text-link-hover);
}

/* 댓글 섹션 */
.comments-section {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.comments-count {
  background: var(--border);
  color: var(--text-dim);
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
  font-size: 0.7rem;
  margin-left: 0.3rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comment {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

.comment-admin {
  background: rgba(139,32,32,0.05);
  padding: 1rem;
  border-left: 2px solid var(--accent);
  margin: 0.5rem 0;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.comment-author {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
}

.comment-admin .comment-author {
  color: #c08040;
}

.comment-date {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.85;
  word-break: keep-all;
}

.comment-notice {
  margin-top: 1.5rem;
  padding: 0.7rem 1rem;
  border: 1px dashed var(--border);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* 모바일 대응 */
@media (max-width: 768px) {
  .post-nav {
    grid-template-columns: 1fr;
  }
  .post-nav-next {
    text-align: left;
  }
  .post-header-title {
    font-size: 1.2rem;
  }
}

/* 게시물 없음 */
.empty-notice {
  padding: 3rem 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
