/* ======================================================
   令和6年度 孤独・孤立調査レポート — スタイルシート
   ====================================================== */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Inter:wght@300;400;600;700&display=swap');

/* ── CSS カスタムプロパティ ── */
:root {
  --sidebar-w: 270px;
  --primary:   #0d1b2a;
  --primary2:  #1b2838;
  --red:       #c62828;
  --red-light: #ef5350;
  --red-pale:  #ffebee;
  --blue:      #1565c0;
  --blue-light:#1976d2;
  --blue-pale: #e3f2fd;
  --green:     #2e7d32;
  --green-pale:#e8f5e9;
  --yellow:    #f57f17;
  --yellow-pale:#fffde7;
  --purple:    #6a1b9a;
  --gray-1:    #f5f7fa;
  --gray-2:    #eceff1;
  --gray-3:    #cfd8dc;
  --gray-4:    #90a4ae;
  --gray-5:    #546e7a;
  --text:      #1a2332;
  --text-sub:  #546e7a;
  --border:    #e0e7ef;
  --shadow:    0 4px 20px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.14);
  --radius:    12px;
  --radius-sm: 8px;
  --font-jp:   'Noto Sans JP', sans-serif;
  --font-en:   'Inter', sans-serif;
  --transition: .3s cubic-bezier(.4,0,.2,1);
}

/* ── リセット & ベース ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: var(--font-jp);
  background: var(--gray-1);
  color: var(--text);
  line-height: 1.7;
  display: flex;
}

/* ── プログレスバー ── */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  width: 0%; z-index: 9999;
  transition: width .1s linear;
}

/* ════════════════════════════════════
   サイドバー
════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--primary);
  position: fixed; top: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo .logo-badge {
  display: inline-block;
  background: var(--red);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 8px;
  letter-spacing: .5px;
}
.sidebar-logo h1 {
  font-size: 13px; color: #fff; font-weight: 700; line-height: 1.5;
}
.sidebar-logo .subtitle {
  font-size: 11px; color: rgba(255,255,255,.45); margin-top: 4px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-group-label {
  font-size: 10px; color: rgba(255,255,255,.35);
  font-weight: 700; letter-spacing: 1px;
  padding: 16px 20px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  color: rgba(255,255,255,.6); font-size: 12.5px;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff; border-left-color: rgba(255,255,255,.3);
}
.nav-item.active {
  background: rgba(198,40,40,.15);
  color: #fff; border-left-color: var(--red);
}
.nav-item .nav-icon {
  width: 20px; text-align: center; font-size: 14px; flex-shrink: 0;
}
.nav-item .nav-number {
  font-size: 10px; background: rgba(255,255,255,.1);
  padding: 1px 6px; border-radius: 10px; margin-left: auto;
  color: rgba(255,255,255,.5);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: rgba(255,255,255,.3);
}

/* ════════════════════════════════════
   メインコンテンツ
════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
}

/* ── トップヘッダー ── */
.top-header {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 36px;
  display: flex; align-items: center; justify-content: space-between;
}
.top-header .breadcrumb {
  font-size: 12px; color: var(--text-sub);
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb .sep { color: var(--gray-4); }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.top-header .header-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-sub);
}
.tag {
  display: inline-flex; align-items: center;
  background: var(--blue-pale); color: var(--blue);
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; gap: 4px;
}
.tag.red { background: var(--red-pale); color: var(--red); }

/* ════════════════════════════════════
   ヒーローセクション
════════════════════════════════════ */
.hero {
  background: #f4f6f9;
  border-bottom: 1px solid #dce3ed;
  padding: 56px 36px 48px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -40%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(198,40,40,.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; bottom: -20%; left: 20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(21,101,192,.05) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(21,101,192,.1); border: 1px solid rgba(21,101,192,.2);
  color: #1a3a5c; font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; margin-bottom: 16px;
  letter-spacing: .5px;
}
.hero h2 {
  font-size: 28px; font-weight: 900; color: #111; line-height: 1.35;
  margin-bottom: 8px;
}
.hero .hero-sub {
  font-size: 14px; color: #555; margin-bottom: 36px;
}

/* KPIカードグリッド */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  position: relative; z-index: 1;
}
.kpi-card {
  background: #fff;
  border: 1px solid #dce3ed;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.kpi-card .kpi-label {
  font-size: 11px; color: #666;
  font-weight: 600; letter-spacing: .5px; margin-bottom: 8px;
  text-transform: uppercase;
}
.kpi-card .kpi-value {
  font-family: var(--font-en);
  font-size: 36px; font-weight: 800; line-height: 1;
  color: #111; margin-bottom: 4px;
}
.kpi-card .kpi-unit {
  font-size: 16px; font-weight: 400; margin-left: 2px;
}
.kpi-card .kpi-desc {
  font-size: 12px; color: #666; margin-top: 6px;
}
.kpi-card.accent-red {
  background: #fff5f5;
  border-color: rgba(198,40,40,.25);
}
.kpi-card.accent-blue {
  background: #f0f5ff;
  border-color: rgba(21,101,192,.25);
}

