/* Asia/Tokyo, 2025-10-06 16:13(UTC+09:00), css/index.css */
#risk-matrix {
  --risk-border: #117713;
  --risk-head-bg: #117713;
  --risk-head-fg: #fff;
  --risk-plan-accent: #ffff00;

  /* Typography scale (risk-matrix local) */
  /* Alias local scale to global tokens in common.css */
  --rm-fs-base: clamp(var(--fs-base-min), 1.5rem + 0.3vw, var(--fs-base-max));
  --rm-fs-head: var(--fs-h2);
  --rm-fs-sub: var(--fs-h3);
  --rm-fs-label: var(--fs-small);
  --rm-fs-plan-letter: clamp(3.2rem, 2.8rem + 2vw, 4.8rem);
  --rm-unit-scale: 0.65;
  --rm-digit-scale-xl: 3;
}
#risk-matrix .risk-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: var(--rm-fs-base);
}
#risk-matrix .risk-table th,
#risk-matrix .risk-table td {
  border: 1px solid var(--risk-border);
  vertical-align: middle;
}
#risk-matrix .risk-table tr > td {
  display: table-cell;
}
#risk-matrix .risk-table thead th {
  position: relative;
  background: var(--risk-head-bg);
  color: var(--risk-head-fg);
  text-align: center;
  font-weight: 700;
  padding: 0.8rem;
}
#risk-matrix .risk-table thead th + th::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #fff;
  pointer-events: none;
}
#risk-matrix .plan-header-cell {
  text-align: left;
  background: #117713;
  color: #ffffff; /* 不透明な白でコントラストを担保 */
}
#risk-matrix .plan-header-cell h2 {
  color: #ffff00;
}
#risk-matrix .risk-table thead th[id^="plan-"] .plan-letter {
  display: block;
  line-height: 1;
  color: var(--risk-plan-accent);
  font-size: var(--rm-fs-plan-letter);
}
#risk-matrix .risk-table thead th[id^="plan-"] .plan-label {
  font-size: clamp(1.6rem, 1.5rem + 0.4vw, 2rem);
}
@media (max-width: 600px) {
  #risk-matrix .risk-table th.plan-header-cell {
    width: 300px;
    min-width: 300px;
  }
}
#risk-matrix .cell-body {
  padding: 0.8rem;
  text-align: left;
}
#risk-matrix .cell-body h2 {
  margin: 0 0 0.2rem;
  font-size: var(--rm-fs-head);
  font-weight: 700;
  line-height: 1.25;
}
#risk-matrix .cell-title .title-text p {
  font-weight: 400;
}
#risk-matrix .cycle-sub {
  margin: 0rem;
  font-size: var(--rm-fs-sub);
  color: #333;
}
#risk-matrix .cell-title {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.6rem 1.2rem;
}
#risk-matrix .cell-title .title-illust {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  max-width: min(120px, 24vw);
  height: auto;
}
@media (max-width: 600px) {
  #risk-matrix .cell-title {
    grid-template-columns: 1fr;
  }
  #risk-matrix .cell-title .title-illust {
    grid-column: 1;
    justify-self: center;
    margin-top: 0.6rem;
  }
}
#risk-matrix .cycle-example {
  border-collapse: collapse;
}
#risk-matrix .cycle-example th,
#risk-matrix .cycle-example td {
  border: 1px solid #d6d6d6;
  padding: 0.5rem 0.6rem;
  vertical-align: top;
}
#risk-matrix .cycle-example th[scope="row"] {
  background: #e8e8d0;
}
#risk-matrix .cycle-example td {
  background: #fff;
}
#risk-matrix .row-section:nth-child(even) td {
  background: #f9feff;
}
#risk-matrix .row-section:nth-child(even) > th[scope="row"] {
  background: #fffff8;
}
#risk-matrix .cell-amount {
  padding: 0.8rem;
  text-align: center;
}
#risk-matrix .label {
  font-size: var(--rm-fs-label);
}

