/* ============================================================
   記事ページ（manuscript/ の原稿）の版面
   ------------------------------------------------------------
   色と書体は shared/design.css から受け取る。ここは配置だけ。
   hanbunkansei/ の各ページと同じ幅・同じ余白に合わせてある。
   ============================================================ */

*{box-sizing:border-box}

:root{
  --fg:var(--ink); --dim:var(--ink-faint); --rule2:var(--rule-soft);
  /* 枠と扉は shared/page.css。幅だけこちらから渡す（左右の余白は body 側） */
  --page-w:42rem; --page-pad:0;
}

body{
  background:var(--bg); color:var(--fg);
  font-family:var(--serif);
  font-size:16px; line-height:1.9; margin:0; padding:0 1.2rem 6rem;
  font-feature-settings:"palt"; -webkit-text-size-adjust:100%;
}
.wrap{max-width:var(--page-w); margin:0 auto;}
a{color:inherit;}
a:hover{color:var(--accent-mid);}
:focus-visible{outline:2px solid var(--mark); outline-offset:2px;}

/* .sitebar / .sitefoot / header.page は shared/page.css が持つ */

/* ---- 本文 ---- */
article{margin:2.6rem 0 0;}
article h2{
  font-size:1.32rem; font-weight:400; letter-spacing:.03em;
  margin:3.2rem 0 1.1rem; padding-top:1.6rem; border-top:1px solid var(--rule);
}
article h3{
  font-size:1.14rem; font-weight:400; letter-spacing:.03em;
  margin:2.4rem 0 .8rem; color:var(--accent-ink);
}
article p{margin:0 0 1.5rem;}
/* 見出しへ飛んだとき、見出しが画面の上端に貼りつかないようにする */
article h2[id],article h3[id]{scroll-margin-top:1.2rem;}

/* ---- 目次（原稿に「目次」とだけ書いた行から作る） ---- */
nav.toc{
  margin:2.4rem 0 3rem; padding:1.2rem 1.3rem;
  background:var(--bg-2); border-left:2px solid var(--accent-pale);
}
nav.toc .toc__head{
  margin:0 0 .6rem; font-size:.9rem; letter-spacing:.08em;
  color:var(--ink-soft);
}
nav.toc ul{margin:0; padding-left:1.1rem; list-style:none;}
nav.toc li{margin:.35rem 0; line-height:1.7; text-indent:-1.1rem;}
nav.toc li::before{content:"—"; color:var(--rule); margin-right:.4rem;}
nav.toc ul ul{
  margin:.3rem 0 .6rem; padding-left:1.1rem; font-size:.94rem;
}
nav.toc ul ul li{color:var(--ink-soft);}
nav.toc a{
  color:inherit; text-decoration:underline;
  text-decoration-color:var(--rule); text-underline-offset:.2em;
  text-decoration-thickness:1px;
}
nav.toc a:hover{color:var(--mark); text-decoration-color:var(--mark);}
/* 本文中のリンク。文字色は本文と同じにして、下線だけ機能色にする。
   段落の中で色文字が続くと本文が騒がしくなるため（DESIGN.md §6-2）。 */
article a{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-color:var(--mark);
  text-underline-offset:.2em;
  text-decoration-thickness:1px;
}
article a:hover{color:var(--mark); text-decoration-thickness:1.5px;}
article strong{font-weight:600;}
article code{
  font-family:var(--ui); font-size:.85em;
  background:var(--bg-2); padding:.1rem .3rem; border-radius:2px;
}
article ul,article ol{margin:0 0 1.5rem; padding-left:1.4rem;}
article li{margin:0 0 .5rem;}
hr.rule{border:0; border-top:1px solid var(--rule); margin:3rem 0;}

/* ---- 名前＋説明の並び（道案内のリンク集など） ---- */
dl.entries{margin:0 0 2rem;}
dl.entries dt{
  font-size:1.06rem; font-weight:400; letter-spacing:.02em; line-height:1.7;
  margin:1.8rem 0 .5rem; padding-left:.8rem;
  border-left:2px solid var(--accent-pale);
}
dl.entries dt:first-child{margin-top:0;}
dl.entries dd{margin:0; padding-left:.8rem; color:var(--ink-soft); font-size:.95rem;}

