/*
Theme Name: good5blog
Description: good5blog custom theme — subscription/gov-support/it-life/finance-info niche comparison articles with E-E-A-T author signals.
Author: pangkyu
Version: 0.1
Text Domain: good5blog
*/

/* Design Ref: docs/02-design/features/good5blog.design.md §5.1, §5.4 */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  line-height: 1.7;
  color: #222;
  max-width: 100%;
  margin: 0;
}

.g5-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Site header */
.g5-site-header {
  border-bottom: 1px solid #eee;
}
.g5-site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g5-site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #222;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.g5-site-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: block;
}
.g5-site-header-inner nav ul {
  list-style: none;
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.g5-site-header-inner nav a {
  color: #444;
  text-decoration: none;
  font-size: 0.92rem;
}
.g5-site-header-inner nav a:hover {
  color: #3b5bdb;
}

/* Site footer */
.g5-site-footer {
  margin-top: 48px;
  border-top: 1px solid #eee;
  background: #fafafa;
  padding: 24px 0;
  text-align: center;
  color: #666;
  font-size: 0.85rem;
}
.g5-site-footer nav a {
  color: #666;
}
.g5-site-footer p {
  margin: 10px 0 0;
}

/* ===================================================================
   Article page readability (single.php)
   =================================================================== */

article h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.35;
  margin: 28px 0 16px;
}

/* Author badge + meta row */
.g5-author-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  color: #555;
}
.g5-author-badge img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* 실사용/실제 확인 경험 문구 — 인용문 느낌으로 시각적 구분 */
.g5-experience-note {
  font-style: italic;
  color: #444;
  background: #fafafa;
  border-left: 3px solid #ccc;
  padding: 10px 14px;
  margin: 16px 0;
  font-size: 0.95rem;
}

/* TL;DR box */
.g5-tldr-box {
  background: #f4f7ff;
  border-left: 4px solid #3b5bdb;
  padding: 16px 18px;
  margin: 20px 0;
  border-radius: 4px;
}
.g5-tldr-box h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3b5bdb;
}
.g5-tldr-box p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
}

/* 본문(the_content) 타이포그래피 — 가독성 개선 */
.g5-content {
  font-size: 1.05rem;
  line-height: 1.85;
  margin: 24px 0;
}
.g5-content p {
  margin: 0 0 20px;
}
.g5-content h2 {
  font-size: 1.3rem;
  margin: 40px 0 16px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}
.g5-content h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.g5-content h3 {
  font-size: 1.1rem;
  margin: 28px 0 12px;
}
.g5-content ul,
.g5-content ol {
  margin: 0 0 20px;
  padding-left: 1.4em;
}
.g5-content li {
  margin-bottom: 8px;
}
.g5-content li strong:first-child {
  color: #222;
}
.g5-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92rem;
}
.g5-content table th,
.g5-content table td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
}
.g5-content table th {
  background: #f6f7f9;
}
.g5-content a {
  color: #3b5bdb;
}
.g5-content strong {
  color: #111;
}
.g5-content img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 24px 0;
}

/* Compare table — 모바일에서는 가로 스크롤 (컬럼을 억지로 줄이지 않음) */
.g5-compare-table {
  margin: 24px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #eee;
  border-radius: 8px;
}
.g5-compare-table table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}
.g5-compare-table th,
.g5-compare-table td {
  border-bottom: 1px solid #eee;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap;
}
.g5-compare-table th {
  background: #f6f7f9;
  font-weight: 700;
}
.g5-compare-table tr:last-child td {
  border-bottom: none;
}

/* Ad slot placeholder — 실제 AdSense 코드 삽입 전까지 빈 공간이 어색하지 않도록 최소 표시 */
.g5-ad-slot {
  margin: 28px 0;
  min-height: 1px;
}
.g5-ad-slot:empty::before {
  content: '';
  display: block;
}

