/* biidama 公開側 CSS。色は「縹（はなだ）B-1 半」（2026-09-12 わーさん決定）。
   読者の好みは <html data-theme="light|dark"> と data-font="mincho"（static/site.js が付ける）で上書きする */

:root {
  color-scheme: light dark;
  --fg: #1f2429;
  --bg: #fafcfe;
  --muted: #66707a;
  --line: #d5dfe8;
  --link: #2480b8;
  --accent: #4aa0d2;   /* 見出しの印・Callout の縁・playlist のボタン。リンクより一さじ淡い */
  --callout-bg: #e4f0fa;
  --warning-bg: #fff6e5;
  --warning-line: #e0a040;
  --code-bg: #eff4f8;
  --mark-bg: #fdf0a6;   /* ==文字== の印。蛍光ペンの黄 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #e4e8ee;
    --bg: #161b20;
    --muted: #98a5b1;
    --line: #303a44;
    --link: #8ccbef;
    --accent: #93cdf0;
    --callout-bg: #1f2c38;
    --warning-bg: #332a1a;
    --warning-line: #b98430;
    --code-bg: #212a32;
    --mark-bg: #5a4d10;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #e4e8ee;
  --bg: #161b20;
  --muted: #98a5b1;
  --line: #303a44;
  --link: #8ccbef;
  --accent: #93cdf0;
  --callout-bg: #1f2c38;
  --warning-bg: #332a1a;
  --warning-line: #b98430;
  --code-bg: #212a32;
  --mark-bg: #5a4d10;
}
:root[data-theme="light"] { color-scheme: light; }

:root {
  --font-body: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  --font-mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "BIZ UDMincho", serif;
}
:root[data-font="mincho"] { --font-body: var(--font-mincho); }
html {
  font-family: var(--font-body);
  font-size: 16px;
  /* iPhone の Safari が横向きで勝手に文字を拡大するのを止める */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  line-height: 2.0;
  padding: 0 1rem 3rem;
}
main, .site-header, .breadcrumb, .site-footer {
  max-width: 40rem; /* rem: 各部の文字の大きさに左右されない（em だとフッターが縮む） */
  margin-left: auto;
  margin-right: auto;
}
a { color: var(--link); }
/* 別タブで開くリンクの印。文字の ↗ は字体によって矢じりがつぶれて斜線に見えるので SVG で描く（色はリンクと同じ）。読み上げには content の言葉。
   絵だけのリンクは変換時に data-image-only が付くので出さない。mask の効かないブラウザでは四角になるので、印ごと出さない */
