/* =========================================================
   古事記 ― 現代語訳と解説
   和モダン スタイルシート
   ========================================================= */

:root {
  --paper:        #f7f3ea;   /* 和紙のような生成り */
  --paper-deep:   #efe8d8;
  --sumi:         #1b1a17;   /* 墨 */
  --sumi-soft:    #4a463d;
  --shu:          #b7282e;   /* 朱 */
  --shu-deep:     #8f1d22;
  --gold:         #a8884c;   /* 金茶 */
  --line:         #d9cfb8;
  --shadow:       rgba(40, 30, 10, 0.10);
  --serif: "Shippori Mincho B1", "Noto Serif JP", "Hiragino Mincho ProN",
           "Yu Mincho", "YuMincho", serif;
  --sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic",
          system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--sumi);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(183, 40, 46, 0.03), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(168, 136, 76, 0.05), transparent 45%);
  line-height: 1.9;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------- ヘッダー ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 234, 0.85);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.site-title {
  font-size: 20px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--sumi); margin: 0;
}
.site-title a { color: inherit; }
.site-title a:hover { text-decoration: none; color: var(--shu); }
.site-nav a { margin-left: 20px; font-size: 14px; color: var(--sumi-soft); }

/* ---------- ヒーロー ---------- */
.hero {
  text-align: center;
  padding: 80px 24px 64px;
  position: relative;
}
.hero .seal {
  display: inline-block;
  font-size: 13px; letter-spacing: 0.4em; color: var(--shu);
  border: 1px solid var(--shu); border-radius: 4px;
  padding: 4px 14px; margin-bottom: 28px;
}
.hero h1 {
  font-size: 56px; margin: 0 0 8px; letter-spacing: 0.2em;
  font-weight: 800;
}
.hero .yomi { color: var(--gold); letter-spacing: 0.5em; font-size: 14px; }
.hero .lead {
  max-width: 560px; margin: 28px auto 0; color: var(--sumi-soft);
  font-size: 17px;
}

/* ---------- セクション見出し ---------- */
.section-head {
  text-align: center; margin: 64px 0 36px;
}
.section-head h2 {
  display: inline-block; font-size: 24px; letter-spacing: 0.2em; margin: 0;
  position: relative; padding-bottom: 12px;
}
.section-head h2::after {
  content: ""; position: absolute; left: 50%; bottom: 0;
  width: 40px; height: 2px; background: var(--shu); transform: translateX(-50%);
}
.section-head p { color: var(--sumi-soft); font-size: 14px; margin: 10px 0 0; }

/* ---------- エピソード一覧 ---------- */
.episode-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
.episode-card {
  display: block; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 24px 24px 26px; box-shadow: 0 2px 10px var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  color: inherit;
}
.episode-card:hover {
  transform: translateY(-3px); box-shadow: 0 10px 24px var(--shadow);
  border-color: var(--gold); text-decoration: none;
}
.episode-card .num {
  font-size: 13px; color: var(--shu); letter-spacing: 0.2em; font-weight: 700;
}
.episode-card h3 {
  font-size: 20px; margin: 8px 0 6px; letter-spacing: 0.08em;
}
.episode-card .kana { font-size: 12px; color: var(--gold); letter-spacing: 0.2em; }
.episode-card .desc {
  font-size: 14px; color: var(--sumi-soft); margin: 12px 0 0; line-height: 1.7;
}

/* ---------- 記事ページ ---------- */
.breadcrumb {
  font-size: 13px; color: var(--sumi-soft); padding: 20px 0 0;
}
.breadcrumb a { color: var(--sumi-soft); }

.article-head { padding: 28px 0 12px; border-bottom: 1px solid var(--line); }
.article-head .num { color: var(--shu); font-size: 14px; letter-spacing: 0.25em; font-weight: 700; }
.article-head h1 { font-size: 38px; margin: 10px 0 6px; letter-spacing: 0.12em; }
.article-head .kana { color: var(--gold); letter-spacing: 0.3em; font-size: 13px; }

.article-body { padding: 8px 0 40px; }

/* ブロック（原文・現代語訳・解説） */
.block { margin: 40px 0; }
.block-label {
  display: inline-block; font-size: 13px; letter-spacing: 0.25em;
  color: #fff; background: var(--sumi); border-radius: 4px;
  padding: 3px 14px; margin-bottom: 16px;
}
.block-label.genbun  { background: var(--sumi); }
.block-label.yakubun { background: var(--shu); }
.block-label.kaisetsu{ background: var(--gold); }

.genbun-text {
  font-size: 16px; color: var(--sumi-soft); line-height: 2.2;
  background: var(--paper-deep); border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0; padding: 20px 24px; letter-spacing: 0.04em;
}
.yakubun-text { font-size: 18px; line-height: 2.15; }
.yakubun-text p { margin: 0 0 1.3em; }
.kaisetsu-text { font-size: 16px; line-height: 2.05; color: var(--sumi-soft); }
.kaisetsu-text p { margin: 0 0 1.2em; }
.kaisetsu-text strong { color: var(--sumi); font-weight: 700; }

/* 神様メモ */
.kami-note {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 22px; margin: 28px 0; box-shadow: 0 2px 8px var(--shadow);
}
.kami-note .h { font-size: 13px; color: var(--shu); letter-spacing: 0.2em; margin: 0 0 8px; }
.kami-note dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.kami-note dt { color: var(--gold); font-size: 14px; white-space: nowrap; }
.kami-note dd { margin: 0; font-size: 15px; }

