/*
Theme Name: Cheonan People
Theme URI: https://cheonanpeople.leejihye.com
Description: 천안 인구 데이터 플랫폼 전용 테마
Author: 천안 사람 데이터 지도
Version: 1.0.0
Template: twentytwentyfive
Text Domain: cheonan-people
*/

:root {
  --cp-navy: #0f2847;
  --cp-navy-light: #1a3a5c;
  --cp-teal: #2d8a8a;
  --cp-teal-light: #3db5b5;
  --cp-orange: #e8943a;
  --cp-orange-light: #f5b870;
  --cp-bg: #faf9f7;
  --cp-bg-warm: #f5f3ef;
  --cp-text: #1a2332;
  --cp-text-sub: #4a5568;
  --cp-text-muted: #718096;
  --cp-border: #e2e8f0;
  --cp-border-light: #edf2f7;
  --cp-card-bg: #ffffff;
  --cp-card-shadow: 0 2px 12px rgba(15,40,71,0.06);
  --cp-card-shadow-hover: 0 8px 32px rgba(15,40,71,0.10);
  --cp-radius: 12px;
  --cp-radius-sm: 8px;
  --cp-radius-lg: 20px;
  --cp-transition: 200ms cubic-bezier(0.4,0,0.2,1);
  --cp-max-w: 780px;
  --cp-gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --cp-transition: 0ms; }
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Noto Sans KR', sans-serif;
  background: var(--cp-bg);
  color: var(--cp-text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--cp-navy);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0 0 24px; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); margin: 56px 0 20px; padding-bottom: 12px; border-bottom: 2px solid var(--cp-teal); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); margin: 40px 0 16px; color: var(--cp-navy-light); }

p { margin: 0 0 20px; color: var(--cp-text-sub); }
a { color: var(--cp-teal); text-decoration: none; transition: color var(--cp-transition); }
a:hover { color: var(--cp-orange); }

/* === SITE HEADER === */
.cp-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cp-border-light);
  padding: 0 24px;
}
.cp-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.cp-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--cp-navy);
  font-weight: 800;
  font-size: 1.1rem;
}
.cp-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.cp-nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.cp-nav a {
  display: block;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--cp-text-sub);
  border-radius: var(--cp-radius-sm);
  transition: all var(--cp-transition);
}
.cp-nav a:hover { background: var(--cp-bg-warm); color: var(--cp-navy); }

.cp-mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.cp-mobile-toggle svg { width: 24px; height: 24px; stroke: var(--cp-navy); }

@media (max-width: 768px) {
  .cp-mobile-toggle { display: block; }
  .cp-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--cp-border);
    box-shadow: var(--cp-card-shadow);
  }
  .cp-nav.open { display: flex; }
}

/* === CONTENT AREA === */
.cp-content {
  max-width: var(--cp-max-w);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* === ARTICLE STYLES === */
.cp-article { background: transparent; }
.cp-article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--cp-radius);
  margin: 24px 0;
}
.cp-article figure { margin: 32px 0; }
.cp-article figcaption { font-size: 0.85rem; color: var(--cp-text-muted); text-align: center; margin-top: 8px; }

/* === TABLES === */
.cp-article table, .cp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--cp-radius);
  overflow: hidden;
  margin: 24px 0;
  font-size: 0.92rem;
  border: 1px solid var(--cp-border);
}
.cp-article table thead th, .cp-table thead th {
  background: var(--cp-navy);
  color: white;
  padding: 14px 16px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.cp-article table tbody td, .cp-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--cp-border-light);
}
.cp-article table tbody tr:last-child td, .cp-table tbody tr:last-child td { border-bottom: none; }
.cp-article table tbody tr:hover, .cp-table tbody tr:hover { background: var(--cp-bg-warm); }