@supports (mask-size: contain) or (-webkit-mask-size: contain) {
  a[target="_blank"]:not([data-image-only])::after {
    content: "";
    content: "" / "（別タブ）";
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-left: 0.15em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Cpath d='M3 9 9 3M4 3h5v5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Cpath d='M3 9 9 3M4 3h5v5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
}
[hidden] { display: none !important; } /* display を指定した箱にも hidden 属性を効かせる（playlist の音量つまみなど） */
.site-header { padding: 1rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-name { font-weight: bold; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4em; }
.site-icon { width: 24px; height: 24px; border-radius: 4px; }
/* 読者の好み（static/site.js が組み立てる） */
.prefs { display: flex; gap: 0.4rem; }
.pref-btn { font: inherit; font-size: 0.85rem; line-height: 1; padding: 0.35em 0.6em; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.pref-btn:active { color: var(--accent); border-color: var(--accent); }
.breadcrumb ol { list-style: none; padding: 0; margin: 0.5rem 0; font-size: 0.9rem; color: var(--muted); }
.breadcrumb li { display: inline; }
.breadcrumb li + li::before { content: " / "; }
.breadcrumb-bottom { margin-top: 2rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.page-title { font-size: 1.5rem; line-height: 1.4; }
/* 本文の見出し: 大きさの差を控えめにして、装飾で段を示す */
.page-body h1, .page-body h2, .page-body h3, .page-body h4, .page-body h5, .page-body h6 { line-height: 1.5; margin: 2em 0 0.8em; }
.page-body h1 { font-size: 1.4rem; padding-bottom: 0.3em; border-bottom: 2px solid var(--fg); }
.page-body h2 { font-size: 1.25rem; padding-bottom: 0.2em; border-bottom: 1px solid var(--line); }
.page-body h3 { font-size: 1.1rem; padding-left: 0.6em; border-left: 4px solid var(--accent); }
.page-body h4 { font-size: 1.05rem; }
.page-body h4::before { content: ""; display: inline-block; width: 0.6em; height: 0.6em; margin-right: 0.4em; background: var(--accent); vertical-align: 0.05em; }
.page-body h5, .page-body h6 { font-size: 1rem; color: var(--muted); }
.page-body h5::before, .page-body h6::before { content: ""; display: inline-block; width: 0.4em; height: 0.4em; margin-right: 0.4em; border: 1px solid var(--muted); vertical-align: 0.15em; }
.page-meta { color: var(--muted); font-size: 0.85rem; margin: 0.2em 0; }
.page-meta .date + .date { margin-left: 0.8em; }
.page-meta .tag { margin-right: 0.5em; }
a.tag { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
a.tag:hover { color: var(--link); border-bottom-color: var(--link); }
.page-body { margin-top: 1.5rem; } /* 題・日付・タグの帯と本文の間。本文が地の文（特にルビつき）で始まる時に窮屈にならないように */
.page-body p { margin: 0 0 1em; }
/* 幅は画面に収める。height="18" のような原稿側の指定は殺さない（width と height の両方がある時だけ比率を守る） */
.page-body img, .page-body video, .page-body audio, .page-body iframe { max-width: 100%; }
.page-body img[width][height], .page-body video[width][height] { height: auto; }
.page-body iframe { aspect-ratio: 16 / 9; width: 100%; }
.page-body table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.page-body th, .page-body td { border: 1px solid var(--line); padding: 0.2em 0.6em; }
.page-body pre { background: var(--code-bg); padding: 0.8em; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 4px; }
.page-body .highlight { margin: 0 0 1em; }
.page-body .highlight pre { margin: 0; }
/* 言語名（pymdownx.highlight の auto_title）。枠の上に小さな札 */
.page-body .highlight .filename { display: block; font-size: 0.75rem; line-height: 1.6; color: var(--muted); background: var(--code-bg); padding: 0.2em 0.8em 0; border-bottom: 1px solid var(--line); border-radius: 4px 4px 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.page-body .highlight .filename + pre { border-radius: 0 0 4px 4px; }
.page-body code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
.page-body :not(pre) > code { background: var(--code-bg); padding: 0 0.3em; border-radius: 3px; }
.page-body blockquote { margin: 1em 0; padding: 0 1em; border-left: 3px solid var(--line); color: var(--muted); }
.page-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
ruby rt { font-size: 0.5em; }
.unresolved-link { border-bottom: 1px dotted var(--muted); }
mark { background: var(--mark-bg); color: inherit; padding: 0 0.1em; border-radius: 2px; }

/* 脚注（[^1] と [^1]: 中身）。番号は本文の肩、中身はページ末尾の一覧。
   番号を押すと static/footnote.js がその場に中身を浮かべる（.footnote-pop。本文 .page-body の中に置かれるので画像の幅制限などは本文と同じ。JS が無ければ一覧へ飛ぶ） */
.page-body sup { line-height: 0; } /* 肩付きの文字で行の間隔を押し広げない */
.footnote-ref { text-decoration: none; padding: 0.4em 0.3em; } /* 指で押せる広さ。行内の上下の余白は行の間隔を変えない */
.footnote { margin-top: 3em; font-size: 0.9rem; line-height: 1.8; }
.footnote ol { padding-left: 1.5em; }
.footnote p { margin: 0 0 0.4em; }
.footnote li:target { background: var(--callout-bg); } /* 番号から飛んできた注 */
.footnote-backref { text-decoration: none; padding: 0 0.3em; }
.footnote-pop { position: absolute; left: 0; top: 0; z-index: 100; box-sizing: border-box; max-width: min(24rem, calc(100vw - 16px)); padding: 0.6em 0.9em; background: var(--bg); color: var(--fg); border: 1px solid var(--accent); border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); font-size: 0.9rem; line-height: 1.7; overflow-wrap: anywhere; }
.footnote-pop p { margin: 0 0 0.5em; }
.footnote-pop p:last-child { margin-bottom: 0; }

/* Callout（曇り硝子） */
.callout {
  margin: 1em 0;
  padding: 0.6em 1em;
  border-left: 3px solid var(--accent);
  background: var(--callout-bg);
  color: var(--fg);
  border-radius: 0 4px 4px 0;
}
.callout-title, .callout > summary { font-weight: bold; margin: 0 0 0.4em; }
.callout > summary { cursor: pointer; }
.callout-warning, .callout-caution, .callout-danger { background: var(--warning-bg); border-left-color: var(--warning-line); }

/* 原稿に生 HTML で書く三部品（要点をひと目で示す段の材料。Markdown は中に書けないので文字と <b>・<br> だけ）
   カード: <div class="cards"><div class="card"><b>題</b><br>数行</div>…</div>   … 画面幅で 1〜2 列
   流れ:   <div class="flow"><div class="step">一歩目</div>…</div>               … 矢印つき横並び。狭い画面では縦に落ちる
   図:     <figure><svg viewBox="…">線は stroke="currentColor"</svg><figcaption>…</figcaption></figure> … 読者の画面色に追従 */
.page-body .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem; margin: 1.5em 0; }
.page-body .card, .page-body .step { border: 1px solid var(--line); border-radius: 6px; padding: 0.6em 0.9em; line-height: 1.7; }
.page-body .card > :first-child, .page-body .step > :first-child { margin-top: 0; }
.page-body .card > :last-child, .page-body .step > :last-child { margin-bottom: 0; }
/* 中に見出しを書いた時は本文の見出しの飾り（下線・左罫・印）を外して、太い一行にする */
.page-body .card h3, .page-body .card h4, .page-body .card h5, .page-body .step h3, .page-body .step h4, .page-body .step h5 { font-size: 1rem; color: inherit; margin: 0 0 0.3em; padding: 0; border: 0; }
.page-body .card h4::before, .page-body .card h5::before, .page-body .step h4::before, .page-body .step h5::before { content: none; }
.page-body .flow { display: flex; align-items: stretch; gap: 0; margin: 1.5em 0; }
.page-body .step { flex: 1 1 0; min-width: 0; }
.page-body .step + .step { margin-left: 1.6rem; position: relative; }
.page-body .step + .step::before { content: "→"; position: absolute; left: -1.6rem; width: 1.6rem; top: 50%; transform: translateY(-50%); text-align: center; color: var(--muted); }
@media (max-width: 36rem) {
  .page-body .flow { flex-direction: column; }
  .page-body .step + .step { margin-left: 0; margin-top: 1.6rem; }
  .page-body .step + .step::before { content: "↓"; left: 0; right: 0; width: auto; top: -1.6rem; height: 1.6rem; line-height: 1.6rem; transform: none; }
}
.page-body figure { margin: 1.5em 0; text-align: center; }
.page-body figure svg { max-width: 100%; height: auto; color: var(--fg); } /* stroke="currentColor" の線がこの色になる */
.page-body figcaption { color: var(--muted); font-size: 0.85rem; line-height: 1.6; margin-top: 0.4em; }

/* 前後ナビ */
.series-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.series-nav > div { flex: 1; }
.series-nav-next { text-align: right; }
.series-nav small { color: var(--muted); }

/* フォルダ索引・タグ索引 */
.page-list { padding-left: 1.2em; }
.page-list time { color: var(--muted); font-size: 0.85em; margin-left: 0.5em; }
.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4em 1em; }

/* 最近の更新（トップの末尾） */
.recent { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.recent h2 { font-size: 1.1em; margin: 0 0 0.5em; }
.recent-more { text-align: right; font-size: 0.9em; margin: 0.3em 0 0; }
.tag-cloud .count { color: var(--muted); font-size: 0.8em; }

/* 上へ戻る（static/site.js が置く） */
.to-top { position: fixed; right: 1rem; bottom: 1.2rem; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--accent); color: var(--bg); text-decoration: none; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; opacity: 0.85; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }

.site-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.site-footer .footer-tags, .site-footer .footer-recent, .site-footer .footer-rss, .site-footer .footer-random { margin-left: 1em; }
.backlinks { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.backlinks h2 { font-size: 1.1em; margin: 0 0 0.5em; }
.site-footer .made-with { float: right; font-size: 0.75rem; }
.site-footer .made-with a { color: var(--muted); }
.breadcrumb-bottom + .site-footer { margin-top: 0.5rem; }

/* lightbox（static/lightbox.js。lightbox2 互換の a[data-lightbox] を拡大表示） */
.wjm-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.wjm-lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; cursor: default; }
.wjm-lightbox figure img { max-width: 92vw; max-height: 85vh; object-fit: contain; border-radius: 4px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.wjm-lightbox figcaption { color: #e8e8e8; font-size: 0.9rem; text-align: center; max-width: 80vw; }
.wjm-lightbox button { position: fixed; background: none; border: none; color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; padding: 0.4rem 0.9rem; opacity: 0.75; user-select: none; }
.wjm-lightbox button:hover { opacity: 1; }
.wjm-lightbox-close { top: 0.4rem; right: 0.6rem; }
.wjm-lightbox-prev { left: 0.3rem; top: 50%; transform: translateY(-50%); font-size: 2.8rem; }
.wjm-lightbox-next { right: 0.3rem; top: 50%; transform: translateY(-50%); font-size: 2.8rem; }

/* playlist（static/playlist.js。div.playlist の中の audio 群を操作盤に組み替える。移植元: 旅人ノ夢 css/playlist.css） */
.playlist-player { max-width: 30rem; margin: 1.5em 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--callout-bg); line-height: 1.6; }
.pl-header { padding: 10px 16px 0; font-size: 0.7em; letter-spacing: 2px; color: var(--muted); text-align: center; }
.pl-nowplaying { padding: 8px 16px 4px; text-align: center; }
.pl-title { font-size: 1.05em; font-weight: bold; line-height: 1.4; }
.pl-artist { font-size: 0.78em; color: var(--muted); margin-top: 2px; }
.pl-seekbar-wrap { padding: 4px 16px; }
.pl-seekbar { display: block; width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; } /* 標準の range。矢印キーでも動く */
.pl-time { display: flex; justify-content: space-between; font-size: 0.68em; color: var(--muted); margin-top: 2px; font-family: monospace; }
.pl-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px 16px 8px; }
.pl-btn { background: none; border: none; cursor: pointer; padding: 6px; margin: 0; line-height: 1; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: color 0.2s; }
.pl-btn.active { color: var(--accent); }
.pl-btn-prev, .pl-btn-next { color: var(--fg); }
.pl-btn-play { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--bg); padding: 0; }
.pl-volume { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px 10px; color: var(--muted); }
.pl-volume-slider { width: 90px; accent-color: var(--accent); cursor: pointer; }
.pl-error { text-align: center; font-size: 0.75em; color: #c44; padding: 0 16px; }
.pl-error:not(:empty) { padding-bottom: 6px; }
.pl-list { border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; }
.pl-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px; cursor: pointer; border: 0; border-left: 3px solid transparent; background: none; color: inherit; font: inherit; text-align: left; transition: background 0.2s, border-color 0.2s; } /* button だが行の見た目のまま */
.pl-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pl-item.current { background: rgba(128, 128, 128, 0.14); border-left-color: var(--accent); }
.pl-item-num { font-size: 0.72em; color: var(--muted); min-width: 1.5em; text-align: right; font-family: monospace; }
.pl-item.current .pl-item-num { color: var(--accent); }
.pl-item-info { flex: 1; min-width: 0; }
.pl-item-title { font-size: 0.88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item.current .pl-item-title { font-weight: bold; }
.pl-item-artist { font-size: 0.7em; color: var(--muted); }
/* hover の色はマウスのある環境だけ（iPhone はタップ後も :hover が残り、押された状態と見分けがつかなくなる） */
@media (hover: hover) {
  .pref-btn:hover { color: var(--accent); border-color: var(--accent); }
  .to-top:hover { opacity: 1; }
  .pl-btn:hover { color: var(--accent); }
  .pl-btn-play:hover { opacity: 0.85; color: var(--bg); }
  .pl-item:hover { background: rgba(128, 128, 128, 0.08); }
}
