/* ───────────────────────────────────────────────────────────
   読書特化スタイル
   設計方針:
   - 本文は明朝体。長文の批評を「読ませる」ための字送り・行間。
   - 1行の文字数を抑え(約34全角)、視線移動の負担を減らす。
   - 余白を大きく取り、画面の中央に文章だけを置く。
   - 配色は紙の白と墨の黒。ダークモードに自動対応。
   ─────────────────────────────────────────────────────────── */

:root {
  --bg:        #fbfaf6;  /* 生成りの紙 */
  --bg-soft:   #f3f1ea;
  --ink:       #1d1b16;  /* 純黒を避けた墨 */
  --ink-soft:  #6b6557;  /* 副次テキスト */
  --ink-faint: #a39b88;
  --rule:      #e3ded2;  /* 罫線 */
  --accent:    #8a5a3b;  /* 朱に寄せた焦茶 */
  --measure:   720px;    /* 一覧系のカラム幅（やや狭め）。本文系は body.wide で810px */

  /* 本文フォント：横書きで読みやすい汎用ゴシック。各OSの標準ゴシックに任せる
     （Mac=ヒラギノ角ゴ / Windows=游ゴシック / Android・Linux=Noto Sans）。 */
  --serif: "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴシック",
           "Yu Gothic Medium", "Yu Gothic", "YuGothic",
           "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  --sans:  "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP",
           system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #15140f;
    --bg-soft:   #1d1b15;
    --ink:       #ddd6c8;
    --ink-soft:  #9b9483;
    --ink-faint: #6b6453;
    --rule:      #2c2a22;
    --accent:    #c79a72;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 16.5px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.95;
  letter-spacing: 0.02em;
  font-feature-settings: "palt" 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* ── ヘッダー / フッター ── */
.site-head {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.4rem 1.5rem 0;
}
.site-title {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  text-decoration: none;
}
.site-title:hover { color: var(--accent); }

.site-foot {
  max-width: var(--measure);
  margin: 5rem auto 3rem;
  padding: 1.6rem 1.5rem 0;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.site-foot a { color: var(--ink-faint); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }
.site-foot p { margin: 0; }

/* ── トップページ（一覧）── */
.index {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.index-lede {
  padding: 3.5rem 0 2.5rem;
}
.index-h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0;
}
.index-tagline {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  border-top: 1px solid var(--rule);
}
.entry:last-child { border-bottom: 1px solid var(--rule); }
.entry a {
  display: block;
  padding: 1.5rem 0.2rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.entry a:hover { background: var(--bg-soft); }
.entry-title {
  display: block;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.entry a:hover .entry-title { color: var(--accent); }
.entry-epigraph {
  display: block;
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── 記事ページ ── */
.article {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.article-head {
  padding: 3.5rem 0 0;
  margin-bottom: 3rem;
}
.article-title {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
  margin: 0;
}
.article-epigraph {
  margin: 1.1rem 0 0;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.8;
}
.article-meta {
  margin: 1.4rem 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

/* 本文 — ここが読書体験の中心 */
.prose {
  font-size: 1rem;
}
.prose p {
  margin: 0 0 1.85em;
  text-indent: 1em;       /* 段落冒頭を一字下げ（印刷書籍の組み方） */
  text-align: justify;
  text-justify: inter-character;
  word-break: normal;
  line-break: strict;
  overflow-wrap: anywhere;
}
/* 引用・画像だけの段落は一字下げしない */
.prose blockquote p { text-indent: 0; }
.prose p:has(> img:only-child),
.prose p:has(> a.linkcard) { text-indent: 0; }
.prose h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 3rem 0 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.prose h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 2.4rem 0 1rem;
}
.prose blockquote {
  margin: 2em 0;
  padding: 0.7em 1.1em;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 0 4px 4px 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2.5em auto;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3em auto;
  width: 40%;
}
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.85em; }
.prose li { margin: 0.4em 0; }
.prose code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}
.prose em { font-style: normal; border-bottom: 1px dotted var(--ink-soft); padding-bottom: 0.05em; }
.prose strong { font-weight: 600; }

/* 記事下ナビ */
.article-nav {
  margin-top: 4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}
.article-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.article-nav a:hover { color: var(--accent); }

/* ── 画面が広いとき本文をやや大きく ── */
@media (min-width: 768px) {
  html { font-size: 17px; }
}

/* ── 印刷 ── */
@media print {
  .site-head, .site-foot, .article-nav { display: none; }
  body { background: #fff; color: #000; }
}

/* ───────────────────────────────────────────────────────────
   追加コンポーネント（ナビ／ジャンル絞り込み／ホーム／サイトマップ／掲示板）
   ─────────────────────────────────────────────────────────── */

/* ヘッダーナビ */
.site-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem 1rem; }
.site-nav { display: flex; gap: 1.1rem; font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.06em; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ジャンル絞り込みバー */
.genre-filter {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.5rem 1.5rem 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.genre-btn {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.genre-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.genre-btn.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* 一覧の各記事に付くジャンルタグ */
.entry-genre {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
}

/* ホーム（ランディング） */
.home { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
.home-hero { padding: 4rem 0 2.5rem; }
.home-title { font-size: 2rem; font-weight: 600; letter-spacing: 0.06em; margin: 0; }
.home-tagline { margin: 1rem 0 0; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.8; }
.home-lede { margin: 1.6rem 0 0; line-height: 1.95; }
.home-actions { margin: 2.2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.8rem; }
.home-actions a {
  font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.04em;
  text-decoration: none; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 1.1rem;
}
.home-actions a:hover { border-color: var(--accent); color: var(--accent); }
.home-section-title {
  margin: 3.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.12em; color: var(--ink-soft);
}

/* サイトマップ */
.sitemap { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
.sitemap h2 {
  font-size: 0.85rem; font-family: var(--sans); letter-spacing: 0.12em; color: var(--ink-soft);
  margin: 2.4rem 0 0.8rem; padding-top: 1rem; border-top: 1px solid var(--rule);
}
.sitemap ul { list-style: none; margin: 0; padding: 0; }
.sitemap li { padding: 0.4rem 0; }
.sitemap a { color: var(--ink); text-decoration: none; }
.sitemap a:hover { color: var(--accent); }
.sitemap .sm-genre { font-family: var(--sans); font-size: 0.7rem; color: var(--ink-faint); margin-left: 0.6rem; }

/* 掲示板 */
.bbs { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
.bbs-form { margin: 1.5rem 0 2.5rem; display: flex; flex-direction: column; gap: 0.7rem; }
.bbs-form input, .bbs-form textarea {
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 0.8rem;
}
.bbs-form textarea { min-height: 6em; resize: vertical; }
.bbs-form button {
  align-self: flex-start; font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.04em;
  color: var(--bg); background: var(--ink); border: none; border-radius: 6px; padding: 0.6rem 1.4rem; cursor: pointer;
}
.bbs-form button:hover { background: var(--accent); }
.bbs-note { font-family: var(--sans); font-size: 0.75rem; color: var(--ink-faint); }
.bbs-list { list-style: none; margin: 0; padding: 0; }
.bbs-post { border-top: 1px solid var(--rule); padding: 1.1rem 0; }
.bbs-post:last-child { border-bottom: 1px solid var(--rule); }
.bbs-meta { font-family: var(--sans); font-size: 0.75rem; color: var(--ink-faint); margin: 0 0 0.4rem; }
.bbs-meta .bbs-name { color: var(--ink-soft); font-weight: 500; }
.bbs-body { margin: 0; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.bbs-empty { color: var(--ink-faint); padding: 1.5rem 0; }

/* 掲示板スパム対策：ハニーポット（人間には不可視、ボットだけが入力する） */
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 掲示板 管理（削除）UI */
.bbs-del {
  margin-left: 0.8rem; font-family: var(--sans); font-size: 0.7rem;
  color: var(--accent); background: transparent; border: 1px solid var(--rule);
  border-radius: 4px; padding: 0.05rem 0.5rem; cursor: pointer;
}
.bbs-del:hover { border-color: var(--accent); }
.bbs-admin-toggle { margin-top: 2.5rem; text-align: right; }
.bbs-admin-toggle a { font-family: var(--sans); font-size: 0.72rem; color: var(--ink-faint); text-decoration: none; }
.bbs-admin-toggle a:hover { color: var(--accent); }

/* つぶやき（24時間） */
.tweets { margin-top: 1rem; }
.tweets-note { font-family: var(--sans); font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.04em; }
.tweet-admin { margin: 0.4rem 0 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.tweet-admin textarea { font-family: var(--serif); font-size: 0.95rem; color: var(--ink); background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 0.8rem; min-height: 3.5em; resize: vertical; }
.tweet-admin-row { display: flex; align-items: center; gap: 0.8rem; }
.tweet-admin-row button { font-family: var(--sans); font-size: 0.8rem; color: var(--bg); background: var(--ink); border: none; border-radius: 6px; padding: 0.45rem 1.1rem; cursor: pointer; }
.tweet-admin-row button:hover { background: var(--accent); }
.tweet-list { list-style: none; margin: 0; padding: 0; }
.tweet { border-top: 1px solid var(--rule); padding: 1rem 0.1rem; }
.tweet:last-child { border-bottom: 1px solid var(--rule); }
.tweet-body { margin: 0; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.tweet-meta { margin: 0.4rem 0 0; font-family: var(--sans); font-size: 0.72rem; color: var(--ink-faint); }
.tweet-toggle { margin-top: 0.8rem; text-align: right; }
.tweet-toggle a { font-family: var(--sans); font-size: 0.72rem; color: var(--ink-faint); text-decoration: none; }
.tweet-toggle a:hover { color: var(--accent); }

/* コメント（記事下） */
.comments { max-width: var(--measure); margin: 3.5rem auto 0; padding: 0; }
.comments-title { font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.12em; color: var(--ink-soft); margin: 0 0 1rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); }

.tweet-admin[hidden] { display: none; }

/* つぶやきを1つのパネルとして他と視覚的に分離 */
.tweets {
  margin: 2.2rem 0 1rem;
  padding: 1.2rem 1.4rem 1.4rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.tweets .home-section-title { margin: 0 0 0.6rem; padding-top: 0; border-top: none; }
.tweets .tweet:last-child { border-bottom: none; }

/* 読了率カウンター（左下固定・PC/スマホ共通） */
.read-pct {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 60;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--ink-faint); border-radius: 999px;
  padding: 0.32rem 0.8rem; min-width: 3em; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* 記事タイトルの固定バー（スクロールで出現） */
.reading-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 55;
  background: var(--bg); border-bottom: 1px solid var(--rule);
  padding: 0.7rem 1.5rem;
  transform: translateY(-100%); transition: transform 0.25s ease;
}
.reading-bar.is-visible { transform: translateY(0); }
.reading-bar-title {
  display: block; max-width: var(--measure); margin: 0 auto;
  font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* リンクカード（Amazon / Netflix / YouTube 等） */
.prose a.linkcard {
  display: flex; align-items: stretch; margin: 2em 0;
  border: 1px solid var(--rule); border-radius: 10px; overflow: hidden;
  text-decoration: none; color: var(--ink); background: var(--bg-soft);
  transition: border-color 0.15s ease;
}
.prose a.linkcard:hover { border-color: var(--accent); }
.linkcard-text { display: flex; flex-direction: column; justify-content: center; gap: 0.3rem; padding: 0.9rem 1.1rem; min-width: 0; }
.linkcard-title { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; }
.linkcard-domain { font-family: var(--sans); font-size: 0.74rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkcard-fav { flex: 0 0 auto; width: 58px; background: var(--bg) center / 28px no-repeat; border-right: 1px solid var(--rule); }
.linkcard-media .linkcard-thumb { flex: 0 0 auto; width: 144px; background: #000 center / cover no-repeat; }
@media (max-width: 480px) { .linkcard-media .linkcard-thumb { width: 108px; } }

/* つぶやきパネルの視認性改善（特にダークで薄かった） */
.tweets .home-section-title { color: var(--ink); }
.tweets-note { color: var(--ink-soft); }
.tweets .bbs-empty { color: var(--ink-soft); }
.tweet-meta { color: var(--ink-soft); }
.tweet-toggle a { color: var(--ink-soft); }
@media (prefers-color-scheme: dark) {
  .tweets { background: #211f18; border-color: #3a3729; }
}

/* トップの記事ページャー */
.pager { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin: 1.8rem 0 0; font-family: var(--sans); font-size: 0.85rem; }
.pager button { font-family: var(--sans); font-size: 0.82rem; color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 6px; padding: 0.4rem 0.9rem; cursor: pointer; }
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button:disabled { color: var(--ink-faint); cursor: default; opacity: 0.5; }
.pager-status { color: var(--ink-soft); min-width: 4em; text-align: center; }

/* 404画像 */
.notfound-img { margin: 2.5rem 0 0; }
.notfound-img img { width: 100%; height: auto; display: block; border-radius: 10px; }
.notfound .article-nav { border-top: none; }

/* 本文系ページ(記事・About・404)は810px、一覧系は --measure(720px) のまま */
body.wide { --measure: 810px; }
.article { padding-left: 15px; padding-right: 15px; }
.prose { font-size: 16px; }            /* スマホ基準 */
.prose p { line-height: 1.75; margin: 0 0 28px; }
@media (min-width: 768px) {
  .prose { font-size: 18px; }          /* PC */
  .prose p { line-height: 2.1; margin: 0 0 38px; }
}
