/* ===================================
   モバイル文字サイズ統一CSS
   全ページで一貫性のある文字サイズ
   =================================== */

/* ===================================
   基準となる文字サイズ（モバイル）
   =================================== */
@media (max-width: 767px) {
  /* セクションタイトル（h2）の統一 */
  h2,
  .section-title,
  h2.text-center,
  .legal-hero-title {
    font-size: 1.3rem !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    margin-bottom: 1rem !important;
  }
  
  /* サブタイトル（h3）の統一 */
  h3,
  .card-title,
  .office-name,
  .legal-section-title {
    font-size: 1.1rem !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
  }
  
  /* 小見出し（h4）の統一 */
  h4,
  .phone-item h4,
  .legal-card h4 {
    font-size: 1rem !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
  }
  
  /* 本文の統一 */
  p,
  .card-text,
  .office-description,
  .legal-section-content p,
  .legal-hero-subtitle {
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
  }
  
  /* リスト項目の統一 */
  li,
  .feature-list li,
  .legal-list-item {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }
  
  /* ボタンの統一 */
  .btn,
  .legal-form-button {
    font-size: 0.9rem !important;
    padding: 0.7rem 1.2rem !important;
    font-weight: 600 !important;
  }
  
  .btn-large {
    font-size: 1rem !important;
    padding: 0.8rem 1.5rem !important;
  }
  
  /* フォームラベルの統一 */
  .form-label,
  label,
  .legal-form-label {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
  }
  
  /* フッターテキストの統一 */
  .footer,
  .footer-section h4,
  .footer-links,
  .footer-links a,
  .legal-footer,
  .legal-footer-bottom {
    font-size: 0.85rem !important;
  }
  
  /* 緊急セクション特別調整 */
  #emergency h2 {
    font-size: 1.3rem !important; /* 他のh2と同じに */
  }
  
  #emergency .card h2 {
    font-size: 1.3rem !important;
  }
  
  #emergency .phone-item h4 {
    font-size: 0.95rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* FAQ テキストサイズ統一 */
  .faq-question-text {
    font-size: 0.9rem !important;
  }
  
  .faq-answer p {
    font-size: 0.85rem !important;
  }
  
  /* タグとバッジの統一 */
  .tag,
  .badge,
  .stat-label {
    font-size: 0.75rem !important;
  }
  
  .stat-number {
    font-size: 1.3rem !important;
  }
}

/* ===================================
   iPhone SE (375px以下) 微調整
   =================================== */
@media (max-width: 375px) {
  /* 法的ページヘッダーをさらに小さく */
  .legal-logo {
    font-size: 0.8rem !important;
  }
  
  .legal-logo-icon {
    font-size: 0.9rem !important;
  }
  
  .legal-breadcrumb {
    font-size: 0.7rem !important;
  }
  
  .legal-breadcrumb-separator {
    margin: 0 0.2rem !important;
  }
  /* タイトルを少し小さく */
  h2,
  .section-title,
  h2.text-center,
  .legal-hero-title {
    font-size: 1.2rem !important;
  }
  
  h3,
  .card-title {
    font-size: 1rem !important;
  }
  
  h4 {
    font-size: 0.95rem !important;
  }
  
  /* 本文も調整 */
  p,
  .card-text {
    font-size: 0.85rem !important;
  }
  
  li {
    font-size: 0.8rem !important;
  }
  
  /* ボタンも小さく */
  .btn {
    font-size: 0.85rem !important;
    padding: 0.6rem 1rem !important;
  }
  
  /* フッター */
  .footer,
  .legal-footer {
    font-size: 0.8rem !important;
  }
}

/* ===================================
   320px以下（極小画面）対応
   =================================== */
@media (max-width: 320px) {
  h2 {
    font-size: 1.1rem !important;
  }
  
  h3 {
    font-size: 0.95rem !important;
  }
  
  p {
    font-size: 0.8rem !important;
  }
  
  li {
    font-size: 0.75rem !important;
  }
  
  .btn {
    font-size: 0.8rem !important;
    padding: 0.5rem 0.8rem !important;
  }
}

