/* ==========================================================================
   実家のはなし - 共通スタイルシート
   このファイル1つを全ページから読み込む。ページ別のCSSは作らない。
   ========================================================================== */

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

html,
body,
h1, h2, h3, h4, p,
ul, ol, li,
figure, figcaption {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* --- カラー・トークン ------------------------------------------------------ */
:root {
  --base:      #FAF7F0;
  --surface:   #FFFFFF;
  --ink:       #232323;
  --ink-sub:   #5A5A5A;
  --green:     #2F4A3C;
  --amber:     #E8A33D;
  --line-grn:  #06C755;
  --border:    #E0DACE;
  --alert:     #B54B32;

  /* ジャンル別アクセント */
  --genre-souzoku:  #2F4A3C;
  --genre-akiya:    #8A4B2A;
  --genre-shisetsu: #2C5545;

  --radius: 8px;
  --max-width: 720px;
}

/* --- ベースタイポグラフィ --------------------------------------------------- */
html {
  font-size: 112.5%; /* 16px * 1.125 = 18px を基準にする */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 1rem; /* 18px */
  line-height: 1.9;
  color: var(--ink);
  background: var(--base);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a {
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  color: var(--green);
  line-height: 1.5;
  font-weight: 700;
}

h1 {
  font-size: 1.6667rem; /* 30px */
}

h2 {
  font-size: 1.3333rem; /* 24px */
  margin-top: 2.5em;
}

h3 {
  font-size: 1.1111rem; /* 20px */
  margin-top: 1.8em;
}

p {
  margin-top: 1em;
}

p:first-child {
  margin-top: 0;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* 記事本文は段落間の余白を多めに取る */
.article-body p {
  margin-top: 1.4em;
}

.article-body ul,
.article-body ol {
  margin-top: 1em;
  padding-left: 1.3em;
}

.article-body ul li {
  list-style: disc;
  margin-top: 0.6em;
}

.article-body ol li {
  list-style: decimal;
  margin-top: 0.6em;
}

.article-date {
  margin-top: 8px;
  font-size: 0.7778rem; /* 14px */
  color: var(--ink-sub);
}

.article-source {
  margin-top: 2em;
  font-size: 0.8889rem; /* 16px */
  color: var(--ink-sub);
}

/* 記事本文直下に単体で置かれる関連ツールカード（.card-grid外）の上余白。
   line-cta と同じ margin-top: 40px を流用し、前後の余白を揃える */
.article-body .card {
  margin-top: 40px;
}

/* --- フォーカス可視化 ------------------------------------------------------ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* --- レイアウト共通 --------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 20px;
  overflow-wrap: break-word;
}

main {
  display: block;
  padding-block: 32px 48px;
}

@media (min-width: 768px) {
  main {
    padding-block: 48px 64px;
  }
}

/* --- タップ対象・ボタン共通 -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  /* 背景がamberの中間輝度のため、白文字ではコントラスト比を満たさない。
     濃色テキストを使うことで4.5:1以上を確保する。 */
  background: var(--amber);
  color: var(--ink);
}

.btn-line {
  /* line-grnも中間輝度のため、白文字ではコントラスト比不足。濃色テキストを使う。 */
  background: var(--line-grn);
  color: var(--ink);
  width: 100%;
}

.btn-outline {
  background: var(--surface);
  color: var(--green);
  border-color: var(--green);
}

/* --- ヘッダー -------------------------------------------------------------- */
.site-header {
  background: var(--green);
  color: #FFFFFF;
}

.header-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.site-logo {
  font-size: 1.1111rem; /* 20px */
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #FFFFFF;
}

.site-nav {
  background: var(--green);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.site-nav[hidden] {
  display: none;
}

.site-nav ul {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 8px 16px 16px;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.site-nav li:first-child a {
  border-top: none;
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .site-nav[hidden] {
    display: block;
  }

  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    padding: 0 16px 14px;
  }

  .site-nav a {
    min-height: 40px;
    border-top: none;
  }
}

/* --- リード文 -------------------------------------------------------------- */
.lead {
  font-size: 1.1111rem; /* 20px */
  color: var(--ink);
}

/* --- カード ---------------------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

@media (min-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .card-grid--tools {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.card-genre {
  display: inline-block;
  font-size: 0.7778rem; /* 14px */
  font-weight: 700;
  color: #FFFFFF;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.card-genre--souzoku  { background: var(--genre-souzoku); }
.card-genre--akiya    { background: var(--genre-akiya); }
.card-genre--shisetsu { background: var(--genre-shisetsu); }

.card h3 {
  margin-top: 0;
  font-size: 1.1111rem;
}

.card p {
  color: var(--ink-sub);
  font-size: 0.8889rem; /* 16px */
  margin-top: 8px;
}

/* --- セクション見出し -------------------------------------------------------- */
.section-title {
  margin-top: 3em;
}

/* --- LINE誘導ボックス -------------------------------------------------------- */
.line-cta {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.line-cta-label {
  font-size: 0.8889rem;
  color: var(--ink-sub);
  margin-top: 0;
}

.line-cta-title {
  font-size: 1.1111rem;
  font-weight: 700;
  color: var(--green);
  margin-top: 4px;
}

.line-cta .btn-line {
  margin-top: 16px;
}

.line-cta-note {
  font-size: 0.7778rem;
  color: var(--ink-sub);
  margin-top: 12px;
}

/* --- フッター -------------------------------------------------------------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 32px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--green);
  font-size: 0.8889rem;
  text-decoration: underline;
}

.footer-disclaimer {
  margin-top: 16px;
  font-size: 0.7778rem; /* 14px */
  line-height: 1.8;
  color: var(--ink-sub);
}

.footer-copyright {
  margin-top: 16px;
  font-size: 0.7778rem;
  color: var(--ink-sub);
}

/* --- 注記・免責ボックス ------------------------------------------------------ */
.notice-box {
  margin-top: 20px;
  background: #FDF6EA;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.8889rem; /* 16px */
  color: var(--ink-sub);
  line-height: 1.8;
}

/* --- フォーム部品共通（ツールで使用） ------------------------------------------ */
input,
select,
textarea {
  font-size: 1rem; /* 16px以上でiOS自動ズームを防ぐ */
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

/* --- 診断ツール共通（souzoku / akiya / shisetsu で使い回す） --------------------- */
.tool-header {
  margin-bottom: 8px;
}

.tool-header .lead {
  margin-top: 8px;
}

.tool-progress {
  margin-top: 20px;
  font-size: 0.8889rem; /* 16px */
  font-weight: 700;
  color: var(--ink-sub);
}

.tool-step {
  margin-top: 20px;
}

.field-error {
  margin-top: 8px;
  color: var(--alert);
  font-size: 0.8889rem;
  font-weight: 700;
}

.tool-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.tool-secondary-action {
  margin-top: 16px;
  width: 100%;
}

/* 結果一覧（行ごとにラベル・提出先・期限バッジを表示） */
.result-list {
  margin-top: 20px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.result-row:first-child {
  border-top: none;
}

.result-row-label {
  font-weight: 700;
  color: var(--ink);
}

.result-row-place {
  margin-top: 4px;
  font-size: 0.7778rem; /* 14px */
  color: var(--ink-sub);
}

.result-row-status {
  text-align: right;
}

.result-row-date {
  font-size: 0.7778rem;
  color: var(--ink-sub);
}

/* amber/alertは中間〜低輝度のため、背景色として使い濃色/白文字でコントラスト比を確保する */
.result-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 1.1111rem; /* 20px */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-badge--overdue {
  background: var(--alert);
  color: #FFFFFF;
}

.result-badge--soon {
  background: var(--amber);
  color: var(--ink);
}

.result-badge--normal {
  background: var(--base);
  color: var(--ink);
  border: 1px solid var(--border);
}

/* 結果コード表示 */
.result-code-box {
  margin-top: 24px;
  background: var(--base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  overflow-wrap: break-word;
}

.result-code-label {
  font-size: 0.8889rem;
  color: var(--ink-sub);
  margin-top: 0;
}

.result-code {
  margin-top: 8px;
  font-size: 1.3333rem; /* 24px */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  color: var(--green);
  overflow-wrap: anywhere;
}

.result-code-desc {
  margin-top: 6px;
  font-size: 0.7778rem;
  color: var(--ink-sub);
}

.result-code-box .tool-actions {
  justify-content: center;
}

.copy-feedback {
  margin-top: 8px;
  font-size: 0.7778rem;
  color: var(--green);
  font-weight: 700;
}

/* --- 選択肢リスト（akiya / shisetsu のラジオ・チェックボックス選択で使い回す） -------- */
.field-group {
  margin-top: 16px;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}

.option-row input[type="radio"],
.option-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex-shrink: 0;
}

.option-row:has(input:checked) {
  border-color: var(--green);
  background: var(--base);
}

/* --- ユーティリティ ---------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- アニメーション抑制 ------------------------------------------------------ */
@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;
  }
}

/* --- 印刷（診断ツールの結果画面で上書きして使用） -------------------------------- */
@media print {
  .site-header,
  .site-nav,
  .site-footer,
  .line-cta,
  .no-print {
    display: none !important;
  }
}