/* number blocks – unified metrics */
#risk-matrix .num-lg,
#risk-matrix .num-xl {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#risk-matrix .num-lg {
  font-size: clamp(2.1rem, 1.9rem + 1.9vw, 3.2rem);
  font-weight: 500;
}
#risk-matrix .num-xl {
  font-size: var(--rm-fs-base);
}
#risk-matrix .num-xl .num {
  font-size: calc(1em * var(--rm-digit-scale-xl));
  line-height: 1;
}
#risk-matrix .unit,
#risk-matrix .num-lg .unit,
#risk-matrix .num-xl .unit,
#risk-matrix .num-lg + .unit,
#risk-matrix .num-xl + .unit {
  display: inline-block;
  margin-left: 0.1em;
  vertical-align: baseline;
  font-size: 0.7em;
}
#risk-matrix .num-xl .unit {
  font-size: calc(1em * var(--rm-unit-scale));
  margin-left: 0.25em;
}

/* range blocks */
#risk-matrix .range {
  display: grid;
  gap: 0.2rem;
  justify-items: center;
}
#risk-matrix .range .tilde {
  font-size: 1.3rem;
  line-height: 1;
}
#risk-matrix .range > div {
  display: inline-flex;
  align-items: baseline;
  font-size: clamp(1.8rem, 1.6rem + 1.6vw, 2.8rem);
  font-variant-numeric: tabular-nums;
}
#risk-matrix .range > div .unit {
  font-size: 0.7em;
  margin-left: 0.1em;
}

/* surgery block – single source of size truth */
#risk-matrix .cycle-surgery {
  display: block;
  text-align: center;
  --s-num: clamp(2.2rem, 2rem + 2vw, 3.4rem);
}
#risk-matrix .cycle-surgery .cap4 {
  margin: 0.4rem 0 0.2rem;
}
#risk-matrix .cycle-surgery .num-lg {
  font-size: var(--s-num);
  display: inline-flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
#risk-matrix .cycle-surgery .num-lg + .unit {
  display: inline-block;
  font-size: calc(var(--s-num) * 0.7);
  margin-left: 0.1em;
  vertical-align: baseline;
}

#risk-matrix .stack img {
  display: block;
  margin-inline: auto;
}

#risk-matrix .row-feehead th.fee-scope {
  position: relative;
  text-align: center;
  font-weight: 700;
  background: #117713;
  color: #ffff00;
}
#risk-matrix .row-feehead td.fee-head {
  text-align: center;
  font-weight: 700;
  background: #117713;
  color: #ffff00;
}
#risk-matrix .row-feehead .fee-scope-inner,
#risk-matrix .row-feehead .fee-head-inner {
  display: block;
  font-size: clamp(2rem, 1.4rem + 1.4vw, 2.6rem);
  line-height: 1.2;
  padding-block: 0.6em;
}
#risk-matrix .row-feehead .fee-scope-inner .note-inline sup {
  color: #fff;
  font-size: 0.55em;
  line-height: 1;
  vertical-align: super;
  margin-left: 0.15em;
}
#risk-matrix .row-feehead th.fee-scope::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: #fff;
  pointer-events: none;
}
#risk-matrix .fee .cell-amount,
#risk-matrix .row-fee td.cell-amount {
  background: #fdffd4;
}
#risk-matrix .fee-type {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}
#risk-matrix .type-link {
  display: inline-block;
  margin: 1rem auto;
  padding: 1rem 1.4rem;
  border: 2px solid #117713;
  border-radius: 8px;
  font-weight: 700;
  font-size: clamp(1.8rem, 1.6rem + 0.6vw, 2.4rem);
  width: auto;
  min-width: 8em;
  text-align: center;
}
#risk-matrix .type-figs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: center;
}
#risk-matrix .type-figs figure {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  margin: 0;
  text-align: center;
}
#risk-matrix .type-figs img {
  display: block;
  width: clamp(32px, 8vw, 52px);
  height: auto;
}
@media (max-width: 480px) {
  #risk-matrix .type-figs img {
    width: clamp(28px, 12vw, 44px);
  }
}
#risk-matrix .type-figs figcaption {
  margin-top: 0.4rem;
  line-height: 1.3;
  font-size: clamp(1.6rem, 1.5rem + 0.2vw, 1.8rem);
}

