/* ===================================================
   lowup.ai Blog — Light Theme (기존 사이트 디자인 통일)
   style.css와 함께 로드됩니다
   =================================================== */

/* ── 블로그 페이지 기본 ── */
.blog-page {
  background: #fff;
  min-height: 100vh;
}

/* ── 읽기 진행 바 ── */
#read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--blue);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ── 블로그 네비 링크 활성 ── */
.nav-links a.blog-active { color: var(--blue); }

/* ============================================
   블로그 목록 페이지
   ============================================ */
.blog-hero {
  padding: calc(var(--nav-height) + clamp(60px, 8vw, 100px)) 40px clamp(48px, 6vw, 80px);
  text-align: center;
  background: linear-gradient(180deg, #f5f6ff 0%, #ffffff 100%);
  border-bottom: 1px solid #f0f0f0;
}

.blog-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: rgba(0, 22, 213, 0.07);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.blog-hero h1 {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 900;
  color: var(--black);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.blog-hero h1 em { color: var(--blue); font-style: normal; }

.blog-hero p {
  font-size: clamp(14px, 1.6vw, 17px);
  color: var(--text-sub);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto;
}

/* 필터 바 */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.category-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 7px 18px;
  border: 1.5px solid #e0e0e0;
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: -0.01em;
  min-width: 52px;
}

.cat-btn:hover { border-color: var(--blue); color: var(--blue); background: rgba(0,22,213,0.04); }
.cat-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.search-wrap { position: relative; flex-shrink: 0; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #aaa; pointer-events: none; }

.search-input {
  padding: 9px 16px 9px 40px;
  background: var(--gray-light);
  border: 1.5px solid transparent;
  border-radius: 100px;
  color: var(--black);
  font-size: 13px;
  font-family: inherit;
  width: 240px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.search-input::placeholder { color: #aaa; }
.search-input:focus { border-color: var(--blue); background: #fff; }

/* 포스트 그리드 */
.posts-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 40px 80px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  min-height: 280px;
}

/* 포스트 카드 */
.post-card {
  background: #f9f9fb;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 48px rgba(0,22,213,0.10);
  border-color: rgba(0,22,213,0.08);
}

.card-thumb { aspect-ratio: 16/9; overflow: hidden; background: #e8e8ec; flex-shrink: 0; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.post-card:hover .card-thumb img { transform: scale(1.04); }

.card-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eff0f8, #e4e6f5);
}
.card-thumb-placeholder svg { opacity: 0.25; color: var(--blue); }

.card-body { padding: 22px 24px 28px; display: flex; flex-direction: column; flex: 1; gap: 16px; }

.card-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: flex-start;
}

.badge-ai        { background: rgba(0,22,213,0.09); color: var(--blue); }
.badge-marketing { background: rgba(124,58,237,0.09); color: #5b21b6; }
.badge-tech      { background: rgba(8,145,178,0.09); color: #0e7490; }
.badge-biz       { background: rgba(5,150,105,0.09); color: #047857; }
.badge-default   { background: #ebebeb; color: #555; }

.card-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--black);
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-info); }
.card-meta span { display: flex; align-items: center; gap: 4px; }
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-info); }

.card-excerpt {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid #ebebeb; }
.card-link {
  font-size: 13px; font-weight: 700; color: var(--blue);
  display: inline-flex; align-items: center; gap: 4px; transition: gap 0.15s;
}
.post-card:hover .card-link { gap: 8px; }

/* 빈/로딩 */
.posts-empty { grid-column: 1/-1; text-align: center; padding: 80px 24px; color: var(--text-info); }
.posts-empty svg { margin: 0 auto 16px; opacity: 0.3; color: var(--blue); }
.posts-empty p { font-size: 15px; }

.posts-loading { grid-column: 1/-1; display: flex; justify-content: center; align-items: center; padding: 80px; gap: 12px; color: var(--text-info); font-size: 14px; }
.spinner { width: 20px; height: 20px; border: 2px solid #e0e0e0; border-top-color: var(--blue); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 스켈레톤 */
.skeleton-card { background: var(--card-bg); border-radius: 20px; overflow: hidden; }
.skeleton-thumb { aspect-ratio: 16/9; background: #e4e5ec; }
.skeleton-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.skeleton-line { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #e8e9f0 0%, #f2f3f8 50%, #e8e9f0 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton-line.w-20 { width: 20%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 페이지네이션 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 48px; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f5f5f7; border: 1.5px solid transparent; border-radius: 10px;
  color: var(--text-sub); font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); background: rgba(0,22,213,0.04); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================
   블로그 상세 페이지
   ============================================ */
.article-wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px 80px; }

.article-hero {
  max-width: 760px; margin: 0 auto;
  padding: calc(var(--nav-height) + 60px) 0 48px; text-align: center;
}

.article-category {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-info);
  background: none;
  padding: 0;
  border-radius: 0;
}

.article-title {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--black);
  margin-bottom: 22px;
}

.article-meta { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 13px; color: var(--text-info); flex-wrap: wrap; }
.article-meta span { display: flex; align-items: center; gap: 5px; }

.article-thumb-wrap { max-width: 760px; margin: 0 auto 48px; }
.article-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 0; border: none; box-shadow: none; }

/* 본문 + TOC 레이아웃 */
.article-layout { display: grid; grid-template-columns: 1fr 260px; gap: 60px; max-width: 1060px; margin: 0 auto; align-items: start; }

/* 본문 */
.article-content { min-width: 0; }
.article-content > *:first-child { margin-top: 0; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  color: var(--black); font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.35; margin: 2em 0 0.75em;
  scroll-margin-top: calc(var(--nav-height) + 40px + 24px);
}

.article-content h2 { font-size: 24px; padding-bottom: 12px; border-bottom: 2px solid #f0f0f0; }
.article-content h3 { font-size: 20px; }
.article-content h4 { font-size: 17px; }

.article-content p { font-size: 16px; line-height: 1.9; color: var(--text-sub); margin-bottom: 1.4em; }
.article-content ul, .article-content ol { margin: 0 0 1.4em 1.4em; color: var(--text-sub); }
.article-content li { font-size: 16px; line-height: 1.8; margin-bottom: 6px; }

.article-content blockquote {
  margin: 2em 0; padding: 20px 24px;
  border-left: 3px solid var(--blue);
  background: rgba(0,22,213,0.04);
  border-radius: 0 12px 12px 0;
  color: var(--text-sub); font-size: 16px; line-height: 1.7; font-style: italic;
}

.article-content pre { background: #f5f6f8; border: 1px solid #e8e8ee; border-radius: 12px; padding: 20px 24px; overflow-x: auto; margin: 1.5em 0; }
.article-content code { font-family: 'SF Mono','Fira Code',monospace; font-size: 14px; color: var(--blue); line-height: 1.7; }
.article-content p code { background: rgba(0,22,213,0.07); padding: 2px 7px; border-radius: 5px; font-size: 13.5px; }

.article-content img { width: 100%; border-radius: 12px; border: 1px solid #f0f0f0; margin: 1.5em 0; }
.article-content figure { margin: 1.5em 0; }
.article-content figcaption { text-align: center; font-size: 13px; color: var(--text-info); margin-top: 8px; }
.article-content .cdx-delimiter { text-align: center; color: var(--text-info); margin: 2.5em 0; font-size: 20px; letter-spacing: 0.5em; }

.article-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 14px; }
.article-content th, .article-content td { padding: 12px 16px; text-align: left; border: 1px solid #e8e8ee; }
.article-content th { background: #f5f6f8; font-weight: 700; color: var(--black); }
.article-content td { color: var(--text-sub); }

/* TOC */
.toc-sidebar {
  overflow-y: auto;
  scrollbar-width: none;
}
.toc-sidebar::-webkit-scrollbar { display: none; }
.toc-box {
  background: none;
  border: none;
  border-radius: 0;
  padding: 12px 0 0;
  border-top: 2px solid var(--black);
}
.toc-title { font-size: 12px; font-weight: 800; color: var(--black); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 14px; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.toc-item a { display: block; font-size: 13px; line-height: 1.5; color: var(--text-sub); padding: 6px 0; border-left: none; border-radius: 0; transition: color 0.15s; text-decoration: none; }
.toc-item a:hover { color: var(--blue); }
.toc-item.active a { color: var(--blue); font-weight: 600; }
.toc-item.depth-3 a { padding-left: 12px; font-size: 12px; }
.toc-item.depth-4 a { padding-left: 24px; font-size: 12px; color: var(--text-info); }

/* 이전/다음 */
.post-nav { margin: 48px 0 0; padding: 12px 0 0; border-top: 2px solid var(--black); }
.post-nav-title { font-size: 12px; font-weight: 800; color: var(--black); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 14px; }
.post-nav-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; text-decoration: none; background: none; border: none; border-radius: 0; transition: none; }
.post-nav-item:hover .nav-title { color: var(--blue); }
.nav-label { font-size: 11px; font-weight: 700; color: var(--text-info); text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 4px; white-space: nowrap; padding-top: 2px; }
.nav-title { font-size: 13px; line-height: 1.5; color: var(--text-sub); transition: color 0.15s; }

/* Back to Top */
#back-to-top { position: fixed; bottom: 32px; right: 32px; width: 44px; height: 44px; background: var(--blue); color: #fff; border: none; border-radius: 50%; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 100; box-shadow: 0 4px 16px rgba(0,22,213,0.3); transition: transform 0.2s; }
#back-to-top.visible { display: flex; }
#back-to-top:hover { transform: translateY(-3px); }

.section-divider { max-width: 1060px; margin: 60px auto 0; border: none; border-top: 1px solid #f0f0f0; }


/* ============================================
   반응형
   ============================================ */
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: 1fr; max-width: 760px; }
  .toc-sidebar { display: none; }
  .post-nav, .section-divider { max-width: 760px; }
}

@media (max-width: 1023px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .blog-hero { padding: calc(var(--nav-height) + 60px) 24px 48px; }
  .filter-bar { padding: 28px 20px 0; gap: 12px; }
  .search-wrap { width: 100%; }
  .search-input { width: 100%; }
  .posts-section { padding: 28px 20px 60px; }
  .posts-grid { grid-template-columns: 1fr; gap: 16px; }
  .article-wrap { padding: 0 20px 60px; }
  .article-hero { padding: calc(var(--nav-height) + 40px) 0 32px; }
  .article-thumb-wrap { margin-bottom: 32px; }
  .post-nav { max-width: 100%; }
#back-to-top { bottom: 20px; right: 20px; }
}

/* ── 영문 번역 레이아웃 안정화 ── */
html[lang="en"] .blog-hero p { word-break: normal; }
html[lang="en"] .card-title,
html[lang="en"] .card-excerpt { word-break: break-word; }

@media (max-width: 480px) {
  .blog-hero h1 { font-size: 28px; }
  .card-body { padding: 16px 18px 18px; }
  .posts-section { padding: 20px 16px 48px; }
  .filter-bar { padding: 24px 16px 0; }
}
