/* ======================================
   ながさきふっこうものがたり — style.css
   ====================================== */

/* ======================================
   ローディング画面（ぽんぽん浮き出るカード）
   ====================================== */
#loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #0c2340 0%, #0c4a6e 60%, #0369a1 100%);
  z-index: 9999;
  overflow: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 画像カード共通 */
.ls-card {
  position: absolute;
  width: 370px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(0,0,0,0.55), 0 6px 16px rgba(0,0,0,0.3);
  opacity: 0;
  animation: ls-pop 0.5s var(--d, 0s) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ls-card img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

/* ぽんっと弾ける */
@keyframes ls-pop {
  0%   { opacity: 0; transform: scale(0.15) rotate(var(--r, 0deg)); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1)    rotate(var(--r, 0deg)); }
}

/* 各カードの位置・遅延・回転（17枚をランダムに散らす） */
.ls-c1  { left: 2%;   top: 4%;   --d: 0.00s; --r: -8deg; }
.ls-c2  { right: 3%;  top: 3%;   --d: 0.12s; --r:  7deg; }
.ls-c3  { left: 3%;   bottom: 6%;--d: 0.24s; --r:  6deg; }
.ls-c4  { right: 2%;  bottom: 5%;--d: 0.36s; --r: -6deg; }
.ls-c5  { left: 27%;  top: 3%;   --d: 0.08s; --r:  4deg; }
.ls-c6  { right: 26%; top: 4%;   --d: 0.20s; --r: -5deg; }
.ls-c7  { left: 26%;  bottom: 5%;--d: 0.32s; --r: -3deg; }
.ls-c9  { left: 2%;   top: 38%;  --d: 0.16s; --r:  3deg; }
.ls-c10 { right: 2%;  top: 36%;  --d: 0.28s; --r: -4deg; }
.ls-c11 { left: 27%;  top: 40%;  --d: 0.40s; --r: -6deg; }
.ls-c12 { right: 26%; top: 38%;  --d: 0.52s; --r:  6deg; }
.ls-c13 { left: 14%;  top: 18%;  --d: 0.60s; --r:  5deg; }
.ls-c14 { right: 14%; top: 20%;  --d: 0.68s; --r: -4deg; }
.ls-c15 { left: 14%;  bottom: 16%;--d: 0.76s; --r: -3deg; }
.ls-c16 { right: 14%; bottom: 14%;--d: 0.84s; --r:  4deg; }
.ls-c17 { left: calc(50% - 185px); top: calc(50% - 130px); --d: 0.92s; --r: -2deg; }

/* タイトル（カードが全部出たあとにフェードイン） */
.loading-title {
  position: absolute;
  bottom: 14%;
  left: 0; right: 0;
  z-index: 2;
  text-align: center;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: clamp(18px, 3.5vw, 30px);
  font-weight: 800;
  color: #fff;
  line-height: 1.7;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
  opacity: 0;
  animation: ls-fade-in 0.7s 1.8s ease forwards;
}

.loading-title rt {
  font-size: 0.45em;
  font-weight: 400;
  color: rgba(255,255,255,0.82);
}

@keyframes ls-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* スキップボタン */
.loading-skip {
  position: absolute;
  bottom: 28px;
  right: 28px;
  padding: 10px 22px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.38);
  border-radius: 100px;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
  z-index: 3;
  transition: background 0.15s;
}

.loading-skip:hover { background: rgba(255,255,255,0.30); }

body:has(#loading-screen:not(.out)) { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  #loading-screen { display: none; }
}

/* モバイル: カード小さめ・overflow防止 */
@media (max-width: 640px) {
  .ls-card { width: 200px; border-radius: 12px; }
  .ls-card img { height: 140px; }
  /* 中間・内側の列は375px端末でoverflow → 非表示 */
  .ls-c5, .ls-c6, .ls-c7,
  .ls-c11, .ls-c12, .ls-c13, .ls-c14, .ls-c15, .ls-c16 { display: none; }
  .ls-c17 { left: calc(50% - 100px); top: calc(50% - 70px); }
}

