/* ============================================================
   抄録集PDF 組版スタイル（段階1 MVP）
   学会運営サイト PoC / Ren（CTO） 2026-07-03
   ------------------------------------------------------------
   方針：印刷用HTML＋print CSS（@page）→ ブラウザPDF保存。
   目次/著者索引のページ番号連動は proceedings.js の軽量ページネーターで算出（外部ライブラリ不使用）。
   文字耐性：フォントフォールバックチェーンで丸数字・IPA・
   サロゲート漢字・旧字・上付き下付きを豆腐(□)にしない。
   ============================================================ */

/* ---- フォント供給（段階1の合否の要）----
   本文：明朝（Noto Serif JP → Hiragino Mincho → Yu Mincho）
   フォールバック：Noto Sans JP（IPA/記号を広くカバー）→
     Hiragino Sans → 数学記号系 → system-ui。
   Noto は Google Fonts CDN から読む（オフライン時はローカル明朝/ゴシックに縮退）。
   IPA(G6)・ギリシャ(G3)・数学記号(G4)・上付き下付き(G5)は Noto Sans / Hiragino が供給。
   サロゲート漢字(G7)・旧字(G8)は Hiragino / Noto Serif JP が供給。 */
:root {
  --serif-chain: "Noto Serif JP", "Noto Serif CJK JP",
    "Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "Yu Mincho",
    "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans Math", "Noto Sans Symbols", "Noto Sans Symbols 2",
    serif;
  --sans-chain: "Noto Sans JP", "Noto Sans CJK JP",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Noto Sans Math", "Noto Sans Symbols", "Noto Sans Symbols 2",
    system-ui, sans-serif;
  --ink: #1a1a1a;
  --muted: #555;
  --rule: #999;
  --accent: #2d5f3f;
}

/* ---- ページ設定（A4・ノンブル）---- */
@page {
  size: A4;
  margin: 22mm 20mm 20mm 20mm;
  @bottom-center {
    content: counter(page);
    font-family: var(--sans-chain);
    font-size: 9pt;
    color: var(--muted);
  }
}
/* 表紙はノンブルなし */
@page cover { margin: 0; @bottom-center { content: ""; } }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: var(--serif-chain);
  font-size: 10.5pt;
  line-height: 1.75;
  /* 文字が確実にグリフを拾えるよう、合字・カーニングは素直に */
  font-feature-settings: "palt" 0;
  /* 上付き下付き(G5)を正しく表示するための素の描画 */
  font-variant-numeric: normal;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ===== 画面プレビュー時の見た目（印刷では @page が効く）===== */
.screen-note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-family: var(--sans-chain);
  font-size: 12px;
  padding: 10px 14px;
  margin: 12px auto;
  max-width: 780px;
  border-radius: 6px;
}
.screen-note button {
  font: inherit;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 5px;
  padding: 6px 14px;
  cursor: pointer;
  margin-left: 8px;
}
@media print { .screen-note { display: none !important; } }

/* 画面ではA4見当を紙っぽく見せる（印刷実体は @page が支配） */
@media screen {
  body { background: var(--line); padding: 16px 0; }
  .sheet {
    background: var(--surface);
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 12px;
    padding: 22mm 20mm 20mm;
    box-shadow: 0 1px 6px rgba(0,0,0,.18);
  }
  .sheet.cover { padding: 0; }
}
@media print {
  .sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
}

/* ===== 表紙 ===== */
.cover {
  page: cover;
  page-break-after: always;
  break-after: page;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.cover-inner { padding: 40mm 24mm; width: 100%; }
.cover .society { font-family: var(--sans-chain); font-size: 13pt; color: var(--muted); letter-spacing: .08em; }
.cover .event { font-size: 22pt; font-weight: 700; line-height: 1.5; margin: 10mm 0 6mm; }
.cover .kind { font-size: 30pt; font-weight: 700; color: var(--accent); letter-spacing: .18em; margin: 8mm 0; }
.cover .meta { font-family: var(--sans-chain); font-size: 12pt; color: var(--ink); line-height: 2; margin-top: 12mm; }
.cover .rulebar { width: 60mm; height: 2px; background: var(--accent); margin: 8mm auto; }

/* ===== セクション見出し（目次・本体・索引の各扉/章頭）===== */
.part-title {
  font-family: var(--sans-chain);
  font-size: 16pt;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  margin: 0 0 10mm;
  page-break-before: always;
  break-before: page;
}
.part-title.first { page-break-before: avoid; break-before: avoid; }

/* ===== 目次 ===== */
.toc-session {
  font-family: var(--sans-chain);
  font-weight: 700;
  font-size: 11.5pt;
  color: var(--ink);
  margin: 6mm 0 2mm;
  border-left: 4px solid var(--accent);
  padding-left: 8px;
}
.toc-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 1.2mm 0;
  font-size: 10pt;
  break-inside: avoid;
  color: var(--ink);
  text-decoration: none;
}
.toc-no { font-family: var(--sans-chain); color: var(--accent); font-weight: 700; white-space: nowrap; min-width: 12mm; }
.toc-title { flex: 1 1 auto; }
.toc-author { color: var(--muted); font-size: 9pt; white-space: nowrap; }
/* リーダー線＋ページ番号 */
.toc-dots { flex: 1 1 auto; border-bottom: 1px dotted var(--rule); margin: 0 4px; transform: translateY(-3px); min-width: 8mm; }
/* ページ番号：proceedings.js の paginate() が data-ref から算出して textContent に入れる。
   画面でも印刷/PDFでも同じ番号が出る（依存ライブラリ不要）。 */
