/* ============================================================
   くまもと被災者支援ナビ — style.css
   仕様書（spec-design.md）2〜6節のデザインシステム実装
   純粋なCSS。外部フォント・外部リソース参照なし。
   ============================================================ */

/* ---------- 0. リセット ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: auto; /* ネイティブスクロールを死守。JSでの上書き禁止 */
}

img,
svg {
  max-width: 100%;
  display: block;
}

ul,
ol {
  padding-left: 1.3em;
}

button {
  font: inherit;
}

table {
  border-collapse: collapse;
}

/* ---------- 1. カラートークン（仕様書2節・この値のまま） ---------- */
:root {
  --green-900: #12332a;
  --green-800: #17453a;
  --green-700: #1d5c48;
  --green-600: #247a5b;
  --green-50: #eaf3ee;
  --amber-700: #8a5a00;
  --amber-600: #a96a00;
  --amber-50: #fdf3e0;
  --red-700: #b3261e;
  --red-50: #fdecea;
  --paper: #f7f5f0;
  --card: #ffffff;
  --ink: #1f1f1c;
  --ink-2: #565650;
  --line: #e4dfd4;
  --focus: #8a5a00;
}

/* ---------- 2. タイポグラフィ（仕様書3節） ---------- */
html {
  font-size: 17px;
}
@media (min-width: 600px) {
  html {
    font-size: 18px;
  }
}
html.large {
  font-size: 20px;
}
@media (min-width: 600px) {
  html.large {
    font-size: 21px;
  }
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic",
    "Yu Gothic Medium", "Yu Gothic", -apple-system, sans-serif;
  line-height: 1.9;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) {
  body {
    padding-bottom: 0;
  }
}

p {
  margin: 0 0 1em;
}

h1,
h2,
h3 {
  font-weight: 700;
  color: var(--ink);
}

h1 {
  font-size: 1.5rem;
  line-height: 1.45;
  margin: 4px 0 18px;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 34px 0 14px;
  padding: 2px 0 2px 12px;
  border-left: 4px solid var(--green-700);
}

h3 {
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 20px 0 10px;
}

a {
  color: var(--green-700);
  text-decoration: underline;
}
a:visited {
  color: var(--green-700);
}

/* ---------- 3. レイアウト ---------- */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding-left: 18px;
  padding-right: 18px;
}

main {
  flex: 1 0 auto;
  width: 100%;
  padding-top: 20px;
  padding-bottom: 40px;
}

/* ---------- 4. ヘッダー（仕様書4節） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--green-900);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.header-inner {
  padding-top: 10px;
  padding-bottom: 8px;
}

.header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.site-title {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  min-width: 0;
}
.site-title:hover,
.site-title:focus-visible {
  text-decoration: underline;
}

.fontsize-toggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.fontsize-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}
.fontsize-btn[aria-pressed="true"] {
  background: #ffffff;
  color: var(--green-900);
  border-color: #ffffff;
}

.header-row2 {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--green-50);
}

/* ---------- 5. オフライン帯（仕様書7節） ---------- */
.offline-banner {
  background: var(--amber-50);
  color: var(--amber-700);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--amber-600);
  transition: opacity 0.2s ease;
}
.offline-banner[hidden] {
  display: none;
}

/* ---------- 6. 下部固定ナビ／デスクトップタブ（仕様書4節） ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 8px 2px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
}

.bottom-nav__item.is-active {
  background: var(--green-700);
  color: #ffffff;
}

@media (min-width: 600px) {
  .bottom-nav {
    position: static;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    background: var(--green-50);
    border-top: none;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
    padding: 6px 12px;
  }
  .bottom-nav__item {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
  }
}

/* ---------- 7. フッター（仕様書4節） ---------- */
.site-footer {
  background: var(--green-50);
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.7;
  padding: 22px 0 26px;
  border-top: 1px solid var(--line);
}
.site-footer p {
  margin: 0 0 8px;
}
.site-footer p:last-child {
  margin-bottom: 0;
}
.footer-meta a {
  color: var(--green-700);
}

/* ============================================================
   8. コンポーネント（仕様書5節・クラス名固定）
   ============================================================ */

/* .card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.card--danger {
  background: var(--red-50);
  border-left: 4px solid var(--red-700);
}
.card--warn {
  background: var(--amber-50);
  border-left: 4px solid var(--amber-600);
}
.card--ok {
  background: var(--green-50);
  border-left: 4px solid var(--green-600);
}

/* .btn */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
.btn svg {
  flex-shrink: 0;
}
.btn--primary {
  background: var(--green-700);
  color: #ffffff;
  border-color: var(--green-700);
}
.btn--primary:hover {
  background: var(--green-800);
}
.btn--tel {
  background: #ffffff;
  color: var(--green-700);
  border-color: var(--green-700);
  font-size: 1.15rem;
}
.btn--ghost {
  background: transparent;
  color: var(--green-700);
  border-color: var(--line);
}

/* .alert-strip */
.alert-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--red-50);
  color: var(--red-700);
  padding: 14px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.5;
}
.alert-strip svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* .tag */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.6;
}
.tag--amber {
  background: var(--amber-50);
  color: var(--amber-700);
}

/* .check-item */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 56px;
  padding: 12px 4px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.check-item:last-child {
  border-bottom: none;
}
.check-item__box {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 6px;
  border: 2px solid var(--green-700);
  background: #ffffff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}
.check-item__box:checked {
  background-color: var(--green-700);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 13l4 4L19 7' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check-item__label {
  flex: 1;
  padding-top: 2px;
}
.check-item__box:checked ~ .check-item__label {
  color: var(--ink-2);
}

/* details.acc（ネイティブアコーディオン・JS不使用） */
details.acc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}
details.acc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
details.acc summary::-webkit-details-marker {
  display: none;
}
details.acc summary::marker {
  content: "";
}
details.acc summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--green-700);
}
details.acc[open] summary::after {
  content: "\2212"; /* − */
}
details.acc .acc-body {
  padding: 0 18px 18px;
}

