/* ==========================================================================
   Responsive Styles
   SP対応スタイル（@media max-width）
   基準幅: PC = 1440px / タブレット = 768px / スマホ = 480px
   ※ PC（〜1440px想定）は style.css 側のデフォルトで表現する
   ========================================================================== */

/* --------------------------------------------------------------------------
   タブレット幅（1024px以下）
   3カラムだと窮屈になるレイアウトを 2カラムに調整
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  /* --- Services: 3カラム → 2カラム（タブレット幅） --- */
  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   タブレット以下（768px以下）
   この境界で「横並び → 縦積み」「端セクションの余白詰め」を適用する
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* 表示制御 */
  .pc-only {
    display: none;
  }

  .sp-only {
    display: block;
  }

  .sp-br {
    display: block;
  }

  .pc-br {
    display: none;
  }

  /* FVフルブリードコンテナの左右余白をSP向けに詰める（8.33vwだと窮屈なため） */
  .container-fluid {
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
  }

  /* 横並び → 縦積み（画像が上 → テキストが下）
     .media-row--reverse も column にすることで、常に画像（先頭要素）が上にくる */
  .media-row,
  .media-row--reverse {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  /* セクション余白の調整（SP は全セクション統一 50px） */
  .section-padding,
  .section-padding-sm {
    padding-top: 50px;
    padding-bottom: 50px;
  }

  /* 最初のセクションの上余白・最後のセクションの下余白を 0 にする
     （main 直下の最初/最後の section、または section-padding を持つ要素が対象）
     ただし .hero / .th-hero / .aip-hero は上 padding を維持、
     .page-cta は下 padding を維持する */
  main > section:first-child:not(.hero):not(.th-hero):not(.aip-hero),
  main > .section-padding:first-child,
  main > .section-padding-sm:first-child {
    padding-top: 0;
  }

  main > section:last-child:not(.page-cta),
  main > .section-padding:last-child,
  main > .section-padding-sm:last-child {
    padding-bottom: 0;
  }

  /* すべてのセクション見出しの下マージンを 15px に統一（SP） */
  .section-title {
    margin-bottom: 15px;
  }

  /* --- Site Header --- */
  .site-header-inner {
    padding: var(--space-sm) var(--space-md);
    min-height: 64px;
  }
  .site-nav,
  .site-header-ctas {
    display: none;
  }
  .site-nav-toggle {
    display: flex;
  }

  /* --- Hero --- */
  .hero {
    padding: 50px 0;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  /* SP ではカルーセルは非表示 */
  .hero-visual {
    display: none;
  }
  /* SP はコンテンツの余白を要素ごとに調整（均等 gap を無効化） */
  .hero-content {
    gap: 0;
  }
  .hero-title {
    margin-bottom: 12px;
  }
  .hero-lead {
    margin-bottom: 20px;
  }
  ul.hero-features {
    flex-wrap: nowrap;
    gap: 2px;
    margin-bottom: 20px;
  }
  .hero-feature {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  .hero-feature-laurel {
    width: 20px;
    height: 44px;
  }
  .hero-feature-content {
    min-width: 0;
    padding: 0;
  }
  .hero-feature-text {
    font-size: 9.5px;
    white-space: nowrap;
  }
  .hero-feature-highlight {
    font-size: 1.9em;
  }
  .hero-ctas {
    margin-top: 0;
    gap: 10px;
  }
  .hero-ctas .btn {
    flex: 1;
    min-width: 0;
  }

  /* --- About --- */
  .about {
    padding: 50px 0;
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
  .about-diagram {
    max-width: 440px;
    margin: 0 auto;
  }

  /* --- About: リング内フェーズラベル（SPでも縮小して表示） --- */
  .about-diagram-phase-num {
    font-size: 9px;
  }
  .about-diagram-phase-name {
    font-size: 10px;
  }

  /* --- Services: 3カラム → 1カラム --- */
  .services-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-top: var(--space-xl);
  }
  .service-card > article {
    padding: 25px;
  }
  .service-card-link {
    width: 40px;
    height: 40px;
  }

  /* --- Support: 4カラム階段 → 1カラム縦積み。バナー(縦書き)左 + コンテンツ右 --- */
  .support {
    padding: 50px 0;
  }
  .support-steps {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: none;
  }
  .support-step,
  .support-step--1,
  .support-step--2,
  .support-step--3,
  .support-step--4 {
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    text-align: left;
  }
  /* SP では縦点線は非表示 */
  .support-step:not(:first-child)::before {
    display: none;
  }
  /* バナーは縦書き + 下向き矢印形状 */
  .support-step-banner {
    writing-mode: vertical-rl;
    -webkit-writing-mode: vertical-rl;
    width: auto;
    max-width: none;
    min-width: 48px;
    margin: 0;
    padding: 14px 10px 26px;
    flex-shrink: 0;
    clip-path: polygon(
      0 8px,
      0 calc(100% - 22px),
      4px calc(100% - 18px),
      50% 100%,
      calc(100% - 4px) calc(100% - 18px),
      100% calc(100% - 22px),
      100% 8px,
      calc(100% - 8px) 0,
      8px 0
    );
    text-align: center;
  }
  .support-step-content {
    flex: 1;
    padding-top: 0;
  }

  /* --- Section CTA: 2ボタン横並び → 縦積み --- */
  .sec-cta {
    padding: 50px 0;
  }
  .sec-cta-sub {
    margin-bottom: var(--space-md);
  }
  .sec-cta-buttons {
    grid-template-columns: 1fr;
    gap: 25px;
    max-width: 480px;
  }
  .sec-cta-btn {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--fz-base);
  }

  /* --- Concerns: SP でパディングを詰める（画像は 100% で自動リフロー） --- */
  .concerns {
    padding: 50px 0;
  }
  .concerns-intro {
    margin-bottom: 30px;
  }

  /* --- Featured: 5枚同時 → 1.2枚（次のカードの hint だけ見える） --- */
  .featured {
    padding: 50px 0;
  }
  .featured-intro {
    margin-bottom: 30px;
  }
  .featured-card {
    flex: 0 0 70%;
  }

  /* --- Partners: 5列 → 3+2列 --- */
  .partners {
    padding: 50px 0;
  }
  .partners-intro {
    margin-bottom: 30px;
  }
  .partners-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  /* --- Flow: SP 用に余白・番号バブルを縮小 --- */
  .flow {
    padding: 50px 0;
  }
  .flow-intro {
    margin-bottom: 30px;
  }
  .flow-step {
    padding: var(--space-md);
    gap: var(--space-md);
  }
  .flow-step-num {
    width: 48px;
    height: 48px;
    font-size: var(--fz-md);
  }
  .flow-step-title {
    font-size: var(--fz-lg);
  }
  /* SP でもコネクターの位置を padding + 番号バブル半径に合わせる */
  .flow-step:not(:last-child)::after {
    left: calc(var(--space-md) + 24px);
  }
  .flow-step:not(:last-child)::before {
    left: calc(var(--space-md) + 16px);
  }

  /* --- Contact / Form pages（資料請求 / 個別相談） --- */
  .contact-hero {
    padding: 50px 0;
  }
  .contact-form-section {
    padding: 50px 0;
  }
  .contact-form {
    padding: var(--space-lg) var(--space-md);
    gap: var(--space-md);
  }
  .form-submit-wrap .btn {
    min-width: 0;
    width: 100%;
  }

  /* --- Page CTA: 2カード → 1カラム縦積み --- */
  .page-cta {
    padding: 50px 0;
  }
  .page-cta-intro {
    margin-bottom: 30px;
  }
  .page-cta-cards {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .page-cta-card {
    padding: var(--space-lg);
  }
  .page-cta-card-btn {
    align-self: stretch;
  }

  /* --- Taskhub ページ: レスポンシブ --- */
  /* HTML 構造:
       section.th-hero > .container > .th-hero-grid
         ├ .th-hero-content（青背景ゾーン: タイトル〜CTAまで）
         └ .th-hero-visual （白背景ゾーン: モック画像）
     .th-hero と .container の背景・padding を無効化し、
     .th-hero-content / .th-hero-visual それぞれに全幅背景 + 内側 padding を持たせる */
  .th-hero {
    padding: 0;
    background: none;
  }
  .th-hero::before {
    display: none;
  }
  .th-hero > .container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }
  .th-hero-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  /* 青ゾーン: タイトル〜CTAボタンまで */
  .th-hero-content {
    background: linear-gradient(135deg,
      rgba(0, 113, 185, 1) 0%,
      rgba(98, 169, 246, 1) 75%,
      rgba(164, 228, 255, 1) 100%);
    padding: 50px var(--container-padding);
    gap: 0;
  }
  .th-hero-title {
    margin-bottom: 12px;
  }
  .th-hero-lead {
    margin-bottom: 20px;
  }
  /* リード文の <br> を SP では非表示に */
  .th-hero-lead br {
    display: none;
  }
  /* CTA ボタンを縦並びに（AI Platform と同様） */
  .th-hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 0;
  }
  .th-hero-ctas .btn {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  /* 白ゾーン: モック画像 */
  .th-hero-visual {
    background: var(--color-white);
    padding: 40px var(--container-padding);
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
  }
  .th-hero-visual-img {
    max-width: 340px;
  }
  .th-hero-visual-caption {
    color: var(--color-gray);
  }
  .th-hero-visual-caption strong {
    color: var(--color-primary);
  }
  /* Taskhub 全セクションイントロの下マージンを 30px に統一 */
  .th-section-intro {
    margin-bottom: 30px;
  }
  .th-concerns,
  .th-apps,
  .th-features,
  .th-support,
  .th-pricing,
  .th-faq {
    padding: 50px 0;
  }
  .th-feature-group {
    padding: 50px 0;
  }
  .th-feature-group + .th-feature-group {
    margin-top: var(--space-md);
  }
  /* 3列 → 2列 */
  .th-concerns-grid,
  .th-apps-grid,
  .th-support-grid,
  .th-feature-trio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* 機能 4: 2カラム → 1カラム */
  .th-feature-body {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  /* 機能 5 pair: 2列 → 1列 */
  .th-feature-pair {
    grid-template-columns: 1fr;
  }
  /* 料金: 4列 → 2列 */
  .th-pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: var(--space-lg);
  }
  /* 料金カード: tag / name / price の間隔を詰める */
  .th-pricing-card {
    gap: 4px;
  }
  .th-pricing-name {
    margin-top: 2px;
  }
  .th-pricing-price {
    margin-top: 2px;
    padding-bottom: 10px;
  }
  /* FAQ: question / answer の padding = 15px */
  .th-faq-question {
    padding: 15px;
  }
  .th-faq-answer {
    padding: 15px;
    padding-top: 15px;
  }

  /* --- AI Platform ページ: レスポンシブ --- */
  .aip-hero {
    padding: 50px 0;
  }
  /* Hero コンテンツは gap ではなく個別 margin で余白を制御（トップと同ルール） */
  .aip-hero-content {
    gap: 0;
  }
  /* Hero タイトル: 「プラットフォーム導入支援で、」が改行しないサイズに調整 */
  .aip-hero-title {
    font-size: clamp(1.125rem, 5.4vw, 1.5rem);
    margin-bottom: 12px;
  }
  .aip-hero-lead {
    margin-bottom: 20px;
  }
  /* CTA ボタンを縦並びに（トップページと同様） */
  .aip-hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 0;
  }
  .aip-hero-ctas .btn {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  /* ロゴ帯: SP では余白を詰める + ロゴ幅を縮小 */
  .aip-hero-logos {
    padding: 50px 0;
  }
  .aip-hero-logo-list {
    gap: var(--space-md) var(--space-lg);
  }
  .aip-hero-logo-list img {
    max-height: 36px;
    max-width: 130px;
  }
  /* プラットフォーム一覧: 3列 → 1列（3+2 の nth-child 指定を無効化） */
  .aip-platforms,
  .aip-detail,
  .aip-comparison,
  .aip-flow {
    padding: 50px 0;
  }
  /* AI Platform 全セクションイントロの下マージンを 30px に統一 */
  .aip-section-intro {
    margin-bottom: 30px;
  }
  .aip-platform-list {
    grid-template-columns: 1fr;
  }
  .aip-platform-card:nth-child(4),
  .aip-platform-card:nth-child(5) {
    grid-column: auto;
    grid-row: auto;
  }
  /* aip-services セクション上下 padding = 50px */
  .aip-services {
    padding: 50px 0;
  }
  /* 各サービスブロック上下 padding = 40px */
  .aip-service-block {
    padding: 40px 0;
  }
  /* カード padding = 25px 統一 */
  .aip-platform-card {
    padding: 25px;
  }
  .aip-detail-info {
    padding: 25px;
    position: static;
    gap: 5px;
  }
  /* 対象サービス詳細: 2カラム → 1カラム */
  .aip-detail-body {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  /* 対象ユーザーの区切り線を削除 */
  .aip-detail-target {
    border-top: none;
    padding-top: 0;
  }
  /* 反転レイアウト（OpenClaw / ナレフルチャット）も SP では通常順（情報→メニュー）に統一 */
  .aip-service-block--reverse .aip-detail-body {
    grid-template-columns: 1fr;
  }
  .aip-service-block--reverse .aip-detail-info {
    order: 0;
  }
  .aip-service-block--reverse .aip-detail-menus {
    order: 0;
  }
  /* メニューリスト各項目の padding = 15px */
  .aip-menu-list > li {
    padding: 15px;
  }
  /* サービス比較表: 各セルが窮屈にならないよう幅を確保 */
  .aip-compare-table {
    min-width: 1200px;
    table-layout: fixed;
  }
  .aip-compare-table thead th,
  .aip-compare-table tbody th {
    width: 140px;
  }
  .aip-compare-table thead th:nth-child(2),
  .aip-compare-table tbody td:nth-child(2) {
    width: 200px;
  }
  .aip-compare-table thead th:nth-child(3),
  .aip-compare-table tbody td:nth-child(3),
  .aip-compare-table thead th:nth-child(4),
  .aip-compare-table tbody td:nth-child(4) {
    width: 280px;
  }
  .aip-compare-table thead th:nth-child(5),
  .aip-compare-table tbody td:nth-child(5) {
    width: 200px;
  }
  .aip-compare-table th,
  .aip-compare-table td {
    padding: var(--space-md) var(--space-sm);
  }
  /* フロー: 4列 → 2列 */
  .aip-flow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* フローステップ: num+title を横並び中央揃え + description は下段 */
  .aip-flow-step {
    padding: 15px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "num title"
      "lead lead"
      "desc desc";
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
  }
  .aip-flow-num {
    grid-area: num;
    font-size: 24px;
    line-height: 1;
    margin-bottom: 0;
  }
  .aip-flow-title {
    grid-area: title;
  }
  .aip-flow-lead {
    grid-area: lead;
  }
  .aip-flow-desc {
    grid-area: desc;
  }
  /* SP では nav を viewport 端付近に */
  .featured-nav--prev {
    left: 4px;
    transform: translateY(-50%);
  }
  .featured-nav--next {
    left: auto;
    right: 4px;
    transform: translateY(-50%);
  }
  .featured-nav {
    width: 40px;
    height: 40px;
  }

  /* --- Site Footer --- */
  .site-footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  .site-footer-menu {
    flex-direction: column;
    gap: var(--space-xs);
  }
  .site-footer-bottom {
    justify-content: flex-start;
  }

  /* ページ固有のレスポンシブスタイルをここに追記 */
}

/* --------------------------------------------------------------------------
   スマートフォン（480px以下）
   主に余白の微調整。文字サイズは variables.css の clamp() が追従するため
   原則ここでは指定しない（必要な場合のみ追記）
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .section-padding {
    padding-top: 50px;
    padding-bottom: 50px;
  }

  /* --- Support: 2カラム → 1カラム --- */
  .support-steps {
    grid-template-columns: 1fr;
    max-width: 360px;
  }

  /* Concerns の @480px 固有調整はなし（親クラスで対応済み） */

  /* --- Featured: SP でカード幅を 85% に --- */
  .featured-card {
    flex: 0 0 85%;
  }

  /* --- AI Platform: SP でフロー 1列 --- */
  .aip-flow-steps {
    grid-template-columns: 1fr;
  }

  /* --- Taskhub: SP でさらに 1列に --- */
  .th-concerns-grid,
  .th-apps-grid,
  .th-support-grid,
  .th-feature-trio,
  .th-pricing-grid {
    grid-template-columns: 1fr;
  }
  .aip-hero-tags {
    gap: 6px;
  }
  .aip-hero-tags li {
    padding: 4px 10px;
  }

  /* --- Partners: 3列 → 2列 --- */
  .partners-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* --- Hero（SP余白の微調整） --- */
  .hero {
    padding: 50px 0;
  }
  .hero-visual {
    max-width: 280px;
  }
  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-ctas .btn {
    width: 100%;
  }

  /* --- About --- */
  .about-diagram {
    max-width: 320px;
  }
  .about-service-label {
    font-size: 9px;
  }
  .about-diagram-hub-brand {
    font-size: var(--fz-xs);
  }
  .about-diagram-phase-num {
    font-size: 8px;
  }
  .about-diagram-phase-name {
    font-size: 9px;
  }

  /* ページ固有のレスポンシブスタイルをここに追記 */
}