.toc-page { white-space: nowrap; font-family: var(--sans-chain); min-width: 8mm; text-align: right; color: var(--ink); }

/* ===== 本体（演題ブロック）===== */
.session-head {
  font-family: var(--sans-chain);
  font-size: 13pt;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  padding: 4px 10px;
  margin: 8mm 0 4mm;
  page-break-after: avoid;
  break-after: avoid;
}
.session-head.first { page-break-before: avoid; break-before: avoid; }

.endai {
  /* 演題ブロックは改ページで分断しない（設計書§4）*/
  break-inside: avoid;
  page-break-inside: avoid;
  margin: 0 0 7mm;
  padding-bottom: 4mm;
  border-bottom: 1px solid var(--line);
}
.endai:last-child { border-bottom: none; }
.endai-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 1mm; }
.endai-no {
  font-family: var(--sans-chain);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.endai-title { font-size: 12pt; font-weight: 700; line-height: 1.5; }
.endai-authors { font-family: var(--sans-chain); font-size: 10pt; margin: 1mm 0 0; }
.endai-affil { font-family: var(--sans-chain); font-size: 9pt; color: var(--muted); margin: 0 0 2mm; }
.endai-abstract {
  font-size: 10pt;
  line-height: 1.85;
  text-align: justify;
  /* 抄録本文の禁則（行頭・行末禁則）*/
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: pre-wrap; /* 入力の改行(LF)を段落として保持 */
}

/* ===== 著者索引 ===== */
.index-cols { columns: 2; column-gap: 12mm; }
.index-item { break-inside: avoid; margin: 0.8mm 0; font-size: 9.5pt; display: flex; gap: 6px; }
.index-name { font-family: var(--sans-chain); }
.index-pages { color: var(--muted); }
/* 索引のページ番号：paginate() が data-ref から算出して textContent に入れる。 */
.index-page { font-family: var(--sans-chain); }

/* 空状態 */
.empty {
  font-family: var(--sans-chain);
  color: var(--muted);
  text-align: center;
  padding: 20mm 0;
}

/* ===== 体験版（デモ）の帯（2026-08-19 Ren）=====
   proceedings-demo-ribbon.js が ?demo=1 のときだけ body 先頭に注入する。

   【なぜ review2.css を読まずここに書くか】
     このページが読むCSSは proceedings.css と shared/tokens.css だけで、review2.css は読まない。
     review2 版の #demo-ribbon は --on-accent / --surface に依存しているが、tokens.css は
     その2つを持たない＝帯を注入しても文字色が決まらない。よって文字色は固定色を当てる
     （site/demo-ribbon.js と同じ考え方＝学会テーマに関係なく必ず読める色にする）。

   🔴【印刷に出さない】このページの本来の使い方は「印刷→PDF保存」。帯が紙に写ると本末転倒。
     ・帯そのものを display:none
     ・body の padding-top も 0 に戻す（JS が inline style で高さぶんの余白を入れるため、
       !important を付けないとインライン指定に負けて**紙の1枚目の頭に空白帯が残る**）
   ================================================================= */
#demo-ribbon{
  position:fixed; top:0; left:0; right:0; z-index:250;
  box-sizing:border-box; max-width:100%;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  background:linear-gradient(90deg,var(--warn-ink),var(--warn));
  /* 文字色は固定。tokens.css に --on-accent が無いため、ここで自前に定義して使う
     （学会テーマに何が入っても帯の字が読めなくならないようにする）。 */
  --demo-ribbon-ink:#fff;
  color:var(--demo-ribbon-ink);
  font-family:var(--sans-chain);
  padding:8px 16px; font-size:13px;
  box-shadow:0 1px 6px rgba(0,0,0,.2);
}
#demo-ribbon .demo-ribbon-label{font-weight:700; white-space:nowrap;}
#demo-ribbon .demo-ribbon-note{flex:1; min-width:0; line-height:1.5; opacity:.97;}

@media print{
  #demo-ribbon{display:none !important;}
  body{padding-top:0 !important;}
}