/* --- CSS 変数 --- */
:root {
  --sky:     #0ea5e9;
  --sky-lt:  #e0f2fe;
  --sky-md:  #bae6fd;
  --sky-dk:  #0369a1;
  --navy:    #0c4a6e;
  --sun:     #f59e0b;
  --sun-lt:  #fef3c7;
  --green:   #059669;
  --purple:  #7c3aed;
  --orange:  #f97316;
  --teal:    #0d9488;
  --white:   #ffffff;
  --bg:      #f0f9ff;
  --text:    #0c4a6e;
  --gray:    #94a3b8;
  --border:  #bae6fd;

  --r-md:   16px;
  --r-lg:   24px;
  --r-pill: 100px;

  --shadow-sm: 0 2px 8px rgba(14, 165, 233, 0.15);
  --shadow-md: 0 4px 20px rgba(14, 165, 233, 0.2);
}

/* --- リセット --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* --- ベースタイポグラフィ --- */
body {
  font-family: 'BIZ UDPGothic', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'M PLUS Rounded 1c', 'BIZ UDPGothic', sans-serif;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

/* ふりがな */
ruby { ruby-align: center; }
rt {
  font-size: 0.5em;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--sky-dk);
}

/* --- レイアウト共通 --- */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ======================================
   ヘッダー
   ====================================== */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--sky-md);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--sky-dk);
  line-height: 1.3;
  letter-spacing: 0.05em;
}

.site-logo .logo-en {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--gray);
  letter-spacing: 0.08em;
}

.header-nav a {
  font-size: 15px;
  font-weight: 700;
  color: var(--sky-dk);
  padding: 8px 18px;
  border-radius: var(--r-pill);
  border: 2px solid var(--sky);
  transition: all 0.15s;
}

.header-nav a:hover {
  background: var(--sky);
  color: var(--white);
}

/* ======================================
   ヒーローセクション
   ====================================== */
.hero {
  color: var(--white);
  text-align: center;
  padding: 140px 24px 180px;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: #0c4a6e;
}

/* 背景スライドショーステージ */
.hero-bg-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.4s ease, transform 8s ease-out;
}

.hero-bg-img.hbg-active {
  opacity: 1;
  transform: scale(1.0);
}

/* 画像の上に暗めのオーバーレイで文字を読みやすく */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(12, 74, 110, 0.62) 0%,
    rgba(3, 105, 161, 0.48) 50%,
    rgba(14, 165, 233, 0.35) 100%
  );
  z-index: 1;
}

.hero-inner { position: relative; z-index: 2; }

.hero-eyebrow {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border-radius: var(--r-pill);
  padding: 6px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(52px, 10vw, 96px);
  line-height: 1.5;
  margin-bottom: 24px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-title em {
  font-style: normal;
  color: #fde68a;
}

.hero-desc {
  font-size: clamp(16px, 2.5vw, 20px);
  max-width: 640px;
  margin: 0 auto 36px;
  opacity: 0.92;
  line-height: 1.9;
}

/* バッジ群 */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  backdrop-filter: blur(4px);
  border-radius: var(--r-pill);
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
}


/* メインCTAボタン */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fbbf24;
  color: #92400e;
  border-radius: var(--r-pill);
  padding: 18px 44px;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2), 0 2px 8px rgba(251,191,36,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}

.hero-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.25), 0 4px 12px rgba(251,191,36,0.5);
}

.hero-cta-arrow {
  display: inline-block;
  animation: bounce-y 1.2s ease-in-out infinite;
  font-size: 1.1em;
}

/* スクロールヒント */
.hero-scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.65;
}

.scroll-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.scroll-arrow {
  font-size: 20px;
  animation: bounce-y 1.4s ease-in-out infinite;
}

@keyframes bounce-y {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}

