/* ============================================================
   家族を守る AID NOTE — 共通エンハンスメントCSS
   ----------------------------------------------------------
   方針:
   - 既存ページの <style> ブロックを置き換えるのではなく「追加」する
   - ページ固有のCSS変数や色定義は上書きしない（!important は使わない）
   - アクセシビリティ・印刷・モーション設定・新ユーティリティを提供
   - 共通の callout / breadcrumb / TOC コンポーネントを提供
   読み込み方:
     <link rel="stylesheet" href="_components/aid-note.css">
     を <head> の Google Fonts <link> の直後あたりに追加してください
   ============================================================ */

/* ---------- 1. 共通強化（既存と衝突しにくい範囲） ---------- */

/* スムーズなアンカースクロール（OS設定でreduceならOFF） */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* キーボード操作時のフォーカスを必ず可視化（マウス時は出さない）
   = アクセシビリティ評価の底上げ */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid rgba(74,144,217,0.85);
  outline-offset: 2px;
  border-radius: 4px;
}

/* テキスト選択時の色をブランドカラーに */
::selection { background: rgba(232,83,74,0.18); color: inherit; }

/* 画像のlazyロードとレイアウトずれ防止 */
img { content-visibility: auto; }

/* ruby（ふりがな）の最終調整 — どのページにも効く */
ruby { ruby-position: over; }
rt { line-height: 1.2; }

/* スキップリンク（Tab1回で「本文へジャンプ」） */
.an-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #1f2937;
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 9999;
  font-size: 14px;
}
.an-skip:focus { left: 0; }

/* ---------- 2. 印刷スタイル（保護者が印刷して持ち歩く想定） ---------- */
@media print {
  .header, .footer, .cat-nav, .sidebar, .header-menu-btn,
  .an-skip, .toc, .related-products { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  a { color: #000 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .callout { break-inside: avoid; }
  .article, main { max-width: 100% !important; padding: 0 !important; }
}

/* ============================================================
   3. 新ユーティリティ — ページがopt-inして使う共通パーツ
   既存ページには影響しない（クラスを足したときだけ効く）
   ============================================================ */

/* ----- 3-1. Callout（記事内の強調ブロック） ----- */
.an-callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 14px;
  border-left: 6px solid #4a90d9;
  background: #f3f8fc;
  line-height: 1.85;
}
.an-callout-title {
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #185fa5;
}
.an-callout--warn {
  background: #fff5f3;
  border-left-color: #e15a4a;
}
.an-callout--warn .an-callout-title { color: #c0392b; }
.an-callout--tip {
  background: #f3faf5;
  border-left-color: #4caf8a;
}
.an-callout--tip .an-callout-title { color: #0f6e56; }
.an-callout--kids {
  background: #fdf0f3;
  border-left-color: #f4a6b4;
}
.an-callout--kids .an-callout-title { color: #c14a63; }

/* ----- 3-2. パンくず（記事冒頭に置く） ----- */
.an-breadcrumb {
  font-size: 12px;
  color: #7a6a5a;
  margin: 14px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.an-breadcrumb a {
  color: #7a6a5a;
  text-decoration: none;
  border-bottom: 1px dotted rgba(122,106,90,0.4);
}
.an-breadcrumb a:hover { color: #e15a4a; border-bottom-color: #e15a4a; }
.an-breadcrumb span[aria-current="page"] {
  color: #2d1a0e;
  font-weight: 500;
}
.an-breadcrumb-sep { opacity: 0.5; }

/* ----- 3-3. 目次（TOC） ----- */
.an-toc {
  background: #fff8f0;
  border: 1px solid rgba(232,83,74,0.18);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
}
.an-toc-title {
  font-weight: 700;
  font-size: 13px;
  color: #c0392b;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.an-toc ol {
  margin: 0;
  padding-left: 22px;
  line-height: 1.9;
}
.an-toc ol ol {
  padding-left: 18px;
  font-size: 13px;
  opacity: 0.85;
}
.an-toc a {
  color: #2d1a0e;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.an-toc a:hover {
  color: #e15a4a;
  border-bottom-color: #e15a4a;
}

/* ----- 3-4. 結論ファースト・サマリーボックス（記事冒頭） ----- */
.an-summary {
  background: linear-gradient(180deg, #fff8f0 0%, #fff 100%);
  border: 1px solid rgba(232,83,74,0.18);
  border-radius: 18px;
  padding: 18px 20px;
  margin: 18px 0 24px;
  position: relative;
}
.an-summary-label {
  display: inline-block;
  background: #e15a4a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.an-summary p { margin: 0; line-height: 1.85; }

/* ----- 3-5. 緊急時の119呼び出しボタン（モバイル下固定） ----- */
.an-emergency-call {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #e15a4a;
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(232,83,74,0.4);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.an-emergency-call:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,83,74,0.5);
}
.an-emergency-call::before { content: "📞"; font-size: 18px; }
@media (min-width: 769px) {
  /* デスクトップではより控えめに */
  .an-emergency-call { font-size: 13px; padding: 12px 16px; }
}

/* ----- 3-6. 関連記事カード（記事末） ----- */
.an-related {
  margin: 36px 0 20px;
  padding: 20px;
  background: #fff8f0;
  border-radius: 18px;
  border: 1px solid rgba(232,83,74,0.12);
}
.an-related-title {
  font-size: 14px;
  font-weight: 700;
  color: #c0392b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.an-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.an-related-list a {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.04);
  text-decoration: none;
  color: #2d1a0e;
  font-size: 13px;
  line-height: 1.5;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.an-related-list a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  border-color: rgba(232,83,74,0.4);
}
.an-related-emoji {
  font-size: 22px;
  flex-shrink: 0;
}

/* ----- 3-7. シェアボタン（LINE / X / コピー） ----- */
.an-share {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.an-share a, .an-share button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.an-share a:hover, .an-share button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.an-share .an-share-line { background: #06c755; color: #fff; }
.an-share .an-share-x    { background: #000; color: #fff; }
.an-share .an-share-copy { background: #f5e8d8; color: #7a3b1e; }

/* ============================================================
   4. リーディング体験の微改善（既存と衝突しにくい範囲）
   ============================================================ */

/* 本文 <p> の段落感を少し豊かに（既存指定があれば上書きされる） */
article p, .article p, .post p {
  line-height: 1.95;
  letter-spacing: 0.02em;
}

/* 長文の見出しに上下リズム */
article h2, .article h2, .post h2 {
  scroll-margin-top: 80px; /* sticky headerぶん */
}
article h3, .article h3, .post h3 {
  scroll-margin-top: 80px;
}