#risk-matrix .section-title {
  margin-bottom: 0.6rem;
}
#risk-matrix .note-right {
  margin-top: 0;
}
#risk-matrix .risk-table tbody th[scope="row"]:not(.fee-scope) {
  font-weight: 500;
}

/* hero サイズ調整（既存） */
.hero .h1-main {
  display: block;
  font-size: 5rem;
  padding: 0.4rem 0 0 0;
}
.hero .h1-sub {
  display: block;
  font-size: 3rem;
  padding: 0.4rem 0 0 0;
  color: #bd5500;
}
@media (max-width: 780px) {
  .hero .h1-main {
    display: block;
    font-size: 3rem;
    padding: 0.4rem 0 0 0;
  }
  .hero .h1-sub {
    display: block;
    font-size: 2rem;
    padding: 0;
  }
  .btn-primary {
    padding: 1rem;
    margin-top: 0;
  }
}
@media (max-width: 480px) {
  .hero .h1-main {
    display: block;
    font-size: 3rem;
  }
  .hero .h1-sub {
    display: block;
    font-size: 2rem;
    padding: 0;
  }
  .btn-primary {
    padding: 0.5rem 2rem;
    margin-top: 0;
    font-size: 2rem;
  }
}
@media (max-width: 380px) {
  .hero .h1-main {
    display: block;
    font-size: 2.5rem;
    padding: 0.4rem 0 0 0;
  }
  .hero .h1-sub {
    display: block;
    font-size: 1.6rem;
    padding: 0;
  }
  .btn-primary {
    font-size: 1.6rem;
    padding: 0.5rem 2rem;
    margin-top: 0;
  }
}
@media (max-width: 600px) {
  #risk-matrix .risk-table thead th#plan-a,
  #risk-matrix .risk-table thead th#plan-b,
  #risk-matrix .risk-table thead th#plan-c,
  #risk-matrix .risk-table tbody td {
    max-width: none;
  }
}
@media (max-width: 600px) {
  #risk-matrix .cell-body h2 {
    font-size: clamp(2.2rem, 1.8rem + 1.2vw, 3rem);
  }
}

/* ▼ ここから：CSS擬似要素によるイラスト挿入を停止（HTMLへ移行済み） */
#risk-matrix .row-section .title-illust {
  display: block;
}
#risk-matrix
  .row-section:nth-of-type(1)
  .title-text
  > p:nth-of-type(3)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(2)
  .title-text
  > p:nth-of-type(3)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(3)
  .title-text
  > p:nth-of-type(2)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(4)
  .title-text
  > p:nth-of-type(2)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(5)
  .title-text
  > p:nth-of-type(2)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(6)
  .title-text
  > p:nth-of-type(2)::before {
  content: none;
}
#risk-matrix
  .row-section:nth-of-type(7)
  .title-text
  > p:nth-of-type(2)::before {
  content: none;
}
/* ▲ ここまで */

/* ========== 追加: Jidan（示談交渉サービス） ========== */
#risk-matrix .jidan-banner .jb-label {
  display: inline-block;
  font-size: clamp(1.6rem, 1.5rem + 0.3vw, 1.8rem);
  line-height: 1.2;
  color: #fff;
  background: var(--brand, #c05600);
  padding: 0.6rem 1rem;
  border-radius: 0.4rem;
  white-space: nowrap;
}