/* ======================================
   リード文
   ====================================== */
.lead-section {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 28px 0;
}

.lead-text {
  max-width: 820px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 2;
  color: var(--text);
  text-align: center;
}

.lead-text strong {
  color: var(--sky-dk);
  font-weight: 700;
}

/* ======================================
   検索ボックス
   ====================================== */
.search-section {
  padding: 48px 0 0;
}

.search-wrap {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  height: 60px;
  padding: 0 130px 0 22px;
  font-family: 'BIZ UDPGothic', sans-serif;
  font-size: 17px;
  border: 2px solid var(--sky-md);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.2);
}

.search-input::placeholder { color: var(--gray); }

.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 48px;
  padding: 0 22px;
  background: var(--sky);
  color: var(--white);
  border-radius: var(--r-pill);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(14,165,233,0.35);
}

.search-btn:hover { background: var(--sky-dk); }
.search-btn:active { transform: translateY(-50%) scale(0.97); }

/* ======================================
   カテゴリフィルター
   ====================================== */
.filter-section {
  padding: 32px 0 40px;
}

.filter-label {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--sky-dk);
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}

.filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.filter-btn {
  padding: 10px 22px;
  border-radius: var(--r-pill);
  border: 2px solid var(--sky-md);
  background: var(--white);
  color: var(--sky-dk);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--sky);
  background: var(--sky-lt);
}

.filter-btn.active {
  background: var(--sky);
  border-color: var(--sky);
  color: var(--white);
  box-shadow: 0 2px 10px rgba(14,165,233,0.35);
}

/* ======================================
   カード一覧
   ====================================== */
.cards-section {
  padding: 0 0 80px;
}

.cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: flex-start;
}

/* ======================================
   人物カード
   ====================================== */
.story-card[hidden] { display: none !important; }

.story-card {
  width: calc(25% - 24px);
  min-width: 200px;
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 32px 20px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border);
  transition: transform 0.18s, box-shadow 0.18s;
}

.story-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 32px rgba(14,165,233,0.25);
  border-color: var(--sky);
}

.story-card:hover .card-thumb {
  box-shadow: 0 0 0 4px var(--sky-lt), 0 0 0 7px var(--sky), 0 0 20px rgba(14,165,233,0.3);
}

.story-card:hover .btn-read {
  background: var(--sky-dk);
  transform: scale(1.05);
}

/* 円形サムネイル（画像なし時はグラデーション＋頭文字） */
.card-thumb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--white);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--sky-lt), 0 0 0 6px var(--sky-md);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb::before {
  content: attr(data-initial);
}

.card-thumb img ~ * { display: none; }
.card-thumb:has(img)::before { display: none; }

