/* ===== デザイントークン ===== */
:root {
  --primary:       #1A8AC4;
  --primary-dark:  #0F6A9E;
  --primary-light: #E0F2FC;
  --accent:        #FF6A20;
  --accent-light:  #FFF1E8;
  --bg:            #EEF4F9;
  --surface:       #FFFFFF;
  --text:          #1A2B3C;
  --text-mid:      #4A5D70;
  --text-light:    #8FA4B5;
  --border:        #CDD9E5;
  --border-light:  #E4EDF5;
  --navy:          #0E1E30;
  --radius:        14px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 4px rgba(20,40,65,0.07), 0 2px 10px rgba(20,40,65,0.04);
  --shadow-md:     0 4px 18px rgba(20,40,65,0.11), 0 1px 4px rgba(20,40,65,0.06);
  --shadow-hover:  0 12px 36px rgba(20,40,65,0.16), 0 2px 8px rgba(20,40,65,0.08);
}

/* ===== リセット ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ===== 基本 ===== */
body {
  font-family: 'Meiryo UI', 'Meiryo', 'Yu Gothic UI', 'Hiragino Sans', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
}

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

/* ===== ページ読み込みアニメーション ===== */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-grid > :nth-child(1)  { animation: cardEnter 0.45s ease both 0.04s; }
.card-grid > :nth-child(2)  { animation: cardEnter 0.45s ease both 0.10s; }
.card-grid > :nth-child(3)  { animation: cardEnter 0.45s ease both 0.16s; }
.card-grid > :nth-child(4)  { animation: cardEnter 0.45s ease both 0.22s; }
.card-grid > :nth-child(5)  { animation: cardEnter 0.45s ease both 0.28s; }
.card-grid > :nth-child(6)  { animation: cardEnter 0.45s ease both 0.34s; }
.card-grid > :nth-child(7)  { animation: cardEnter 0.45s ease both 0.40s; }
.card-grid > :nth-child(8)  { animation: cardEnter 0.45s ease both 0.46s; }
.card-grid > :nth-child(9)  { animation: cardEnter 0.45s ease both 0.52s; }
.card-grid > :nth-child(10) { animation: cardEnter 0.45s ease both 0.58s; }

/* ===== スクロールフェードイン（JS付与） ===== */
.scroll-fade {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.scroll-fade.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== ヘッダー ===== */
header {
  background: var(--surface);
  box-shadow: 0 2px 14px rgba(20,40,65,0.08);
  padding: 0 24px;
  position: relative;
}
header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 100%);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 12px 0;
}

.site-title { position: relative; display: inline-flex; align-items: center; }
.site-title img { height: 58px; width: auto; display: block; }
.site-title span {
  position: absolute;
  left: 100%; bottom: 4px;
  margin-left: 12px;
  font-size: 11px; font-weight: 400; color: var(--text-light);
  white-space: nowrap;
}

nav a { margin-left: 20px; font-size: 14px; color: var(--text-mid); white-space: nowrap; }
nav a:hover { color: var(--primary); text-decoration: none; }

/* ===== 天気バー ===== */
.weather-bar {
  background: linear-gradient(90deg, #0D4F7A 0%, #1570A8 100%);
  display: flex;
  align-items: center;
  height: 34px;
  overflow: hidden;
}

.weather-label {
  flex-shrink: 0;
  color: rgba(255,255,255,0.9);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  width: 130px;
  justify-content: center;
  background-color: rgba(0,0,0,0.2);
  height: 100%;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.weather-label i { font-size: 14px; }

.weather-track-wrap { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; }

.weather-track {
  display: flex; gap: 48px; white-space: nowrap;
  animation: weather-scroll 60s linear infinite;
}
.weather-track span { color: rgba(255,255,255,0.85); font-size: 12px; }

@keyframes weather-scroll {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ===== JEPXティッカーバー ===== */
.jepx-bar {
  background: linear-gradient(90deg, #0A3D2B 0%, #1A6B48 100%);
  display: flex;
  align-items: center;
  height: 34px;
  overflow: hidden;
}

.jepx-label {
  flex-shrink: 0;
  color: rgba(255,255,255,0.9);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  width: 130px;
  justify-content: center;
  background-color: rgba(0,0,0,0.25);
  height: 100%;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.jepx-label i { font-size: 14px; }

.jepx-track-wrap { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; -webkit-transform: translateZ(0); transform: translateZ(0); }

.jepx-track {
  display: flex; gap: 48px; white-space: nowrap;
  animation: weather-scroll 109s linear infinite;
}
.jepx-track span { color: rgba(255,255,255,0.85); font-size: 12px; }

.jepx-date {
  flex-shrink: 0;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  padding: 0 12px;
  white-space: nowrap;
  border-left: 1px solid rgba(255,255,255,0.12);
}

/* ===== コンテナ ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }

/* ===== 検索バー ===== */
.search-section {
  background: linear-gradient(135deg, #0F6A9E 0%, #1A8AC4 100%);
  padding: 36px 24px; text-align: center;
}
.search-section h2 { color: rgba(255,255,255,0.92); font-size: 17px; font-weight: 500; margin-bottom: 16px; letter-spacing: 0.04em; }
.search-box {
  display: flex; max-width: 560px; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}
.search-box input {
  flex: 1; padding: 13px 20px; font-size: 15px; border: none; outline: none;
  font-family: 'Meiryo UI', 'Meiryo', sans-serif;
}
.search-box button {
  background-color: var(--accent); color: #fff; border: none;
  padding: 13px 24px; font-size: 15px; cursor: pointer;
  font-family: 'Meiryo UI', 'Meiryo', sans-serif; font-weight: 700;
  transition: background 0.15s;
}
.search-box button:hover { background-color: #E0570E; }

/* ===== 2カラムレイアウト ===== */
.page-layout { display: flex; gap: 24px; align-items: flex-start; }

.sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border-radius: var(--radius); border: 1px solid var(--border-light);
  padding: 16px 0;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 20px;
}

/* サイドバーボタン */
.sidebar-action-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff !important; text-align: center; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 700;
  text-decoration: none !important;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(26,138,196,0.3);
}
.sidebar-action-btn:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 5px 16px rgba(26,138,196,0.4); }

.sidebar-action-btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--primary) !important;
  text-align: center; padding: 9px 12px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 700;
  text-decoration: none !important;
  border: 2px solid var(--primary-light); margin-top: 8px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.sidebar-action-btn-outline:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); }

.sidebar-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 5px;
}

