/* =====================================================================
   疾患別「関連図の下書き」ページ(public/diseases/)で使う部品
   ---------------------------------------------------------------------
   ・ページは scripts/build-diseases.cjs がアプリの疾患テンプレート(JSON)から作る(直接編集しない)。
   ・紹介ページと同じ tokens.css と style.css を読み込んだうえで、このファイルを足す。
     ヘッダー・カード・ボタン・状態表示・フッターは style.css のものをそのまま使う。
   ・関連図(SVG)のノードの色は style.css の .n-〇〇 と同じ。ここでは style.css にない
     検査(n-lab)・社会(n-social)・患者さん(n-patient)と、枠・矢印のラベルを足す。
   ・色は tokens.css の変数だけを使う。色だけで区別しないよう、種類の名前を必ず文字で出す。

   目次
     1. ページの枠・見出し・パンくず   【<main class="disease-main">】
     2. 図(SVG)と凡例                【<figure class="figure">】
     3. 本文の部品(項目・看護問題・確認ポイント・資料)
     4. 一覧ページ                      【<ul class="disease-cards">】
     5. 印刷
   ===================================================================== */

/* ===== 1. ページの枠・見出し・パンくず ===== */
.disease-main {
  max-width: 880px;
  padding-top: 16px;
  padding-bottom: 48px;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}
.crumbs a {
  color: var(--mint);
}
.disease-main h1 {
  font-size: clamp(26px, 6vw, 38px);
  margin-bottom: 16px;
}
.disease-main h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
.disease-main .lead {
  font-size: 16px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.pill {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
  background: var(--surface);
}
.banner {
  margin: 20px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
}
.banner-draft {
  background: var(--peach-bg);
  color: var(--peach);
  border: 1px solid currentColor;
}
.section-sm {
  margin-top: 40px;
}
/* アプリへの案内(公開前は「公開準備中」+紹介ページへのボタン) */
.cta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.back {
  margin-top: 40px;
}

/* ===== 2. 図(SVG)と凡例 ===== */
.figure {
  margin: 24px 0 0;
  padding: 12px;
}
/* 図は横に長い。スマホでは横にスクロールして見る(縮めすぎると文字が読めないため) */
.figure-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--grid) 1.1px, transparent 1.1px);
  background-size: 18px 18px;
}
.kanrenzu {
  display: block;
  min-width: 720px;
  width: 100%;
  height: auto;
}
.figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.figure figcaption strong {
  color: var(--fg);
}
/* ノード:style.css の .n と同じ作り。種類ごとに --c(線・種類名)と --cb(塗り) */
.kanrenzu .n rect {
  fill: var(--cb);
  stroke: var(--c);
  stroke-width: 2;
}
.kanrenzu .n.pot rect {
  stroke-dasharray: 6 5;
}
.kanrenzu .n .tag {
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: var(--c);
}
.kanrenzu .n .lbl {
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  fill: var(--fg);
}
.kanrenzu .n .lbl.big {
  font-size: 18px;
}
.kanrenzu .n .sub {
  font-family: var(--f-body);
  font-size: 14px;
  fill: var(--muted);
}
.n-lab {
  --c: var(--muted);
  --cb: var(--surface);
}
.n-social {
  --c: var(--mint);
  --cb: var(--mint-bg);
}
.n-patient {
  --c: var(--fg);
  --cb: var(--surface);
}
.kanrenzu .n-prob.pot rect {
  fill: var(--surface);
}
.kanrenzu .n-prob.pot .tag {
  fill: var(--prob);
}
.kanrenzu .n-prob.pot .lbl {
  fill: var(--fg);
}
/* 見出しの枠(身体・心理・社会) */
.kanrenzu .guides rect {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  stroke-dasharray: 10 8;
}
.kanrenzu .guides text {
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 700;
  fill: var(--muted);
}
/* 矢印とそのラベル(文字の周りを白くして線の上でも読めるようにする) */
.kanrenzu .edges line {
  stroke: var(--edge);
  stroke-width: 1.8;
}
.kanrenzu .edges line.pot {
  stroke-dasharray: 6 5;
}
.kanrenzu .ah {
  fill: var(--edge);
}
.kanrenzu .elbl {
  font-family: var(--f-body);
  font-size: 14px;
  fill: var(--muted);
  stroke: var(--surface);
  stroke-width: 4;
  paint-order: stroke;
}
/* 凡例:種類の名前と色見本。点線は潜在的 */
.legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
  color: var(--muted);
}
.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend .swatch {
  width: 18px;
  height: 12px;
  border-radius: 4px;
  background: var(--cb, var(--surface));
  border: 2px solid var(--c, var(--edge));
}
.legend .pot .swatch {
  border-style: dashed;
}

/* ===== 3. 本文の部品 ===== */
.steps {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
}
.node-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.node-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border-left: 5px solid var(--c, var(--edge));
  box-shadow: var(--shadow);
}
.node-item .cat {
  font-size: 14px;
  font-weight: 700;
  color: var(--c, var(--muted));
  white-space: nowrap;
}
.node-item strong {
  font-size: 15px;
}
.node-item .detail,
.sources .detail {
  grid-column: 2;
  display: block;
  font-size: 14px;
  color: var(--muted);
}
@media (max-width: 480px) {
  .node-item {
    grid-template-columns: 1fr;
  }
  .node-item .detail {
    grid-column: 1;
  }
}
.problems {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.problems li {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--prob);
  box-shadow: var(--shadow);
}
.problem {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
}
.problem .num {
  display: inline-block;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--prob);
  color: var(--on-prob);
  font-size: 14px;
}
.evidence {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ev {
  display: inline-block;
  font-size: 14px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--cb, var(--surface));
  color: var(--fg);
  border: 1px solid var(--c, var(--line));
}
.checkpoints {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.checkpoints li {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.checkpoints .q {
  margin: 0;
  font-weight: 700;
}
.checkpoints .q::before {
  content: '□ ';
  color: var(--mint);
}
.checkpoints .hint {
  margin: 4px 0 0 1.4em;
  font-size: 14px;
  color: var(--muted);
}
.sources {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
}
.review {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* ===== 4. 一覧ページ ===== */
.disease-cards {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
}
.disease-cards h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.disease-cards h2 a {
  color: var(--mint);
  text-decoration: none;
}
.disease-cards h2 a:hover {
  text-decoration: underline;
}
.disease-cards p {
  font-size: 14px;
  margin: 0;
}
.note {
  margin-top: 32px;
  font-size: 14px;
  color: var(--muted);
}

/* ===== 5. 印刷 ===== */
@media print {
  .crumbs,
  .cta .btn,
  .back,
  .skip-link {
    display: none;
  }
  .figure-scroll {
    overflow: visible;
    background: none;
  }
  .kanrenzu {
    min-width: 0;
  }
  .node-item,
  .problems li,
  .checkpoints li {
    box-shadow: none;
    border: 1px solid #999;
  }
  .banner-draft {
    border: 2px solid #000;
  }
  /* 看護問題の番号は白文字なので、印刷では枠線+本文の色にする */
  .problem .num {
    background: none;
    color: var(--fg);
    border: 1px solid var(--fg);
  }
}
