/* ==========================================================================
   補助金ガイド（/subsidy/・page-subsidy.php）
   読み込み: functions.php（/subsidy/ のときだけ）
   色は style.css の :root 変数を使う。受付状況の色だけここで変数化する。
   ========================================================================== */

.sg-wrap {
  --sg-open: #15803d;
  --sg-open-bg: #ecfdf3;
  --sg-upcoming: #1d4ed8;
  --sg-upcoming-bg: #eef4ff;
  --sg-closed: #64748b;
  --sg-closed-bg: #f1f5f9;
  --sg-checking: #a16207;
  --sg-checking-bg: #fef9e7;
  --sg-alert: #b42318;
  --sg-alert-bg: #fff4f2;
  color: var(--sol-text);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: break-word;
}
.sg-wrap *,
.sg-wrap *::before,
.sg-wrap *::after { box-sizing: border-box; }
.sg-wrap a { color: var(--sol-primary); }
.sg-con { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.sg-br-sp { display: none; }
.sg-nw { white-space: nowrap; }
/* 最終行が1文字だけになる折り返しを避ける（対応ブラウザのみ。非対応でも表示は崩れない） */
.sg-wrap p, .sg-wrap li, .sg-wrap dd, .sg-wrap td { text-wrap: pretty; }

.sg-bc { max-width: 1080px; margin: 0 auto; padding: 10px 20px; font-size: 13px; color: var(--sol-text-muted); }

/* ---------- 受付状況ラベル ---------- */
.sg-st {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  border: 1px solid currentColor;
}
.sg-st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sg-st--open     { color: var(--sg-open);     background: var(--sg-open-bg); }
.sg-st--upcoming { color: var(--sg-upcoming); background: var(--sg-upcoming-bg); }
.sg-st--closed   { color: var(--sg-closed);   background: var(--sg-closed-bg); }
.sg-st--checking { color: var(--sg-checking); background: var(--sg-checking-bg); }
.sg-st--none     { color: var(--sg-closed);   background: var(--sg-closed-bg); }
.sg-st-note { display: inline-block; margin-left: 6px; font-size: 13px; color: var(--sol-text-muted); }

/* ---------- ヒーロー ---------- */
.sg-hero { background: var(--sol-bg); border-bottom: 1px solid var(--sol-border); padding: 40px 0 36px; }
.sg-kicker { margin: 0 0 8px; color: var(--sol-primary); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.sg-h1 { margin: 0 0 12px; font-size: clamp(26px, 4vw, 40px); font-weight: 800; line-height: 1.35; }
.sg-updated { margin: 0 0 16px; font-size: 14px; }
.sg-updated span { display: inline-block; padding: 4px 12px; background: #fff; border: 1px solid var(--sol-border); border-radius: 6px; font-weight: 700; }
.sg-lead { max-width: 760px; }
.sg-lead p { margin: 0 0 10px; }
.sg-caution {
  max-width: 760px; margin: 16px 0 20px; padding: 12px 14px;
  background: #fff; border-left: 4px solid var(--sol-primary); border-radius: 4px;
  font-size: 15px; font-weight: 700;
}
.sg-hero-btns, .sg-cta__btns { display: flex; flex-wrap: wrap; gap: 12px; }

.sg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 24px; border-radius: 999px;
  font-size: 16px; font-weight: 700; text-decoration: none; line-height: 1.4;
}
.sg-wrap .sg-btn--line { background: var(--sol-line); color: #fff; }
.sg-wrap .sg-btn--tel  { background: #fff; color: var(--sol-text); border: 1px solid var(--sol-border); }
.sg-wrap .sg-btn--form { background: var(--sol-primary); color: #fff; }
.sg-btn:focus-visible, .sg-wrap a:focus-visible, .sg-city-select:focus-visible, .sg-faq__q:focus-visible {
  outline: 3px solid var(--sol-primary-border); outline-offset: 2px;
}

.sg-toc { margin-top: 24px; }
.sg-toc ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sg-toc a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  background: #fff; border: 1px solid var(--sol-border); border-radius: 8px;
  color: var(--sol-text); font-size: 14px; font-weight: 700; text-decoration: none;
}

/* ---------- セクション共通 ---------- */
.sg-sec { padding: 56px 0; scroll-margin-top: 80px; }
.sg-sec--bg { background: var(--sol-bg); }
.sg-wrap [id^="sg-"] { scroll-margin-top: 80px; }
.sg-h2 {
  margin: 0 0 14px; padding-left: 14px; border-left: 5px solid var(--sol-primary);
  font-size: clamp(22px, 3vw, 30px); font-weight: 800; line-height: 1.4;
}
.sg-h2--sm { font-size: 20px; }
.sg-h3 { margin: 40px 0 12px; font-size: 20px; font-weight: 800; }
.sg-h4 { margin: 20px 0 8px; font-size: 16px; font-weight: 800; }
.sg-text { margin: 0 0 16px; max-width: 820px; }
.sg-small { margin: 10px 0 0; font-size: 14px; color: var(--sol-text-muted); line-height: 1.7; }

/* ---------- ① 早見表 ---------- */
.sg-quick { margin-top: 8px; }
.sg-quick__table { width: 100%; border-collapse: collapse; background: #fff; font-size: 15px; line-height: 1.6; }
.sg-quick__table th, .sg-quick__table td { padding: 12px 12px; border: 1px solid var(--sol-border); text-align: left; vertical-align: top; }
.sg-quick__table thead th { background: var(--sol-text); color: #fff; font-size: 14px; white-space: nowrap; }
.sg-quick__table tbody th { font-weight: 700; min-width: 200px; }
.sg-quick__table tbody th a { color: var(--sol-text); text-decoration: underline; text-decoration-color: var(--sol-primary-border); text-underline-offset: 3px; }
.sg-quick__amount { font-weight: 700; }
.sg-quick__row--closed { background: #fafafa; color: var(--sol-text-muted); }
.sg-quick__table .sg-st-note { display: block; margin: 4px 0 0; }

/* ---------- 注意BOX ---------- */
.sg-alert {
  margin: 28px 0 0; padding: 20px 22px;
  background: var(--sg-alert-bg); border: 2px solid var(--sg-alert); border-radius: 10px;
}
.sg-alert__title { margin: 0 0 8px; color: var(--sg-alert); font-size: 19px; font-weight: 800; line-height: 1.5; }
.sg-alert__title::before { content: '!'; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--sg-alert); color: #fff; font-size: 15px; vertical-align: 2px; }
.sg-alert p { margin: 0 0 8px; }
.sg-alert ul { margin: 0 0 10px; padding-left: 1.2em; }
.sg-alert li { margin-bottom: 4px; }
.sg-alert__foot { font-weight: 700; }

/* ---------- カード ---------- */
.sg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.sg-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#sg-cases .sg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sg-card {
  display: flex; flex-direction: column;
  padding: 24px; background: #fff; border: 1px solid var(--sol-border); border-radius: 12px;
}
.sg-card--featured { border: 2px solid var(--sol-primary); }
.sg-card--separate { border-style: dashed; }
.sg-card--closed { background: #fafafa; }
.sg-card__head { margin-bottom: 12px; }
.sg-card__head .sg-st { margin-bottom: 8px; }
.sg-tag { display: inline-block; margin: 0 0 8px 6px; padding: 2px 8px; border-radius: 4px; background: var(--sol-primary-pale); color: var(--sol-text); font-size: 13px; font-weight: 700; }
.sg-card__title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.5; }
.sg-card__title-sub { display: block; margin-top: 2px; font-size: 14px; font-weight: 700; color: var(--sol-text-muted); }
.sg-card__amount { margin: 0; color: var(--sol-primary); font-size: clamp(24px, 3vw, 30px); font-weight: 800; line-height: 1.35; }
.sg-card--closed .sg-card__amount { color: var(--sol-text-muted); }
.sg-card__amount-sub { margin: 2px 0 14px; font-size: 14px; font-weight: 700; color: var(--sol-text-muted); }
.sg-card__foot { margin: auto 0 0; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; }

.sg-rows, .sg-amounts { margin: 0; border-top: 1px solid var(--sol-border); }
.sg-rows div, .sg-amounts div { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--sol-border); font-size: 15px; line-height: 1.6; }
.sg-amounts div { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.sg-rows dt, .sg-amounts dt { font-weight: 700; color: var(--sol-text-muted); }
.sg-amounts dt { color: var(--sol-text); font-weight: 600; }
.sg-rows dd, .sg-amounts dd { margin: 0; }
.sg-amounts dd { font-weight: 800; }

.sg-notes { margin: 14px 0 0; padding-left: 1.2em; font-size: 15px; line-height: 1.7; }
.sg-notes li { margin-bottom: 6px; }

.sg-official {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px;
  font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.sg-small .sg-official, .sg-sources .sg-official { min-height: 0; }
.sg-official__ext { font-size: 13px; }
.sg-inlink { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 700; }

/* 宮城県：募集回 */
.sg-rounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sg-round { padding: 14px; border: 1px solid var(--sol-border); border-radius: 10px; background: #fff; font-size: 15px; }
.sg-round p { margin: 0 0 4px; }
.sg-round__name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; }
.sg-round__label { display: block; font-size: 13px; font-weight: 700; color: var(--sol-text-muted); }
.sg-round--open { border: 2px solid var(--sg-open); }
.sg-round--closed { color: var(--sol-text-muted); background: #fafafa; }

/* 国：進捗 */
.sg-progress { margin: 0 0 16px; padding: 14px; background: var(--sol-bg); border-radius: 10px; }
.sg-progress__label { margin: 0 0 8px; font-size: 15px; }
.sg-progress__label strong { color: var(--sol-primary); font-size: 20px; }
.sg-progress__label span { display: inline-block; font-size: 13px; color: var(--sol-text-muted); }
.sg-progress__bar { height: 12px; background: #e8edf3; border-radius: 999px; overflow: hidden; }
.sg-progress__bar span { display: block; height: 100%; background: var(--sol-primary); border-radius: 999px; }

.sg-mini-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; background: #fff; }
.sg-mini-table th, .sg-mini-table td { padding: 10px; border: 1px solid var(--sol-border); text-align: left; vertical-align: top; }
.sg-mini-table thead th { background: var(--sol-primary-pale); font-size: 14px; }
/* 金額が「7／万円」のように途中で折り返さないよう、空白・句読点の位置で折り返す（短いセルだけ） */
.sg-mini-table:not(.sg-mini-table--more) th,
.sg-mini-table:not(.sg-mini-table--more) td { word-break: keep-all; overflow-wrap: anywhere; }

/* ---------- ⑤ 市町村 ---------- */
.sg-mini-table--more tbody th, .sg-mini-table--more td:nth-child(3), .sg-mini-table--more td:last-child { white-space: nowrap; }
.sg-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 20px; padding: 0; list-style: none; font-size: 14px; }
.sg-city-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sg-city { display: flex; flex-direction: column; padding: 18px; background: #fff; border: 1px solid var(--sol-border); border-radius: 12px; }
.sg-city--open { border-top: 4px solid var(--sg-open); }
.sg-city--upcoming { border-top: 4px solid var(--sg-upcoming); }
.sg-city--checking, .sg-city--closed { border-top: 4px solid var(--sol-border); }
.sg-city__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.sg-city__name { margin: 0; font-size: 20px; font-weight: 800; }
.sg-city__program { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--sol-text-muted); }
.sg-city__amounts { margin: 0 0 10px; padding-left: 1.1em; font-size: 15px; font-weight: 700; line-height: 1.6; }
.sg-city__amounts li { margin-bottom: 4px; }
.sg-city__meta { margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.sg-city__meta div { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 6px; margin-bottom: 4px; }
.sg-city__meta dt { font-weight: 700; color: var(--sol-text-muted); }
.sg-city__meta dd { margin: 0; }
.sg-city__note { margin: 0 0 6px; font-size: 14px; color: var(--sol-text-muted); line-height: 1.6; }
.sg-city__foot { margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 0 16px; }

.sg-city-select-wrap { max-width: 620px; margin: 36px 0 0; padding: 20px; background: var(--sol-bg); border-radius: 12px; }
.sg-city-select-label { display: block; margin-bottom: 8px; font-size: 16px; font-weight: 800; }
.sg-city-select { width: 100%; min-height: 52px; padding: 0 16px; border: 2px solid var(--sol-primary); border-radius: 10px; background: #fff; color: var(--sol-text); font-size: 16px; font-weight: 700; cursor: pointer; }

/* ---------- ⑥ ケース ---------- */
.sg-case { padding: 22px; background: #fff; border: 1px solid var(--sol-border); border-radius: 12px; }
.sg-case__title { margin: 0 0 12px; font-size: 18px; font-weight: 800; line-height: 1.5; }
.sg-case__list { margin: 0 0 12px; padding-left: 1.1em; font-size: 15px; line-height: 1.7; }
.sg-case__list li { margin-bottom: 6px; }
.sg-case__note { margin: 0; padding-top: 10px; border-top: 1px dashed var(--sol-border); font-size: 14px; color: var(--sol-text-muted); line-height: 1.7; }

/* ---------- ⑦ 注意 ---------- */
.sg-checks { margin: 0; padding: 0; list-style: none; counter-reset: sgc; display: grid; gap: 12px; max-width: 860px; }
.sg-checks li { position: relative; padding: 16px 16px 16px 56px; background: #fff; border: 1px solid var(--sol-border); border-radius: 10px; counter-increment: sgc; }
.sg-checks li::before { content: counter(sgc); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--sol-text); color: #fff; font-size: 14px; font-weight: 800; }
.sg-checks strong { display: block; margin-bottom: 2px; font-size: 17px; }

/* ---------- ⑧ サポート ---------- */
.sg-support__badge { display: inline-block; margin: 0 0 14px; padding: 8px 16px; background: var(--sol-primary); color: #fff; border-radius: 8px; font-size: 18px; font-weight: 800; }
.sg-steps { margin: 8px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sg-steps li { display: flex; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--sol-border); border-radius: 10px; }
.sg-steps__no { flex: 0 0 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--sol-primary-pale); color: var(--sol-primary); font-weight: 800; }
.sg-steps strong { display: block; margin-bottom: 4px; font-size: 16px; }
.sg-steps p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--sol-text-muted); }

/* ---------- 施工事例 ---------- */
.sg-case-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.sg-work { display: block; background: #fff; border: 1px solid var(--sol-border); border-radius: 12px; overflow: hidden; text-decoration: none; }
.sg-wrap .sg-work { color: var(--sol-text); }
.sg-work img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.sg-work__body { padding: 14px 16px 16px; }
.sg-work__region { margin: 0 0 4px; color: var(--sol-primary); font-size: 13px; font-weight: 800; }
.sg-work__title { margin: 0 0 6px; font-size: 16px; line-height: 1.5; }
.sg-work__type { margin: 0; font-size: 13px; color: var(--sol-text-muted); }
.sg-more-link { margin: 20px 0 0; text-align: center; font-weight: 700; }

/* ---------- ⑨ FAQ ---------- */
.sg-faq { max-width: 860px; display: grid; gap: 10px; }
.sg-faq__item { background: #fff; border: 1px solid var(--sol-border); border-radius: 10px; }
.sg-faq__q { position: relative; min-height: 44px; padding: 14px 44px 14px 16px; font-weight: 800; cursor: pointer; list-style: none; }
.sg-faq__q::-webkit-details-marker { display: none; }
.sg-faq__q::after { content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--sol-primary); font-size: 22px; font-weight: 700; }
.sg-faq__item[open] .sg-faq__q::after { content: '−'; }
.sg-faq__a { margin: 0; padding: 0 16px 16px; font-size: 15px; line-height: 1.8; }

.sg-content { padding-top: 40px; padding-bottom: 40px; }

/* ---------- 出典 ---------- */
.sg-sec--sources { padding: 40px 0; border-top: 1px solid var(--sol-border); }
.sg-sources { margin: 12px 0 0; padding-left: 1.2em; font-size: 15px; line-height: 1.7; }
.sg-sources li { margin-bottom: 8px; }

/* ---------- ⑩ CTA ---------- */
.sg-cta { padding: 56px 0; background: var(--sol-text); color: #fff; text-align: center; }
.sg-cta__title { margin: 0 0 12px; color: #fff; font-size: clamp(22px, 3.2vw, 30px); font-weight: 800; line-height: 1.45; }
.sg-cta__lead { max-width: 620px; margin: 0 auto 22px; color: rgba(255, 255, 255, .9); }
.sg-cta__btns { justify-content: center; }
.sg-cta__hours { margin: 14px 0 0; font-size: 14px; color: rgba(255, 255, 255, .85); }
.sg-cta__checks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 14px; font-weight: 700; }
.sg-cta__checks li::before { content: '✓ '; color: var(--sol-primary-light); }

/* ==========================================================================
   レスポンシブ（既存ブレークポイント 980 / 768 / 640 / 480）
   ========================================================================== */
@media (max-width: 980px) {
  .sg-city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #sg-cases .sg-grid { grid-template-columns: 1fr; }
  .sg-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 早見表・その他市町村の表はカード表示に切り替え（横スクロールさせない） */
  .sg-quick__table, .sg-quick__table tbody, .sg-quick__table tr, .sg-quick__table th, .sg-quick__table td,
  .sg-mini-table--more, .sg-mini-table--more tbody, .sg-mini-table--more tr, .sg-mini-table--more th, .sg-mini-table--more td { display: block; width: 100%; }
  .sg-quick__table thead, .sg-mini-table--more thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sg-quick__table, .sg-mini-table--more { background: transparent; border: 0; }
  .sg-quick__table tr, .sg-mini-table--more tr { margin-bottom: 14px; background: #fff; border: 1px solid var(--sol-border); border-radius: 12px; overflow: hidden; }
  .sg-quick__row--closed { background: #fafafa !important; }
  .sg-quick__table th, .sg-quick__table td, .sg-mini-table--more th, .sg-mini-table--more td { border: 0; border-bottom: 1px solid var(--sol-border); padding: 10px 16px; }
  .sg-quick__table tbody th, .sg-mini-table--more tbody th { min-width: 0; background: var(--sol-primary-pale); font-size: 16px; }
  .sg-quick__table td, .sg-mini-table--more td { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 10px; }
  .sg-quick__table td::before, .sg-mini-table--more td::before { content: attr(data-label); font-size: 13px; font-weight: 700; color: var(--sol-text-muted); }
  .sg-quick__table td:last-child, .sg-mini-table--more td:last-child { border-bottom: 0; }
  .sg-quick__table td > *, .sg-mini-table--more td > * { justify-self: start; }
  .sg-mini-table--more tbody th, .sg-mini-table--more td:nth-child(3) { white-space: normal; }
}

@media (max-width: 768px) {
  .sg-grid, .sg-grid--2 { grid-template-columns: 1fr; }
  .sg-rounds { grid-template-columns: 1fr; }
  .sg-sec { padding: 44px 0; }
  .sg-hero { padding: 28px 0; }
}

@media (max-width: 640px) {
  .sg-city-grid { grid-template-columns: 1fr; }
  .sg-steps { grid-template-columns: 1fr; }
  .sg-case-grid { grid-template-columns: 1fr; }
  .sg-card { padding: 18px; }
  .sg-amounts div { grid-template-columns: 1fr; gap: 0; }
  .sg-mini-table { font-size: 14px; }
  .sg-mini-table th, .sg-mini-table td { padding: 8px; }
}

@media (max-width: 480px) {
  .sg-con, .sg-bc { padding-left: 16px; padding-right: 16px; }
  .sg-br-sp { display: inline; }
  .sg-hero-btns .sg-btn, .sg-cta__btns .sg-btn { width: 100%; }
  .sg-rows div { grid-template-columns: 1fr; gap: 0; }
  .sg-quick__table td, .sg-mini-table--more td { grid-template-columns: 1fr; gap: 0; }
  .sg-toc a { font-size: 13px; padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-wrap { scroll-behavior: auto; }
}