/* ════════════════════════════════════
   セクション共通
════════════════════════════════════ */
.section {
  padding: 48px 36px;
}
.section:nth-child(even) { background: #fff; }
.section:nth-child(odd)  { background: var(--gray-1); }

.section-header { margin-bottom: 32px; }
.section-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-family: var(--font-en); font-size: 13px; font-weight: 700;
  margin-right: 10px; flex-shrink: 0;
}
.section-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 0;
  margin-bottom: 8px;
}
.section-desc {
  font-size: 14px; color: var(--text-sub); margin-top: 6px;
  padding-left: 38px; max-width: 720px; line-height: 1.8;
}

/* ── サブセクション ── */
.sub-section { margin-bottom: 48px; }
.sub-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sub-title::before {
  content: '';
  display: inline-block; width: 4px; height: 18px;
  background: var(--red); border-radius: 2px;
}

/* ── グリッドレイアウト ── */
.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; align-items: start;
}
.grid-3 {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 20px;
}
.col-span-2 { grid-column: span 2; }

/* ── チャートカード ── */
.chart-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.chart-card:hover { box-shadow: var(--shadow-lg); }
.chart-card .chart-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.chart-card .chart-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  line-height: 1.4;
}
.chart-card .chart-source {
  font-size: 10.5px; color: var(--text-sub); margin-top: 4px;
}
.source-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
  flex-shrink: 0;
}
.source-badge.data { background: var(--blue-pale); color: var(--blue); }
.source-badge.web  { background: var(--green-pale); color: var(--green); }

.chart-card .chart-body {
  padding: 16px;
  display: flex; justify-content: center;
}
.chart-card .chart-body img {
  max-width: 100%; height: auto; border-radius: 6px;
  cursor: zoom-in;
}
.chart-card .chart-footer {
  padding: 12px 20px;
  background: var(--gray-1);
  border-top: 1px solid var(--gray-2);
  font-size: 12px; color: var(--text-sub);
}

/* ── インラインChart.jsコンテナ ── */
.inline-chart-wrap {
  padding: 20px; display: flex; justify-content: center;
}
.inline-chart-wrap canvas { max-height: 260px; }

/* ── インサイトボックス ── */
.insight-box {
  border-radius: var(--radius);
  padding: 20px 24px; margin: 20px 0;
  border-left: 4px solid var(--blue);
  background: var(--blue-pale);
  font-size: 13.5px; line-height: 1.8;
}
.insight-box.red {
  border-left-color: var(--red);
  background: var(--red-pale);
}
.insight-box.green {
  border-left-color: var(--green);
  background: var(--green-pale);
}
.insight-box.yellow {
  border-left-color: var(--yellow);
  background: var(--yellow-pale);
}
.insight-box .insight-title {
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.insight-box.red .insight-title { color: var(--red); }
.insight-box .insight-title { color: var(--blue); }
.insight-box.green .insight-title { color: var(--green); }
.insight-box.yellow .insight-title { color: var(--yellow); }

/* ── 引用元バッジ ── */
.cite {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.06); color: var(--text-sub);
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  font-weight: 500; text-decoration: none;
  transition: background var(--transition);
}
.cite:hover { background: rgba(0,0,0,.12); }
.cite.data-src { background: var(--blue-pale); color: var(--blue); }
.cite.web-src  { background: var(--green-pale); color: var(--green); }

/* ── スタッツグリッド ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin: 20px 0;
}
.stat-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 16px;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform var(--transition);
}
.stat-item:hover { transform: translateY(-2px); }
.stat-item .stat-val {
  font-family: var(--font-en); font-size: 30px; font-weight: 800;
  line-height: 1; color: var(--red); margin-bottom: 6px;
}
.stat-item .stat-val.blue { color: var(--blue); }
.stat-item .stat-val.green { color: var(--green); }
.stat-item .stat-label {
  font-size: 11.5px; color: var(--text-sub); line-height: 1.5;
}

/* ── テーブル ── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; background: #fff;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: var(--primary); color: rgba(255,255,255,.9);
  padding: 12px 16px; font-weight: 600; text-align: left;
  font-size: 12px; letter-spacing: .3px;
}
.data-table td {
  padding: 11px 16px; border-bottom: 1px solid var(--gray-2);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-1); }
.table-val {
  font-family: var(--font-en); font-weight: 700; color: var(--red);
}

/* ── バーインジケーター ── */
.bar-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.bar-label { font-size: 12.5px; width: 160px; flex-shrink: 0; }
.bar-track {
  flex: 1; height: 22px; background: var(--gray-2);
  border-radius: 4px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px;
}
.bar-fill.blue {
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
}
.bar-fill .bar-pct {
  color: #fff; font-size: 11px; font-weight: 700;
  font-family: var(--font-en); white-space: nowrap;
}
.bar-fill-val { font-family: var(--font-en); font-size: 13px; font-weight: 700; color: var(--text); }