@media (max-width: 640px) {
  .cp-article table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* === LISTS === */
.cp-article ul, .cp-article ol {
  padding-left: 24px;
  margin: 16px 0;
}
.cp-article li {
  margin-bottom: 8px;
  color: var(--cp-text-sub);
  line-height: 1.7;
}
.cp-article ul li::marker { color: var(--cp-teal); }

/* === BLOCKQUOTE / CALLOUT === */
.cp-article blockquote, .cp-callout {
  background: linear-gradient(135deg, #f0fafa 0%, #f7f9fc 100%);
  border-left: 4px solid var(--cp-teal);
  border-radius: 0 var(--cp-radius) var(--cp-radius) 0;
  padding: 20px 24px;
  margin: 28px 0;
  font-size: 0.95rem;
  color: var(--cp-navy);
}
.cp-article blockquote p:last-child { margin-bottom: 0; }

/* === CARDS === */
.cp-card {
  background: var(--cp-card-bg);
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-card-shadow);
  overflow: hidden;
  transition: transform var(--cp-transition), box-shadow var(--cp-transition);
}
.cp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cp-card-shadow-hover);
}
.cp-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.cp-card-body { padding: 20px; }
.cp-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cp-navy);
  margin: 0 0 8px;
  line-height: 1.4;
}
.cp-card-desc {
  font-size: 0.88rem;
  color: var(--cp-text-muted);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cp-card-meta {
  font-size: 0.8rem;
  color: var(--cp-text-muted);
  margin-top: 12px;
}

/* === GRID === */
.cp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cp-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 900px) { .cp-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cp-grid-3, .cp-grid-2 { grid-template-columns: 1fr; } }

/* === FOOTER === */
.cp-footer {
  background: var(--cp-navy);
  color: rgba(255,255,255,0.7);
  padding: 64px 24px 40px;
}
.cp-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.cp-footer a { color: var(--cp-teal-light); }
.cp-footer a:hover { color: white; }
.cp-footer-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}
.cp-footer-links {
  display: flex;
  gap: 24px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.cp-footer-links a { font-size: 0.88rem; }
.cp-footer-copy {
  font-size: 0.82rem;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  line-height: 1.7;
}
.cp-footer-legal {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  margin-top: 16px;
  line-height: 1.7;
}

/* === BUTTONS === */
.cp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--cp-radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: all var(--cp-transition);
  text-decoration: none;
}
.cp-btn-primary { background: var(--cp-teal); color: white; }
.cp-btn-primary:hover { background: var(--cp-navy); color: white; }
.cp-btn-outline { background: transparent; color: var(--cp-teal); border: 1.5px solid var(--cp-teal); }
.cp-btn-outline:hover { background: var(--cp-teal); color: white; }

/* === BAR CHART (CSS) === */
.cp-bar { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.cp-bar-label { width: 100px; font-size: 0.85rem; color: var(--cp-text-sub); text-align: right; flex-shrink: 0; }
.cp-bar-track { flex: 1; height: 28px; background: var(--cp-border-light); border-radius: 6px; overflow: hidden; position: relative; }
.cp-bar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; display: flex; align-items: center; padding: 0 10px; }
.cp-bar-fill.teal { background: linear-gradient(90deg, var(--cp-teal), var(--cp-teal-light)); }
.cp-bar-fill.orange { background: linear-gradient(90deg, var(--cp-orange), var(--cp-orange-light)); }
.cp-bar-fill.navy { background: linear-gradient(90deg, var(--cp-navy), var(--cp-navy-light)); }
.cp-bar-val { font-size: 0.78rem; font-weight: 600; color: white; white-space: nowrap; }

/* === LEGAL NOTICES === */
.legal-notice, .ai-notice { max-width: var(--cp-max-w); }

/* === HIDE WP DEFAULTS === */
.wp-site-blocks > header, .wp-site-blocks > footer { display: none !important; }
.wp-block-post-comments-form { display: none !important; }
body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: none; }

/* === SCROLL ANIMATIONS === */
.cp-fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.cp-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === SINGLE POST HERO === */
.cp-post-hero {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--cp-radius-lg);
  margin-bottom: 32px;
}

/* === TOC === */
.cp-toc {
  background: var(--cp-bg-warm);
  border-radius: var(--cp-radius);
  padding: 24px 28px;
  margin: 24px 0 40px;
}
.cp-toc-title { font-size: 0.9rem; font-weight: 700; color: var(--cp-navy); margin: 0 0 12px; }
.cp-toc ol { margin: 0; padding-left: 20px; }
.cp-toc li { margin-bottom: 6px; }
.cp-toc a { font-size: 0.88rem; color: var(--cp-text-sub); }
.cp-toc a:hover { color: var(--cp-teal); }

/* === RELATED POSTS === */
.cp-related { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--cp-border); }
.cp-related-title { font-size: 1.2rem; font-weight: 700; color: var(--cp-navy); margin: 0 0 24px; border: none; padding: 0; }
