/* ════════════════════════════════════════════════════════
   mobile.css  —  iPhone SE〜15 Pro Max レスポンシブ対応
   対象幅: 375px〜430px / iOS Safari 最適化
   全ページ共通で読み込む

   iPhone 特有の対策:
   - Safe Area (ノッチ・Dynamic Island・ホームバー)
   - dvh (Safariのアドレスバー消失によるvh問題)
   - タップターゲット 44×44px 最低保証
   - input font-size 16px 以上 (自動ズーム防止)
   - -webkit- プレフィックス付与
   - hover → active (タッチデバイス用)
   - text-size-adjust (フォント自動拡大防止)
════════════════════════════════════════════════════════ */

/* ── 基本設定 ── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── NAV グリッド（全ページ共通・デスクトップ）
   auto 1fr auto: ロゴ列はコンテンツ幅のみ→空白なし、中央列がリンクを保持 ── */
.nav-inner {
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  align-items: center !important;
}
/* ロゴはコンテンツ幅のみ（auto列なので fit-content 不要、justify-selfのみ残す） */
.logo {
  justify-self: start !important;
}
.nav-links {
  position: static !important;
  left: auto !important;
  transform: none !important;
}
.nav-right {
  justify-self: end;
  justify-content: flex-end !important;
}

/* ════════════════
   ハンバーガーボタン
   PC では display:none
   ════════════════ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.hamburger .hb-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text, #0D0D12);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}
.hamburger.open .hb-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open .hb-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.open .hb-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* nav 右側ラッパー (nav-btn + hamburger を並べる) */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ════════════════
   モバイルメニュー (全ページ共通)
   ════════════════ */
.mobile-menu {
  display: none;
  position: fixed;
  top: 56px; /* モバイル時のnav高さ */
  left: 0;
  right: 0;
  z-index: 997;
  background: #071220;
  border-bottom: 1px solid rgba(100, 148, 215, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.50);
  overflow-y: auto;
  max-height: calc(100dvh - 56px);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-overflow-scrolling: touch;
}
.mobile-menu.open {
  display: block;
}

.mobile-menu-list {
  list-style: none;
}
.mobile-menu-list li a {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #EBF0FF);
  text-decoration: none;
  border-bottom: 1px solid rgba(100, 148, 215, 0.10);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.02em;
}
.mobile-menu-list li a:active {
  background: rgba(255, 255, 255, 0.05);
}
.mobile-menu-list li:last-child a {
  border-bottom: none;
}