/* .src */
.src {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.5;
}
.src a {
  color: var(--ink-2);
}
.src svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* .section-note */
.section-note {
  color: var(--ink-2);
  font-size: 0.85rem;
  margin: 4px 0 16px;
}

/* .toc（カード内のリンクリスト。.cardと併用） */
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li {
  border-bottom: 1px solid var(--line);
}
.toc li:last-child {
  border-bottom: none;
}
.toc a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.toc a:hover,
.toc a:focus-visible {
  color: var(--green-700);
}
.toc svg {
  flex-shrink: 0;
  color: var(--ink-2);
}

/* テーブル .tbl（横スクロールラッパー必須） */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.tbl th,
.tbl td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl th {
  background: var(--green-50);
  color: var(--ink);
  font-weight: 700;
}
.tbl tr:last-child td {
  border-bottom: none;
}

/* 外部リンクアイコン共通（インラインSVGはHTML側に直書き） */
.icon-external {
  display: inline-block;
  vertical-align: -2px;
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

/* ---------- 9. アクセシビリティ（仕様書10節） ---------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==== checklist/shindan/risai 追加分 ==== */

/* ---------- アンカージャンプ時にsticky headerへ隠れないための余白 ---------- */
section[id] {
  scroll-margin-top: 88px;
}
#shindan-form,
#shindan-result {
  scroll-margin-top: 88px;
}

/* ---------- 既存アイコンのサイズ未指定を補う（.btn内 / .toc内のSVG） ---------- */
.btn svg {
  width: 22px;
  height: 22px;
}
.toc svg {
  width: 18px;
  height: 18px;
}

/* ---------- ステータスタグ（shindan.html診断結果） ---------- */
.tag--ok {
  background: var(--green-50);
  color: var(--green-800);
}
.tag--wait {
  background: var(--amber-50);
  color: var(--amber-700);
}

/* ---------- checklist.html: check-itemのタイトル/説明の文字サイズ分離 ---------- */
.check-item__title {
  display: block;
}
.check-item__desc {
  display: block;
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.6;
}

/* ---------- shindan.html: 質問（大きなボタン型） ---------- */
.q-block {
  margin-bottom: 8px;
}
.q-block__note {
  margin: -10px 0 14px;
  color: var(--ink-2);
  font-size: 0.9rem;
}
.q-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 30px;
}
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}
.q-option__input {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  accent-color: var(--green-700);
  cursor: pointer;
}
.q-option__text {
  flex: 1;
  font-weight: 700;
}
.q-option.is-checked {
  border-color: var(--green-700);
  background: var(--green-50);
}

/* ---------- shindan.html: 診断結果カード ---------- */
.shindan-result {
  margin-top: 34px;
}
.result-edit {
  margin-bottom: 10px;
}
.result-edit a {
  font-weight: 700;
}
.result-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.result-card__head h3 {
  margin: 0;
}
.result-card__oneline {
  font-weight: 700;
}
.result-card__note-label {
  color: var(--amber-700);
}

/* ---------- risai.html: カード見出し（アイコン＋テキスト） ---------- */
.card__lead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}
.card__lead svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--red-700);
}

/* ---------- risai.html: ステップ表示（写真の撮り方／申請から交付までの流れ） ---------- */
.steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  counter-reset: step-counter;
}
.step {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 26px;
}
.step:last-child {
  padding-bottom: 0;
}
.step::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-700);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
}
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 38px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.step__body {
  flex: 1;
  min-width: 0;
  padding-top: 6px;
}

/* ---------- risai.html: 写真の撮り方インライン図解（SVG） ---------- */
.photo-figure {
  margin: 14px 0 22px;
  text-align: center;
}
.photo-diagram {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 0 auto;
}
.photo-diagram text {
  font-family: inherit;
}
.photo-figure figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.d-fill {
  fill: var(--green-50);
  stroke: var(--green-700);
}
.d-line {
  fill: none;
  stroke: var(--green-700);
}
.d-muted {
  fill: none;
  stroke: var(--ink-2);
}
.d-accent-line {
  fill: none;
  stroke: var(--amber-600);
}
.d-arrow {
  fill: var(--ink-2);
  stroke: none;
}
.d-label {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

/* ==== Fable追加分（セレクタ改善・生成画像） ==== */
select[data-city-select]{appearance:none;-webkit-appearance:none;width:100%;min-height:56px;padding:8px 48px 8px 16px;font-size:1.05rem;font-weight:600;font-family:inherit;color:var(--ink);background-color:var(--card);border:2px solid var(--green-700);border-radius:12px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d5c48' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 16px center;background-size:22px;cursor:pointer}
select[data-city-select]:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.card-illust{width:100%;height:auto;border-radius:10px;margin:2px 0 12px;display:block;border:1px solid var(--line)}
.phase-banner{width:100%;height:auto;border-radius:14px;margin:10px 0 14px;display:block;border:1px solid var(--line)}
.photo-illust{width:100%;max-width:480px;height:auto;border-radius:10px;display:block;margin:0 auto;border:1px solid var(--line)}
.hero-illust{width:100%;height:auto;border-radius:14px;margin:6px 0 16px;display:block;border:1px solid var(--line)}
@media (min-width: 600px) {
  .bottom-nav { flex-wrap: nowrap; }
  .bottom-nav__item { flex: 0 1 auto; padding: 10px clamp(8px, 2vw, 20px); white-space: nowrap; }
}
