/* 品質保証：共通部品に加える、今回の原稿固有の配置。 */
#fv .fv-definition { order: 9; }
#fv .fv-photo-block { order: 8; min-width: 0; }
#fv .fv-photo-block .photo-placeholder { aspect-ratio: 4 / 3; }
#footer { background: var(--color-navy); }
[data-complete-title] { scroll-margin-top: var(--header-offset); }
.opt > span { overflow-wrap: anywhere; }

/* 長い定義と注記を持つ比較表は、枠の内側で横にスクロールする。 */
table[data-table-kind="definition"] th:first-child { width: 15%; }
table[data-table-kind="definition"] th:nth-child(2) { width: 35%; }
table[data-table-kind="definition"] th:nth-child(3) { width: 50%; }
table[data-table-kind="ratio"] th:first-child { width: 46%; }
table[data-table-kind="qualifications"] :is(thead th:first-child, tbody th) { width: 28%; }

/* 年収の数値はスマホでも収め、年齢・勤続の注記は自然に折り返す。 */
#nenshu table { min-width: 0; table-layout: fixed; }
#nenshu thead th:first-child { width: 3.8em; }
#nenshu :is(th, td) { overflow-wrap: anywhere; }
#nenshu .table-scroll { max-width: var(--width-wide); }

@media (min-width: 768px) {
  #fv .fv-photo-block { grid-area: 4 / 2 / 6 / 3; align-self: start; }
  #fv .fv-photo-block .photo-placeholder { aspect-ratio: 16 / 9; }
  #fv .fv-definition { grid-column: 1 / -1; grid-row: 8; }
}
@media print {
  table[data-table-kind] { min-width: 0; }
}

/* 図の文字はHTMLで保持。工程の箱と矢印は別々に描く。 */
.quality-map {
  padding: var(--space-card);
  border: 1px solid var(--color-navy);
  border-radius: var(--radius-card);
  background: var(--color-bg);
}
.quality-map-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 6px;
  color: var(--color-navy);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}
.quality-band {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 6px 2px;
  border: 1px solid var(--color-navy);
  border-radius: 5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.assurance-band { grid-column: 1 / -1; grid-row: 1; color: white; background: var(--color-navy); }
.control-band { grid-column: 3; grid-row: 2; }
.inspection-band { grid-column: 2 / 5; grid-row: 3; color: var(--color-primary); border-color: var(--color-primary); }
.quality-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  grid-row: 4;
  grid-column: var(--stage);
  min-width: 0;
  min-height: 88px;
  padding: 10px 2px;
  border: 1px solid var(--color-navy);
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.quality-stage:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -6px;
  top: calc(50% - 3px);
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--color-navy);
  border-right: 1px solid var(--color-navy);
  transform: rotate(45deg);
}
.quality-stage-detail { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-primary); color: var(--color-primary); }
.quality-map figcaption { margin-top: var(--space-4); }

/* 4本の棒は同じ目盛り。1.0倍の基準線を全行で共有する。 */
.ratio-chart {
  --label-width: 220px;
  --value-width: 64px;
  --ratio-gap: 16px;
  --track-start: calc(var(--label-width) + var(--ratio-gap));
  padding: var(--space-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
}
.figure-title { color: var(--color-navy); font-size: 18px; font-weight: 700; line-height: 1.65; }
.ratio-reference-label { position: relative; min-height: 30px; margin-top: 20px; font-size: 14px; font-variant-numeric: tabular-nums; }
.ratio-reference-label > span {
  position: absolute;
  left: calc(var(--track-start) + (100% - var(--track-start) - var(--value-width) - var(--ratio-gap)) * var(--reference-ratio));
  transform: translateX(-50%);
}
.ratio-rows { position: relative; }
.ratio-rows::after {
  content: "";
  position: absolute;
  inset-block: 0;
  left: calc(var(--track-start) + (100% - var(--track-start) - var(--value-width) - var(--ratio-gap)) * var(--reference-ratio));
  border-left: 2px dashed var(--color-navy);
  pointer-events: none;
}
.ratio-row {
  display: grid;
  grid-template-columns: var(--label-width) minmax(0, 1fr) var(--value-width);
  gap: 8px var(--ratio-gap);
  align-items: center;
  padding-block: 16px;
  border-top: 1px solid var(--color-border);
}
.ratio-row > p { margin: 0; }
.ratio-label { font-size: 16px; font-weight: 700; }
.ratio-track { height: 20px; background: var(--color-bg-alt); border-radius: 3px; }
.ratio-bar { display: block; height: 100%; width: var(--bar-size); background: var(--color-primary); border-radius: 3px; }
.ratio-value { font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ratio-note { grid-column: 2 / -1; position: relative; z-index: 1; padding: 4px 0; background: white; color: var(--color-text-sub); font-size: 14px; }
.ratio-chart figcaption { margin-top: 16px; }

/* 原稿にある6ステップをそのまま流れ図にし、重複した図は作らない。 */
#flow > .flow-stages { --size-number: 48px; max-width: var(--width-wide); }
#flow .step > div { min-width: 0; }

@media (max-width: 767px) {
  .quality-map { padding: 16px 10px; }
  .ratio-chart { --ratio-gap: 12px; --track-start: 0px; }
  .ratio-row { grid-template-columns: minmax(0, 1fr) var(--value-width); }
  .ratio-label { grid-column: 1 / -1; position: relative; z-index: 1; background: white; }
  .ratio-note { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
  .quality-map-grid { gap: 12px; font-size: 16px; }
  .quality-stage { padding: 16px 8px; }
  .quality-stage:not(:last-child)::after { right: -10px; width: 7px; height: 7px; }
  #flow > .flow-stages { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
  #flow .flow-stages .step { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px 1fr; gap: 16px; padding-bottom: 0; }
  #flow .flow-stages .step > .num { margin-inline: auto; }
  #flow .flow-stages .step > div { padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: white; }
  #flow .flow-stages .step .h3 { font-size: 18px; }
  #flow .flow-stages .step:not(:last-child)::after { top: 24px; bottom: auto; left: 50%; width: calc(100% + 16px); height: 2px; }
  #flow .flow-stages .flow-note { font-size: 14px; padding: 8px; }
}
@media print {
  .quality-map, .ratio-chart { break-inside: avoid; }
}

/* 求人倍率の表：スマホで「0.64倍」が折り返さないように */
table[data-table-kind="ratio"] td:last-child { white-space: nowrap; }
