/* ==========================================================================
   レスポンシブ - 画面サイズ別の調整
   ========================================================================== */

/* ============================================
   ブレークポイント定義
   ============================================ */
:root {
    --breakpoint-xs: 375px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ============================================
   超大画面 (1536px以上)
   ============================================ */
@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
    
    /* カードのグリッドを4列に */
    .grid-cols-1.md\:grid-cols-3.xl\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   大画面デスクトップ (1280px - 1536px)
   ============================================ */
@media (min-width: 1280px) and (max-width: 1535px) {
    .container {
        max-width: 1280px;
    }
    
    /* 価格計算機の最適化 */
    #customize .price-calculator {
        position: sticky;
        top: 5rem;
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
    }
}

/* ============================================
   デスクトップ (1024px - 1280px)
   ============================================ */
@media (min-width: 1024px) and (max-width: 1279px) {
    #customize .price-calculator {
        position: sticky;
        top: 6rem;
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
    }
    
    /* プランカードの調整 */
    #plans .grid {
        gap: 1.5rem;
    }
}

/* ============================================
   タブレット横向き (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    /* ヒーローセクション */
    .vtuber-hero p {
        font-size: 1.25rem;
    }
    
    /* 価格計算機 */
    #customize .price-calculator {
        position: static !important;
        margin-top: 2rem;
    }
    
    /* グリッドレイアウト調整 */
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* カード間隔 */
    .problem-card,
    .solution-card,
    .creator-card {
        margin-bottom: 1rem;
    }
}

/* ============================================
   タブレット縦向き (640px - 768px)
   ============================================ */
@media (min-width: 640px) and (max-width: 767px) {
    /* 2列グリッドを維持 */
    .grid-cols-1.sm\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* フォントサイズ調整 */
    h2.text-4xl,
    h2.text-5xl {
        font-size: 2.25rem !important;
    }
    
    /* ボタンサイズ */
    button,
    .btn {
        padding: 0.875rem 1.75rem;
    }
}

/* ============================================
   モバイル標準 (375px - 640px)
   ============================================ */
@media (min-width: 375px) and (max-width: 639px) {
    /* ヒーローセクション */
    .vtuber-hero {
        min-height: 90vh;
        padding: 4rem 0;
    }
    
    .vtuber-hero p {
        font-size: 1rem;
    }
    
    /* ボタン調整 */
    .vtuber-hero button,
    .vtuber-hero a {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        width: 100%;
    }
    
    /* グリッド調整 */
    .vtuber-hero .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* セクションパディング */
    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* カードパディング */
    .problem-card,
    .solution-card,
    .creator-card,
    .guarantee-badge {
        padding: 1.25rem;
    }
    
    /* 見出しサイズ */
    h2.text-4xl,
    h2.text-5xl {
        font-size: 1.75rem !important;
    }
    
    h3.text-2xl {
        font-size: 1.25rem !important;
    }
    
    /* プラン価格 */
    #plans .text-5xl {
        font-size: 2rem !important;
    }
    
    /* プロセスステップ */
    .process-step {
        padding-left: 2.5rem;
    }
    
    .process-number {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
        left: 0;
    }
    
    /* FAQ */
    .faq-item {
        padding: 1rem 0;
    }
    
    /* お問い合わせフォーム */
    #contact .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    /* 価格計算機 */
    #customize .price-calculator {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 50vh;
        border-radius: 1rem 1rem 0 0;
        z-index: 50;
        transform: translateY(calc(100% - 80px));
        transition: transform 0.3s ease;
    }
    
    #customize .price-calculator.expanded {
        transform: translateY(0);
    }
    
    /* スクロール可能なリスト */
    #selectedItems {
        max-height: 120px;
    }
}

/* ============================================
   極小画面 (375px以下)
   ============================================ */
@media (max-width: 374px) {
    /* コンテナパディング */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* ヒーローセクション */
    .vtuber-hero {
        min-height: 100vh;
        padding: 3rem 0;
    }
    
    .vtuber-hero p {
        font-size: 0.875rem;
    }
    
    /* フレックスレイアウト */
    .vtuber-hero .flex {
        flex-direction: column !important;
    }
    
    /* グリッドを1列に */
    .vtuber-hero .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* 実績数値 */
    .vtuber-hero .text-3xl {
        font-size: 1.5rem !important;
    }
    
    /* フォーム要素（iOSズーム防止） */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* ボタンを全幅に */
    button,
    a[role="button"],
    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* カードのパディング削減 */
    .problem-card,
    .solution-card,
    .creator-card {
        padding: 1rem;
    }
    
    /* 見出しサイズ */
    h2.text-3xl,
    h2.text-4xl,
    h2.text-5xl {
        font-size: 1.5rem !important;
    }
    
    h3.text-xl,
    h3.text-2xl {
        font-size: 1.125rem !important;
    }
    
    /* テーブルをスクロール可能に */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ============================================
   横向きモバイル対応
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    /* ヒーローセクション高さ調整 */
    .vtuber-hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    /* 固定ヘッダーを非表示 */
    header.sticky {
        position: relative !important;
    }
    
    /* モーダルやポップアップの高さ制限 */
    .modal,
    .popup {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ============================================
   高解像度ディスプレイ対応
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* 画像の高解像度版を使用 */
    .hero-image {
        /* css/ 配下から参照するため ../assets/ を使用 */
        background-image:
            linear-gradient(135deg, rgba(246, 167, 193, 0.75) 0%, rgba(232, 92, 136, 0.75) 100%),
            url('../assets/hero-bg-mobile.jpg');
    }
    
    /* より細いボーダー */
    .border {
        border-width: 0.5px;
    }
}

/* ============================================
   印刷対応
   ============================================ */
@media print {
    /* 不要な要素を非表示 */
    header,
    footer,
    #backToTop,
    .hero-video,
    button,
    .price-calculator {
        display: none !important;
    }
    
    /* 背景色を削除 */
    * {
        background: white !important;
        color: black !important;
    }
    
    /* リンクのURLを表示 */
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    /* ページブレイクの制御 */
    .page-break {
        page-break-after: always;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* ============================================
   アクセシビリティ：大きい文字サイズ
   ============================================ */
@media (prefers-contrast: high) {
    /* コントラストを強化 */
    .text-gray-600 {
        color: #333 !important;
    }
    
    .border {
        border-color: #000 !important;
    }
    
    button,
    .btn {
        border: 2px solid currentColor !important;
    }
}

/* ============================================
   ダークモード対応（将来の実装用）
   ============================================ */
/* ダークモード用の配色は、背景だけが暗くなり文字が読めなくなるため削除（2026-10-15）。このLPは明るい配色のみで表示する。 */

/* ============================================
   特定デバイス対応
   ============================================ */

/* iPhone X以降のノッチ対応 */
@supports (padding: env(safe-area-inset-top)) {
    header {
        padding-top: env(safe-area-inset-top);
    }
    
    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* iPad Pro対応 */
@media only screen 
  and (min-width: 1024px) 
  and (max-width: 1366px) 
  and (-webkit-min-device-pixel-ratio: 1.5) {
    .container {
        max-width: 980px;
    }
}

/* ============================================
   パフォーマンス最適化
   ============================================ */

/* 小画面では複雑なアニメーションを削減 */
@media (max-width: 768px) {
    * {
        animation-duration: 0.3s !important;
    }
    
    .hero-video {
        display: none;
    }
    
    /* 影を簡略化 */
    .shadow-xl {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
}

/* 低速接続対応 */
@media (prefers-reduced-data: reduce) {
    /* 動画を非表示 */
    video {
        display: none;
    }
    
    /* 画像品質を下げる */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}