/**
 * レスポンシブデザイン - 手ぶらdeお遍路
 */

/* =============================================================================
   大画面デスクトップ (1200px以上)
   ============================================================================= */

@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
        padding: 0 30px;
    }
    
    .hero h1,
    .hero-title {
        font-size: 4em;
    }
    
    .hero-subtitle {
        font-size: 1.6em;
    }
    
    .hero-description {
        font-size: 1.4em;
    }
    
    .section {
        padding: 100px 0;
    }
    
    .section-title {
        font-size: 2.8em;
    }
    
    .section-title--large {
        font-size: 2.4em;
    }
    
    .problems-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    .solutions-grid,
    .features-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 1000px;
        margin: 50px auto;
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* =============================================================================
   デスクトップ (1024px以上)
   ============================================================================= */

@media (min-width: 1024px) {
    .nav {
        display: flex;
    }
    
    .nav-mobile {
        display: none;
    }
}

/* =============================================================================
   デスクトップ (1024px~1199px)
   ============================================================================= */

@media (min-width: 1024px) and (max-width: 1199px) {
    .container {
        max-width: 1024px;
        padding: 0 25px;
    }
    
    .hero h1,
    .hero-title {
        font-size: 3.2em;
    }
    
    .hero-subtitle {
        font-size: 1.5em;
    }
    
    .hero-description {
        font-size: 1.3em;
    }
    
    .section-title {
        font-size: 2.4em;
    }
    
    .section-title--large {
        font-size: 2.2em;
    }
    
    .problems-grid,
    .solutions-grid,
    .features-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .testimonials-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* =============================================================================
   タブレット・モバイル共通（1023px以下）
   ハンバーガーメニュー表示、UIアクションのフォントサイズ統一
   ============================================================================= */

@media (max-width: 1023px) {
    :root {
        --header-height: 70px;
        --ui-action-font-size: 1em;
        --ui-action-font-size-lg: 1em;
    }

    .header,
    .header-content {
        height: var(--header-height);
    }

    .nav {
        display: none;
    }

    .nav-mobile {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: transparent;
        border: 0;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    #primary-nav {
        display: none;
    }

    #primary-nav.is-open {
        position: fixed;
        top: var(--header-height, 70px);
        right: 0;
        left: 0;
        z-index: 999;
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - var(--header-height, 70px));
        padding: 0;
        margin: 0;
        gap: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-top: 1px solid rgba(255,255,255,.15);
        background: linear-gradient(
            to bottom right,
            var(--primary-dark) 0%,
            var(--primary-color) 80%,
            var(--secondary-color) 100%
        );
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
        font: inherit;
    }

    #primary-nav.is-open a {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        min-height: 48px;
        padding: 14px 20px;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,.10);
        border-radius: 0;
        font-family: inherit;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.5;
        text-decoration: none;
        color: #fff;
        transition: background .2s ease;
    }

    #primary-nav.is-open a:last-child {
        border-bottom: none;
    }
    
    #primary-nav.is-open a:hover,
    #primary-nav.is-open a.active {
        background: rgba(255,255,255,.15);
    }

    #primary-nav.is-open a.active {
        font-weight: 600;
    }

    #primary-nav.is-open a:focus-visible {
        outline: 2px solid rgba(255,255,255,.6);
        outline-offset: -2px;
    }

    body.nav-open {
        overflow: hidden;
        touch-action: none;
    }
}

/* =============================================================================
   タブレット横 (768px~1023px)
   ============================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .hero h1,
    .hero-title {
        font-size: 2.8em;
    }
    
    .hero-subtitle {
        font-size: 1.4em;
    }
    
    .hero-description {
        font-size: 1.2em;
    }
    
    .section-title {
        font-size: 2.2em;
    }
    
    .section-title--large {
        font-size: 2em;
    }
    
    .problems-grid,
    .solutions-grid,
    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .services-grid,
    .comparison-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .stats-grid,
    .trust-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .support-list {
        grid-template-columns: repeat(2, 1fr);
        max-width: 720px;
        gap: 22px 36px;
        justify-content: center;
        justify-items: start;
    }

    .cta-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .btn {
        flex: 0 0 auto;
        min-width: 220px;
    }
}

/* =============================================================================
   タブレット縦・モバイルラージ (577px~767px)
   ============================================================================= */

@media (min-width: 577px) and (max-width: 767px) {
    .container {
        max-width: 100%;
        padding: 0 18px;
    }
    
    .hero:not(.hero--fixed) {
        padding: calc(var(--header-height, 70px) + 40px) 0 60px;
    }

    .hero h1,
    .hero-title {
        font-size: 2.4em;
    }
    
    .hero-subtitle {
        font-size: 1.3em;
    }
    
    .hero-description {
        font-size: 1.1em;
    }
    
    .section-title {
        font-size: 2em;
    }
    
    .section-title--large {
        font-size: 1.8em;
    }
    
    .section-description, 
    .hero-description, 
    .trust-item p, 
    .testimonial-item p,
    .comparison-item p {
        font-size: 1.3em;
    }
    
    .problems-grid,
    .solutions-grid,
    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .services-grid,
    .comparison-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .stats-grid,
    .trust-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .support-list {
        grid-template-columns: repeat(2, 1fr);
        max-width: 620px;
        gap: 18px 28px;
        justify-content: center;
        justify-items: start;
    }

    .cta-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .btn {
        flex: 0 0 auto;
        min-width: 200px;
    }

    .form-container {
        max-width: 500px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 18px;
    }
    
    .pain-image {
        max-width: 350px;
    }
}

/* =============================================================================
   モバイル (576px以下)
   ============================================================================= */