/* ---- 引用（当時の資料） ---- */
blockquote{
  margin:0 0 1.6rem; padding:1rem 1.1rem; background:var(--bg-2);
  border-left:2px solid var(--accent-pale); font-size:.95rem;
}
blockquote p{margin:0 0 .8rem;}
blockquote p:last-child{margin:0;}
blockquote .cite{
  font-family:var(--ui); font-size:.8rem; letter-spacing:.06em;
  color:var(--dim); margin-top:.8rem; line-height:1.7;
}

/* ---- 表 ---- */
.table-scroll{overflow-x:auto; margin:0 0 1.6rem; -webkit-overflow-scrolling:touch;}
table{border-collapse:collapse; width:100%; font-family:var(--ui); font-size:.88rem;}
th,td{
  border-bottom:1px solid var(--rule-soft); padding:.5rem .7rem;
  text-align:left; vertical-align:top; line-height:1.7;
}
thead th{
  border-bottom:1px solid var(--rule); color:var(--dim);
  font-weight:600; letter-spacing:.03em; white-space:nowrap;
}
td.num,th.num{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap;}
/* 列が多い表（5列以上）を狭い画面に詰め込むと、1文字ずつ折り返して読めなくなる。
   最低幅を決めて、収まらないぶんは .table-scroll の横送りに逃がす。
   4列までの表は今までどおり画面幅に収める。 */
.table-scroll table.wide td{min-width:5.5em;}

/* 5列の表は列幅を固定する。節ごとに中身の長さが違うので、自動だと表ごとに
   列の位置がずれて、続けて読むときに目が迷う。 */
@media (min-width:601px){
  table.list-table{table-layout:fixed;}
  table.list-table th:nth-child(1),table.list-table td:nth-child(1){width:16%;}
  table.list-table th:nth-child(2),table.list-table td:nth-child(2){width:17%;}
  table.list-table th:nth-child(3),table.list-table td:nth-child(3){width:16%;}
  table.list-table th:nth-child(4),table.list-table td:nth-child(4){width:13%;}
  table.list-table th:nth-child(5),table.list-table td:nth-child(5){width:38%;}
}

/* 狭い画面では、5列の表を1件1ブロックに開く。横送りをなくし、
   自治体を見出し、誌名を主役、年代範囲と形式をメタ、特記を本文として読ませる。
   列見出しは読み上げには残し、目には見せない。 */
@media (max-width:600px){
  .table-scroll table.list-table td{min-width:0;}
  table.list-table{display:block; width:100%;}
  table.list-table thead{
    position:absolute; width:1px; height:1px;
    overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap;
  }
  table.list-table tbody,table.list-table tr,table.list-table td{display:block; width:auto;}
  table.list-table tr{
    padding:.95rem 0; border-bottom:1px solid var(--rule-soft);
  }
  table.list-table tr:last-child{border-bottom:0;}
  table.list-table td{border:0; padding:0; line-height:1.7;}
  table.list-table td:nth-child(1){                    /* 自治体 */
    font-size:.78rem; letter-spacing:.06em; color:var(--ink-faint);
  }
  table.list-table td:nth-child(2){                    /* 誌名 */
    font-size:1.02rem; line-height:1.5; margin:.15rem 0 .4rem;
  }
  table.list-table td:nth-child(3),
  table.list-table td:nth-child(4){                    /* 年代範囲・形式 */
    display:inline; font-size:.78rem; letter-spacing:.04em; color:var(--ink-soft);
  }
  table.list-table td:nth-child(3)::after{
    content:"／"; margin:0 .4rem; color:var(--rule);
  }
  table.list-table td:nth-child(5){                    /* 特記 */
    margin-top:.45rem; font-size:.82rem; line-height:1.8; color:var(--ink-soft);
  }
  table.list-table td:nth-child(5):empty{margin-top:0;}
}

/* ---- 畳む節（原稿に「畳む」とだけ書いた行から下の ## と ###） ----
   開閉の作りと件数・矢羽根は shared/page.css の .sec が持つ。
   ここは記事の版面に合わせた字づかいの調整だけ。 */