.mobile-menu-footer {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(100, 148, 215, 0.10);
}
.mobile-menu-tel-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  background: rgba(192, 144, 40, 0.12);
  border: 1.5px solid rgba(192, 144, 40, 0.28);
  border-radius: 10px;
  font-size: 17px;
  font-weight: 800;
  color: var(--accent2, #D4AA45);
  text-decoration: none;
  letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-tel-link:active {
  opacity: 0.8;
}
.mobile-menu-cta-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  background: linear-gradient(135deg, #9A7418 0%, #C09028 45%, #D4AA45 100%);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #071220;
  text-decoration: none;
  letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-cta-link:active {
  opacity: 0.85;
}

/* ════════════════════════════════════════
   メディアクエリ: スマホ全般 (〜768px)
   ════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── ハンバーガー表示 ── */
  .hamburger {
    display: flex;
  }

  /* ── NAV 共通 (Type A: fixed / Type B: sticky) ── */
  nav {
    height: 56px !important;
    padding: 0 !important;
    padding-left: calc(16px + env(safe-area-inset-left)) !important;
    padding-right: calc(16px + env(safe-area-inset-right)) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  /* Type B nav の .nav-inner ラッパー */
  .nav-inner {
    padding: 0 !important;
    padding-left: calc(16px + env(safe-area-inset-left)) !important;
    padding-right: calc(16px + env(safe-area-inset-right)) !important;
  }

  /* ナビリンク非表示 */
  .nav-links {
    display: none !important;
  }

  /* ハンバーガーを右端に固定 */
  .nav-right {
    margin-left: auto;
    justify-self: end !important;
  }

  /* モバイルではCTAボタン非表示（モバイルメニュー内に表示） */
  .nav-btn,
  .nav-cta {
    display: none !important;
  }

  /* 電話番号エリア非表示 (index.html) */
  .nav-tel {
    display: none !important;
  }

  /* ── スティッキーバー (Safe Area 対応) ── */
  .sticky {
    padding-top: 10px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    padding-left: calc(16px + env(safe-area-inset-left)) !important;
    padding-right: calc(16px + env(safe-area-inset-right)) !important;
    -webkit-backdrop-filter: blur(16px);
  }
  /* blog-post.html / blog-post2.html のスティッキーCTAバー */
  .sticky-cta {
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    padding-left: calc(24px + env(safe-area-inset-left)) !important;
    padding-right: calc(24px + env(safe-area-inset-right)) !important;
  }
  .sticky-left span {
    display: none;
  }
  .sticky-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    font-size: 13px;
  }
  .sticky-btn:active {
    background: var(--accent2, #2952CC) !important;
  }

  /* ── フッター (Safe Area 対応) ── */
  footer {
    flex-direction: column !important;
    gap: 12px !important;
    text-align: center !important;
    padding: 20px 20px !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
  }
  .foot-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px !important;
  }

  /* ── ヒーロー: バナーのみの場合は min-height 不要、空白防止 ── */
  .hero {
    min-height: auto;
  }
  /* ── バナースライダー: スマホ用画像(750×537)の比率に合わせる ── */
  .hero .banner-slider {
    aspect-ratio: 750 / 537 !important;
    max-height: 500px !important;
  }

  /* ── タップターゲット 44px 最低保証 ── */
  .btn-main,
  .btn-sub,
  .btn-main-inv,
  .btn-sub-inv,
  .p-btn-main,
  .p-btn-sub,
  .btn-quote,
  .btn-demo,
  .btn-white,
  .btn-outline-w,
  .btn-submit,
  .btn-tel,
  .nav-btn,
  .nav-cta,
  .sticky-btn,
  .filter-tab,
  .tab,
  .mobile-menu-cta-link,
  .mobile-menu-tel-link {
    min-height: 44px !important;
  }

  /* ── フォーム入力 16px 以上 (Safari自動ズーム防止) ── */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  input[type="password"],
  select,
  textarea,
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
    -webkit-appearance: none;
  }

  /* ── タッチデバイスの hover 無効化 (残像防止) ── */
  @media (hover: none) {
    .reason-card:hover,
    .v-card:hover,
    .feature-card:hover,
    .faq-item:hover,
    .related-card:hover,
    .featured-card:hover {
      box-shadow: none !important;
      transform: none !important;
    }
    .btn-main:hover    { background: linear-gradient(135deg, #9A7418 0%, #C09028 40%, #D4AA45 100%) !important; }
    .btn-sub:hover     { border-color: rgba(100, 148, 215, 0.30) !important; color: var(--text2, #EBF0FF) !important; }
    .nav-btn:hover     { background: linear-gradient(135deg, #9A7418 0%, #C09028 40%, #D4AA45 100%) !important; }
    .sticky-btn:hover  { background: linear-gradient(135deg, #9A7418 0%, #C09028 40%, #D4AA45 100%) !important; }
    .nav-cta:hover     { background: linear-gradient(135deg, #9A7418 0%, #C09028 40%, #D4AA45 100%) !important; }
    .filter-tab:hover:not(.active) { background: none !important; color: var(--text2, #EBF0FF) !important; border-color: rgba(100, 148, 215, 0.25) !important; }
  }

  /* active 状態でタップフィードバック */
  .btn-main:active,
  .btn-main-inv:active,
  .nav-btn:active,
  .nav-cta:active  { background: linear-gradient(135deg, #9A7418 0%, #C09028 40%, #D4AA45 100%) !important; opacity: 0.88; }
  .btn-sub:active  { border-color: rgba(192, 144, 40, 0.45); }
  .filter-tab:active { opacity: 0.8; }

  /* ── パンくず ── */
  .breadcrumb {
    padding: 12px 16px 0 !important;
  }
  .breadcrumb-inner {
    padding-top: 12px !important;
    font-size: 12px;
    flex-wrap: wrap;
  }

  /* ── ページヘッダー ── */
  .page-header {
    padding: 24px 16px 32px !important;
  }
  .page-title {
    font-size: 28px !important;
    letter-spacing: -0.01em !important;
  }

  /* ── about・cases のページヒーロー (グラデーション) ── */
  .page-hero {
    padding: 48px 20px !important;
  }
  .page-hero h1 {
    font-size: 26px !important;
    line-height: 1.3 !important;
  }
  .page-hero p {
    font-size: 14px !important;
  }

  /* ── コンタクトページ: フォーム縦積み ── */
  .contact-inner {
    grid-template-columns: 1fr !important;
  }
  .form-row {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    position: static !important;
    top: auto !important;
  }
  .form-wrap {
    padding: 28px 20px !important;
  }
  .trust-strip {
    padding: 12px 16px !important;
  }
  .trust-strip-inner {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  /* ── ブログ: サイドバー下に移動 ── */
  .blog-inner {
    grid-template-columns: 1fr !important;
  }
  .featured-grid {
    grid-template-columns: 1fr !important;
  }
  .featured-card.main {
    grid-row: auto !important;
  }

  /* ── ブログ記事・about・cases のレイアウト ── */
  .page-wrap {
    grid-template-columns: 1fr !important;
    padding: 24px 16px 60px !important;
    align-items: stretch !important;
  }
  .article-hero {
    aspect-ratio: unset !important;
    padding: 24px 20px !important;
  }

  /* ── FAQ ── */
  .faq-inner {
    grid-template-columns: 1fr !important;
  }

  /* ── スペックテーブル (product) ── */
  .spec-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .spec-table th {
    width: 120px !important;
    white-space: normal;
    font-size: 12px;
    padding: 12px 14px !important;
  }
  .spec-table td {
    font-size: 13px;
    padding: 12px 14px !important;
  }

  /* ── プロダクトページ: サブ動画グリッド ── */
  .video-sub-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── stats strip (cases) ── */
  .stats-inner {
    gap: 32px !important;
  }

  /* ── 会社案内: グリッド ── */
  .message-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── cases: featured card ── */
  .case-featured {
    grid-template-columns: 1fr !important;
  }
  .case-featured-img {
    min-height: 240px !important;
  }

  /* ── news.html サイドバー ── */
  .news-main-inner {
    grid-template-columns: 1fr !important;
  }

  /* ── NAV: flex切り替えでハンバーガーを確実に右端へ ── */
  .nav-inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    grid-template-columns: none !important;
  }

  /* ── インライン display:grid を1カラムに ── */
  [style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* ── 代表メッセージ (about.html) インラインgrid ── */
  [style*="grid-template-columns:260px"] {
    grid-template-columns: 1fr !important;
  }

  /* ── 各ページ: インライン大パディング縮小 ── */
  [style*="padding:80px 48px"],
  [style*="padding:96px 48px"],
  [style*="padding:80px 60px"] {
    padding: 56px 20px !important;
  }
  [style*="padding:64px 48px"],
  [style*="padding:72px 48px"] {
    padding: 48px 20px !important;
  }

  /* ── gap 縮小 ── */
  [style*="gap:64px"],
  [style*="gap:80px"] {
    gap: 24px !important;
  }
  [style*="gap:40px"],
  [style*="gap:48px"] {
    gap: 20px !important;
  }

  /* ── メリットグリッド / 比較 / 関連記事 ── */
  .merit-grid,
  .comparison {
    grid-template-columns: 1fr !important;
  }

  /* ── product-welder / cleaner: ヒーローグリッド ── */
  .hero-grid,
  .feat-grid,
  .comp-grid,
  .usecase-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── 製品ページ: ヒーロー縦積み ── */
  .product-hero-inner {
    grid-template-columns: 1fr !important;
  }

  /* ── p-name / price フォント ── */
  .p-name     { font-size: 26px !important; }
  .price-main { font-size: 26px !important; }
  .sec-title  { font-size: 24px !important; margin-bottom: 32px !important; }

  /* ── CTAボタン縦積み ── */
  .p-btns {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .p-btn-main,
  .p-btn-sub {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* ════════════════════════════════════════
   メディアクエリ: iPhone専用 (〜430px)
   ════════════════════════════════════════ */
@media (max-width: 430px) {

  /* ── インライン大フォントサイズ縮小 ── */
  [style*="font-size:72px"] { font-size: 44px !important; line-height: 1 !important; }
  [style*="font-size:64px"] { font-size: 40px !important; line-height: 1 !important; }
  [style*="font-size:56px"] { font-size: 36px !important; line-height: 1 !important; }
  [style*="font-size:48px"] { font-size: 30px !important; line-height: 1.1 !important; }
  [style*="font-size:40px"] { font-size: 26px !important; }
  [style*="font-size:36px"] { font-size: 24px !important; }
  [style*="font-size:52px"] { font-size: 32px !important; line-height: 1.1 !important; }
  [style*="font-size:44px"] { font-size: 26px !important; line-height: 1.3 !important; }
  [style*="font-size:26px"] { font-size: 19px !important; line-height: 1.45 !important; }
  [style*="font-size:20px"] { font-size: 16px !important; }

  /* ── KPI数字: border-right を border-bottom に切り替え ── */
  [style*="border-right:1px solid"] {
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,.15);
    padding-bottom: 24px !important;
    margin-bottom: 8px;
  }
  [style*="border-right:2px solid"] {
    border-right: none !important;
    border-bottom: 2px solid var(--border, #E8E6E2);
    padding-bottom: 24px !important;
    margin-bottom: 8px;
  }

  /* ── h1 サイズ ── */
  h1 {
    font-size: 30px !important;
    line-height: 1.2 !important;
  }

  /* ── ヒーロー ── */
  .hero {
    padding: 76px 20px 48px !important;
    padding-top: calc(76px + env(safe-area-inset-top)) !important;
  }

  /* ── ヒーローボタン縦積み ── */
  .hero-btns {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .hero-btns .btn-main,
  .hero-btns .btn-sub {
    width: 100% !important;
    text-align: center;
    justify-content: center;
  }

  /* ── ヒーローチップ ── */
  .hero-chips {
    gap: 12px !important;
  }

  /* ── ニュースバー縦積み ── */
  .news-bar {
    padding: 0 16px !important;
  }
  .news-bar-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .news-label {
    border-right: none !important;
    border-bottom: 1px solid var(--border, #E8E6E2);
    padding: 12px 0 !important;
    margin: 0 !important;
    width: 100%;
  }
  .news-list {
    padding: 8px 0 !important;
    gap: 6px !important;
  }
  .news-item {
    flex-wrap: wrap;
    gap: 6px !important;
  }
  .news-title {
    width: 100%;
    flex: none;
  }
  .news-more {
    border-left: none !important;
    border-top: 1px solid var(--border, #E8E6E2);
    padding: 12px 0 !important;
    margin: 0 !important;
    width: 100%;
  }

  /* ── フロー (STEP) 縦積み ── */
  .flow-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  .flow-arrow {
    display: none !important;
  }

  /* ── CTAボタン縦積み ── */
  .cta-btns {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .btn-main-inv,
  .btn-sub-inv {
    justify-content: center;
  }

  /* ── セクション共通パディング ── */
  section {
    padding: 56px 20px !important;
  }

  /* ── スタッツストリップ: モバイルは縦積みバナー形式で目立つ表示 ── */
  .strip {
    padding: 0 !important;
    background: linear-gradient(135deg, #060f1e 0%, #0C1A30 60%, #0A1830 100%) !important;
    border: none !important;
  }
  .strip-inner {
    flex-direction: column !important;
    border: none !important;
    border-radius: 0 !important;
    gap: 0 !important;
  }
  .strip-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 18px 28px !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(100, 148, 215, 0.12) !important;
  }
  .strip-item:last-child {
    border-bottom: none !important;
  }
  .strip-item .val {
    font-size: 32px !important;
    font-weight: 900 !important;
    color: #D4AA45 !important;
    line-height: 1 !important;
    min-width: 90px !important;
    letter-spacing: -.01em !important;
  }
  .strip-item .lbl {
    font-size: 14px !important;
    color: rgba(185, 205, 250, 0.72) !important;
    margin-top: 0 !important;
    letter-spacing: .04em !important;
    font-weight: 500 !important;
  }

  /* ── 製品カード縦積み ── */
  .product-card {
    grid-template-columns: 1fr !important;
  }
  .product-visual {
    border-right: none !important;
    border-bottom: 1px solid var(--border, #E8E6E2);
    min-height: 240px !important;
  }

  /* ── 理由・動画・特長グリッド ── */
  .reasons-grid,
  .videos-grid,
  .features-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── 使用事例グリッド ── */
  .usecases-grid {
    grid-template-columns: 1fr !important;
  }
  .usecase-card {
    grid-template-columns: 1fr !important;
  }
  .uc-thumb {
    min-height: 80px;
  }

  /* ── 関連記事グリッド ── */
  .related-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── 安心要素 (product) ── */
  .trust-row {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* ── 価格ブロック ── */
  .price-main {
    font-size: 24px !important;
  }

  /* ── sec-title ── */
  .sec-title {
    font-size: 24px !important;
    margin-bottom: 32px !important;
  }

  /* ── 会社概要テーブル ── */
  .company-table {
    display: block;
  }
  .company-table tr,
  .company-table th,
  .company-table td {
    display: block;
    width: 100%;
  }
  .company-table th {
    border-bottom: none;
    padding-bottom: 4px !important;
  }

  /* ── cases: results grid ── */
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* ── cases: cases grid ── */
  .cases-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── フォームラップ ── */
  .form-wrap {
    padding: 24px 16px !important;
  }

  /* ── ページヒーロー ── */
  .page-hero {
    padding: 40px 16px !important;
  }
  .page-hero h1 {
    font-size: 22px !important;
  }

  /* ── CTA セクション ── */
  .cta-sec h2,
  .cta-bottom h2 {
    font-size: 22px !important;
    line-height: 1.4 !important;
  }

  /* ── フッター ── */
  footer {
    padding: 20px 16px !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
  }

  /* ════════════════════════════════════════
     製品ページ専用 スマホ最適化
     ════════════════════════════════════════ */

  /* 見出し内 <br> を非表示にして自然な折り返しに */
  h1 br, h2 br, h3 br { display: none !important; }

  /* 製品名・価格 */
  .p-name    { font-size: 22px !important; line-height: 1.35 !important; letter-spacing: -.01em !important; }
  .price-main { font-size: 24px !important; }
  .p-catch   { font-size: 13px !important; }
  .p-eyebrow { font-size: 10px !important; }

  /* セクションタイトル */
  .sec-title { font-size: 20px !important; line-height: 1.4 !important; margin-bottom: 24px !important; }

  /* 製品ヒーロー（product-welder / cleaner）縦積み時の余白 */
  .product-hero { padding: 32px 16px 48px !important; }
  .product-hero-inner { gap: 24px !important; }

  /* サムネイル非表示（縦積み時に邪魔になる） */
  .thumb-row { display: none !important; }

  /* スペックラベル */
  .spec-table th { width: 90px !important; font-size: 11px !important; }
  .spec-table td { font-size: 12px !important; }

  /* 関連記事タイトル */
  .rc-info h3 { font-size: 13px !important; }

  /* 製品カード（product.html） */
  .dc-name { font-size: 18px !important; }
  .dc-desc  { font-size: 13px !important; }

  /* lineup（product.html ヒーロー内カード） */
  .lineup-name { font-size: 18px !important; }
  .lineup-desc { font-size: 12px !important; }
}