@media (max-width: 576px) {
    :root {
        --header-height: 70px;
        --container-padding: 15px;
    }
    
    .container {
        padding: 0 var(--container-padding);
    }
    
    .hero:not(.hero--fixed) {
        padding: calc(var(--header-height, 70px) + 40px) 0 60px;
        text-align: center;
    }
    
    .hero h1,
    .hero-title {
        margin-bottom: 20px;
        font-size: 2.2em;
    }
    
    .hero-subtitle {
        margin-bottom: 18px;
        font-size: 1.25em;
    }
    
    .hero-description {
        margin-bottom: 30px;
        font-size: 1.05em;
    }

    .hero-overlay {
        background: rgba(0,0,0,0.5);
    }

    .section {
        padding: 60px 0;
    }
    
    .section-title {
        margin-bottom: 30px;
        font-size: 1.8em;
    }
    
    .section-title--large {
        font-size: 1.6em;
    }
    
    .section-description {
        margin-bottom: 35px;
        font-size: 1.1em;
    }
    
    .problems-grid,
    .solutions-grid,
    .features-grid,
    .pricing-grid,
    .services-grid,
    .comparison-grid,
    .testimonials-grid,
    .stats-grid,
    .trust-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 25px;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn,
    .btn--lg {
        width: auto;
        min-width: 240px;
        max-width: 320px;
    }
    
    .stat-value {
        font-size: 2.5em;
    }
    
    .form-container {
        max-width: 100%;
    }
    
    .form-group {
        margin-bottom: 25px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    .faq-question {
        padding: 18px 20px;
        font-size: 0.95em;
    }
    
    .faq-answer.show {
        padding: 20px;
    }
    
    .pain-image {
        max-width: 300px;
    }
    
    .support-list {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 18px;
        max-width: min(540px, calc(100% - 30px));
        margin-inline: auto;
    }

    .support-list li {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        max-width: 100%;
        width: 100%;
        padding: 0;
        border: 0;
        line-height: 1.8;
    }

    .support-list li:before {
        flex-shrink: 0;
        margin-top: 0.2em;
    }
    
    .final-cta h2 {
        font-size: 2em;
    }
    
    .final-description {
        font-size: 1.1em;
    }
}

/* =============================================================================
   小画面スマートフォン (421px~576px)
   ============================================================================= */

@media (min-width: 421px) and (max-width: 576px) {
    :root {
        --ui-action-font-size: 0.95em;
        --ui-action-font-size-lg: 0.95em;
    }

    .container {
        padding: 0 12px;
    }
    
    .hero h1,
    .hero-title {
        font-size: 1.9em;
    }
    
    .section-title {
        font-size: 1.6em;
    }
    
    .section-title--large {
        font-size: 1.5em;
    }
    
    .support-list {
        grid-template-columns: 1fr;
        justify-items: start;
        max-width: min(540px, calc(100% - 24px));
        margin-inline: auto;
    }
    
    .support-list li {
        width: 100%;
    }
}

/* =============================================================================
   極小画面 (420px以下)
   ============================================================================= */

@media (max-width: 420px) {
    :root {
        --header-height: 60px;
        --container-padding: 10px;
        --ui-action-font-size: 0.85em;
        --ui-action-font-size-lg: 0.85em;
        --ui-action-pad-y: 14px;
        --ui-action-pad-x: 18px;
        --ui-action-pad-y-lg: 14px;
        --ui-action-pad-x-lg: 18px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 var(--container-padding);
    }
    
    .header {
        padding: 10px 0;
    }
    
    .logo {
        font-size: 1.2em;
    }

    .nav-mobile {
        font-size: 1.2em;
    }
    
    .hero:not(.hero--fixed) {
        padding: calc(var(--header-height, 60px) + 40px) 0 50px;
    }
    
    .hero h1,
    .hero-title {
        font-size: 1.8em;
    }
    
    .hero-subtitle {
        font-size: 1.1em;
    }
    
    .hero-description {
        font-size: 0.95em;
    }
    
    .section {
        padding: 50px 0;
    }
    
    .section-title {
        font-size: 1.5em;
    }
    
    .section-title--large {
        font-size: 1.4em;
    }
    
    .section-description {
        font-size: 1em;
    }

    .support-list {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 14px;
        max-width: min(540px, calc(100% - 20px));
        margin-inline: auto;
    }

    .support-list li {
        max-width: 100%;
        width: 100%;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .stat-label {
        font-size: 0.85em;
    }
}

/* =============================================================================
   iPhone/Safari 専用調整
   ============================================================================= */

@supports (-webkit-touch-callout: none) {
    html {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    body {
        position: relative;
        width: 100%;
        height: 100%;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: none;
    }

    .hero--image {
        background-attachment: scroll;
    }

    @media (max-width: 1023px) {
        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: var(--header-height) !important;
            padding-top: 0 !important;
        }

        .header-content {
            height: var(--header-height) !important;
        }

        main > .hero:first-child.hero--fixed {
            margin-top: var(--header-height);
        }

        #primary-nav.is-open {
            top: var(--header-height) !important;
            max-height: calc(100vh - var(--header-height));
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
    }
}

/* =============================================================================
   ランドスケープモード (横向き) ※1023px以下
   ============================================================================= */

@media (max-width: 1023px) and (orientation: landscape) {
    .hero:not(.hero--fixed) {
        padding: calc(var(--header-height) + 20px) 0 40px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .hero h1,
    .hero-title {
        font-size: 2em;
    }
    
    .section-title {
        font-size: 1.6em;
    }
}

/* =============================================================================
   印刷用スタイル
   ============================================================================= */

@media print {
    .header,
    .nav,
    .nav-mobile,
    .cta-buttons,
    .final-cta {
        display: none;
    }
    
    .hero,
    .section {
        padding: 20px 0;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}
