/* =========================================================
   インド五千年史 共通デザイン
   色・文字・レイアウトはここでまとめて管理しています
   ========================================================= */

/* ---- 色の設定（ここを変えるとサイト全体の色が変わります） ---- */
:root {
  --ink: #1f1a17;          /* 本文の文字色 */
  --ink-soft: #5b5048;     /* 補足の文字色 */
  --paper: #fbf6ee;        /* 背景（生成り色） */
  --paper-2: #f3e9da;      /* 少し濃い背景 */
  --saffron: #d9731a;      /* サフラン色（インドの象徴色） */
  --saffron-deep: #a8520c;
  --indigo: #1d2a4d;       /* 藍色 */
  --gold: #c9a24a;         /* 金色 */
  --green: #2f6b4f;        /* 緑（国旗の色） */
  --line: #e2d5c1;         /* 罫線 */
  --night: #120f0d;        /* ドラマチックな場面の背景 */
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 70px; } /* ページ内リンクで飛んだとき、見出しがヘッダーに隠れないように */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.95;
  letter-spacing: .02em;
}
img { max-width: 100%; display: block; }
a { color: var(--saffron-deep); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.4; letter-spacing: .04em; }

/* ---- ヘッダー（全ページ共通・common.js が中身を入れます） ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(29, 42, 77, .96);
  backdrop-filter: blur(6px);
  color: #fff;
  border-bottom: 3px solid var(--saffron);
}
.site-header .inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px;
}
.brand { color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.brand span { color: var(--gold); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #e8e3da; text-decoration: none; font-size: .9rem;
  padding: 6px 12px; border-radius: 999px;
}
.nav a:hover { background: rgba(255,255,255,.1); }
.nav a.active { background: var(--saffron); color: #fff; }
.menu-btn { display: none; background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 1rem; }

@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 63px; left: 0; right: 0; background: var(--indigo); flex-direction: column; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
}

/* ---- ヒーロー（ページ最上部の大きな写真） ---- */
.hero {
  position: relative; min-height: 78vh;
  display: flex; align-items: flex-end;
  color: #fff; overflow: hidden; background: var(--night);
}
.hero.short { min-height: 56vh; }
.hero img.bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: .72; animation: slowzoom 24s ease-out forwards;
}
@keyframes slowzoom { from { transform: scale(1.08); } to { transform: scale(1); } }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05) 30%, rgba(10,8,6,.88) 100%);
}
.hero .hero-text { position: relative; z-index: 2; max-width: 1100px; margin: 0 auto; padding: 48px 16px 56px; width: 100%; }
.hero .kicker { color: var(--gold); font-size: .95rem; letter-spacing: .3em; }
.hero h1 { font-size: clamp(2rem, 6vw, 4rem); margin: .2em 0 .3em; text-shadow: 0 2px 20px rgba(0,0,0,.6); }
.hero p.lead { font-size: clamp(1rem, 2vw, 1.2rem); max-width: 760px; color: #f1ebe2; }
.hero .credit-inline { position: absolute; right: 12px; bottom: 8px; z-index: 3; font-size: .7rem; color: rgba(255,255,255,.6); }
.hero .credit-inline a { color: rgba(255,255,255,.7); }

/* ---- 本文の器 ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; margin: 0 auto; padding: 0 16px; }
section.block { padding: 72px 0; }
section.block.alt { background: var(--paper-2); }
.sec-title { font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin: 0 0 .2em; }
.sec-title small { display: block; font-family: var(--sans); font-size: .85rem; color: var(--saffron); letter-spacing: .3em; font-weight: 400; }
.sec-lead { color: var(--ink-soft); margin-bottom: 2em; }

/* ---- 写真（figure） ---- */
figure.ph { margin: 1.6em 0; }
figure.ph img { width: 100%; border-radius: 6px; cursor: zoom-in; box-shadow: 0 6px 24px rgba(0,0,0,.12); background: #ddd; }
figure.ph figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .5em; line-height: 1.6; }
.credit { display: block; font-size: .72rem; color: #9a8d80; margin-top: 2px; }
.credit a { color: #9a8d80; }
.float-r { float: right; width: 42%; margin: .3em 0 1em 1.6em; }
.float-l { float: left; width: 42%; margin: .3em 1.6em 1em 0; }
.clear { clear: both; }
@media (max-width: 700px) { .float-r, .float-l { float: none; width: 100%; margin: 1.2em 0; } }

/* 写真ギャラリー */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 1.5em 0; }
.gallery figure.ph { margin: 0; }
.gallery figure.ph img { aspect-ratio: 4/3; object-fit: cover; }

/* ---- カード ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: #fff; border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink);
  box-shadow: 0 4px 18px rgba(60,40,20,.08); transition: transform .25s, box-shadow .25s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(60,40,20,.16); }
.card img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.card .body { padding: 16px 18px 20px; }
.card .era { font-size: .78rem; color: var(--saffron); letter-spacing: .1em; }
.card h3 { margin: .2em 0 .4em; font-size: 1.25rem; }
.card p { margin: 0; font-size: .92rem; color: var(--ink-soft); line-height: 1.75; }

/* ---- 時代の帯（トップページ） ---- */
.eraband { display: flex; border-radius: 8px; overflow: hidden; margin: 24px 0; font-size: .78rem; }
.eraband a { color: #fff; text-decoration: none; padding: 14px 6px; text-align: center; line-height: 1.4; flex: 1; }
.eraband a:hover { filter: brightness(1.15); }
@media (max-width: 700px) { .eraband { flex-direction: column; } }

/* ---- 年表 ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; position: sticky; top: 64px; z-index: 10; background: var(--paper); padding: 12px 0; }
.filters button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 16px; font: inherit; font-size: .88rem; cursor: pointer;
}
.filters button.on { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.era-head {
  margin: 56px 0 18px; padding: 18px 22px; border-radius: 8px; color: #fff;
  background: var(--indigo); display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
.era-head h2 { margin: 0; font-size: 1.5rem; }
.era-head span { color: var(--gold); font-size: .9rem; }
.tl { position: relative; margin-left: 10px; padding-left: 28px; border-left: 3px solid var(--line); }
.tl-item { position: relative; margin: 0 0 26px; display: grid; grid-template-columns: 1fr 180px; gap: 18px; align-items: start; }
.tl-item.noimg { grid-template-columns: 1fr; }
.tl-item::before {
  content: ""; position: absolute; left: -37px; top: 8px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 3px solid var(--saffron);
}
.tl-item.big::before { background: var(--saffron); width: 19px; height: 19px; left: -39px; }
.tl-year { font-family: var(--serif); color: var(--saffron-deep); font-weight: 700; font-size: 1.05rem; }
.tl-item h3 { margin: 0 0 .2em; font-size: 1.15rem; }
.tl-item p { margin: 0; font-size: .95rem; color: #3d342e; }
.tl-item img { border-radius: 6px; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.tag { display: inline-block; font-size: .7rem; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; color: #fff; font-family: var(--sans); font-weight: 400; }
.tag.pol { background: var(--indigo); }
.tag.war { background: #a23b2a; }
.tag.rel { background: var(--saffron); }
.tag.cul { background: var(--green); }
.tl-item a.more { font-size: .85rem; }
@media (max-width: 640px) { .tl-item { grid-template-columns: 1fr; } .tl-item img { max-width: 260px; } }

/* ---- ドラマチックな物語ブロック（出来事ページ） ---- */
.story { position: relative; color: #f3ece2; background: var(--night); overflow: hidden; }
.story .story-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.story::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,8,6,.92) 0%, rgba(10,8,6,.7) 60%, rgba(10,8,6,.5) 100%); z-index: 1; }
.story .inner { position: relative; z-index: 2; max-width: 860px; margin: 0 auto; padding: 90px 16px; }
.story .date { color: var(--gold); letter-spacing: .25em; font-size: .9rem; }
.story h2 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); margin: .2em 0 .6em; color: #fff; }
.story p { font-size: 1.05rem; line-height: 2.1; }
.story .voice {
  font-family: var(--serif); font-size: 1.25rem; color: #fff; border-left: 3px solid var(--saffron);
  padding: .4em 0 .4em 1em; margin: 1.6em 0; line-height: 1.9;
}
.story .voice cite { display: block; font-size: .85rem; color: var(--gold); font-style: normal; margin-top: .4em; }
.story figure.ph figcaption, .story .credit, .story .credit a { color: #b9ad9e; }
.story .facts { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: 8px; padding: 14px 18px; font-size: .9rem; margin-top: 2em; }
.story .facts b { color: var(--gold); }
.story a { color: #f4b673; }

/* ---- 目次 ---- */
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.toc a { display: block; background: #fff; padding: 12px 14px; border-radius: 8px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--saffron); font-size: .92rem; line-height: 1.5; }
.toc a small { display: block; color: var(--saffron-deep); font-size: .75rem; }
.toc a:hover { background: #fff6ea; }

/* ---- 王朝ページの基本データ表 ---- */
.datatable { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; font-size: .95rem; }
.datatable th, .datatable td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.datatable th { width: 28%; background: var(--paper-2); font-weight: 500; white-space: nowrap; }

/* 囲み記事 */
.box { background: #fff; border-radius: 10px; padding: 22px 26px; margin: 2em 0; border-top: 4px solid var(--saffron); box-shadow: 0 4px 18px rgba(60,40,20,.06); }
.box h3 { margin-top: 0; }
.box.buddha { border-top-color: var(--gold); background: #fffaf0; }
.box.buddha h3::before { content: "☸ "; color: var(--gold); }

/* 人物カード */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin: 1.5em 0; }
.person { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 3px 14px rgba(60,40,20,.06); }
.person h4 { margin: 0 0 .3em; font-size: 1.1rem; }
.person .life { font-size: .78rem; color: var(--saffron-deep); }
.person p { font-size: .92rem; margin: .4em 0 0; line-height: 1.8; }

/* 前後ページの移動 */
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 50px 0 0; flex-wrap: wrap; }
.pager a { flex: 1; min-width: 220px; background: var(--indigo); color: #fff; text-decoration: none; padding: 16px 20px; border-radius: 8px; font-size: .95rem; }
.pager a.next { text-align: right; }
.pager a small { display: block; color: var(--gold); font-size: .75rem; }

/* ---- 写真の拡大表示（ライトボックス） ---- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox img { max-height: 84vh; max-width: 100%; object-fit: contain; }
.lightbox .cap { color: #ddd; font-size: .9rem; margin-top: 10px; text-align: center; max-width: 800px; }
.lightbox .close { position: absolute; top: 12px; right: 18px; color: #fff; font-size: 2rem; background: none; border: 0; cursor: pointer; }

/* ---- フッター ---- */
.site-footer { background: var(--indigo); color: #cfd3df; padding: 40px 16px; margin-top: 0; font-size: .88rem; }
.site-footer .inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--gold); }

/* スクロールで浮かび上がる演出 */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s, transform .9s; }
.reveal.show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } .hero img.bg { animation: none; } }

/* 引用（本文中） */
blockquote.q { font-family: var(--serif); font-size: 1.15rem; border-left: 3px solid var(--saffron); margin: 1.6em 0; padding: .3em 0 .3em 1.1em; color: #3a2f27; }
blockquote.q cite { display: block; font-size: .82rem; color: var(--ink-soft); font-style: normal; margin-top: .3em; }
.note { font-size: .82rem; color: var(--ink-soft); }
