/* ============================================
   알고가 | 정보지기 — 티스토리 스킨 v3
   다크테마 · 3컬럼 레이아웃
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

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

:root {
  --bg: #111118;
  --surface: #1c1c28;
  --surface2: #22223a;
  --border: rgba(255,255,255,0.07);
  --text: #e2e2ec;
  --text-muted: #7f7f9a;
  --accent: #5c6bc0;
  --accent-bright: #7986cb;
  --accent-dark: #3949ab;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── 헤더 ── */
#header-wrapper {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

#header {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

#header .blog-title a {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
}

#header .blog-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}

.search-form input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 8px 16px;
  width: 200px;
  font-family: 'Noto Sans KR', sans-serif;
}

.search-form input::placeholder { color: var(--text-muted); }

.search-form button {
  background: var(--accent);
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  color: #fff;
  font-size: 13px;
  transition: background 0.2s;
  border-radius: 0 24px 24px 0;
}

.search-form button:hover { background: var(--accent-dark); }

/* ── 3컬럼 메인 레이아웃 ── */
#outer-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  gap: 20px;
  align-items: start;
}

/* ── 왼쪽 사이드바 ── */
#sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 62px;
}

/* 프로필 */
.profile-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
}

.profile-banner {
  background: linear-gradient(135deg, #1a237e, var(--accent));
  height: 60px;
}

.profile-img-wrap {
  padding: 0 16px 18px;
  margin-top: -30px;
}

.profile-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--surface2);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
}

.profile-img img { width: 100%; height: 100%; object-fit: cover; }

.profile-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
}

.profile-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.profile-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sns-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  transition: opacity 0.2s, transform 0.15s;
}

.sns-btn:hover { opacity: 0.8; transform: scale(1.08); }
.sns-btn.naver { background: #03c75a; }
.sns-btn.blogger { background: #ff5722; }

/* 사이드바 공통 위젯 */
.s-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.s-widget-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.s-widget-body { padding: 10px 16px; }

/* 카테고리 — 티스토리 기본 위젯 스타일 강제 override */
.s-widget-body,
.s-widget-body *,
.s-widget-body div,
.s-widget-body ul,
.s-widget-body li,
.s-widget-body span,
.s-widget-body table,
.s-widget-body td {
  background: transparent !important;
  background-color: transparent !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  color: var(--text-muted) !important;
}

.s-widget-body ul { list-style: none; }
.s-widget-body ul li { border-bottom: 1px solid var(--border) !important; }
.s-widget-body ul li:last-child { border-bottom: none !important; }

.s-widget-body a {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 7px 2px;
  font-size: 12px;
  color: var(--text-muted) !important;
  transition: color 0.2s;
}

.s-widget-body a:hover { color: var(--accent-bright) !important; }

/* 방문자 */
.visitor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 12px 16px;
  text-align: center;
}

.visitor-label { font-size: 10px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px; }
.visitor-num { font-size: 16px; font-weight: 900; color: var(--accent-bright); }

/* ── 오른쪽 사이드바 ── */
#sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 62px;
}