#jidan-service.jidan-info {
  margin: 1.2rem 0 1.6rem;
}
#jidan-service .jidan-box {
  background: #e9f6f5;
  border: 2px solid var(--brand, #117713);
  border-radius: var(--radius, 8px);
  padding: 1.6rem;
}
#jidan-service .jidan-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.6rem;
}
#jidan-service .jidan-icon {
  width: clamp(64px, 10vw, 84px);
  flex: 0 0 auto;
}
#jidan-service .jidan-img {
  width: 100%;
  height: auto;
  display: block;
}
#jidan-service .jidan-head-text .label {
  display: inline-block;
  background: var(--brand, #117713);
  color: #fff;
  padding: 0.2rem 0.8rem;
  border-radius: 0.4rem;
  font-size: clamp(1.6rem, 1.5rem + 0.4vw, 2rem);
  margin-bottom: 1rem;
}
#jidan-service .jidan-text h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 1.6rem + 1vw, 2.6rem);
  line-height: 1.3;
}
#jidan-service .jidan-text .caption {
  margin: 0;
  color: #555;
  font-size: var(--rm-fs-label, clamp(1.5rem, 1.4rem + 0.3vw, 1.7rem));
}
#jidan-service .jidan-text p,
#jidan-service .jidan-text ul {
  font-size: var(--rm-fs-base, clamp(1.6rem, 1.5rem + 0.3vw, 1.8rem));
  line-height: 1.7;
  margin: 0rem;
  padding: 0rem 2rem;
}
#jidan-service .jidan-text details {
  margin-top: 0.8rem;
  background: #fff;
  border: 1px solid #cfead3;
  border-radius: var(--radius, 8px);
  padding: 0.8rem 1.2rem;
}
#jidan-service .jidan-text summary {
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 600px) {
  #risk-matrix .jidan-banner {
    gap: 0.6rem;
    padding: 0.6rem;
  }
  #jidan-service .jidan-box {
    padding: 1.2rem;
  }
  #jidan-service .jidan-head {
    gap: 0.8rem;
  }
}

#risk-matrix .jidan-banner .jb-label {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 2px;
}
#risk-matrix .jidan-banner .jb-label:hover,
#risk-matrix .jidan-banner .jb-label:focus {
  background: var(--brand-strong, #5d410c);
  text-decoration-thickness: 3px;
}

/* ================================================================
   ▼ 追記：PC＝説明文の右に回り込み／SP＝同じく右に回り込み（表・見出し横は出さない）
   （.title-illust はDOM維持のまま視覚的に非表示、擬似要素で表示）
   ================================================================= */

/* 対象段落のみフロールート化（回り込みの局所化） */
#risk-matrix .row-section .title-text > p:nth-of-type(2),
#risk-matrix .row-section .title-text > p:nth-of-type(3) {
  display: flow-root;
  position: relative;
}

/* 擬似要素の共通ボックス（contentは各行で付与） */
#risk-matrix .row-section .title-text > p:nth-of-type(2)::before,
#risk-matrix .row-section .title-text > p:nth-of-type(3)::before {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  inline-size: min(120px, 24vw);
  aspect-ratio: 1 / 1;
}

/* PC：本文右に回り込み、グリッド右列は使わない */
@media (min-width: 601px) {
  /* 実画像を視覚的に非表示（DOMは残す） */
  #risk-matrix .row-section .title-illust {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  /* 右列を使わないので1カラム化（既存定義は上書き） */
  #risk-matrix .cell-title {
    grid-template-columns: 1fr;
  }
  /* 巻き込み配置（対象段落にだけ現れる） */
  #risk-matrix
    .row-section:nth-of-type(1)
    .title-text
    > p:nth-of-type(3)::before,
  #risk-matrix
    .row-section:nth-of-type(2)
    .title-text
    > p:nth-of-type(3)::before,
  #risk-matrix
    .row-section:nth-of-type(3)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(4)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(5)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(6)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(7)
    .title-text
    > p:nth-of-type(2)::before {
    float: right;
    margin: 0.2rem 0 0.6rem 1.2rem;
  }
}

