/* 和同会 組織図 v2（ユーザー承認画像を最終デザイン基準として新規実装）
   既存の .p-org-chart__wd-org-* とはクラス名を完全に分離しており、
   organization-chart.css（旧版）は本ファイルの影響を受けない。 */

.p-orgchart2__stage {
  --oc2-green: #0f7a34;
  --oc2-blue: #135fa9;
  --oc2-purple: #7b57a4;
  --oc2-orange: #ef8b13;
  --oc2-pink: #e25785;
  --oc2-lightblue: #5f7fbe;
  --oc2-deepblue: #174f88;
  position: relative;
  margin: 0 auto;
  max-width: 980px;
  padding: 44px clamp(16px, 5vw, 56px) 52px;
  border-radius: 24px;
  overflow: hidden;
  background-image: url(/images/share/main_img_2025.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  isolation: isolate;
}
.p-orgchart2__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.87);
  z-index: 0;
}
.p-orgchart2__title,
.p-orgchart2__canvas {
  position: relative;
  z-index: 1;
}
.p-orgchart2__title h2 {
  margin: 0 0 36px;
}

.p-orgchart2__canvas {
  display: flex;
  justify-content: center;
}
.p-orgchart2__main {
  width: fit-content;
  max-width: 100%;
}

.p-orgchart2__row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 92px;
  padding-left: 54px;
}
.p-orgchart2__row--branch3 { min-height: 156px; }
.p-orgchart2__row--branch2 { min-height: 112px; }
.p-orgchart2__row--branch7 { min-height: 360px; }

.p-orgchart2__row[data-tone="green"] { --tone: var(--oc2-green); }
.p-orgchart2__row[data-tone="blue"] { --tone: var(--oc2-blue); }
.p-orgchart2__row[data-tone="purple"] { --tone: var(--oc2-purple); }
.p-orgchart2__row[data-tone="orange"] { --tone: var(--oc2-orange); }
.p-orgchart2__row[data-tone="pink"] { --tone: var(--oc2-pink); }
.p-orgchart2__row[data-tone="lightblue"] { --tone: var(--oc2-lightblue); }
.p-orgchart2__row[data-tone="deepblue"] { --tone: var(--oc2-deepblue); }

/* 左側縦ライン：各行が自分の色で自分の行の高さ分だけラインを担当する。
   先頭行は中央から下のみ、最終行は上から中央のみとして、線がノード間だけを結ぶ。 */
.p-orgchart2__row::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--tone);
}
.p-orgchart2__row:first-child::before { top: 50%; }
.p-orgchart2__row:last-child::before { bottom: 50%; }

.p-orgchart2__node {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tone);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--tone);
  z-index: 2;
}
.p-orgchart2__stub {
  position: absolute;
  left: 22px;
  top: 50%;
  width: 32px;
  height: 2px;
  background: var(--tone);
}