/* 최근 글 */
.recent-list { list-style: none; }
.recent-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.recent-list li:last-child { border-bottom: none; }
.recent-list li a {
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.recent-list li a:hover { color: var(--accent-bright); }

/* 달력 */
.s-widget-body table { width: 100%; font-size: 11px; border-collapse: collapse; }
.s-widget-body table th { color: var(--text-muted); font-weight: 600; padding: 4px 0; text-align: center; }
.s-widget-body table td { text-align: center; padding: 4px 0; color: var(--text-muted); }
.s-widget-body table td a { color: var(--accent-bright); font-weight: 700; }

/* ── 메인 콘텐츠 ── */
#main-wrapper { min-width: 0; }


/* 페이지 제목 */
.page-header {
  padding: 0 0 16px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.page-header strong { color: var(--text); font-weight: 700; }

/* 공지 */
.notice-card {
  background: rgba(92,107,192,0.1);
  border: 1px solid rgba(92,107,192,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.notice-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── 글 목록 — 가로형 카드 ── */
.blog-posts {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  border-bottom: none;
  transition: background 0.15s;
}

.post-card:first-child { border-radius: 12px 12px 0 0; }
.post-card:last-child { border-radius: 0 0 12px 12px; border-bottom: 1px solid var(--border); }
.post-card:only-child { border-radius: 12px; border-bottom: 1px solid var(--border); }

.post-card:hover { background: var(--surface2); }

/* article 자체를 flex container로 — a 태그 의존 없이 가로 배치 */
.post-card {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.post-thumb {
  width: 160px;
  min-height: 110px;
  flex-shrink: 0;
  border-radius: 0;
  background-color: var(--surface2);
  overflow: hidden;
  display: block;
}

.post-thumb img {
  width: 100%;
  height: 100%;
  min-height: 110px;
  object-fit: cover;
  display: block;
}

.post-card:first-child .post-thumb { border-radius: 12px 0 0 0; }
.post-card:last-child .post-thumb { border-radius: 0 0 0 12px; }
.post-card:only-child .post-thumb { border-radius: 12px 0 0 12px; }

.post-thumb-empty {
  background: linear-gradient(135deg, var(--surface2), #1a1a3e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-thumb-empty::after { content: '📰'; font-size: 28px; opacity: 0.3; }

.post-body {
  flex: 1;
  min-width: 0;
  padding: 18px 20px;
}

/* 썸네일 없는 글: 텍스트 전체 너비 */
.post-card:not(:has(.post-thumb)) .post-body {
  padding: 20px 24px;
}

.post-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.post-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-bright);
  background: rgba(92,107,192,0.15);
  border: 1px solid rgba(92,107,192,0.25);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.post-date { font-size: 11px; color: var(--text-muted); }

.post-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.45;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.blog-posts-wrap { display: contents; }

.post-meta-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── 페이지네이션 ── */
.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.pagination a,
.pagination strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
}

.pagination a { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.pagination a:hover { border-color: var(--accent); color: var(--accent-bright); }
.pagination strong { background: var(--accent); color: #fff; font-weight: 700; border: 1px solid var(--accent); }

/* ── 글 상세 ── */
.single-post-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.post-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.single-title {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  line-height: 1.4;
  margin: 10px 0 14px;
}

.single-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }

/* 본문 */
.post-content {
  font-size: 15px;
  line-height: 1.9;
  color: #333;
  background: #fff;
  border-radius: 12px;
  padding: 32px 36px;
  margin-top: 0;
}
.post-content h2 { font-size: 20px; font-weight: 700; margin: 36px 0 12px; color: #fff; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.post-content h3 { font-size: 17px; font-weight: 700; margin: 28px 0 10px; color: var(--accent-bright); }
.post-content p { margin-bottom: 16px; }
.post-content img { border-radius: 10px; margin: 24px auto; }
.post-content a { color: var(--accent-bright); text-decoration: underline; }
.post-content blockquote { background: var(--surface2); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 20px 0; color: var(--text-muted); font-style: italic; }
.post-content ul, .post-content ol { padding-left: 20px; margin-bottom: 14px; }
.post-content li { margin-bottom: 5px; }
.post-content pre { background: #0d0d18; border: 1px solid var(--border); border-radius: 8px; padding: 18px; overflow-x: auto; font-size: 13px; margin: 18px 0; color: #a8b4ff; }
.post-content code { background: var(--surface2); color: var(--accent-bright); padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.post-content pre code { background: none; color: inherit; padding: 0; }

/* 댓글 */
.comment-area { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.comment-area h3 { font-size: 15px; font-weight: 700; margin-bottom: 18px; color: #fff; }

.post-protected { text-align: center; padding: 60px; color: var(--text-muted); }

/* ── 푸터 ── */
#footer-wrapper {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 36px 20px;
  margin-top: 0;
}

.footer-logo { font-size: 16px; font-weight: 900; color: #fff; letter-spacing: 2px; margin-bottom: 6px; }
.footer-tagline { font-size: 11px; color: var(--text-muted); margin-bottom: 16px; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.footer-links a { font-size: 12px; color: var(--text-muted); transition: color 0.2s; }
.footer-links a:hover { color: var(--accent-bright); }
.footer-copy { font-size: 11px; color: rgba(255,255,255,0.15); }

/* ── 반응형 ── */
@media (max-width: 1100px) {
  #outer-wrapper { grid-template-columns: 200px 1fr; }
  #sidebar-right { display: none; }
}

@media (max-width: 768px) {
  #outer-wrapper { grid-template-columns: 1fr; }
  #sidebar-left { position: static; }
  .post-card { flex-direction: column; }
  .post-thumb { width: 100%; height: 180px; border-radius: 12px 12px 0 0 !important; }
  .single-post-wrapper { padding: 20px 16px; }
}