/* SP：本文の右に回り込み（PCと同仕様） */
@media (max-width: 600px) {
  /* 実画像はSPでも視覚的非表示（擬似要素で表示） */
  #risk-matrix .row-section .title-illust {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  /* スマホも右寄せフロートで段落テキストを巻き込む */
  #risk-matrix
    .row-section:nth-of-type(1)
    .title-text
    > p:nth-of-type(3)::before,
  #risk-matrix
    .row-section:nth-of-type(2)
    .title-text
    > p:nth-of-type(3)::before,
  #risk-matrix
    .row-section:nth-of-type(3)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(4)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(5)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(6)
    .title-text
    > p:nth-of-type(2)::before,
  #risk-matrix
    .row-section:nth-of-type(7)
    .title-text
    > p:nth-of-type(2)::before {
    float: right;
    margin: 0.2rem 0 0.6rem 1.2rem;
  }
}

/* ================================================================
   ▼ 特例: Row2（弁護士費用特約）画像の巻き込み対象を本文段落に限定
   ================================================================= */
@media (min-width: 601px) {
  /* 段落のBFC化を解除して、p(3)のフロートが後続段落にも効くように */
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(2),
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(3),
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(4) {
    display: block;
  }
}
@media (max-width: 600px) {
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(2),
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(3),
  #risk-matrix .row-section:nth-of-type(2) .title-text > p:nth-of-type(4) {
    display: block;
  }
}

/* 行ごとの画像割当（contentを付与して出現させる） */
#risk-matrix
  .row-section:nth-of-type(1)
  .title-text
  > p:nth-of-type(3)::before {
  content: "";
  background-image: url("../images/index/hitoniataru.webp");
}
#risk-matrix
  .row-section:nth-of-type(2)
  .title-text
  > p:nth-of-type(3)::before {
  content: "";
  background-image: url("../images/index/bengoshi-soudan.webp");
}
#risk-matrix
  .row-section:nth-of-type(3)
  .title-text
  > p:nth-of-type(2)::before {
  content: "";
  background-image: url("../images/index/shibou.webp");
}
#risk-matrix
  .row-section:nth-of-type(4)
  .title-text
  > p:nth-of-type(2)::before {
  content: "";
  background-image: url("../images/index/kouishougai.webp");
}
#risk-matrix
  .row-section:nth-of-type(5)
  .title-text
  > p:nth-of-type(2)::before {
  content: "";
  background-image: url("../images/index/nyuin.webp");
}
#risk-matrix
  .row-section:nth-of-type(6)
  .title-text
  > p:nth-of-type(2)::before {
  content: "";
  background-image: url("../images/index/shujyutsu.webp");
}
#risk-matrix
  .row-section:nth-of-type(7)
  .title-text
  > p:nth-of-type(2)::before {
  content: "";
  background-image: url("../images/index/tsuin.webp");
}

/* ================================================================== */
/* 例：幅600px以下で数字倍率だけ下げる */
@media (max-width: 600px) {
  #risk-matrix {
    --rm-digit-scale-xl: 2;
  } /* 3.0 → 2.6 など */
}

/* 例：幅480px以下でベースサイズを少し下げる */
@media (max-width: 480px) {
  #risk-matrix {
    --rm-fs-base: clamp(1.7rem, 1.6rem + 0.4vw, 2rem);
  }
}

/* ================================================================
   幅合わせ: .reference / #cycle-notes を #jidan-service と同じ横幅に
   - index.html では #risk-matrix 内に <div class="container"> が既に存在
   - これらセクション内の内側コンテナの左右パディングをゼロにして揃える
   ================================================================= */
#risk-matrix .reference > .container,
#risk-matrix #cycle-notes.risk-annotations > .container {
  max-width: 100%;
  padding-inline: 0;
}
