/* ============================================================
   site-mobile.css — 全ページ共通のレスポンシブ補正
   ・1180px以上のPCデザインは変更しない
   ・ヘッダーはロゴ(表示幅約311px)＋ナビ＋ボタン＋電話で約1160px必要なため、
     1025〜1179pxは縮小表示、1024px以下はハンバーガーメニューに切り替える
   ============================================================ */

/* ページ内アンカー移動時に固定ヘッダーで見出しが隠れないように */
[id] { scroll-margin-top: 92px; }

/* ヘッダー電話番号をリンク化した際の見た目維持 */
.header-tel a,
.header-tel-link { color: inherit; text-decoration: none; }

/* ===== ハンバーガーメニュー（1024px以下で表示） ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 1px solid rgba(42,125,212,0.30);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #0d1f3c;
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu { display: none; }
body.menu-open { overflow: hidden; }

/* --- モバイルメニュー本体（開いた時のみ表示されるため全幅共通で定義） --- */
.mobile-menu.open {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 199; /* ヘッダー(200)より下：開閉ボタンを常に押せるように */
  background: rgba(4, 12, 28, 0.45);
}
.mobile-menu-sheet {
  position: absolute;
  top: 0; right: 0;
  width: min(320px, 88vw);
  height: 100%;
  background: #ffffff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 76px 22px 32px;
  box-shadow: -8px 0 32px rgba(0,0,0,0.20);
}
/* 各ページの「nav { display:none !important }」に負けないよう明示 */
nav.mobile-menu-nav { display: block !important; height: auto !important; }
.mobile-menu-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 4px 6px;
  font-size: 15px;
  font-weight: 600;
  color: #0d1f3c;
  text-decoration: none;
  border-bottom: 1px solid #e6f0fa;
}
.mobile-menu-nav a:active { background: #f0f6ff; }
.mobile-menu-btns { display: flex; gap: 10px; margin: 18px 0 14px; }
.mobile-menu-btns a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.mm-corp { background: #0d1f3c; color: #ffffff; }
.mm-indiv { border: 1.5px solid #0d1f3c; color: #0d1f3c; background: #ffffff; }
.mobile-menu-tel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: #e6f0fa;
  color: #0d1f3c;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}
.mobile-menu-tel small { font-size: 10px; font-weight: 400; margin-left: 8px; color: #445566; }
.mobile-menu-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  background: #06C755;
  color: #ffffff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

/* ===== 1025〜1179px：ヘッダー縮小（はみ出し防止） ===== */
@media (min-width: 1025px) and (max-width: 1179px) {
  header { padding: 0 16px 0 12px !important; }
  .site-logo { height: 46px !important; }
  nav a { padding: 0 9px !important; font-size: 13px !important; }
  .header-right { padding-left: 12px !important; }
  .audience-btns { margin-right: 10px !important; gap: 6px !important; }
  .btn-corp, .btn-indiv { padding: 6px 10px !important; font-size: 12px !important; }
  .header-tel { font-size: 14px !important; }
}

/* ===== 1024px以下：ハンバーガーメニュー化 ===== */
@media (max-width: 1024px) {

  /* --- ヘッダー：ロゴ＋電話＋ハンバーガーの1行構成 --- */
  header {
    height: auto !important;
    min-height: 56px;
    padding: 5px 10px 5px 12px !important;
    gap: 6px;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
  }
  header nav { display: none !important; }        /* PCナビは非表示（メニュー内へ） */
  .audience-btns { display: none !important; }    /* 法人/個人ボタンもメニュー内へ */
  .logo-wrap { min-width: 0; padding: 0 !important; } /* b2c等の上下padding除去＝全ページ56px統一 */
  .site-logo {
    height: 42px !important;
    max-width: 42vw;
    object-fit: contain;
    object-position: left center;
  }
  .header-right {
    border: none !important;
    border-top: none !important;
    padding: 0 !important;
    width: auto !important;
    margin-left: auto;
  }
  .header-tel { font-size: 15px !important; padding: 0 4px 0 0 !important; }
  .header-tel small { font-size: 9px !important; }
  .menu-toggle { display: flex; }

  /* --- トップページHERO：キャッチコピーの絶対配置(left: calc(50% + 230px))が
         画面右へはみ出すため、縦積みの中央配置に変更 --- */
  .hero-content {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 40px 24px 48px;
    align-items: center;
    justify-content: center;
    min-height: 100svh;
  }
  .hero-center { position: relative; left: auto; top: auto; transform: none; width: 100%; }
  .hero-right {
    position: relative; left: auto; top: auto; transform: none;
    width: 100%; max-width: none;
    justify-content: center; text-align: center;
  }
  .hero-tagline { text-align: center; }

  /* iOS/タブレットで background-attachment: fixed は正しく描画されない */
  .about::before,
  .about-us-section::before,
  .building-section::before { background-attachment: scroll !important; }

  /* ブログ一覧：3列 → 2列 */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }

  /* b2c：安心バーが横並びのままはみ出すため余白を圧縮 */
  .assurance-bar { flex-wrap: wrap; gap: 12px 0; }
  .assurance-item { padding: 0 20px; }
}

/* ===== b2c（個人向けページ）：ナビ項目が6つあり約1360px必要なため
       1280〜1399pxは縮小表示、1279px以下でハンバーガーに切り替える ===== */
@media (min-width: 1280px) and (max-width: 1399px) {
  body.b2c-page header { padding: 0 16px !important; }
  body.b2c-page .site-logo { height: 52px !important; }
  body.b2c-page nav a { padding: 0 9px !important; font-size: 13px !important; }
  body.b2c-page .audience-btns { padding: 0 12px !important; }
  body.b2c-page .btn-corp, body.b2c-page .btn-indiv { padding: 7px 12px !important; font-size: 12px !important; }
  body.b2c-page .header-tel { font-size: 15px !important; padding: 0 12px !important; }
}
@media (min-width: 1025px) and (max-width: 1279px) {
  body.b2c-page header {
    height: auto !important;
    min-height: 56px;
    padding: 5px 10px 5px 12px !important;
    gap: 6px;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
  }
  body.b2c-page header nav { display: none !important; }
  body.b2c-page .audience-btns { display: none !important; }
  body.b2c-page .logo-wrap { min-width: 0; padding: 0 !important; }
  body.b2c-page .site-logo { height: 42px !important; }
  body.b2c-page .header-right { border: none !important; padding: 0 !important; width: auto !important; margin-left: auto; }
  body.b2c-page .header-tel { font-size: 15px !important; padding: 0 4px 0 0 !important; }
  body.b2c-page .menu-toggle { display: flex; }
}

/* ===== スマートフォン（〜768px） ===== */
@media (max-width: 768px) {

  /* --- ページ見出し --- */
  .page-hero { padding: 44px 20px 52px !important; }
  .page-hero h1 { font-size: 26px !important; }

  /* --- カード・一覧を1列に --- */
  .services-grid { grid-template-columns: 1fr !important; }
  .points-grid { grid-template-columns: 1fr !important; }
  .blog-grid { grid-template-columns: 1fr !important; }
  .related-grid { grid-template-columns: 1fr !important; }
  .contact-methods { grid-template-columns: 1fr !important; }

  /* --- 料金表：横スクロール可能なラッパー化（文字は小さくしない） --- */
  .pricing-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pricing-table table { min-width: 560px; }
  .freq-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* --- 会社概要テーブル --- */
  .company-table th { width: 100px; padding: 14px 12px; font-size: 13px; }
  .company-table td { padding: 14px 14px; font-size: 13.5px; word-break: break-word; }

  /* --- 施工事例（cases.html） --- */
  .case-item-header { flex-direction: column; gap: 20px; padding: 24px 20px; }
  .case-header-stats { width: 100%; gap: 10px; }
  .c-stat { flex: 1; min-width: 0; padding: 12px 8px; }
  .c-stat .val { font-size: 20px; }
  .case-item-body { padding: 24px 20px; }
  .case-detail-grid { grid-template-columns: 1fr; }
  .process-steps { flex-direction: column; gap: 16px; }
  .process-steps::before { left: 19px; right: auto; top: 20px; bottom: 20px; width: 2px; height: auto; }
  .process-step { display: flex; align-items: flex-start; gap: 14px; text-align: left; }
  .process-dot { margin: 0; flex-shrink: 0; }
  .process-step p { font-size: 12px; }
  .case-voice { flex-direction: column; gap: 10px; padding: 20px 18px; }
  .cta-btns { flex-wrap: wrap; }
  .cta-btns a { width: 100%; max-width: 340px; justify-content: center; text-align: center; }

  /* --- フォーム --- */
  .form-cols { grid-template-columns: 1fr !important; }
  /* iPhoneで入力時に自動ズームしないよう16px以上に */
  .form-row input, .form-row select, .form-row textarea,
  .b2c-form-row input, .b2c-form-row select, .b2c-form-row textarea {
    font-size: 16px !important;
  }
  .submit-btn, .b2c-submit-btn { min-height: 48px; }

  /* --- 固定CTA --- */
  .float-cta { bottom: 14px; right: 12px; }
}

/* 固定CTA：お問い合わせセクション表示中は隠す（フォームを覆わないように） */
.float-cta { transition: opacity 0.25s ease, transform 0.25s ease; }
.float-cta--hidden { opacity: 0; pointer-events: none; transform: translateY(12px); }

/* ===== 320px 極小幅の微調整 ===== */
@media (max-width: 340px) {
  .site-logo { max-width: 36vw; }
  .header-tel { font-size: 13px !important; }
  .header-tel small { display: none; }
  .hero-professional { font-size: 10px !important; letter-spacing: 0.08em !important; }
}