article .sec{margin:0;}
article .sec h2{
  border-top:0; padding-top:0;                 /* 記事の h2 の上罫線は使わない */
  font-size:1.14rem; margin:0; padding:.95rem 0;
  border-bottom:1px solid var(--rule);
}
article .sec .sec h3{
  font-size:1.02rem; color:var(--accent-ink);
  padding:.85rem 0; border-bottom:1px solid var(--rule-soft);
}
article .sec[open] > .sec__head > h3{border-bottom-color:var(--rule);}
.sec__body{padding-bottom:.4rem;}
article .sec .sec__body > :last-child{margin-bottom:0;}
article .sec .sec__body .table-scroll{margin-bottom:0;}
/* 入れ子の節は、外側の節の中で少しだけ引き込む */
article .sec .sec__body > .sec:first-child{margin-top:.2rem;}

/* ---- 図版 ---- */
figure.fig{margin:0 0 2rem;}
figure.fig img{max-width:100%; height:auto; display:block;}
/* 図版は紙のスキャンで、字が黒ではなく中間のグレー（最も濃い所で L=40〜86）。
   明るい紙の上ではインクに見えるが、暗い地の上では紙が光り、字が薄く見える。
   暗い側だけ、紙の白を落として字の濃さを持ち上げる。 */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) figure.fig img{filter:brightness(.82) contrast(1.18);}
}
:root[data-theme="dark"] figure.fig img{filter:brightness(.82) contrast(1.18);}
figure.fig figcaption{
  font-family:var(--ui); font-size:.8rem; letter-spacing:.06em;
  color:var(--dim); margin-top:.6rem;
}

/* ---- 棒グラフ（ビルド時にデータから作る） ---- */
figure.chart{margin:0 0 2.4rem;}
.bars{font-family:var(--ui); font-size:.8rem; color:var(--dim);}
.bar-row{display:grid; grid-template-columns:5.5rem 1fr 3.6rem;
  align-items:center; gap:.6rem; margin:0 0 .35rem;}
.bar-label{white-space:nowrap; letter-spacing:.04em;}
.bar-track{background:var(--track); height:.7rem;}
.bar-fill{background:var(--accent); height:100%;}
.bar-val{text-align:right; font-variant-numeric:tabular-nums; color:var(--ink-soft);}

@media (max-width:480px){
  .bar-row{grid-template-columns:4.6rem 1fr 3.2rem; gap:.45rem; font-size:.7rem;}
}

/* ---- 未処理の目印（ビルドが拾えなかった図版など。公開前に消す） ---- */
.todo{
  font-family:var(--ui); font-size:.8rem; letter-spacing:.06em;
  color:var(--dim); border:1px dashed var(--rule);
  padding:.5rem .7rem; margin:0 0 1.5rem;
}

/* ---- 記事の末尾に置く本（原稿の [asin:...]） ---- */
.books{margin:4rem 0 0; padding-top:1.8rem; border-top:1px solid var(--rule);}
/* 原稿で本が書かれている位置に出すぶん。前の文の続きとして読ませたいので、
   罫線で区切らず、段落ひとつぶんの間合いだけ空ける */
.books--inline{margin:0 0 1.5rem; padding-top:0; border-top:0;}
/* アフィリエイトの断り書きは、本が出たページの末尾に1回だけ */
.books__note--foot{
  margin:2.6rem 0 0; padding-top:1.2rem; border-top:1px solid var(--rule-soft);
}
.books__head{
  font-family:var(--ui); font-size:.82rem; font-weight:400; letter-spacing:.08em;
  color:var(--dim); margin:0 0 1.2rem; border:0; padding:0;
}
a.book{
  display:flex; gap:1rem; align-items:flex-start;
  text-decoration:none; color:inherit;
  padding:.9rem 1rem; margin:0 0 .8rem;
  border:1px solid var(--rule); background:var(--card);
}
a.book:hover{background:var(--bg-2);}
.book__cover{
  flex:0 0 auto; width:76px; height:auto; display:block;
  background:var(--bg-2);
}
.book__text{display:block; min-width:0;}
.book__title{
  display:block; font-size:1rem; line-height:1.7; letter-spacing:.02em;
  color:var(--link);
}
.book__author{
  display:block; margin-top:.3rem;
  font-family:var(--ui); font-size:.82rem; color:var(--ink-soft);
}
.book__go{
  display:block; margin-top:.5rem;
  font-family:var(--ui); font-size:.76rem; letter-spacing:.06em; color:var(--dim);
}
.books__note{
  font-family:var(--ui); font-size:.74rem; letter-spacing:.05em;
  color:var(--dim); margin:.9rem 0 0;
}

