/* ==========================================================================
   ホームページ制作の見積もりシミュレーション（include/fc_price-sim.php）
   料金一覧ページ（/price/）の見た目に合わせる：
   - 見出し … サイト共通の .is-style-page-square（マークアップ側でクラスを付与）
   - 表     … .p-page .wp-block-table td と同じ（枠線 #ccc・左列グレー・中央揃え）
   - ボタン … サイト共通の .c-btn__primary
   ========================================================================== */
.p-sim {
  --sim-line: #ccc;
  --sim-head: #f5f5f5;
  --sim-blue: #17a1e1;
  --sim-blue-pale: #eef8fd;
  margin: 0 0 4rem;
}
.p-sim *,
.p-sim *::before,
.p-sim *::after { box-sizing: border-box; }

.p-sim__sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.p-page .p-sim__lead { margin-bottom: 0; }

/* ステップ（fieldset） */
.p-sim__form { margin: 0; }
.p-sim__step {
  margin: 5rem 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
/* legend は fieldset の枠線上に置かれるため、float で通常の流れに戻す */
.p-sim__legend {
  float: left;
  width: 100%;
  margin: 0 0 2rem;
  font-weight: 700;
  line-height: 1.5;
}
.p-sim__legend + * { clear: both; }
.p-sim__legend small { margin-left: .5em; font-size: 1.4rem; font-weight: 500; }

/* 1. サイトの種類：表と同じ枠線で 3 列 */
.p-sim__types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--sim-line);
  border-left: 1px solid var(--sim-line);
}
.p-sim__type {
  position: relative;
  display: block;
  border-right: 1px solid var(--sim-line);
  border-bottom: 1px solid var(--sim-line);
  cursor: pointer;
}
.p-sim__type input { position: absolute; opacity: 0; pointer-events: none; }
.p-sim__type-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  text-align: center;
  transition: background-color .2s;
}
.p-sim__type-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  padding: 1.6rem 1rem;
  background: var(--sim-head);
  border-bottom: 1px solid var(--sim-line);
  font-weight: 600;
  transition: background-color .2s, color .2s;
}
.p-sim__type-name::before {
  content: "";
  flex: none;
  width: 1.8rem; height: 1.8rem;
  border: 2px solid #999;
  border-radius: 50%;
  background: #fff;
}
.p-sim__type-note { padding: 1.6rem 2rem 0; font-size: 1.4rem; line-height: 1.7; }
.p-sim__type-price { margin-top: auto; padding: 1rem 2rem 1.8rem; font-weight: 600; }
.p-sim__type:hover .p-sim__type-body { background: #fafafa; }
.p-sim__type input:checked + .p-sim__type-body { background: var(--sim-blue-pale); }
.p-sim__type input:checked + .p-sim__type-body .p-sim__type-name { background: var(--sim-blue); color: #fff; }
.p-sim__type input:checked + .p-sim__type-body .p-sim__type-name::before {
  border-color: #fff;
  background: var(--sim-blue);
  box-shadow: inset 0 0 0 3px #fff;
}
.p-sim__type input:focus-visible + .p-sim__type-body { outline: 2px solid var(--sim-blue); outline-offset: -2px; }

/* 2・3：料金一覧の表と同じ 2 列 */
.p-sim__table {
  border-top: 1px solid var(--sim-line);
  border-left: 1px solid var(--sim-line);
}
.p-sim__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.p-sim__row[hidden] { display: none; }
.p-sim__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-width: 0;
  padding: 2rem;
  border-right: 1px solid var(--sim-line);
  border-bottom: 1px solid var(--sim-line);
  text-align: center;
}
.p-sim__cell--head {
  flex-direction: row;
  gap: 1rem;
  background: var(--sim-head);
  font-weight: 600;
}
.p-sim__note { font-size: 1.4rem; line-height: 1.6; }
.p-sim__price { font-weight: 600; }

/* 数量ステッパー */
.p-sim__stepper { display: flex; align-items: center; }
.p-sim__stepper-btn {
  width: 4rem; height: 4rem;
  border: 1px solid var(--sim-line);
  background: #fff;
  color: #212121;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s;
}
.p-sim__stepper-btn:hover { background: var(--sim-head); }
.p-sim__stepper-input {
  width: 6rem; height: 4rem;
  border: 1px solid var(--sim-line);
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  font-size: 1.7rem;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.p-sim__stepper-input::-webkit-inner-spin-button,
.p-sim__stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.p-sim__stepper-unit { margin-left: 1rem; font-size: 1.4rem; white-space: nowrap; }
.p-sim__stepper-btn:focus-visible,
.p-sim__stepper-input:focus-visible { position: relative; outline: 2px solid var(--sim-blue); outline-offset: -2px; }

/* オプション */
.p-sim__check { cursor: pointer; }
.p-sim__check input {
  flex: none;
  width: 2rem; height: 2rem;
  margin: 0;
  accent-color: var(--sim-blue);
  cursor: pointer;
}
.p-sim__row--option .p-sim__cell { transition: background-color .2s; }
.p-sim__row--option.is-checked .p-sim__cell { background: var(--sim-blue-pale); }
.p-sim__days select {
  height: 4rem;
  padding: 0 3.2rem 0 1.2rem;
  border: 1px solid var(--sim-line);
  border-radius: 0;
  background: #fff;
  font-size: 1.6rem;
}
.p-sim__days select:disabled { opacity: .4; }

/* 算出ボタン（.c-btn__primary に合わせる） */
.p-sim__action { margin-top: 5rem; text-align: center; }
.p-sim__submit.c-btn__primary {
  border: 0;
  font-size: 1.8rem;
  font-family: inherit;
  cursor: pointer;
}
.p-sim__submit.c-btn__primary:hover { opacity: .8; }
.p-page .p-sim__stale { margin: 1.5rem 0 0; color: #d0413a; font-size: 1.4rem; font-weight: 600; }

/* 結果 */
.p-sim__result {
  margin-top: 5rem;
  padding: 4rem;
  border: 1px solid var(--sim-line);
  scroll-margin-top: 10rem;
  transition: opacity .2s;
}
.p-sim__result.is-stale { opacity: .45; }
.p-sim__total { text-align: center; }
.p-page .p-sim__total-label { margin: 0; font-weight: 600; }
.p-page .p-sim__total-price {
  margin: .5rem 0 0;
  font-size: 4.8rem;
  font-weight: 700;
  line-height: 1.3;
}
.p-page .p-sim__total-price small { margin-left: .4rem; font-size: 2rem; }
.p-page .p-sim__total-tax { margin: 0; font-size: 1.4rem; }
.p-page .p-sim__sub { margin: 4rem 0 2rem; font-weight: 700; line-height: 1.5; }
.p-sim__breakdown { width: 100%; margin: 0; }
.p-sim__breakdown table { width: 100%; table-layout: auto; }
.p-page .p-sim__breakdown td:last-child { white-space: nowrap; }
.p-page .p-sim__breakdown td { padding: 1.4rem 2rem; }

.p-sim__notes { margin: 2rem 0 0; padding: 0; list-style: none; font-size: 1.4rem; line-height: 1.8; }
.p-sim__notes li { position: relative; margin: 0; padding-left: 1.2em; list-style: none; }
.p-sim__notes li::before { content: "※"; position: absolute; left: 0; top: 0; }

.p-sim__contact-wrap,
.p-sim__result .p-sim__contact { margin-top: 3rem; }
.p-sim__result { text-align: left; }
.p-sim__contact.c-btn__primary {
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  gap: 1rem;
  color: #fff;
  text-decoration: none;
}
.p-sim__contact.c-btn__primary:hover { opacity: .8; }

/* 料金一覧ページのボタン [price_simulation_link] */
.p-sim-link {
  margin: 3rem 0 6rem;
  padding: 3rem 2rem;
  border: 1px solid var(--sim-line, #ccc);
  text-align: center;
}
.p-page .p-sim-link__text { margin: 0 0 2rem; }
.p-sim-link__btn.c-btn__primary { color: #fff; text-decoration: none; }
.p-sim-link__btn.c-btn__primary:hover { opacity: .8; }

/* タブレット・スマホ */
@media only screen and (max-width: 768px) {
  .p-sim__step { margin-top: 4rem; }
  .p-sim__types { grid-template-columns: 1fr; }
  .p-sim__type-body { flex-direction: row; flex-wrap: wrap; align-items: stretch; text-align: left; }
  .p-sim__type-name { justify-content: flex-start; padding: 1.4rem 1.6rem; }
  .p-sim__type-note { flex: 1 1 60%; padding: 1.2rem 1.6rem; }
  .p-sim__type-price { margin: 0; padding: 1.2rem 1.6rem; align-self: center; }
  .p-sim__row { grid-template-columns: 1fr; }
  .p-sim__cell { padding: 1.6rem; }
  .p-sim__cell--head { justify-content: flex-start; text-align: left; }
  .p-sim__row--option .p-sim__cell:not(.p-sim__cell--head) { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: left; }
  .p-sim__row--option .p-sim__note { flex-basis: 100%; }
  .p-sim__result { padding: 2.4rem 1.6rem; }
  .p-page .p-sim__total-price { font-size: 3.6rem; }
  .p-page .p-sim__breakdown td { padding: 1.2rem 1rem; }
  .p-sim__contact.c-btn__primary,
  .p-sim-link__btn.c-btn__primary { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .p-sim * { transition: none !important; }
}
