/*
 * 마켓시그널 레이아웃 CSS
 * design-tokens.css의 변수를 사용해 헤더/내비/히어로/카드그리드/푸터/본문을 구성
 * buupbox.com과 동일한 레이아웃 시스템 + 기존 게시글(so-toc/so-callout 등)과 호환되도록 확장
 */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
}

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

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── 헤더 / 내비게이션 ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .nav-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}
.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* ── 히어로 (홈) ── */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 20px 40px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 12px;
}
.hero p.lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 28px;
}
.hero .disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ── 카드 그리드 (카테고리/최신글) ── */
.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px;
}
.section h1, .section h2 {
  font-size: 1.4rem;
  margin-bottom: 18px;
}
.section .lead {
  color: var(--text-muted);
  margin: -8px 0 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.grid .card {
  background: var(--bg-secondary);
  padding: 0 0 20px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.grid .card .card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 14px;
  background: var(--border);
}
.grid .card h3, .grid .card p {
  padding-left: 20px;
  padding-right: 20px;
}
.grid .card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.grid .card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.grid .card a.card-link {
  position: absolute;
  inset: 0;
}
.pick-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.cat-badge {
  display: inline-block;
  margin: 16px 20px 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ── 이런 고민, 낯설지 않으시죠 (홈 화면 공감 카드) ── */
.pain-points { text-align: center; }
.pain-eyebrow {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.pain-points h2 { margin-bottom: 10px; }
.pain-points .lead { margin: 0 auto 32px; max-width: 520px; }
.pain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  text-align: left;
}
.pain-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.pain-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.pain-thumb-wrap { aspect-ratio: 4 / 3; overflow: hidden; }
.pain-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pain-body { padding: 20px; }
.pain-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.4;
}
.pain-card p {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.pain-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.pain-link:hover { text-decoration: none; }

/* ── 주제별로 보기 (홈 화면 카테고리 그룹) ── */
.post-group + .post-group { margin-top: 36px; }
.post-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.post-group-head h3 { margin: 0; font-size: 1.1rem; }
.post-group-more {
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--text-muted);
}
.post-group-more:hover { color: var(--accent); }

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.post-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.post-list .card-thumb {
  width: 96px;
  height: 54px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  background: var(--border);
}
.post-list-text { min-width: 0; }
.post-list .tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 8px;
}

/* ── 피처드 이미지 (상단 썸네일) ── */
.featured-thumb-wrap {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 0 20px;
}
.featured-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

/* ── 본문 아티클 ── */
article.post {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
article.post h1 { font-size: 1.8rem; margin-bottom: 12px; }
article.post .byline {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
article.post h2 { font-size: 1.3rem; margin-top: 40px; border-top: 1px solid var(--border); padding-top: 24px; }
article.post h3 { font-size: 1.08rem; margin-top: 28px; margin-bottom: 10px; color: var(--text-primary); }
article.post table { width: 100%; border-color: var(--border) !important; margin: 16px 0; border-collapse: collapse; }
article.post table th {
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
}
article.post table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
article.post table tr:nth-child(even) td { background: var(--bg-secondary); }
article.post dl dt { font-weight: 600; margin-top: 14px; }
article.post dl dd { margin-left: 0; color: var(--text-muted); }
article.post ul, article.post ol { padding-left: 1.4em; }
article.post li { margin: 6px 0; }
article.post li::marker { color: var(--accent); }
article.post img { max-width: 100%; height: auto; border-radius: var(--radius-md); }

/* ── 목차(TOC) — nav.toc(buupbox) / .so-toc(stockor 기존 글) 공통 지원 ── */
article.post nav.toc,
article.post .so-toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 24px 0 40px;
}
article.post nav.toc > p.toc-label,
article.post .so-toc .so-toc-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
article.post nav.toc ul,
article.post .so-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  counter-reset: none;
}
article.post nav.toc li::marker,
article.post .so-toc li::marker { content: none; }
article.post nav.toc a,
article.post .so-toc a {
  color: var(--text-primary);
  font-size: 0.94rem;
  border-bottom: none;
}
article.post nav.toc a::before,
article.post .so-toc a::before {
  content: '→';
  color: var(--accent);
  margin-right: 8px;
}
article.post nav.toc a:hover,
article.post .so-toc a:hover { color: var(--accent); text-decoration: none; }