@media (max-width:480px){
  a.book{gap:.8rem; padding:.8rem;}
  .book__cover{width:64px;}
  .book__title{font-size:.95rem;}
}

/* ---- フッター ---- */
footer.page{
  margin:4.5rem 0 0; padding-top:1.6rem; border-top:1px solid var(--rule);
  font-family:var(--ui); font-size:.82rem; letter-spacing:.06em; color:var(--dim);
  line-height:2;
}
footer.page a{text-decoration:none;}
footer.page .method{display:block; margin-bottom:.6rem;}

@media (max-width:480px){
  body{font-size:15.5px; padding:0 1rem 4rem;}
  /* 太さで差を付けられない分、見出しの段差は狭い画面でも保つ（扉は page.css 側） */
  article h2{font-size:1.24rem;}
  article h3{font-size:1.08rem;}
}

/* 行まるごとがリンク1本（書名など）。段落より詰めて並べる */
article p.linkline{margin:0 0 .5rem;}
article p.linkline + p:not(.linkline){margin-top:1.2rem;}

/* ---- 別ページへ送るカード ---- */
a.pagecard{
  display:block; text-decoration:none; margin:0 0 1.8rem;
  padding:1rem 1.1rem; border:1px solid var(--rule); background:var(--card);
}
a.pagecard:hover{background:var(--mark-wash);}
.pagecard__title{
  display:block; font-size:1.06rem; font-weight:400; letter-spacing:.03em;
  color:var(--ink);
  text-decoration:underline; text-decoration-color:var(--mark);
  text-underline-offset:5px; text-decoration-thickness:1px;
}
a.pagecard:hover .pagecard__title{color:var(--mark); text-decoration-thickness:1.5px;}
.pagecard__desc{
  display:block; margin-top:.3rem; font-family:var(--ui);
  font-size:.86rem; color:var(--ink-soft); line-height:1.8;
}

/* ---- 広報誌の一覧（/kouhou-list/） ----
   地方ごとに畳んだ7つの表だと、自分の県が載っているかを確かめるのに
   まず地方を当てなければならず、ページ内検索も畳んだ中には効かなかった。
   1枚の表にして、絞り込みと並べ替えを後から足す形にしている。
   操作盤は JavaScript が動くときだけ出る（hidden を外す）ので、
   動かないときは77件が素の表としてそのまま読める。 */

.koho__ctrl{
  font-family:var(--ui); font-size:.82rem;
  background:var(--bg-2); border:1px solid var(--rule-soft);
  border-radius:4px; padding:.85rem .9rem .6rem; margin:0 0 1.2rem;
}
.koho__ctrl[hidden]{display:none;}
.koho__line{
  display:flex; flex-wrap:wrap; align-items:center;
  gap:.35rem .8rem; margin:0 0 .55rem;
}
.koho__leg{color:var(--ink-faint); letter-spacing:.06em; flex:0 0 auto;}
.koho__q,.koho__sort{display:flex; align-items:center; gap:.4rem;}
.koho__q{flex:1 1 14em;}
.koho__q span,.koho__sort span{color:var(--ink-faint); letter-spacing:.06em;}
.koho__q input{
  flex:1 1 auto; min-width:0; font:inherit; color:var(--ink);
  background:var(--bg); border:1px solid var(--rule);
  border-radius:3px; padding:.32rem .5rem;
}
.koho__sort select{
  font:inherit; color:var(--ink); background:var(--bg);
  border:1px solid var(--rule); border-radius:3px; padding:.3rem .4rem;
}
.koho__box{
  display:inline-flex; align-items:center; gap:.28rem;
  color:var(--ink-soft); white-space:nowrap; cursor:pointer;
}
.koho__box input{margin:0;}
.koho__hit{
  margin:.2rem 0 0; padding-top:.5rem;
  border-top:1px solid var(--rule-soft);
  color:var(--ink-faint); letter-spacing:.04em;
}

/* 年代範囲は「1953 昭和28年12月号〜現在」に印が付くので、5列の既定より広くいる。
   そのぶんを自治体・誌名から取る。 */
@media (min-width:601px){
  table.koho th:nth-child(1),table.koho td:nth-child(1){width:15%;}
  table.koho th:nth-child(2),table.koho td:nth-child(2){width:16%;}
  table.koho th:nth-child(3),table.koho td:nth-child(3){width:21%;}
  table.koho th:nth-child(4),table.koho td:nth-child(4){width:9%;}
  table.koho th:nth-child(5),table.koho td:nth-child(5){width:39%;}
}

