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

:root {
  --color-primary: #1a56db;
  --color-primary-dark: #1e40af;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-bg: #ffffff;
  --color-bg-light: #f9fafb;
  --color-border: #e5e7eb;
  --color-accent: #059669;
  --font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;

  /* Responsive max-widths */
  --max-width-content: 860px;   /* 본문 읽기 최적 너비 */
  --max-width-wide: 1400px;     /* PC 전체 레이아웃 */
}

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

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.8;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* PC에서 글자 크기 살짝 키움 */
@media (min-width: 1024px) {
  html { font-size: 17px; }
}

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

/* 본문 전용 컨테이너 - 읽기 최적 너비 */
.container-content {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

img { max-width: 100%; height: auto; border-radius: 8px; display: block; }

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 0;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 52px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 0.25rem;
}

.site-logo {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--color-text);
  white-space: nowrap;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo-icon { width: 26px; height: 26px; flex-shrink: 0; }
.site-logo:hover { text-decoration: none; color: var(--color-primary); }

.site-nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}
.site-nav a:hover { background: #f3f4f6; color: var(--color-primary); text-decoration: none; }

.mobile-menu {
  display: none;
  flex-direction: column;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1rem 1rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 0.6rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px solid #f3f4f6;
}
.mobile-menu a:hover { color: var(--color-primary); text-decoration: none; }

/* === Main Content === */
/* === Top Banner === */
.top-banner {
  padding: 0.75rem 0;
}
.top-banner .container {
  background: linear-gradient(135deg, #1a56db, #7c3aed);
  padding: 0.9rem 2rem;
  border-radius: 10px;
  text-align: center;
}
.top-banner-link {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-decoration: none;
}
.top-banner-link:hover {
  text-decoration: underline;
  color: #fff;
}
@media (max-width: 767px) {
  .top-banner-link { font-size: 1rem; }
}

.site-main { padding: 2.5rem 0; min-height: 60vh; }

/* === Post Card (List) === */
.post-list { display: flex; flex-direction: column; gap: 1.5rem; }

.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

.post-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.post-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.12); transform: translateY(-3px); }

.post-card-image { width: 100%; overflow: hidden; }
.post-card-image img { width: 100%; height: auto; object-fit: contain; }

.post-card-content { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.post-card-title { font-size: 1.15rem; font-weight: 800; line-height: 1.4; }
.post-card-title a { color: var(--color-text); }
.post-card-title a:hover { color: var(--color-primary); text-decoration: none; }
.post-card-excerpt { font-size: 0.85rem; color: var(--color-text-light); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { font-size: 0.8rem; color: var(--color-text-light); display: flex; gap: 0.75rem; }
.post-card-meta .category { color: var(--color-accent); font-weight: 500; }

/* === Single Post Layout === */
/* 포스트 페이지는 본문 중심, 이미지는 full-width */
.post {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 768px) {
  .post { padding: 0 2rem; }
}

.post-header { margin-bottom: 1.75rem; }

.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.post-meta {
  font-size: 0.875rem;
  color: var(--color-text-light);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* 히어로 이미지 - 본문 너비 꽉 채움, 최대한 크게 */
.post-hero {
  margin: 0 0 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-light);
}
.post-hero img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
}

/* === Post Content Typography === */
.post-content {
  max-width: var(--max-width-content);
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  letter-spacing: -0.01em;
}
.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.6rem;
}
.post-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}
.post-content p { margin-bottom: 1.1rem; }
.post-content ul, .post-content ol { margin: 0.75rem 0 1.25rem 1.75rem; }
.post-content li { margin-bottom: 0.5rem; line-height: 1.75; }
.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 0.85rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--color-bg-light);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
.post-content th, .post-content td {
  padding: 0.7rem 1rem;
  border: 1px solid var(--color-border);
  text-align: left;
}
.post-content th {
  background: var(--color-bg-light);
  font-weight: 600;
  color: var(--color-text);
}
.post-content tr:hover td { background: #f8faff; }
.post-content strong { color: var(--color-text); font-weight: 700; }

/* 테이블 모바일 스크롤 */
.post-content .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* === Tags === */
.post-tags { margin: 1.5rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--color-text-light);
  transition: all 0.15s;
}
.tag:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); text-decoration: none; }

/* === Disclaimer === */
.post-disclaimer {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.6;
}

/* === Related Posts === */
.related-posts { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.related-posts h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.related-list { display: flex; flex-direction: column; gap: 0.5rem; }
.related-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--color-bg-light);
  transition: background 0.15s;
  gap: 1rem;
}
.related-card:hover { background: var(--color-border); text-decoration: none; }
.related-title { font-weight: 500; color: var(--color-text); font-size: 0.95rem; }
.related-card time { font-size: 0.8rem; color: var(--color-text-light); white-space: nowrap; flex-shrink: 0; }

/* === Callout Boxes === */
.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  line-height: 1.7;
  font-size: 0.97rem;
}
.callout strong { display: block; margin-bottom: 0.35rem; font-size: 1rem; }

