/* ─── CSS 변수 토큰 ────────────────────────────────────── */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Header (nav) ──────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10000;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.header-left { display: flex; align-items: center; gap: 24px; min-width: 0; flex-wrap: wrap; }
.logo { font-size: 17px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; flex-shrink: 0; }
.logo a { color: inherit; text-decoration: none; }

/* GNB 메뉴 */
.gnb { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.gnb-item { font-size: 14px; font-weight: 700; color: #475569; padding: 7px 14px; border-radius: 6px; text-decoration: none; white-space: nowrap; transition: background .12s, color .12s; }
.gnb-item:hover { background: #f1f5f9; color: var(--primary); }
.gnb-item.active { color: var(--primary); background: #eff6ff; }
@media (max-width: 900px) {
  .header-left { gap: 12px; }
  .gnb-item { font-size: 13px; padding: 6px 10px; }
  .search-box { flex: 1 1 200px; }
}
@media (max-width: 580px) {
  .header-inner { padding: 8px 12px; gap: 6px; }
  .header-left { width: 100%; justify-content: space-between; gap: 8px; }
  .logo { font-size: 15px; }
  .gnb-item { font-size: 12px; padding: 5px 8px; }
  .search-box { width: 100%; flex: 1 1 100%; }
}

.search-box {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  width: 280px;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
}
.search-box input {
  border: none; background: transparent; outline: none;
  width: 100%; font-size: 14px; color: var(--text-main);
  font-family: 'Pretendard', -apple-system, sans-serif;
}

/* ── Container ─────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb-nav { padding: 12px 0 0; }
.breadcrumb-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-faint);
}
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb-item.active { color: var(--text-main); font-weight: 600; }
.breadcrumb-sep { color: var(--text-faint); font-size: 12px; }

/* ── Hero ──────────────────────────────────────────────── */
.hero-card {
  background: #0f172a; border-radius: 14px;
  padding: 32px 28px; color: white; margin-bottom: 36px; margin-top: 16px;
}
.hero-eyebrow { font-size: 13px; color: #64748b; font-weight: 600; margin-bottom: 4px; }
h1.hero-title {
  font-size: 38px; font-weight: 800; letter-spacing: -1.5px;
  line-height: 1; margin-bottom: 6px; color: white;
}
.hero-subtitle { font-size: 13px; color: #64748b; margin-bottom: 24px; }
.hero-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.hero-links  { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-link {
  padding: 7px 14px; border-radius: 7px;
  background: #1e293b; border: 1px solid #334155;
  color: #94a3b8; text-decoration: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hero-link:hover { background: #334155; color: #e2e8f0; }
.hero-badge {
  display: inline-block; padding: 6px 14px; border-radius: 6px;
  background: #1e293b; border: 1px solid #10b981;
  color: #10b981; font-size: 13px; font-weight: 700;
}

/* ── 이웃 동네 (M7) 독립 배치 여백 ──────────────────────── */
#m7-neighbor { margin-bottom: 36px; }

/* ── Category group (article) ──────────────────────────── */
.category-group { margin-bottom: 48px; }
.category-header {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}
.category-header h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}
.category-header > span { font-size: 13px; color: var(--text-muted); }
.ym-badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: #3b82f6; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 4px; padding: 2px 8px; vertical-align: middle;
  margin-left: 6px; letter-spacing: 0;
}

/* ── Section KPI (dl bar) ──────────────────────────────── */
.section-kpi {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 20px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}
.section-kpi > div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 20px 4px 0;
  margin-right: 20px;
  border-right: 1px solid var(--border);
}
.section-kpi > div:last-child { border-right: none; padding-right: 0; margin-right: 0; }
.section-kpi dt { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.section-kpi dd { font-size: 15px; font-weight: 800; color: var(--text-main); margin: 0; white-space: nowrap; }
.section-kpi dd em { font-size: 12px; font-weight: 500; font-style: normal; color: var(--text-muted); margin-left: 3px; }

/* ── Grid layouts ──────────────────────────────────────── */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: stretch; }
.grid-main-side > .card { min-height: 0; }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 0 12px 40px; }
  h1.hero-title { font-size: 26px; }
  .hero-card { padding: 20px 16px; }
}

/* ── Color utils ────────────────────────────────────────── */
.c-success { color: var(--success); }
.c-danger  { color: var(--danger); }
.c-warning { color: var(--warning); }
.c-primary { color: var(--primary); }
.c-muted   { color: var(--text-muted); }

/* ── Section title ──────────────────────────────────────── */
.section-title {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.06em;
}

/* ── Month navigation ────────────────────────────────────── */
.month-nav-section { margin-bottom: 40px; }
.month-nav-section h2 {
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.month-nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.env-report-more { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.env-report-more-link { display: inline-flex; align-items: center; padding: 9px 18px; background: #0284c7; border: 1px solid #0284c7; border-radius: 8px; font-size: 13px; font-weight: 600; color: #fff; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.env-report-more-link:hover { background: #0369a1; border-color: #0369a1; }
.month-nav-label {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em;
}
.ym-opt { display: none; }
.ym-year-tabs { display: flex; gap: 5px; margin-bottom: 8px; flex-wrap: wrap; justify-content: center; }
.ym-year-btn {
  padding: 4px 11px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.ym-year-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ym-month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.ym-month-grid.hidden { display: none; }
.ym-month-btn {
  padding: 6px 0; border-radius: 6px; text-align: center;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); text-decoration: none;
  font-size: 12px; font-weight: 600;
}
.ym-month-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ym-month-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.neighbor-links { display: flex; flex-wrap: wrap; gap: 6px; }
.neighbor-link {
  padding: 5px 12px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}
.neighbor-link:hover { border-color: var(--primary); color: var(--primary); }

/* ── FAQ ─────────────────────────────────────────────────── */
.faq-section { margin-bottom: 48px; }
.faq-section h2 {
  font-size: 20px; font-weight: 800; letter-spacing: -0.5px;
  padding-bottom: 10px; border-bottom: 2px solid var(--text-main);
  margin-bottom: 20px;
}
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.faq-question {
  width: 100%; text-align: left; padding: 16px 20px;
  background: none; border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Pretendard', -apple-system, sans-serif;
  font-size: 14px; font-weight: 700; color: var(--text-main); line-height: 1.5;
}
.faq-question:hover { background: var(--bg); }
.faq-arrow { font-size: 18px; color: var(--text-faint); flex-shrink: 0; transition: transform 0.2s; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  display: none; padding: 14px 20px 16px;
  font-size: 14px; color: var(--text-muted); line-height: 1.8;
  border-top: 1px solid var(--border);
}
.faq-item.open .faq-answer { display: block; }
.faq-answer strong { color: var(--text-main); }
.faq-fact-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.faq-fact-list li {
  padding: 6px 12px; background: var(--bg);
  border-radius: 6px; font-size: 13px; color: var(--text-muted);
  border-left: 3px solid var(--border);
}
.faq-fact-list li strong { color: var(--text-main); }
.faq-fact-list li.highlight { border-left-color: var(--primary); background: var(--primary-light); color: #1e40af; }
.faq-fact-list li.highlight strong { color: #1e40af; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 28px 0; margin-top: 0;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.footer-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap; margin-bottom: 20px;
}
.footer-brand { font-size: 15px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.footer-desc { font-size: 13px; color: var(--text-faint); line-height: 1.7; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--primary); }
.footer-bottom {
  padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-faint);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

/* ── Misc ────────────────────────────────────────────────── */
.no-data { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Chart data disclosure ───────────────────────────────── */
details.chart-data { margin-top: 10px; }
details.chart-data summary {
  font-size: 12px; color: var(--text-faint); font-weight: 600;
  cursor: pointer; user-select: none;
  padding: 5px 2px; list-style: none;
}
details.chart-data summary::-webkit-details-marker { display: none; }
details.chart-data summary::before { content: "▸ "; }
details.chart-data[open] summary::before { content: "▾ "; }
.chart-data-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.chart-data-table caption { text-align: left; font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.chart-data-table th { padding: 5px 8px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.chart-data-table td { padding: 5px 8px; border-bottom: 1px dashed var(--border); }
.chart-data-table tr:last-child td { border-bottom: none; font-weight: 700; background: var(--bg); }

/* ═══════════════════════════════════════════════════════════
   동네 한눈에 (mSnapshot) — 판단 지원 카드
═══════════════════════════════════════════════════════════ */
.snap-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 20px 0;
  overflow: hidden;
}

/* ── 헤더 ── */
.snap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
}
.snap-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}
.snap-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}
.snap-grade-badge {
  font-size: 15px;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}
.snap-grade-good { background: #d1fae5; color: #065f46; }
.snap-grade-ok   { background: #dbeafe; color: #1e40af; }
.snap-grade-mid  { background: #fef3c7; color: #92400e; }
.snap-grade-bad  { background: #fee2e2; color: #991b1b; }

/* ── 본문 레이아웃 ── */
.snap-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.snap-body > * {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}
.snap-body > *:last-child { border-right: none; }

/* ── KPI 블록 ── */
.snap-kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}
.snap-kpi { text-align: center; flex: 1; }
.snap-kpi-divider { width: 1px; height: 48px; background: var(--border); flex-shrink: 0; }
.snap-kpi-value {
  font-size: 36px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -1px;
}
.snap-kpi-unit { font-size: 16px; font-weight: 600; letter-spacing: 0; margin-left: 1px; }
.snap-kpi-label { font-size: 12px; font-weight: 700; color: var(--text-main); margin-top: 6px; }
.snap-kpi-sub   { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ── 분야별 순위 도트 ── */
.snap-rank-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}
.snap-rank-rows { display: flex; flex-direction: column; gap: 10px; }
.snap-rank-row  { display: flex; align-items: center; gap: 10px; }
.snap-rank-name { font-size: 12px; font-weight: 600; color: var(--text-main); width: 72px; flex-shrink: 0; }
.snap-dots      { display: flex; gap: 5px; }
.snap-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border);
  transition: background .2s;
}
.snap-dot-on       { background: var(--primary); }
.snap-dot-on.snap-dot-safe { background: var(--success); }
.snap-dot-on.snap-dot-env  { background: #06b6d4; }
.snap-dot-on.snap-dot-vol  { background: var(--warning); }
.snap-rank-num { font-size: 12px; color: var(--text-faint); margin-left: auto; white-space: nowrap; }

/* ── 체크리스트 ── */
.snap-check-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.snap-check-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.snap-check-summary { font-size: 12px; font-weight: 700; }
.snap-check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.snap-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
}
.snap-check-item strong { display: block; font-size: 14px; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.snap-check-desc      { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.snap-check-count     { display: inline-block; font-size: 12px; font-weight: 600; color: #1e40af; background: #dbeafe; border-radius: 3px; padding: 1px 6px; margin-top: 5px; }
.snap-check-threshold { font-size: 12px; color: var(--text-faint); margin-left: auto; white-space: nowrap; flex-shrink: 0; }

.snap-check-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.snap-check-ok   .snap-check-icon { background: #d1fae5; color: #065f46; }
.snap-check-warn .snap-check-icon { background: #fef3c7; color: #92400e; }
.snap-check-bad  .snap-check-icon { background: #fee2e2; color: #991b1b; }
.snap-check-na   .snap-check-icon { background: var(--border); color: var(--text-faint); }

.snap-check-ok   { border-left: 3px solid var(--success); }
.snap-check-warn { border-left: 3px solid var(--warning); }
.snap-check-bad  { border-left: 3px solid var(--danger); }
.snap-check-na   { border-left: 3px solid var(--border); }

.stat-row   { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--bg); gap: 5px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.stat-sub   { font-size: 12px; color: var(--text-faint); }

/* ── 날씨·대기질 진입점 배너 ── */
.env-entry-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid #0284c7;
  border-radius: 10px; padding: 12px 16px;
  text-decoration: none; color: var(--text-muted);
  font-size: 14px; margin-bottom: 20px;
  transition: background 0.15s, border-color 0.15s;
}
.env-entry-banner:hover { background: var(--surface-alt, #f1f5f9); border-left-color: #0369a1; }
.env-entry-arrow { font-size: 13px; font-weight: 700; color: #0284c7; white-space: nowrap; margin-left: 12px; }


/* ── Snapshot 2-col ── */
.snap-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── 반응형 ── */
@media (max-width: 900px) {
  .snap-body {
    grid-template-columns: 1fr;
  }
  .snap-body > * {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .snap-body > *:last-child { border-bottom: none; }
  .snap-kpi-value { font-size: 28px; }
  .snap-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .section-kpi { flex-direction: column; gap: 0; padding: 10px 14px; }
  .section-kpi > div { border-right: none; padding: 6px 0; margin-right: 0; border-bottom: 1px solid var(--border); }
  .section-kpi > div:last-child { border-bottom: none; }
  .category-header { flex-wrap: wrap; gap: 8px; }
  .month-nav-grid { grid-template-columns: 1fr; }
  .snap-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 640px) {
  .env-report-more-link { font-size: 12px; padding: 7px 12px; }
}