/* 地方の見出しの行。並べ替えを開始年にすると隠れる。 */
.koho__group th{
  position:sticky; top:0; z-index:1;
  background:var(--bg); border-bottom:1px solid var(--rule);
  font-size:.86rem; letter-spacing:.08em; color:var(--ink);
}
.koho__n{margin-left:.6rem; font-weight:400; color:var(--ink-faint);}

/* 並べ替えに使う年。「頃」が付いているものは確定値ではない。 */
.koho__yr{
  display:inline-block; margin-right:.45rem;
  font-variant-numeric:tabular-nums; color:var(--ink-faint);
}
/* 開始年が古くても5冊しかない、抜粋だけ、ということがある。空振りを防ぐ印。 */
.koho__b{
  display:inline-block; margin-left:.4rem; padding:.02em .4em;
  font-size:.72rem; letter-spacing:.04em; line-height:1.6;
  border:1px solid var(--rule); border-radius:2px; color:var(--ink-faint);
  white-space:nowrap;
}
.koho__b--continuous{border-color:var(--accent-pale); color:var(--accent-ink);}
.koho__sum{
  font-family:var(--ui); font-size:.8rem; color:var(--ink-faint);
  letter-spacing:.04em; margin:-.8rem 0 1.6rem;
}

/* 特記は長いものが多いので3行に切り、行を押したら開く。
   切るのは JavaScript が付けた koho--clamp のときだけ。 */
.koho--clamp tbody tr:not(.koho__group){cursor:pointer;}
.koho--clamp .koho__note{
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3;
  overflow:hidden;
}
.koho--clamp tr.is-open .koho__note{display:block; overflow:visible;}

/* 絞り込みで消した行。list-table は狭い画面で tr を display:block に
   するので、そのままだと hidden が効かない。 */
table.koho tr[hidden]{display:none;}

@media (max-width:600px){
  table.koho .koho__group{padding:0;}
  .koho__group th{
    display:block; padding:.5rem 0 .35rem; border-top:1px solid var(--rule);
  }
  .koho--clamp .koho__note{-webkit-line-clamp:2;}
}

/* 現行サイトから消えて WARP にだけ残っている号がある。保存版への添え物。 */
.koho__warp{
  display:inline-block; margin-left:.4rem; font-size:.72rem;
  letter-spacing:.06em; color:var(--ink-faint);
}
/* リンクの生死を最後に確かめた日（linkcheck.py が書いた控えから出す）。 */
.koho__checked{
  font-family:var(--ui); font-size:.78rem; color:var(--ink-faint);
  letter-spacing:.04em; margin:-1.2rem 0 1.6rem;
}

/* 表の上の地図。部品は kouhou-map/map.css。 */
.koho__map{margin:0 0 1.4rem;}
.koho__map .kmap-map{height:min(52vh, 460px); min-height:300px;}

/* 各行の小さな位置図。村の名前を知らなくても、どのあたりかが見える。
   日本の形は1つの <path>（koho__locdefs）を <use> で呼び、点だけを行ごとに打つ。
   広い画面では自治体名の下に置き、狭い画面（行がカードになる）では行の右上に置く。
   点の朱は地図の上の印にだけ使う固定色。 */
:root{--loc-land:var(--rule-soft); --loc-dot:#b5462f;}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){--loc-dot:#e08a74;}
}
:root[data-theme="dark"]{--loc-dot:#e08a74;}
.koho__locdefs{position:absolute; width:0; height:0; overflow:hidden;}
.koho__loc{
  display:block; width:56px; height:58px; margin:.3rem 0 0 -4px;
  border-radius:3px;
}
@media (max-width:600px){
  table.koho tbody tr{position:relative;}
  .koho__loc{position:absolute; top:.5rem; right:0; margin:0;}
  table.koho tbody td:nth-child(-n+2){padding-right:64px;}
}
.koho__loc svg{display:block; width:100%; height:100%; fill:var(--loc-land);}
.koho__loc circle{fill:var(--loc-dot); stroke:var(--bg); stroke-width:30;}
.koho__loc:hover,.koho__loc:focus-visible{background:var(--mark-wash);}
/* ポップアップの「表のこの行へ」で来た行 */
table.koho tr:target td{background:var(--mark-wash);}