/* カテゴリ別カードカラー */
[data-category="医療"] .card-thumb    { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
[data-category="芸術"] .card-thumb    { background: linear-gradient(135deg, #a855f7, #6d28d9); }
[data-category="教育"] .card-thumb    { background: linear-gradient(135deg, #10b981, #059669); }
[data-category="まちづくり"] .card-thumb { background: linear-gradient(135deg, #f97316, #c2410c); }
[data-category="産業"] .card-thumb    { background: linear-gradient(135deg, #14b8a6, #0d9488); }
[data-category="宗教"] .card-thumb    { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* 人物名 */
.card-name {
  font-size: 22px;
  color: var(--navy);
  margin-top: 4px;
}

/* キャッチコピー */
.card-catch {
  font-size: 13px;
  color: var(--sky-dk);
  line-height: 1.7;
  flex: 1;
}

/* タグ */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.tag {
  font-size: 12px;
  font-weight: 700;
  background: var(--sun-lt);
  color: #92400e;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  letter-spacing: 0.02em;
}

/* よむボタン */
.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  border-radius: var(--r-pill);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(249,115,22,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.btn-read::before { content: '📄'; font-size: 15px; }
.btn-read::after  { content: '→'; font-size: 16px; font-weight: 900; }

.btn-read:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(249,115,22,0.5);
}

.btn-read:active { transform: scale(0.97); }

/* 準備中カード */
.story-card.coming-soon {
  opacity: 0.6;
  pointer-events: none;
}

.story-card.coming-soon .btn-read {
  background: var(--gray);
  box-shadow: none;
}

.story-card.coming-soon .btn-read::before,
.story-card.coming-soon .btn-read::after { content: ''; }

.badge-soon {
  font-size: 12px;
  font-weight: 700;
  background: var(--gray);
  color: var(--white);
  border-radius: var(--r-pill);
  padding: 3px 10px;
}

/* 検索結果なし */
.no-results {
  text-align: center;
  padding: 60px 20px;
  font-size: 18px;
  color: var(--gray);
  width: 100%;
}

.no-results strong {
  color: var(--sky-dk);
}

/* ======================================
   カード件数バッジ
   ====================================== */
.cards-count {
  text-align: center;
  margin-bottom: 24px;
  font-size: 15px;
  color: var(--sky-dk);
  font-weight: 700;
}

/* ======================================
   フッター
   ====================================== */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.8);
  padding: 48px 24px;
  text-align: center;
}

.footer-title {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--sky); }

.footer-copy {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-top: 12px;
}

/* ======================================
   物語ページ（stories/*.html）共通
   PDF版のカラーリングに合わせる:
   4コマまんが=緑 / タイムライン=赤 / エピソード=橙 / もっとしりたい=青
   ====================================== */
:root {
  --story-green:  #00bf63;
  --story-red:    #ff5757;
  --story-orange: #ffbd59;
  --story-blue:   #5170ff;
  --story-name:   #ff914d;
  --story-cream:  #ebe4cf;
  --story-tl-dark:  #004aad;
  --story-tl-light: #38b6ff;
}

body:has(.story-main) {
  background: var(--white);
}

.story-hero {
  background: var(--white);
  color: var(--text);
  padding: 48px 24px 32px;
  border-bottom: 2px solid var(--border);
}

.story-hero-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 40px;
  align-items: center;
}

.story-hero-media img {
  width: 100%;
  border-radius: var(--r-lg);
  box-shadow: 0 8px 28px rgba(12,74,110,0.18);
}

.story-hero-eyebrow {
  font-size: 14px;
  font-weight: 700;
  color: var(--story-name);
  margin-bottom: 6px;
  line-height: 1.7;
}

.story-hero-title {
  font-size: clamp(34px, 5vw, 52px);
  color: var(--story-name);
  margin-bottom: 16px;
}

.story-hero-desc {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
}

.story-hero-cat {
  display: inline-block;
  background: var(--story-green);
  color: var(--white);
  border-radius: var(--r-pill);
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* セクションナビ（sticky・PDFの4色ピルを再現） */
.story-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--white);
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}

.story-nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  padding: 14px 24px;
}

.story-nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  color: var(--white);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  transition: transform 0.15s, box-shadow 0.15s;
}

.story-nav a:hover { transform: translateY(-2px); }
.story-nav a:active { transform: translateY(0); }

.story-nav a[href="#comic"]   { background: var(--story-green); }
.story-nav a[href="#timeline"]{ background: var(--story-red); }
.story-nav a[href="#episode"] { background: var(--story-orange); color: #7c4a00; }
.story-nav a[href="#video"]   { background: var(--navy); }
.story-nav a[href="#more"]    { background: var(--story-blue); }

.story-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  background: var(--white);
}

.story-section {
  padding: 56px 0;
  border-bottom: 2px solid var(--border);
  scroll-margin-top: 76px;
}

.story-section:last-of-type { border-bottom: none; }

.story-section h2 {
  font-size: clamp(24px, 4vw, 32px);
  text-align: center;
  margin-bottom: 32px;
}

/* セクション見出しの色分け（PDF準拠） + 見出し前の小ピルバッジ */
.story-section h2::before {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  margin-right: 12px;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

#comic h2    { color: var(--story-green); }
#comic h2::before    { content: '📖 4コマまんが'; background: var(--story-green); }
#timeline h2 { color: var(--story-red); }
#timeline h2::before { content: '🕐 タイムライン'; background: var(--story-red); }
#episode h2  { color: #d9820a; }
#episode h2::before  { content: '▶ エピソード'; background: var(--story-orange); color: #7c4a00; }
#video h2    { color: var(--navy); }
#video h2::before    { content: '🎬 どうが'; background: var(--navy); }
#more h2     { color: var(--story-blue); }
#more h2::before     { content: '🔍 もっとしりたい'; background: var(--story-blue); }

@media (max-width: 540px) {
  .story-section h2::before {
    display: table;
    margin: 0 auto 12px;
  }
}

/* 4コマまんが */
.comic-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.comic-panel {
  border: 2px solid var(--navy);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.comic-panel img {
  width: 100%;
  display: block;
}

.comic-panel-caption {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #0a7a41;
  background: #e7f9ef;
}

/* タイムライン（PDFの矢羽根リボンを再現・紺と水色の交互配色） */
.story-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-step {
  display: grid;
  grid-template-columns: 110px 220px 1fr;
  gap: 20px;
  align-items: stretch;
  padding: 4px 0;
}

.timeline-date {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  padding-top: 28px;
  line-height: 1.5;
}

.timeline-chevron {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 34px;
  color: var(--white);
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  line-height: 1.4;
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
}

.timeline-step:nth-child(odd)  .timeline-chevron { background: var(--story-tl-dark); }
.timeline-step:nth-child(even) .timeline-chevron { background: var(--story-tl-light); }

.timeline-body {
  padding: 18px 24px;
}

.timeline-body p {
  font-size: 14px;
  line-height: 1.9;
}

/* エピソード */
.story-episode p {
  font-size: 16px;
  line-height: 2;
  margin-bottom: 1em;
}

/* どうが */
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--navy);
}

.video-frame img,
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--white);
  background: linear-gradient(160deg, #0c4a6e, #0369a1);
}

.video-placeholder .badge-soon {
  font-size: 14px;
  padding: 6px 18px;
}

.video-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-play-btn::after {
  content: '▶';
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--sky-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* もっとしりたい（PDF準拠: クリーム背景＋青枠） */
#more {
  background: var(--story-cream);
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.more-links {
  border: 2px solid var(--story-blue);
  border-radius: var(--r-md);
  padding: 24px 28px;
  background: var(--white);
  max-width: 700px;
  margin: 0 auto;
}

.more-links li {
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 10px;
}

.more-links li:last-child { margin-bottom: 0; }

.more-links a {
  color: var(--story-blue);
  font-weight: 700;
  word-break: break-all;
  text-decoration: underline;
}

/* フッター前アクション（PDF DL・他の物語） */
.story-actions {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  background: var(--story-cream);
}

.story-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 30px;
  border-radius: var(--r-pill);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.15s, box-shadow 0.15s;
}

.story-actions .btn-pdf {
  background: var(--white);
  color: var(--sky-dk);
  border: 2px solid var(--sky);
}

.story-actions .btn-pdf:hover { background: var(--sky-lt); }

.story-actions .btn-others {
  background: var(--sky);
  color: var(--white);
}

.story-actions .btn-others:hover { background: var(--sky-dk); }

@media (max-width: 700px) {
  .story-hero-inner { grid-template-columns: 1fr; }
  .story-section { padding: 40px 0; }
  .timeline-step {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 0 0 28px;
  }
  .timeline-date { text-align: left; padding-top: 0; font-size: 13px; }
  .timeline-chevron {
    clip-path: none;
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 14px;
    text-align: left;
    justify-content: flex-start;
  }
  .timeline-body { padding: 4px 2px 0; }
  .video-play-btn::after { width: 60px; height: 60px; font-size: 20px; }
}

/* ======================================
   about ページ固有
   ====================================== */
.about-hero {
  background: linear-gradient(160deg, #0369a1, #0ea5e9);
  color: var(--white);
  padding: 60px 24px;
  text-align: center;
}

.about-hero h1 { font-size: clamp(22px, 4vw, 36px); margin-bottom: 12px; }
.about-hero p  { font-size: 17px; opacity: 0.9; }

.about-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 24px;
}

.about-section h2 {
  font-size: 24px;
  color: var(--sky-dk);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--sky-md);
}

.about-section p, .about-section li {
  font-size: 17px;
  line-height: 1.9;
  margin-bottom: 16px;
  color: var(--text);
}

.about-section ul { margin-left: 1.5em; }
.about-section li { list-style: disc; }

.about-box {
  background: var(--sky-lt);
  border-left: 4px solid var(--sky);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 24px 28px;
  margin: 24px 0;
}

.about-box h3 {
  font-size: 18px;
  color: var(--sky-dk);
  margin-bottom: 12px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--sky);
  color: var(--white);
  border-radius: var(--r-pill);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
  margin-top: 32px;
}