/* 前後ナビ */
.article-nav {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line); padding: 28px 0; margin-top: 20px;
}
.article-nav a {
  flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 18px; color: inherit; transition: border-color .18s ease;
}
.article-nav a:hover { border-color: var(--gold); text-decoration: none; }
.article-nav .dir { font-size: 12px; color: var(--shu); letter-spacing: 0.2em; }
.article-nav .ttl { font-size: 15px; margin-top: 4px; }
.article-nav .next { text-align: right; }
.article-nav .disabled { visibility: hidden; }

/* ---------- フッター ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 32px 24px; text-align: center;
  color: var(--sumi-soft); font-size: 13px; line-height: 1.9;
}
.site-footer a { color: var(--sumi-soft); }

/* ---------- 挿絵枠 ---------- */
.illust { margin: 28px 0 8px; }
.illust img {
  display: block; width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--line); box-shadow: 0 4px 14px var(--shadow);
}
.illust-frame {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 200px; padding: 28px 20px;
  background:
    repeating-linear-gradient(45deg, rgba(168,136,76,0.04) 0 10px, transparent 10px 20px),
    var(--paper-deep);
  border: 1px solid var(--gold); border-radius: 10px;
  outline: 3px solid var(--paper); outline-offset: -7px;
}
.illust-frame .mark {
  font-size: 12px; letter-spacing: 0.4em; color: #fff; background: var(--gold);
  border-radius: 4px; padding: 3px 12px;
}
.illust-frame .cap { font-size: 17px; color: var(--sumi); letter-spacing: 0.08em; }
.illust-frame .hint { font-size: 12px; color: var(--sumi-soft); }
.illust figcaption {
  text-align: center; font-size: 12px; color: var(--sumi-soft);
  margin-top: 8px; letter-spacing: 0.05em;
}

/* ---------- ページ導入文 ---------- */
.page-intro {
  text-align: center; color: var(--sumi-soft); font-size: 15px;
  max-width: 620px; margin: 4px auto 8px;
}

/* ---------- 系図 ---------- */
.gen-block { margin: 48px 0; }
.gen-block > h3 {
  font-size: 19px; letter-spacing: 0.12em; margin: 0 0 6px;
  padding-left: 12px; border-left: 4px solid var(--shu);
}
.gen-block .note { font-size: 13px; color: var(--sumi-soft); margin: 0 0 20px; padding-left: 16px; }
.lineage { display: flex; flex-direction: column; align-items: center; text-align: center; }
.node {
  display: inline-block; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 18px; box-shadow: 0 2px 7px var(--shadow);
  color: inherit; max-width: 100%;
}
a.node { transition: border-color .15s ease, transform .15s ease; }
a.node:hover { border-color: var(--gold); transform: translateY(-2px); text-decoration: none; }
.node .nm { font-weight: 700; letter-spacing: 0.06em; }
.node .rd { font-size: 11px; color: var(--gold); letter-spacing: 0.12em; }
.node.god { border-color: var(--gold); }
.node.emp { border-left: 4px solid var(--shu); }
.gen-arrow { color: var(--shu); font-size: 18px; line-height: 1.2; margin: 7px 0; }
.gen-pair { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gen-pair .eq { color: var(--gold); font-weight: 700; }
.gen-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.gen-children-label { font-size: 12px; color: var(--sumi-soft); margin: 10px 0 6px; }

/* ---------- 用語集 ---------- */
.glossary-toc {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px 0 36px;
}
.glossary-toc a {
  font-size: 13px; letter-spacing: 0.1em; color: var(--sumi-soft);
  border: 1px solid var(--line); border-radius: 20px; padding: 6px 16px; background: #fff;
}
.glossary-toc a:hover { border-color: var(--gold); color: var(--shu); text-decoration: none; }
.gloss-group { margin: 40px 0; scroll-margin-top: 80px; }
.gloss-group > h3 {
  font-size: 18px; letter-spacing: 0.12em; margin: 0 0 18px;
  padding-bottom: 8px; border-bottom: 2px solid var(--shu); display: inline-block;
}
.gloss-item {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 20px; margin: 12px 0; box-shadow: 0 2px 7px var(--shadow);
}
.gloss-item .term { font-size: 18px; font-weight: 700; letter-spacing: 0.06em; }
.gloss-item .read { font-size: 12px; color: var(--gold); letter-spacing: 0.12em; margin-left: 8px; }
.gloss-item .def { font-size: 15px; color: var(--sumi-soft); margin: 8px 0 0; line-height: 1.85; }
.gloss-item .appear { font-size: 12px; margin: 10px 0 0; }
.gloss-item .appear span { color: var(--sumi-soft); letter-spacing: 0.1em; }
.gloss-item .appear a { margin-right: 10px; }

/* ---------- 資料リンク（トップ） ---------- */
.resource-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.resource-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 24px; box-shadow: 0 2px 10px var(--shadow); color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.resource-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px var(--shadow); border-color: var(--gold); text-decoration: none; }
.resource-card h3 { font-size: 19px; margin: 0 0 6px; letter-spacing: 0.08em; }
.resource-card p { font-size: 14px; color: var(--sumi-soft); margin: 0; line-height: 1.7; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 56px 20px 40px; }
  .hero h1 { font-size: 40px; }
  .episode-grid { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: 1fr; }
  .article-head h1 { font-size: 28px; }
  .site-nav a { margin-left: 12px; font-size: 13px; }
  .illust-frame { min-height: 150px; }
}