/* ===================================
   法的ページ（プライバシーポリシー等）の統一
   =================================== */
@media (max-width: 767px) {
  /* 法的ページのヘッダー */
  .legal-header {
    font-size: 0.9rem !important;
  }
  
  .legal-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 0.75rem !important;
  }
  
  .legal-logo {
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
  }
  
  .legal-logo-icon {
    font-size: 1rem !important;
    margin-right: 0.3rem !important;
    flex-shrink: 0 !important;
  }
  
  .legal-breadcrumb {
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    align-items: center !important;
    margin-top: 0.3rem !important;
    max-width: 100% !important;
  }
  
  .legal-breadcrumb a,
  .legal-breadcrumb span {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  .legal-breadcrumb-separator {
    margin: 0 0.3rem !important;
  }
  
  /* 法的ページのヒーロー */
  .legal-hero-title {
    font-size: 1.3rem !important;
    font-weight: 700 !important;
  }
  
  .legal-hero-subtitle {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }
  
  .legal-hero-meta-item {
    font-size: 0.8rem !important;
  }
  
  /* 法的ページの本文 */
  .legal-section-content {
    font-size: 0.9rem !important;
  }
  
  .legal-section-content p {
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
  }
  
  .legal-list {
    font-size: 0.85rem !important;
  }
  
  .legal-list-item {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }
  
  /* 法的ページのカード */
  .legal-card {
    padding: 1rem !important;
  }
  
  .legal-card h4 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .legal-card p {
    font-size: 0.85rem !important;
  }
  
  /* 法的ページのフッター */
  .legal-footer {
    padding: 1rem !important;
  }
  
  .legal-footer-bottom {
    font-size: 0.85rem !important;
    padding: 1rem !important;
    text-align: center !important;
  }
  
  /* 目次 */
  .legal-toc {
    font-size: 0.85rem !important;
  }
  
  .legal-toc-link {
    font-size: 0.85rem !important;
    padding: 0.5rem !important;
  }
  
  /* コールアウト */
  .legal-callout {
    padding: 1rem !important;
  }
  
  .legal-callout-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .legal-callout p {
    font-size: 0.85rem !important;
  }
}

/* ===================================
   テーブルの文字サイズ統一
   =================================== */
@media (max-width: 767px) {
  table,
  .comparison-table {
    font-size: 0.8rem !important;
  }
  
  th,
  .comparison-table th {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
  }
  
  td,
  .comparison-table td {
    font-size: 0.8rem !important;
  }
}

/* ===================================
   ナビゲーションメニューの統一
   =================================== */
@media (max-width: 767px) {
  .nav-link {
    font-size: 0.9rem !important;
  }
  
  .nav-toggle {
    font-size: 1rem !important;
  }
  
  .logo {
    font-size: 1rem !important;
  }
  
  .logo-icon {
    font-size: 1.2rem !important;
  }
}

/* ===================================
   アイコン付きテキストの調整
   =================================== */
@media (max-width: 767px) {
  /* 絵文字アイコンのサイズ調整 */
  h2:first-child,
  h3:first-child {
    /* 絵文字を含む見出しの調整 */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* 絵文字のサイズを固定 */
  .emoji,
  h2 > span:first-child,
  h3 > span:first-child {
    font-size: 1.2rem !important;
    margin-right: 0.3rem;
  }
}

/* ===================================
   グローバル上書き（最優先）
   =================================== */
@media (max-width: 767px) {
  /* すべての要素に適用される基本ルール */
  * {
    /* 最大フォントサイズ制限 */
    max-font-size: 1.5rem;
  }
  
  /* 見出しの最大サイズ制限 */
  h1 { font-size: min(1.5rem, font-size) !important; }
  h2 { font-size: min(1.3rem, font-size) !important; }
  h3 { font-size: min(1.1rem, font-size) !important; }
  h4 { font-size: min(1rem, font-size) !important; }
  h5 { font-size: min(0.95rem, font-size) !important; }
  h6 { font-size: min(0.9rem, font-size) !important; }
}