.btn-back:hover { background: var(--sky-dk); }

/* ======================================
   レスポンシブ
   ====================================== */
@media (max-width: 1000px) {
  .story-card { width: calc(33.3% - 22px); }
}

@media (max-width: 700px) {
  .story-card { width: calc(50% - 16px); }
  .cards-grid { gap: 20px; }
  .hero { padding: 100px 20px 120px; min-height: 100svh; }
  .hero-title { font-size: clamp(34px, 9vw, 52px); line-height: 1.35; }
  .hero-desc { font-size: 15px; line-height: 1.85; }
  .hero-badge { font-size: 13px; padding: 6px 14px; }
  .header-inner { gap: 10px; }
  .site-logo { font-size: 17px; }
  .lead-text { font-size: 14px; line-height: 1.9; text-align: left; }
  .search-input { font-size: 15px; height: 54px; padding: 0 110px 0 18px; }
  .search-btn { height: 44px; padding: 0 18px; font-size: 14px; }
  .filter-btn { font-size: 13px; padding: 8px 16px; }
}

@media (max-width: 540px) {
  .site-logo { font-size: 13px; letter-spacing: 0.02em; }
  .logo-en { display: none; }
  .header-nav a { font-size: 12px; padding: 6px 12px; }
  .header-inner { padding: 12px 16px; }
}

