/*
Theme Name: HONGDRICK
Theme URI: https://hongdrick.com
Author: HONGDRICK
Description: 깔끔한 화이트+블랙 게임 블로그 테마. 반응형 2컬럼 레이아웃, 다크모드, 계층형 카테고리, 검색 기능 지원.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: hongdrick
*/

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

:root {
  --bg: #fafafa;
  --surface: #fff;
  --border: #e8e8e8;
  --text: #1a1a1a;
  --text-soft: #666;
  --text-muted: #999;
  --accent: #000;
  --accent-soft: rgba(0,0,0,0.04);
  --card-bg: #fff;
  --tag-bg: #f0f0f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --header-bg: rgba(255,255,255,0.95);
  --input-bg: #f5f5f5;
  --overlay-bg: rgba(0,0,0,0.25);
  --max-width: 1100px;
  --font: 'Pretendard Variable', 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.dark-mode {
  --bg: #121212;
  --surface: #1e1e1e;
  --border: #333;
  --text: #e0e0e0;
  --text-soft: #999;
  --text-muted: #666;
  --accent: #fff;
  --accent-soft: rgba(255,255,255,0.08);
  --card-bg: #1a1a1a;
  --tag-bg: #2a2a2a;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.5);
  --header-bg: rgba(18,18,18,0.95);
  --input-bg: #2a2a2a;
  --overlay-bg: rgba(0,0,0,0.55);
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: var(--font); cursor: pointer; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  text-decoration: none;
  user-select: none;
}
.site-logo span { font-weight: 300; }

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-menu {
  display: flex;
  gap: 2px;
  list-style: none;
}

.nav-menu a {
  display: block;
  background: none;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.nav-menu a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 17px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--accent); }

.darkmode-btn {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 14px;
  padding: 4px 9px;
  border-radius: 20px;
  transition: all 0.3s;
}

.hamburger-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 6px 8px;
  display: none;
}

/* ── Search Bar ── */
.search-bar {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 20px;
  display: none;
}
.search-bar.active { display: block; }

.search-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-family: var(--font);
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }

/* ── Main Grid ── */
.main-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 32px;
}

/* ── Post Cards ── */
.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  display: block;
}
.post-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--tag-bg);
}

.post-card + .post-card { margin-top: 14px; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.post-meta a { color: var(--text-muted); }
.post-meta a:hover { color: var(--accent); }

.post-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.3px;
  color: var(--text);
}

.post-excerpt {
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 10px;
  line-height: 1.7;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 28px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-soft);
  transition: all 0.2s;
}
.pagination .current {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Sidebar ── */
.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.sidebar-card-inner { padding: 16px; }
.sidebar-card-inner.profile {
  padding: 20px;
  text-align: center;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e0e0, #ccc);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
body.dark-mode .profile-avatar {
  background: linear-gradient(135deg, #333, #555);
}

.profile-name { font-size: 14px; font-weight: 700; }
.profile-desc { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  color: var(--text-muted);
}

/* ── Category Tree ── */
.cat-list { list-style: none; }

.cat-item a,
.cat-item > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-soft);
  transition: background 0.15s;
  text-decoration: none;
}

/* 파란색 링크 색상 강제 덮어쓰기 */
.cat-list a,
.cat-list a:visited,
.cat-list a:link {
  color: var(--text-soft) !important;
  text-decoration: none !important;
}
.cat-list .cat-item.active a,
.cat-list .cat-item.active a:visited {
  color: var(--accent) !important;
}
.cat-item a:hover,
.cat-item > span:hover {
  background: var(--accent-soft);
}
.cat-item.active > a,
.cat-item.active > span {
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--accent);
}

.cat-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--tag-bg);
  padding: 2px 7px;
  border-radius: 10px;
}

.cat-children {
  list-style: none;
  padding-left: 28px;
}
.cat-children .cat-item a {
  font-size: 12px;
  padding: 6px 10px;
}
.cat-children .cat-count { font-size: 10px; }

.cat-name-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}
.cat-name-wrap a {
  color: var(--text-soft) !important;
}
.cat-item.active .cat-name-wrap a {
  color: var(--accent) !important;
  font-weight: 600;
}

.cat-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--text-muted);
  transition: transform 0.2s;
  margin-right: 6px;
  flex-shrink: 0;
}
.cat-arrow.open { transform: rotate(90deg); }

/* ── Visitor Counter ── */
.visitor-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.visitor-grid {
  display: flex;
  justify-content: space-between;
  text-align: center;
}
.visitor-num {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.visitor-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Single Post ── */
.single-content {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-soft);
}
.single-content p { margin-bottom: 16px; }
.single-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}
.single-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}
.single-content img {
  border-radius: 8px;
  margin: 16px 0;
}
.single-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}
.single-content pre {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  margin: 16px 0;
}
.single-content code {
  background: var(--tag-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.single-content pre code {
  background: none;
  padding: 0;
}

.single-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.single-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.single-meta a { color: var(--text-muted); }
.single-meta a:hover { color: var(--accent); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ── Comments ── */
.comments-section { margin-top: 48px; }

.comments-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  resize: vertical;
  font-family: var(--font);
  line-height: 1.6;
  transition: border-color 0.2s;
}
.comment-form textarea:focus { border-color: var(--accent); }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-family: var(--font);
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
.comment-form input:focus { border-color: var(--accent); }

.comment-submit {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: opacity 0.2s;
}
.comment-submit:hover { opacity: 0.8; }

.comment-list { list-style: none; }

.comment-item {
  padding: 16px;
  background: var(--accent-soft);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.comment-item .comment-author {
  font-size: 13px;
  font-weight: 600;
}
.comment-item .comment-date {
  font-size: 12px;
  color: var(--text-muted);
}
.comment-item .comment-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
  margin-top: 6px;
}

/* ── Recent Posts ── */
.recent-posts { margin-top: 40px; }

.recent-posts-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.recent-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.recent-item a {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}
.recent-item .recent-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Mobile Drawer ── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay-bg);
  display: none;
}
.mobile-overlay.active { display: block; }

.mobile-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.drawer-header span { font-size: 14px; font-weight: 700; }

.drawer-close {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 20px;
  cursor: pointer;
}

.drawer-nav { margin-bottom: 20px; }
.drawer-nav a {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.drawer-cat-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-label { font-size: 13px; color: var(--text-muted); }
.filter-reset {
  background: var(--tag-bg);
  border: none;
  color: var(--text-soft);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
}
.site-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── 404 ── */
.not-found {
  text-align: center;
  padding: 60px 0;
}
.not-found-icon { font-size: 48px; margin-bottom: 16px; }
.not-found h1 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.not-found p { color: var(--text-soft); }

/* ── Responsive ── */
@media (max-width: 820px) {
  .main-grid { grid-template-columns: 1fr !important; }
  .sidebar { display: none !important; }
  .nav-menu { display: none !important; }
  .hamburger-btn { display: block !important; }
}

@media (min-width: 821px) {
  .mobile-overlay { display: none !important; }
}