.sidebar-links { list-style: none; margin: 0; padding: 0; }

.sidebar-links li a {
  display: block; padding: 8px 16px; font-size: 13px; color: var(--text-mid);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, padding-left 0.15s;
}
.sidebar-links li a:hover {
  background-color: var(--primary-light); color: var(--primary-dark);
  border-left-color: var(--primary); padding-left: 20px;
  text-decoration: none;
}

.main-content { flex: 1; min-width: 0; }

/* アコーディオン（高さトランジション） */
.sidebar-has-children { list-style: none; }

.sidebar-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 8px 16px;
  font-size: 13px;
  font-family: 'Meiryo UI', 'Meiryo', sans-serif;
  color: var(--text-mid);
  background: none; border: none; border-left: 3px solid transparent;
  cursor: pointer; text-align: left;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.sidebar-toggle:hover { background-color: var(--primary-light); color: var(--primary-dark); border-left-color: var(--primary); }

.sidebar-toggle-arrow {
  font-size: 9px; color: var(--primary);
  transition: transform 0.25s ease; flex-shrink: 0;
}
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-arrow { transform: rotate(90deg); }

.sidebar-children {
  list-style: none; padding: 0; margin: 0;
  max-height: 0; overflow: hidden;
  background-color: #F5FAFF;
  border-top: 0px solid var(--border-light);
  border-bottom: 0px solid var(--border-light);
  transition: max-height 0.3s ease, border-width 0.3s;
}
.sidebar-children.open {
  max-height: 400px;
  border-top-width: 1px;
  border-bottom-width: 1px;
}
.sidebar-children li a { padding: 6px 16px 6px 30px; font-size: 12px; color: #5A6F80; }

/* ===== セクション ===== */
.section { margin-bottom: 36px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.section-title i {
  font-size: 17px; color: var(--accent);
  background: var(--accent-light);
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-link { font-size: 12px; color: var(--primary); font-weight: 500; }

/* ===== カード ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

a.card-link {
  display: block; text-decoration: none; color: inherit; cursor: pointer;
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}
a.card-link:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 20px;
  background-color: var(--primary-light); color: var(--primary-dark);
}
.tag.news { background-color: var(--accent-light); color: #C04800; }

.card-date { font-size: 11px; color: var(--text-light); }

.card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; line-height: 1.6; color: var(--text); }
.card-summary { font-size: 13px; color: var(--text-mid); margin-bottom: 10px; line-height: 1.7; }

.card-source { font-size: 11px; color: var(--text-light); border-top: 1px solid var(--border-light); padding-top: 10px; margin-top: 4px; }
.card-source a { color: var(--primary); font-size: 11px; }

/* ===== カテゴリグリッド ===== */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.category-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px 16px;
  text-align: center; border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease; cursor: pointer;
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); text-decoration: none; }
.category-icon { font-size: 28px; margin-bottom: 8px; }
.category-name { font-size: 13px; font-weight: 700; color: var(--text); }

/* ===== サブセクション ===== */
.subsection {
  margin-top: 16px; background: var(--primary-light);
  border: 1px solid #B8D8ED; border-radius: var(--radius); padding: 16px 20px;
}
.subsection-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.subsection-note { font-size: 13px; color: var(--text-mid); margin-bottom: 10px; }

.link-placeholder {
  font-size: 13px; color: var(--text-light); font-style: italic;
  padding: 10px; background: var(--surface); border-radius: var(--radius-sm);
  border: 1px dashed var(--border); text-align: center;
}

.subsection-btn {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
  background: var(--primary); color: #fff !important;
  padding: 8px 18px; border-radius: 20px; font-size: 13px; font-weight: 700;
  text-decoration: none !important; transition: background 0.15s;
}
.subsection-btn:hover { background: var(--primary-dark); }

.tag.occto { background-color: #E8F7EE; color: #1A7A40; }
.tag.emsc  { background-color: #F3EEF8; color: #7A3AA0; }

/* ===== NEW バッジ ===== */
.badge-new {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  color: #fff; background: var(--accent);
  padding: 2px 7px; border-radius: 20px; margin-left: 4px;
  vertical-align: middle;
  animation: badgePop 1.8s ease infinite;
}
@keyframes badgePop {
  0%, 100% { opacity: 1; transform: scale(1); }
  40%       { transform: scale(1.12); }
  60%       { opacity: 0.85; transform: scale(0.95); }
}

/* ===== 解説ページ本文 ===== */
.explain-body {
  padding: 8px 0 56px;
  counter-reset: explain-section;
}

/* 見出し：番号バッジ付き */
.explain-h2 {
  counter-increment: explain-section;
  font-size: 16px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 0;
  margin: 36px 0 16px;
  border-bottom: 2px solid var(--border-light);
  position: relative;
}

.explain-h2::before {
  content: counter(explain-section, decimal-leading-zero);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  color: #fff; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.explain-h2::after {
  content: '';
  position: absolute; bottom: -2px; left: 0;
  width: 60px; height: 2px;
  background: var(--primary);
}

/* 本文 */
.explain-body p {
  font-size: 15px; line-height: 1.95; color: var(--text); margin-bottom: 16px;
}

/* 強調テキスト */
.explain-body strong {
  background: linear-gradient(transparent 60%, rgba(255,106,32,0.15) 60%);
  font-weight: 700; padding: 0 2px;
}

/* リスト */
.explain-ul {
  list-style: none;
  font-size: 15px; line-height: 1.9; color: var(--text);
  margin: 0 0 16px 0; padding: 0;
}

.explain-ul li {
  padding: 4px 0 4px 20px;
  position: relative;
  margin-bottom: 4px;
}

.explain-ul li::before {
  content: '';
  position: absolute; left: 0; top: 0.85em;
  width: 7px; height: 7px;
  border-radius: 50%; background: var(--primary);
  opacity: 0.8;
}

.explain-ol {
  font-size: 15px; line-height: 1.9; color: var(--text);
  margin: 0 0 16px 20px;
}
.explain-ol li { margin-bottom: 6px; }
.explain-ol li::marker { color: var(--primary); font-weight: 700; }

/* 参照元ボックス */
.explain-source {
  margin-top: 48px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px; color: var(--text-mid);
}

/* コールアウトボックス（重要事項） */
.explain-callout {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px; line-height: 1.8; color: var(--text);
}

/* ===== 用語集バナー ===== */
.glossary-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--primary-light) 0%, #C8E8F5 100%);
  border: 1px solid #B0D4EA; border-radius: var(--radius);
  padding: 20px 24px; text-decoration: none !important;
  transition: box-shadow 0.2s, transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.glossary-banner:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.glossary-banner-icon { font-size: 30px; flex-shrink: 0; }
.glossary-banner-text { flex: 1; }
.glossary-banner-title { font-size: 15px; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.glossary-banner-desc { font-size: 13px; color: var(--text-mid); }
.glossary-banner-arrow { font-size: 18px; color: var(--primary); flex-shrink: 0; }

/* ===== フッター ===== */
footer {
  background: linear-gradient(135deg, var(--navy) 0%, #1A3A58 100%);
  color: rgba(255,255,255,0.6);
  text-align: center; padding: 28px 24px;
  font-size: 13px; margin-top: 32px;
}
footer a { color: rgba(255,255,255,0.45); }
footer a:hover { color: rgba(255,255,255,0.9); }

/* ===== スマホ対応 ===== */
@media (max-width: 768px) {
  /* ヘッダー */
  .header-inner { justify-content: center; min-height: 56px; }
  .site-title img { height: 44px; }
  .site-title span { display: none; }

  /* コンテナ */
  .container { padding: 16px 12px; }

  /* 2カラム → 1カラム */
  .page-layout { flex-direction: column; }

  /* サイドバーをニュースの下に */
  .sidebar {
    width: 100%;
    position: static;
    order: 2;
  }
  .main-content { order: 1; }

  /* カードグリッドを1カラムに */
  .card-grid { grid-template-columns: 1fr; }

  /* 天気バー・JEPXバーのラベルを短縮 */
  .weather-label,
  .jepx-label { font-size: 10px; width: 105px; }

  /* JEPXバーがスマホで折り返さないようにする */
  .jepx-bar { overflow: hidden; flex-wrap: nowrap; }
  .jepx-track-wrap { overflow: hidden; min-width: 0; }
  .jepx-date { display: none; }
}