.callout.tip {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  color: #065f46;
}
.callout.tip strong { color: #047857; }

.callout.warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #78350f;
}
.callout.warning strong { color: #b45309; }

.callout.info {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  color: #1e3a5f;
}
.callout.info strong { color: #1d4ed8; }

/* === Inline Post Images === */
.post-inline-image {
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}
.post-inline-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* === Mid-article Image (1:1 square) === */
.post-mid-image {
  margin: 2.5rem auto;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}
.post-mid-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* === 4컷 만화 === */
.post-comic {
  margin: 2.5rem auto;
  max-width: 100%;
  text-align: center;
}
.post-comic figcaption {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.post-comic img {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: inline-block;
}

/* === Section Divider === */
.post-content hr {
  border: none;
  border-top: 2px dashed var(--color-border);
  margin: 2.5rem 0;
}

/* === Ad Units === */
.ad-unit { margin: 1.5rem 0; text-align: center; min-height: 100px; }

/* === Layout with Sidebar === */
.layout-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 320px; flex-shrink: 0; display: none; }

@media (min-width: 1200px) {
  .sidebar { display: block; }
}

.sidebar-sticky {
  position: sticky;
  top: 80px;
}

.hot-news {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
}
.hot-news-title {
  font-size: 1rem;
  font-weight: 800;
  color: #dc2626;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #fecaca;
}
.hot-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
  text-decoration: none;
  color: var(--color-text);
}
.hot-item:last-child { border-bottom: none; }
.hot-item:hover { background: #f9fafb; }
.hot-text {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hot-thumb {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.hot-desc {
  flex: 1;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--color-text);
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hot-item:hover .hot-desc { color: var(--color-primary); }

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.75rem 0;
  font-size: 0.85rem;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.9;
}
.site-footer a { color: var(--color-text-light); }
.site-footer a:hover { color: var(--color-primary); }

/* === Pagination === */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination li { list-style: none; }
.pagination a, .pagination .active a {
  display: block;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.pagination a:hover { background: var(--color-bg-light); text-decoration: none; }
.pagination .active a { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* === Home Page === */
.home-hero { text-align: center; padding: 2.5rem 0 2rem; }
.home-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.6rem; letter-spacing: -0.02em; }
.home-hero p { color: var(--color-text-light); font-size: 1.05rem; line-height: 1.7; }

/* === Share Buttons === */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}
.share-label { font-size: 0.85rem; color: var(--color-text-light); font-weight: 500; margin-right: 4px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-light);
  background: var(--color-bg-light);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.share-btn:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); text-decoration: none; }
.share-twitter:hover { background: #000; border-color: #000; }
.share-facebook:hover { background: #1877f2; border-color: #1877f2; }
.share-line:hover { background: #06c755; border-color: #06c755; }
.share-bottom { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.share-bottom .share-label { display: block; width: 100%; margin-bottom: 8px; font-size: 0.95rem; font-weight: 600; color: var(--color-text); }

/* === Table of Contents === */
.toc {
  margin: 1.75rem 0;
  padding: 1.1rem 1.5rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.toc summary {
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  user-select: none;
}
.toc nav { margin-top: 0.5rem; }
.toc ul { list-style: none; margin: 0; padding-left: 0; }
.toc li { padding: 3px 0; }
.toc li li { padding-left: 1.25rem; }
.toc a { font-size: 0.88rem; color: var(--color-primary); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* === Comments === */
.comments {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.comments h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* 태블릿 (768px ~ 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .container { padding: 0 1.5rem; }
  .post-title { font-size: 1.75rem; }
  .post-hero img { }
  .post-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* 모바일 (~ 767px) */
@media (max-width: 767px) {
  html { font-size: 15px; }

  .container { padding: 0 1rem; }
  .container-content { padding: 0 1rem; }

  /* 헤더 */
  .menu-toggle { display: block; }
  .site-nav { display: none; }
  .site-logo { font-size: 1.1rem; }

  /* 포스트 제목 */
  .post-title { font-size: 1.5rem; }

  /* 히어로 이미지 */
  .post-hero img { border-radius: 8px; }

  /* 본문 */
  .post-content { font-size: 1rem; }
  .post-content h2 { font-size: 1.25rem; margin-top: 2rem; }
  .post-content h3 { font-size: 1.1rem; }

  /* 카드 세로 배치 */
  .post-list { grid-template-columns: 1fr; }

  /* 홈 히어로 */
  .home-hero { padding: 1.5rem 0 1.25rem; }
  .home-hero h1 { font-size: 1.5rem; }
  .home-hero p { font-size: 0.95rem; }

  /* 공유 버튼 */
  .share-buttons { gap: 6px; }
  .share-btn { min-width: 34px; height: 34px; font-size: 0.8rem; padding: 0 10px; }

  /* TOC */
  .toc { padding: 0.85rem 1rem; }

  /* 관련 포스트 */
  .related-card { flex-direction: column; align-items: flex-start; gap: 0.25rem; }

  /* 페이지네이션 */
  .pagination { gap: 0.35rem; }
  .pagination a { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

  /* 사이트 메인 */
  .site-main { padding: 1.5rem 0; }
}

/* 작은 모바일 (~ 380px) */
@media (max-width: 380px) {
  html { font-size: 14px; }
  .post-title { font-size: 1.35rem; }
  .site-nav a { font-size: 0.75rem; }
}