.p-orgchart2__card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 300px;
  flex: 0 0 300px;
  min-height: 68px;
  padding: 14px 22px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(24, 43, 55, 0.08);
}
.p-orgchart2__icon {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  background: var(--tone);
}
.p-orgchart2__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.p-orgchart2__row[data-tone="green"] .p-orgchart2__icon svg:first-child { fill: currentColor; }
.p-orgchart2__label {
  margin: 0;
  color: #2b2320;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

/* 右側フロー：長い横ライン → 縦ブラケット → 短い横スタブ → 小カード */
.p-orgchart2__branch {
  position: relative;
  margin-left: 92px;
  display: flex;
  align-items: center;
}
.p-orgchart2__branch-line {
  position: absolute;
  left: -92px;
  top: 50%;
  width: 92px;
  height: 2px;
  background: var(--tone);
}
.p-orgchart2__branch-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.p-orgchart2__branch-list::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 17px;
  bottom: 17px;
  width: 2px;
  background: var(--tone);
}
.p-orgchart2__branch-list li {
  position: relative;
  display: flex;
  align-items: center;
}
.p-orgchart2__branch-node {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tone);
  z-index: 2;
}
.p-orgchart2__branch-stub {
  position: absolute;
  left: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--tone);
}
.p-orgchart2__pill {
  display: block;
  min-width: 150px;
  padding: 8px 16px;
  border: 1.5px solid color-mix(in srgb, var(--tone) 45%, #d9d2c8);
  border-radius: 10px;
  background: #fff;
  color: #2b2320;
  font-size: 0.98rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

/* ---------- Tablet (834px前後)：全体バランスを保ちながら縮小 ---------- */
@media screen and (max-width: 900px) {
  .p-orgchart2__stage { padding: 36px 24px 44px; border-radius: 18px; }
  .p-orgchart2__card { width: 240px; flex-basis: 240px; padding: 12px 18px; gap: 12px; }
  .p-orgchart2__label { font-size: 1.12rem; }
  .p-orgchart2__icon { flex-basis: 40px; width: 40px; height: 40px; }
  .p-orgchart2__icon svg { width: 22px; height: 22px; }
  .p-orgchart2__branch { margin-left: 56px; }
  .p-orgchart2__branch-line { left: -56px; width: 56px; }
  .p-orgchart2__pill { min-width: 122px; font-size: 0.88rem; padding: 7px 12px; }
  .p-orgchart2__row { min-height: 82px; padding-left: 46px; }
  .p-orgchart2__row--branch3 { min-height: 140px; }
  .p-orgchart2__row--branch2 { min-height: 100px; }
  .p-orgchart2__row--branch7 { min-height: 320px; }
}

/* ---------- Mobile (480px前後)：横スクロール禁止のため縦構造へ切替 ---------- */
@media screen and (max-width: 480px) {
  .p-orgchart2__stage { padding: 28px 16px 36px; border-radius: 14px; }
  .p-orgchart2__title h2 { margin-bottom: 24px; }
  .p-orgchart2__canvas { display: block; }
  .p-orgchart2__main { width: 100%; max-width: 100%; }

  .p-orgchart2__row,
  .p-orgchart2__row--branch3,
  .p-orgchart2__row--branch2,
  .p-orgchart2__row--branch7 {
    display: block;
    min-height: 0;
    padding-left: 26px;
    margin-bottom: 20px;
  }
  .p-orgchart2__row::before { left: 9px; top: 0; bottom: -20px; }
  .p-orgchart2__row:first-child::before { top: 24px; }
  .p-orgchart2__row:last-child::before,
  .p-orgchart2__row:last-child::before { bottom: 0; }
  .p-orgchart2__row:last-child { margin-bottom: 0; }
  .p-orgchart2__row:last-child::before { display: none; }

  .p-orgchart2__node { left: 3px; top: 24px; transform: none; }
  .p-orgchart2__stub { display: none; }

  .p-orgchart2__card {
    width: 100%;
    flex-basis: auto;
    border-radius: 16px;
    padding: 12px 16px;
    gap: 12px;
  }
  .p-orgchart2__label { font-size: 1.05rem; }
  .p-orgchart2__icon { flex-basis: 40px; width: 40px; height: 40px; }
  .p-orgchart2__icon svg { width: 22px; height: 22px; }

  .p-orgchart2__branch {
    margin-left: 0;
    margin-top: 10px;
    padding-left: 20px;
  }
  .p-orgchart2__branch-line { display: none; }
  .p-orgchart2__branch-list { gap: 8px; }
  .p-orgchart2__branch-list::before { left: -1px; top: 10px; bottom: 10px; }
  .p-orgchart2__branch-node { left: -5px; }
  .p-orgchart2__branch-stub { left: -1px; width: 14px; }
  .p-orgchart2__pill {
    min-width: 0;
    width: fit-content;
    max-width: 100%;
    white-space: normal;
    font-size: 0.84rem;
    padding: 6px 12px;
    margin-left: 14px;
  }
}

@media print {
  .p-orgchart2__stage { break-inside: avoid; background-image: none; }
  .p-orgchart2__card, .p-orgchart2__pill { box-shadow: none; }
}