/* ── 포인트 강조 콜아웃 박스 — .callout(buupbox) / .so-callout(stockor 기존 글) 공통 지원 ── */
article.post .callout,
article.post .so-callout {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-primary));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 24px 0;
}
article.post .callout p,
article.post .so-callout ul { margin: 0; }
article.post .callout p + p { margin-top: 8px; }
article.post .callout-label,
article.post .so-callout-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ── 인용구 ── */
article.post blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}
article.post blockquote p { margin: 8px 0; }
article.post blockquote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── 같이보면 좋은글 (관련 글 카드) — .related-posts / .so-related 공통 지원 ── */
article.post .related-posts,
article.post .so-related {
  margin: 32px 0;
  border-top: none !important;
  padding-top: 0 !important;
  background: none;
  border: none;
}
.related-posts-grid,
.so-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.related-posts-grid li,
.so-related li {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  transition: box-shadow 0.15s ease;
}
.related-posts-grid li:hover,
.so-related li:hover { box-shadow: var(--shadow-soft); }
.related-posts-grid a,
.so-related a {
  display: block;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
}
.related-posts-grid a:hover,
.so-related a:hover { color: var(--accent); text-decoration: none; }
.so-related-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}

/* ── 출처/참고 링크 — .sources / .so-sources 공통 지원 ── */
article.post .sources,
article.post .so-sources {
  margin-top: 16px;
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
article.post .sources a,
article.post .so-sources a { color: var(--text-muted); text-decoration: underline; }
article.post .sources a:hover,
article.post .so-sources a:hover { color: var(--accent); }
.so-sources-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}
article.post .so-sources ul { list-style: none; padding: 0; margin: 0; }
article.post .so-sources li { margin: 4px 0; }

/* ── FAQ ── */
article.post .so-faq { margin: 32px 0; }
.so-faq-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 14px;
  border-top: none !important;
  padding-top: 0 !important;
}
.so-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 12px 0;
  background: var(--bg-primary);
}
.so-faq-q {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
  display: flex;
  gap: 8px;
}
.so-faq-q::before { content: "Q."; color: var(--accent); }
.so-faq-a {
  color: var(--text-muted);
  margin: 0;
  display: flex;
  gap: 8px;
}
.so-faq-a::before { content: "A."; color: var(--success); flex-shrink: 0; }

.breadcrumb {
  max-width: 720px;
  margin: 20px auto 0;
  padding: 0 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── 푸터 ── */
.site-footer {
  position: relative;
  margin-top: 64px;
  padding: 0 20px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0) 0 0/22px 22px,
    var(--footer-bg);
  color: var(--footer-text-muted);
  overflow: hidden;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--footer-accent), transparent);
  opacity: 0.55;
}
.footer-glow {
  position: absolute;
  top: -120px;
  left: 50%;
  width: 560px;
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--footer-accent) 22%, transparent), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
.footer-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--footer-border);
}
.footer-brand .footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--footer-text);
}
.footer-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--footer-accent) 16%, transparent);
  font-size: 0.95rem;
}
.footer-logo-mark img {
  width: 20px;
  height: 20px;
}
.footer-brand .footer-logo:hover { text-decoration: none; opacity: 0.85; }
.footer-brand .footer-logo-text {
  background: linear-gradient(90deg, var(--footer-text), var(--footer-accent) 140%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.footer-brand p {
  margin: 16px 0 0;
  max-width: 300px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--footer-text-muted);
}
.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--footer-text);
}
.footer-contact:hover { color: var(--footer-accent); text-decoration: none; }
.footer-contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--footer-border);
  font-size: 0.72rem;
}
.footer-col h4 {
  position: relative;
  margin: 0 0 20px;
  padding-top: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--footer-text);
}
.footer-col h4::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--footer-accent);
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-col a {
  position: relative;
  display: inline-block;
  font-size: 0.88rem;
  color: var(--footer-text-muted);
  transition: color 0.15s ease;
}
.footer-col a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--footer-accent);
  transition: right 0.2s ease;
}
.footer-col a:hover { color: var(--footer-text); text-decoration: none; }
.footer-col a:hover::after { right: 0; }
.footer-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 28px;
}
.footer-legal p {
  margin: 0 auto;
  max-width: 640px;
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--footer-text-muted);
  opacity: 0.85;
}
.footer-legal p + p { margin-top: 8px; }
.footer-legal .footer-copyright { opacity: 1; color: var(--footer-text-muted); }
.footer-top-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--footer-text);
  padding: 8px 14px;
  border: 1px solid var(--footer-border);
  border-radius: 999px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.footer-top-link:hover {
  text-decoration: none;
  border-color: var(--footer-accent);
  background: color-mix(in srgb, var(--footer-accent) 12%, transparent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--footer-accent) 25%, transparent);
  transform: translateY(-1px);
}
.footer-top-arrow { transition: transform 0.2s ease; }
.footer-top-link:hover .footer-top-arrow { transform: translateY(-2px); }

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  .footer-brand p { margin-left: auto; margin-right: auto; }
  .footer-brand .footer-logo { justify-content: center; }
  .footer-col h4::before { left: 50%; transform: translateX(-50%); }
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}