/* ── ポリシーカード ── */
.policy-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 20px;
}
.policy-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
  display: flex; gap: 16px; align-items: flex-start;
}
.policy-card .policy-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-family: var(--font-en); font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.policy-card .policy-title {
  font-size: 14px; font-weight: 700; margin-bottom: 6px;
  color: var(--text);
}
.policy-card .policy-desc {
  font-size: 13px; color: var(--text-sub); line-height: 1.75;
}

/* ── タイムライン（法律） ── */
.timeline {
  position: relative; padding-left: 28px; margin: 20px 0;
}
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px;
  bottom: 4px; width: 2px; background: var(--blue);
}
.timeline-item {
  position: relative; margin-bottom: 20px; padding-left: 16px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--blue);
}
.timeline-date {
  font-family: var(--font-en); font-size: 11px; font-weight: 700;
  color: var(--blue); letter-spacing: .5px; text-transform: uppercase;
  margin-bottom: 3px;
}
.timeline-event {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  margin-bottom: 4px;
}
.timeline-detail { font-size: 12.5px; color: var(--text-sub); }

/* ── 参考文献 ── */
.ref-section { margin-bottom: 32px; }
.ref-section .ref-category {
  font-size: 13px; font-weight: 700; color: var(--text);
  padding: 8px 12px; background: var(--gray-2);
  border-radius: var(--radius-sm); margin-bottom: 10px;
}
.ref-list { list-style: none; }
.ref-list li {
  padding: 10px 0; border-bottom: 1px solid var(--gray-2);
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px;
}
.ref-list li:last-child { border-bottom: none; }
.ref-icon { flex-shrink: 0; margin-top: 2px; }
.ref-list a { color: var(--blue); text-decoration: none; }
.ref-list a:hover { text-decoration: underline; }

/* ── ライトボックス ── */
#lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.88); z-index: 9000;
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img {
  max-width: 90vw; max-height: 90vh;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
#lightbox-close {
  position: absolute; top: 20px; right: 24px;
  color: #fff; font-size: 28px; cursor: pointer; z-index: 1;
  opacity: .7;
}
#lightbox-close:hover { opacity: 1; }

/* ── スクロールトップ ── */
#scroll-top {
  position: fixed; bottom: 28px; right: 28px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--red); color: #fff;
  border: none; cursor: pointer; font-size: 18px;
  box-shadow: 0 4px 16px rgba(198,40,40,.4);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 80;
}
#scroll-top.show { opacity: 1; pointer-events: auto; }
#scroll-top:hover { transform: translateY(-3px); }

/* ── ハンバーガー（モバイル） ── */
#sidebar-toggle {
  display: none; position: fixed; top: 12px; left: 12px;
  z-index: 200; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 8px 10px;
  cursor: pointer; font-size: 18px;
}

/* ── フッター ── */
.report-footer {
  background: var(--primary); color: rgba(255,255,255,.45);
  padding: 32px 36px; font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.report-footer .footer-credit {
  width: 100%; text-align: center;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 12px; margin-top: 4px;
  font-size: 12px; color: rgba(255,255,255,.5);
}
.report-footer a { color: rgba(255,255,255,.6); text-decoration: none; }
.report-footer a:hover { color: #fff; }

/* ════════════════════════════════════
   アニメーション
════════════════════════════════════ */
.fade-in {
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-in.visible { opacity: 1; transform: none; }

/* ── スクロールバー ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ════════════════════════════════════
   レスポンシブ
════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .policy-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-270px);
    width: 270px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  #sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .main-content { margin-left: 0; }
  .section { padding: 36px 20px; }
  .hero { padding: 48px 20px 36px; }
  .top-header { padding: 12px 20px; padding-left: 60px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .hero h2 { font-size: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card .kpi-value { font-size: 26px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .data-table { font-size: 12px; }
  .report-footer { flex-direction: column; gap: 8px; }
}