@media (max-width: 440px) {
  .story-card { width: 100%; min-width: 0; }
  .cards-grid { gap: 16px; }
  .card-thumb { width: 100px; height: 100px; font-size: 36px; }
  .card-name { font-size: 20px; }
}

/* ======================================
   物語ページ: ステップ学習レイアウト（.senjin-*）
   ステップ1 つかむ / 2 しらべる / 3 まとめる
   ====================================== */
.senjin {
  --step-color: var(--story-green);
  background: var(--bg);
  padding: 28px 20px 56px;
}

.senjin[data-current-step="2"] { --step-color: var(--story-blue); }
.senjin[data-current-step="3"] { --step-color: var(--sun); }

.senjin-inner {
  max-width: 1000px;
  margin: 0 auto;
}

/* --- 人物・現在ステップの見出し --- */
.senjin-head {
  display: grid;
  grid-template-columns: 1fr auto 128px;
  gap: 24px;
  align-items: center;
  background: var(--white);
  border: 3px solid var(--step-color);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.senjin-head-theme {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--sky-dk);
  margin-bottom: 2px;
}

.senjin-head-copy {
  display: inline-block;
  background: var(--sky-lt);
  color: var(--sky-dk);
  border-radius: var(--r-pill);
  padding: 3px 14px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.senjin-head-name {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 800;
  color: var(--story-name);
  line-height: 1.25;
}

.senjin-head-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--step-color);
  color: var(--white);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  transition: background 0.2s;
}