/* 애드센스 unfilled 시 쿠팡파트너스 배너 폴백 (monetization-slot.php) */
.g5-coupang-widget-box {
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.g5-coupang-ftc-notice {
  font-size: 11px;
  color: #999;
  text-align: center;
  line-height: 1.4;
  margin: 0 0 10px;
}
.g5-coupang-widget-box iframe {
  display: block;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 768px) {
  .g5-coupang-widget-box {
    padding: 12px;
  }
}

/* Affiliate CTA */
.g5-affiliate-cta {
  display: inline-block;
  margin: 8px 0 24px;
  padding: 13px 22px;
  background: #2b8a3e;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
  box-shadow: 0 2px 8px rgba(43, 138, 62, 0.25);
}
.g5-affiliate-cta:hover {
  background: #237032;
}

/* Author full profile box (author.php) */
.g5-author-profile {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: #fafafa;
  border-radius: 8px;
  margin: 24px 0;
}
.g5-author-profile img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

/* FAQ 아코디언 (blogv2, 2026-07-12) — 네이티브 <details>/<summary> 사용, JS 불필요 */
.g5-faq-section {
  margin: 32px 0 16px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}
.g5-faq-section .g5-section-title {
  font-size: 1.15rem;
  border-bottom: none;
  margin-bottom: 14px;
}
.g5-faq-item {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.g5-faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.98rem;
  color: #222;
  list-style: none;
}
.g5-faq-item summary::-webkit-details-marker {
  display: none;
}
.g5-faq-item summary::before {
  content: '+';
  display: inline-block;
  width: 1.1em;
  color: #3b5bdb;
  font-weight: 700;
}
.g5-faq-item[open] summary::before {
  content: '−';
}
.g5-faq-item p {
  margin: 10px 0 0;
  padding-left: 1.1em;
  color: #444;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Source links */
.g5-source-links {
  font-size: 0.85rem;
  color: #666;
  margin: 24px 0 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}
.g5-source-links strong {
  display: block;
  margin-bottom: 6px;
  color: #444;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.g5-source-links ul {
  margin: 0;
  padding-left: 1.2em;
}
.g5-source-links li {
  margin-bottom: 4px;
  word-break: break-all;
}
.g5-source-links a {
  color: #666;
}

/* Category landing */
.g5-niche-header {
  margin: 24px 0 8px;
}
.g5-post-card {
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}

/* ===================================================================
   Homepage (index.php) — 히어로 + 니치 카드 + 최신글 그리드
   =================================================================== */

.g5-home-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Accent color tokens per niche */
.g5-accent-blue   { --g5-accent: #3b5bdb; --g5-accent-bg: #eef1ff; }
.g5-accent-green  { --g5-accent: #2b8a3e; --g5-accent-bg: #ecfbee; }
.g5-accent-orange { --g5-accent: #e8590c; --g5-accent-bg: #fff4e6; }
.g5-accent-teal   { --g5-accent: #0c8599; --g5-accent-bg: #e6fcf5; }
.g5-accent-pink   { --g5-accent: #d6336c; --g5-accent-bg: #fff0f6; }

/* Hero */
.g5-hero {
  background: linear-gradient(135deg, #3b5bdb 0%, #0c8599 100%);
  color: #fff;
  padding: 56px 0 64px;
  text-align: center;
}
.g5-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}
.g5-hero-tagline {
  margin: 0;
  font-size: 1.05rem;
  opacity: 0.92;
}

/* 카테고리(니치) 페이지용 축소 히어로 — archive.php */
.g5-hero-compact {
  padding: 36px 0 32px;
}
.g5-hero-compact h1 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

/* 저자 프로필 페이지 히어로 — author.php (2026-07-12 리디자인, 홈페이지 히어로 톤과 통일) */
.g5-author-hero {
  background: linear-gradient(135deg, #3b5bdb 0%, #0c8599 100%);
  color: #fff;
  padding: 40px 0 56px;
}
.g5-author-hero-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}
.g5-author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.g5-author-hero-text h1 {
  margin: 0 0 4px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}
.g5-author-title {
  margin: 0;
  font-size: 1rem;
  opacity: 0.92;
  font-weight: 600;
}

/* 저자 소개/전문분야 카드 — 니치 카드와 동일한 톤(흰 배경, 그림자, 둥근 모서리) */
.g5-author-bio-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 22px;
  margin-top: -32px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.g5-author-bio {
  margin: 0 0 14px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: #333;
}
.g5-author-expertise {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.g5-expertise-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--g5-accent-bg, #eef1ff);
  color: var(--g5-accent, #3b5bdb);
}

/* Niche cards */
.g5-niche-section {
  margin-top: -36px;
}
.g5-niche-grid {
  display: grid;
  /* blogv2: 니치가 5개(구독/정부정책/IT생활/금융/트렌드)로 늘어난 뒤 auto-fit(minmax 220px)이 화면 폭에 따라
     4개까지만 한 줄에 채우고 5번째가 홀로 다음 줄로 밀려나는 문제가 있었다. 니치 개수 고정(5개)에 맞춰
     열 개수를 명시적으로 지정해 5개가 한 줄에 고르게 배치되도록 한다. */
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .g5-niche-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.g5-niche-card {
  background: #fff;
  border: 1px solid #eee;
  border-top: 4px solid var(--g5-accent, #3b5bdb);
  border-radius: 10px;
  padding: 20px;
  text-decoration: none;
  color: #222;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
}
.g5-niche-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}
.g5-niche-emoji {
  font-size: 1.8rem;
}
.g5-niche-card h2 {
  margin: 8px 0 6px;
  font-size: 1.1rem;
}
.g5-niche-card p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #555;
  line-height: 1.5;
}
.g5-niche-count {
  font-size: 0.78rem;
  color: var(--g5-accent, #3b5bdb);
  font-weight: 600;
}

/* Popular posts (blogv2) */
.g5-popular-section {
  margin: 48px 0 0;
}

/* Related posts (blogv2 module-4, single.php) */
.g5-related-section {
  margin: 48px auto;
}

/* Latest posts */
.g5-latest-section {
  margin: 48px 0;
}
.g5-section-title {
  font-size: 1.3rem;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #222;
  display: inline-block;
}
.g5-post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.g5-post-card-v2 {
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.g5-post-card-v2:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.g5-post-card-link {
  display: block;
  text-decoration: none;
  color: #222;
}

/* 썸네일 — featured image가 있으면 노출, 없으면 니치 accent 그라디언트 + 이모지 플레이스홀더 (blogv2) */
.g5-post-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--g5-accent-bg, #eef1ff) 0%, #fff 100%);
}
.g5-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.g5-post-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}
.g5-popular-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #fff;
  color: #d6336c;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/*
 * 유튜브/블로그식 썸네일 제목 오버레이 (blogv2, 2026-07-12 2차 확정).
 * Gemini 이미지엔 텍스트를 굽지 않고, 실제 글 제목(HTML)을 이미지 위에 CSS로 오버레이한다 —
 * 텍스트 정확도 100% 보장 + 배경 사진이 없어도(플레이스홀더) 동일하게 노출되어 일관성 유지.
 */
.g5-post-thumb-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 14px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.6),
    1px -1px 0 rgba(0, 0, 0, 0.6),
    -1px 1px 0 rgba(0, 0, 0, 0.6),
    1px 1px 0 rgba(0, 0, 0, 0.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.g5-post-card-body {
  padding: 18px;
}

.g5-post-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--g5-accent-bg, #eef1ff);
  color: var(--g5-accent, #3b5bdb);
  margin-bottom: 10px;
}
.g5-post-card-v2 h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.4;
}
.g5-post-excerpt {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #555;
  line-height: 1.5;
}
.g5-post-meta {
  font-size: 0.78rem;
  color: #888;
}

.g5-pagination {
  margin-top: 24px;
  text-align: center;
}
.g5-pagination .page-numbers {
  display: inline-block;
  min-width: 36px;
  padding: 8px 12px;
  margin: 0 3px;
  border: 1px solid #eee;
  border-radius: 6px;
  color: #444;
  text-decoration: none;
  font-size: 0.9rem;
}
.g5-pagination .page-numbers.current {
  background: #3b5bdb;
  border-color: #3b5bdb;
  color: #fff;
}
.g5-pagination .page-numbers:hover:not(.current) {
  border-color: #3b5bdb;
  color: #3b5bdb;
}

/* Mobile */
@media (max-width: 600px) {
  .g5-hero {
    padding: 40px 0 48px;
  }
  .g5-niche-grid,
  .g5-post-grid {
    grid-template-columns: 1fr;
  }
}
