/* ブログ ― どこにでもある個人ブログの体裁 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.bl {
  margin: 0; background: #fff; color: #333;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px; line-height: 1.8; overflow-wrap: anywhere;
}
a { color: #0b5cad; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ヘッダー・フッター（1段：目印＋題名、右にメニュー。上端の紺の帯がサイトの色） */
.bl-head { border-top: 3px solid #23407a; border-bottom: 1px solid #ddd; position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: #fff; }
/* ヘッダーは固定。本文の流れには同じ高さの下敷き（.head-spacer）を置くので、ヘッダーが縮んでも本文はずれない。
   --head-full は通常時の高さ、--head-h は今見えている高さ（どちらも site.js が入れる） */
:root { --head-full: 70px; --head-h: 70px; }
.head-spacer { height: var(--head-full); }
/* ページ内リンクで飛ぶと省略ヘッダーに縮むので、飛び先は省略ヘッダー（--head-compact）の下に合わせる */
:root { --head-compact: 47px; }
html { scroll-padding-top: calc(var(--head-compact) + 12px); }
/* ページ内リンク（目次・脚注など）は、飛び先までなめらかにスクロールする。動きを減らす設定のときは一瞬で */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.bl-head-in { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; transition: padding .25s ease; }
.bl-brand, .bl-brand:hover { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.bl-mark { display: block; flex: 0 0 auto; width: 28px; height: 28px; transition: width .25s ease, height .25s ease; }
.bl-title { font-size: 21px; font-weight: bold; color: #222; letter-spacing: .04em; transition: font-size .25s ease; }
.bl-desc { margin: 0; padding-left: 16px; border-left: 1px solid #ddd; font-size: 12px; color: #666; }
.bl-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0 22px; font-size: 14px; transition: font-size .25s ease, max-height .25s ease, opacity .2s ease, padding .25s ease; }
/* 省略ヘッダー（スクロールしたとき）：余白と文字をひと回り小さく */
.head-compact .bl-head-in { padding-top: 6px; padding-bottom: 6px; }
.head-compact .bl-mark { width: 22px; height: 22px; }
.head-compact .bl-title { font-size: 17px; }
.head-compact .bl-nav { font-size: 13px; }
.bl-nav a { color: #333; }
.bl-foot { border-top: 1px solid #ddd; background: #f7f7f7; }
.bl-foot-in { max-width: 1080px; margin: 0 auto; padding: 20px; font-size: 12px; color: #666; line-height: 1.9; }
.bl-foot a { color: #555; }
.bl-foot-in p { margin: 0; }

/* 2段組み */
.bl-wrap { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; display: flex; flex-wrap: wrap; gap: 40px; }
.bl-main { flex: 999 1 600px; min-width: 0; }
.bl-side { flex: 1 1 280px; min-width: 0; font-size: 14px; }
/* PCの2段組みのときだけ、カテゴリーと月別アーカイブを追従させる。画面より高いときは、最後の項目が見えた位置で止める（top は site.js が決める） */
@media (min-width: 960px) {
  .bl-wrap { align-items: stretch; }
  .side-sticky { position: sticky; top: calc(var(--head-h) + 16px); transition: top .25s ease; }
}

/* サイドバー */
.side-w { margin-bottom: 32px; }
.side-w h2 { font-size: 14px; font-weight: bold; color: #222; margin: 0 0 8px; padding: 6px 10px; background: #f2f2f2; }
.side-w ul { list-style: none; margin: 0; padding: 0 4px; }
.side-w li { padding: 4px 0; display: flex; justify-content: space-between; gap: 8px; }
.side-w li span { color: #777; }
.side-profile p { margin: 0 4px 6px; font-size: 13px; line-height: 1.8; color: #555; }
.side-profile strong { color: #333; }
.month-select { width: 100%; margin: 4px 0 0; padding: 6px 8px; font: inherit; font-size: 14px; color: #333; border: 1px solid #ccc; background: #fff; }
.side-more { margin: 6px 4px 0; font-size: 13px; text-align: right; }

/* 記事の頭 */
.ent-date { margin: 0; font-size: 13px; color: #777; display: flex; flex-wrap: wrap; gap: 0 1em; }
.ent-date a { color: #777; }
.ent-title { font-size: 26px; line-height: 1.5; color: #222; margin: 6px 0 10px; font-weight: bold; }
.ent-tags { margin: 0 0 24px; font-size: 13px; }
.ent-tags a { display: inline-block; margin: 0 6px 6px 0; padding: 1px 8px; border: 1px solid #ccc; color: #555; }
.ent-eyecatch { margin: 0 0 28px; }
.ent-eyecatch img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #e9ecef; }

/* 本文 */
.ent-body { font-size: 16px; line-height: 1.95; }
.ent-body p { margin: 0 0 1.3em; }
.ent-body h2 { font-size: 20px; color: #222; margin: 2.2em 0 .9em; padding: 4px 0 6px; border-bottom: 1px solid #ccc; line-height: 1.5; }
.ent-body h3 { font-size: 16px; color: #222; margin: 2em 0 .6em; }
.ent-body h4 { font-size: 15px; color: #222; margin: 1.6em 0 .5em; }
.ent-body hr { border: 0; border-top: 1px solid #ddd; margin: 2em 0; }
.ent-body ul, .ent-body ol { padding-left: 1.5em; margin: 0 0 1.3em; }
.ent-body li { margin: .3em 0; }
.ent-body blockquote { margin: 0 0 1.3em; padding: 2px 0 2px 1em; border-left: 3px solid #ddd; color: #555; }
.ent-body code { font-family: Consolas, Menlo, monospace; font-size: .9em; background: #f4f4f4; padding: 0 .3em; }
.ent-body var.math { font-family: "Times New Roman", serif; font-style: italic; }
.ent-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1.5em; }
.ent-body table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.7; }
.ent-body th, .ent-body td { border: 1px solid #ddd; padding: 8px 12px; text-align: left; vertical-align: top; }
.ent-body th { background: #f5f5f5; font-weight: bold; }
.breadcrumb { font-size: 13px; color: #777; }

/* 3行まとめ・追記・囲み */
.summary { border: 1px solid #ccc; background: #fafafa; padding: 12px 18px 2px; margin: 0 0 1.8em; font-size: 15px; }
.summary .summary-label { margin: 0 0 4px; }
.summary ul { margin-bottom: 1em; }
.summary + hr { display: none; }
.addendum { border: 1px solid #ccc; padding: 12px 18px 2px; margin: 0 0 1.4em; font-size: 15px; }
.addendum-label { font-weight: bold; font-size: 14px; color: #555; margin: 0 0 6px; }
.addendum p { margin-bottom: 1em; }
.callout { border: 1px solid #ccc; background: #fafafa; padding: 12px 18px 2px; margin: 0 0 1.4em; font-size: 15px; }
.callout-title { font-weight: bold; margin-bottom: 4px; }
.callout p { margin-bottom: 1em; }

/* 図 */
.fig { margin: 1.6em 0 1.8em; }
.fig img { max-width: 100%; height: auto; margin: 0 auto; border: 1px solid #e5e5e5; }
.fig figcaption { margin-top: .6em; font-size: 13px; line-height: 1.7; color: #666; text-align: center; }
/* 表の題名（「表1 …」）は表のすぐ上 */
.ent-body .tbl-cap { margin: 1.5em 0 .4em; font-size: 13px; line-height: 1.7; color: #666; }
.fig figcaption em { font-style: normal; }

/* 脚注 */
.footnotes { margin-top: 2em; padding-top: 1em; border-top: 1px solid #ddd; font-size: 13.5px; line-height: 1.8; }
.footnotes p { margin: 0; }
.footnote-ref { font-size: .75em; }

/* 参考文献・関連記事 */
.references ul, .references ol { font-size: 14px; line-height: 1.75; }
.references li { margin: .5em 0; }

/* サムネイル */
.th { display: block; aspect-ratio: 16 / 9; background: #e9ecef; overflow: hidden; }
.th img { width: 100%; height: 100%; object-fit: cover; }
.cards { list-style: none !important; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.cards li { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.7; color: #555; }
.cards li br { display: none; }
.cards li > a.wl, .cards li > span:first-child { font-size: 15px; font-weight: bold; line-height: 1.6; color: #0b5cad; display: block; }
.related .cards li > a.wl { font-size: 14px; font-weight: normal; }
.rows { list-style: none !important; padding: 0 !important; margin: 0 0 1em; }
.rows li { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; margin: 0; border-bottom: 1px solid #e5e5e5; font-size: 15px; }
.rows .th { flex: 0 0 120px; }
.row-body { min-width: 0; flex: 1; }

/* トップ */
.home section { margin-bottom: 44px; }
.home h2 { font-size: 18px; margin: 0 0 14px; padding: 0 0 6px; border-bottom: 2px solid #333; }
.home .latest ul:not(.rows) { list-style: none; padding: 0; }
.home .author { border: 1px solid #ddd; padding: 16px 20px 4px; }
.home .author h3 { font-size: 15px; margin: 0 0 8px; }
.home > hr { display: none; }
.home .series td:last-child { text-align: right; white-space: nowrap; }

/* 一覧 */
.ent-body .post-list { padding: 0; margin: 0 0 1.5em; }
.ent-body .post-card { margin: 0; }
span.post-card-title { color: #555; }
.listing-count { color: #777; font-size: 13px; margin: 0 0 12px; }
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid #e5e5e5; }
.post-card { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #e5e5e5; }
.post-card .th { flex: 0 0 160px; }
.post-card-meta { margin: 0; font-size: 12.5px; color: #777; display: flex; gap: 0 1em; flex-wrap: wrap; }
.post-card-meta a { color: #777; }
.post-card-title { display: block; font-size: 16px; font-weight: bold; line-height: 1.6; margin: 2px 0 4px; }
.post-card-lead { margin: 0; font-size: 13.5px; color: #555; line-height: 1.7; }
.term-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid #e5e5e5; }
.term-list li { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid #e5e5e5; }
.term-list span { color: #777; font-size: 13px; }
.tag-cloud a { display: inline-block; margin: 0 8px 8px 0; padding: 1px 8px; border: 1px solid #ccc; color: #555; font-size: 13px; }

/* ページ送り・カテゴリの入口 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 0; font-size: 14px; }
.pager ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager li a, .pager li span { display: inline-block; min-width: 36px; padding: 6px 10px; text-align: center; border: 1px solid #ccc; color: #333; }
.pager li a:hover { border-color: #0b5cad; color: #0b5cad; text-decoration: none; }
.pager li span[aria-current] { background: #23407a; border-color: #23407a; color: #fff; }
.pager li.gap { padding: 6px 2px; color: #777; }
.pager-prev, .pager-next { min-width: 5em; }
.pager-next { text-align: right; }
.listing-page { font-size: 15px; font-weight: normal; color: #777; margin-left: .5em; }
.cat-nav { font-size: 13px; margin: 0 0 16px; line-height: 2; }
.cat-nav span { color: #777; margin-right: 4px; }
.cat-nav a { display: inline-block; margin: 0 6px 6px 0; padding: 1px 10px; border: 1px solid #ccc; color: #555; }

@media (max-width: 640px) {
  .bl-head-in { padding: 10px 0 0; gap: 0; }
  .bl-brand { padding: 0 16px; }
  .bl-mark { width: 26px; height: 26px; }
  .bl-title { font-size: 17px; letter-spacing: .03em; }
  .bl-desc { display: none; }
  .bl-nav { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 0 20px; font-size: 13px; padding: 8px 16px 9px; max-height: 40px; }
  /* スマホの省略ヘッダー：メニューの段をたたんで1段に */
  .head-compact .bl-head-in { padding: 8px 0; }
  .head-compact .bl-mark { width: 22px; height: 22px; }
  .head-compact .bl-title { font-size: 15px; }
  .head-compact .bl-nav { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; visibility: hidden; transition: max-height .25s ease, opacity .2s ease, padding .25s ease, visibility 0s linear .25s; }
  .bl-wrap { padding: 22px 16px 40px; }
  .ent-title { font-size: 21px; }
  .ent-body { font-size: 15px; line-height: 1.85; }
  .ent-body h2 { font-size: 18px; }
  .ent-eyecatch { margin-left: -16px; margin-right: -16px; }
  .post-card .th, .rows .th { flex-basis: 96px; }
  .summary, .addendum, .callout { padding: 10px 14px 0; font-size: 14px; }
}

/* 表のセルでは、数字や語を途中で折らない（全体の overflow-wrap: anywhere を打ち消す。入りきらないときだけ折る） */
table th, table td { overflow-wrap: break-word; }

/* 中身が短いページでも、フッターを画面の下端に置く */
body.bl { min-height: 100vh; display: flex; flex-direction: column; }
.bl-wrap { width: 100%; }
.bl-foot { margin-top: auto; }

@media (prefers-reduced-motion: reduce) {
  .bl-head *, .side-sticky { transition: none !important; }
}

/* 行・カードごと押せる（site.js）。マウスを乗せると薄く色づく */
.post-card:has(a[href]), .cards li:has(a[href]), .rows li:has(a[href]), .side-w li:has(a[href]), .term-list li:has(a[href]) { cursor: pointer; }
.post-card:has(a[href]):hover, .rows li:has(a[href]):hover, .term-list li:has(a[href]):hover, .side-w li:has(a[href]):hover { background: #f5f8fb; }
.post-card:hover .post-card-title, .rows li:hover a.wl, .cards li:hover > a.wl, .side-w li:hover a, .term-list li:hover a { text-decoration: underline; }
.cards li:has(a[href]) .th img { transition: opacity .15s ease; }
.cards li:has(a[href]):hover .th img { opacity: .88; }
.side-w li { padding-left: 4px; padding-right: 4px; margin: 0 -4px; }
.post-card, .rows li { padding-left: 6px; padding-right: 6px; margin-left: -6px; margin-right: -6px; }

/* 目次：PC幅（1024px以上）はサイドバーで追従し、今読んでいる節を強調。狭いときは記事冒頭の折りたたみ */
.side-toc { display: none; }
.toc-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.toc-list li { margin: 0; }
.toc-list a { display: block; padding: 5px 10px; color: #444; font-size: 13.5px; line-height: 1.6; border-left: 2px solid transparent; text-decoration: none; }
.toc-list .toc-h3 a { padding-left: 22px; font-size: 13px; color: #666; }
.toc-list a:hover { color: #0b5cad; background: #f5f8fb; }
/* 強調は色・左の線・背景だけ（太字にすると文字幅が変わり、折り返し位置がずれるため） */
.toc-list a.is-current { color: #23407a; border-left-color: #23407a; background: #eaf0f8; }
.side-toc .toc-list { max-height: calc(100vh - var(--head-h) - 90px); overflow-y: auto; scrollbar-width: thin; }
.toc-inline { margin: 0 0 24px; border: 1px solid #ddd; background: #fafafa; }
.toc-inline summary { padding: 10px 14px; font-weight: bold; font-size: 14px; cursor: pointer; list-style: none; }
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::before { content: "▸"; display: inline-block; width: 1.2em; color: #777; transition: transform .2s ease; }
.toc-inline[open] summary::before { transform: rotate(90deg); }
.toc-inline nav { padding: 0 8px 10px; }
@media (min-width: 1024px) {
  .side-toc { display: block; }
  .toc-inline { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toc-inline summary::before { transition: none; } }

/* 記事下部：次に読むなら（続きの記事・大きめのカード2枚）・関連記事（書庫のリスト。4件以上ならカルーセル） */
.next-read { margin: 2.4em 0 2em; padding: 18px 20px 20px; border: 1px solid #ddd; background: #fafafa; }
.next-read-title, .related-more-title { margin: 0 0 12px !important; font-size: 15px; font-weight: bold; color: #222; }
.next-cards { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.next-cards li { margin: 0; display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid #e5e5e5; padding: 0 0 12px; }
.next-cards .th { width: 100%; }
.next-cards .row-body { padding: 0 12px; }
.next-cards .post-card-title { font-size: 16px; }
.next-cards .post-card-lead { font-size: 13.5px; }
.next-cards li:has(a[href]) { cursor: pointer; }
.next-cards li:has(a[href]):hover { border-color: #c9d6e6; }
.next-cards li:hover .post-card-title { text-decoration: underline; }
.related-more { margin-top: 2.4em; }
.related-cards .post-card-title { font-size: 14px; font-weight: normal; line-height: 1.6; }
.related-cards li:hover .post-card-title { text-decoration: underline; }
@media (max-width: 640px) {
  .next-read { padding: 14px 12px 14px; }
  .next-cards,   }

/* 関連記事のカルーセル：横に送る。PCは3枚、スマホは1枚半ほど見せる。自動では動かない */
.carousel { position: relative; }
.car-track { list-style: none !important; margin: 0 !important; padding: 2px 0 6px !important; display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: thin; overscroll-behavior-x: contain; }
.car-track > li { flex: 0 0 calc((100% - 32px) / 3); scroll-snap-align: start; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.car-track:focus-visible { outline: 2px solid #0b5cad; outline-offset: 2px; }
.car-btn { position: absolute; top: calc((100% - 6px) / 2 - 40px); z-index: 2; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid #ccc; border-radius: 50%; background: #fff; color: #333; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.car-btn:hover { border-color: #0b5cad; color: #0b5cad; }
.car-btn:disabled { opacity: 0; pointer-events: none; }
.car-btn:focus-visible { outline: 2px solid #0b5cad; outline-offset: 2px; }
.car-prev { left: -14px; }
.car-next { right: -14px; }
@media (max-width: 640px) {
  .car-track > li { flex-basis: 62%; }
  .car-prev { left: -6px; }
  .car-next { right: -6px; }
}
@media (prefers-reduced-motion: reduce) { .car-track { scroll-behavior: auto; } }

/* マウスでつかんで動かせることを示す。動かしている間は位置合わせと滑らかスクロールを止める */
@media (hover: hover) and (pointer: fine) {
  .car-track { cursor: grab; }
  .car-track.is-dragging { cursor: grabbing; }
}
.car-track.is-dragging { scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.car-track.is-dragging a { pointer-events: none; }
.car-track img { -webkit-user-drag: none; user-select: none; }

/* よく読まれている記事：順位・サムネイル・題名の行 */
.rank-rows { counter-reset: rank; }
.rank-rows > li { counter-increment: rank; align-items: center; }
/* 順位はサムネイルの外（左）に出す。サムネイルの左上のカテゴリ表示を隠さないため */
.rank-rows > li::before { content: counter(rank); flex: 0 0 1.6em; text-align: center; color: #23407a; font-size: 20px; font-weight: bold; line-height: 1; font-variant-numeric: tabular-nums; }
.rank-rows .row-body { align-self: center; }

/* 中身が短い列は折り返さない（build.mjs の tidyTables が付ける） */
th.nw, td.nw { white-space: nowrap; }
/* 表の寄せと最低幅（build.mjs の tidyTables が style 属性の代わりに付ける。CSP でインラインの style が使えないため） */
th.ta-l, td.ta-l { text-align: left !important; }
th.ta-c, td.ta-c { text-align: center !important; }
th.ta-r, td.ta-r { text-align: right !important; }
th.mw2 { min-width: 2em; }
th.mw3 { min-width: 3em; }
th.mw4 { min-width: 4em; }
th.mw5 { min-width: 5em; }
th.mw6 { min-width: 6em; }
th.mw7 { min-width: 7em; }
th.mw8 { min-width: 8em; }
th.mw9 { min-width: 9em; }
th.mw10 { min-width: 10em; }
th.mw11 { min-width: 11em; }

/* ブログ内検索（サイドバーの欄と /search/ のページ） */
.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid #ccc; border-radius: 3px; background: #fff; color: #222; }
.search-row button { flex: 0 0 auto; font: inherit; font-size: 13px; padding: 6px 14px; border: 1px solid #23407a; border-radius: 3px; background: #23407a; color: #fff; cursor: pointer; }
.search-row button:hover { background: #1b3363; }
.side-search .search-row { padding: 0 2px; }
.search-form { margin: 0 0 16px; max-width: 520px; }
.blog-search mark { background: #fff1a8; color: inherit; padding: 0 1px; }

@media print {
  .bl-head, .bl-side, .bl-foot { display: none; }
}

/* ページの先頭へ */
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 50; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); transition: opacity .2s, transform .2s; }
.to-top:hover { text-decoration: none; color: #fff; }
.to-top:focus-visible { outline: 3px solid #f0b400; outline-offset: 2px; }
.js-to-top .to-top:not(.is-shown) { opacity: 0; transform: translateY(8px); pointer-events: none; }
@media (max-width: 640px) { .to-top { right: 14px; bottom: 14px; } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }
@media print { .to-top { display: none; } }
.to-top { background: #23407a; border-radius: 50%; }
.to-top:hover { background: #1a3160; }