.senjin-head-step-num { font-size: 13px; font-weight: 700; }
.senjin-head-step-num b { font-size: 20px; margin-left: 2px; }
.senjin-head-step-unit { font-size: 20px; font-weight: 800; }

.senjin-head-media img {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
}

/* --- ステップ切替タブ --- */
.senjin-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.senjin-step-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--white);
  border: 2px solid var(--border);
  border-bottom: none;
  color: var(--sky-dk);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  text-align: center;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.senjin-step-btn:hover { transform: translateY(-2px); }
.senjin-step-btn-num  { font-size: 12px; font-weight: 700; opacity: 0.85; }
.senjin-step-btn-name { font-size: 18px; font-weight: 800; }

.senjin-step-btn.is-current {
  background: var(--step-color);
  border-color: var(--step-color);
  color: var(--white);
}

/* --- ステップ内のトピックナビ --- */
.senjin-navi {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--step-color);
  padding: 12px;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: background 0.2s;
}

.senjin-navi a {
  flex: 1 1 auto;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  transition: background 0.15s, transform 0.15s;
}

.senjin-navi a:hover { transform: translateY(-2px); background: var(--white); }

.senjin-navi a.is-current {
  background: var(--navy);
  color: var(--white);
}

/* --- 本文エリア --- */
.senjin-body {
  background: var(--white);
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 36px 32px 28px;
}

.senjin-topic[hidden] { display: none; }

.senjin-topic-title {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: clamp(21px, 3.4vw, 30px);
  font-weight: 800;
  color: var(--step-color);
  line-height: 1.45;
  padding-bottom: 14px;
  margin-bottom: 28px;
  border-bottom: 3px solid var(--border);
}

.senjin-title-green  { color: var(--story-green); }
.senjin-title-red    { color: var(--story-red); }
.senjin-title-orange { color: #d9820a; }
.senjin-title-blue   { color: var(--story-blue); }
.senjin-title-navy   { color: var(--navy); }
.senjin-title-sun    { color: #d97706; }

.senjin-text p {
  font-size: 15px;
  line-height: 2;
  margin-bottom: 1.1em;
}

.senjin-text p:last-child { margin-bottom: 0; }
.senjin-text-lg p { font-size: 16px; }

/* --- 地図（クリックで読み込み） --- */
.senjin-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--sky-md);
  background: var(--sky-lt);
  margin-bottom: 20px;
}

.senjin-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.senjin-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}

.senjin-map-icon { font-size: 40px; }

.senjin-map-placeholder p {
  font-size: 14px;
  font-weight: 700;
  color: var(--sky-dk);
}

.senjin-map-btn {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--white);
  background: var(--sky);
  border: none;
  border-radius: var(--r-pill);
  padding: 12px 28px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.senjin-map-btn:hover { background: var(--sky-dk); }

/* --- 補足ボックス --- */
.senjin-note {
  background: var(--sky-lt);
  border-left: 5px solid var(--sky);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.senjin-note p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
}

.senjin-note p b { color: var(--sky-dk); }

.senjin-note-sun {
  background: var(--sun-lt);
  border-left-color: var(--sun);
  margin: 28px 0 0;
}

/* --- 先人プロフィール --- */
.senjin-profile {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
}

.senjin-profile-photo img {
  width: 100%;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
}

.senjin-profile-catch {
  font-size: 14px;
  font-weight: 700;
  color: var(--story-name);
  margin-bottom: 12px;
  line-height: 1.7;
}

.senjin-balloon {
  position: relative;
  background: var(--sun-lt);
  border: 2px solid var(--sun);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.95;
  margin-bottom: 20px;
}

.senjin-balloon::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 26px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-right-color: var(--sun);
}

.senjin-profile-list > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  line-height: 1.8;
}

.senjin-profile-list > div:last-child { border-bottom: none; }
.senjin-profile-list dt { font-weight: 700; color: var(--sky-dk); }

/* --- まとめ学習の問い --- */
.senjin-quiz {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.senjin-quiz li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
  background: var(--sun-lt);
  border: 2px solid var(--sun);
  border-radius: var(--r-md);
  padding: 18px 20px;
  list-style: none;
}

.senjin-quiz-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sun);
  color: var(--white);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 16px;
  font-weight: 800;
}

.senjin-quiz-q {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.9;
  margin-bottom: 6px;
}

.senjin-quiz-hint {
  font-size: 13px;
  line-height: 1.8;
  color: var(--sky-dk);
}

/* --- 下部ナビ（つぎへ／もどる・すすむ） --- */
.senjin-foot {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.senjin-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--sky-dk);
}

.senjin-next span { text-decoration: underline; }
.senjin-next::after { content: '→'; }

.senjin-btns { display: flex; gap: 12px; }

.senjin-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 30px;
  border-radius: var(--r-pill);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.15s, background 0.15s;
}

.senjin-btn:hover { transform: translateY(-2px); }

.senjin-btn.is-prev {
  background: var(--white);
  color: var(--sky-dk);
  border: 2px solid var(--sky);
}

.senjin-btn.is-next {
  background: var(--sky);
  color: var(--white);
  border: 2px solid var(--sky);
}

.senjin-btn.is-disabled {
  background: #f1f5f9;
  color: var(--gray);
  border: 2px solid var(--border);
  pointer-events: none;
}

/* --- 本文中で流用する既存パーツの余白調整 --- */
.senjin-topic .comic-list,
.senjin-topic .story-timeline,
.senjin-topic .more-links,
.senjin-topic .video-frame { margin-top: 4px; }

.senjin-topic .more-links { margin-left: auto; margin-right: auto; }

/* --- レスポンシブ --- */
@media (max-width: 860px) {
  .senjin-head { grid-template-columns: 1fr auto; }
  .senjin-head-media { display: none; }
  .senjin-profile { grid-template-columns: 1fr; gap: 20px; }
  .senjin-profile-photo { max-width: 260px; }
  .senjin-balloon::before { left: 26px; top: -12px; border-right-color: transparent; border-bottom-color: var(--sun); }
}

@media (max-width: 700px) {
  .senjin { padding: 20px 14px 44px; }
  .senjin-head { padding: 16px 18px; gap: 14px; }
  .senjin-head-step { padding: 8px 12px; }
  .senjin-head-step-unit { font-size: 16px; }
  .senjin-head-step-num b { font-size: 17px; }
  .senjin-body { padding: 26px 18px 22px; }
  .senjin-steps { gap: 5px; }
  .senjin-step-btn { padding: 9px 4px; }
  .senjin-step-btn-num  { font-size: 11px; }
  .senjin-step-btn-name { font-size: 15px; }
  .senjin-navi { padding: 10px; gap: 6px; }
  .senjin-navi a { min-width: 0; flex: 1 1 46%; font-size: 13px; padding: 9px 8px; }
  .senjin-navi a br.is-pc { display: none; }
  .senjin-foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .senjin-btns { justify-content: space-between; }
  .senjin-btn { flex: 1; justify-content: center; padding: 12px 16px; }
  .senjin-profile-list > div { grid-template-columns: 1fr; gap: 2px; }
  .senjin-quiz li { grid-template-columns: 44px 1fr; gap: 12px; padding: 16px 14px; }
  .senjin-quiz-num { width: 36px; height: 36px; font-size: 14px; }
  .senjin-map { aspect-ratio: 4 / 3; }
}

@media (max-width: 420px) {
  .senjin-head { grid-template-columns: 1fr; }
  .senjin-head-step { flex-direction: row; align-self: start; gap: 8px; }
  .senjin-navi a { flex: 1 1 100%; }
}

/* プレビュー用: 最終トピックの終端表示 */
.senjin-next.is-end { color: var(--gray); }
.senjin-next.is-end::after { content: ''; }
