/* モバイル対応の強制上書き */
@media screen and (max-width: 767px) {
    /* 1. トップのメインビジュアル（青いボックス）の調整 */
    div[style*="height: 400px"] {
        height: auto !important;
        background-size: cover;
        background-position: center;
        padding: 20px 0;
    }

    /* 「NetConventionご紹介」の青い帯 */
    p[style*="width: 500px"] {
        width: 100% !important;
        float: none !important;
        margin-top: 20px !important;
        font-size: 24px !important;
        line-height: 40px !important;
    }

    /* 「問合せはこちらから」のボタン */
    p[style*="width: 250px"] {
        width: 90% !important;
        position: static !important;
        margin: 20px auto !important;
        float: none !important;
    }

    /* 2. グリッド（4列並び）を2列、または1列にする */
    .row-fluid .span3 {
        width: 48% !important;
        float: left !important;
        margin-left: 2% !important;
        margin-bottom: 20px;
    }
    
    .row-fluid .span3:nth-child(2n+1) {
        margin-left: 0 !important;
        clear: both;
    }

    /* 3. 画像のハミ出し防止 */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 4. メニュー部分の調整 */
    .nav__primary {
        float: none !important;
    }
    
    /* 水平線の代わりに入っている大きな画像(bar.png)をスマホでは非表示か調整 */
    img[src*="bar.png"] {
        display: none;
    }
    
    /* 見出し（ソリューション、システム＆サービス） */
    p[style*="background: #4f81bd"] {
        font-size: 16px !important;
        line-height: 1.4 !important;
        padding: 10px !important;
    }
}

/* 小さなスマホ向けに1列にする調整 */
@media screen and (max-width: 480px) {
    .row-fluid .span3 {
        width: 100% !important;
        margin-left: 0 !important;
    }
}


/* --- ハンバーガーメニューの実装 --- */

/* PCではハンバーガーボタンを隠す */
.menu-toggle {
    display: none;
    background: #1f497d; /* サイトに合わせた濃い青 */
    color: #fff;
    padding: 10px 15px;
    cursor: pointer;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}
.menu-toggle i {
    margin-right: 10px;
}

/* スマホ表示時の設定 (767px以下) */
@media screen and (max-width: 767px) {
    /* 元々のメニュー（Superfish）と、古いセレクトボックス型メニューを非表示にする */
    .nav__primary .sf-menu, 
    .select-menu { 
        display: none !important; 
    }

    /* ハンバーガーボタンを表示 */
    .menu-toggle {
        display: block;
        margin-bottom: 10px;
    }

    /* ボタンが押された時に表示するメニューのスタイル */
    .nav__primary.menu-open .sf-menu {
        display: block !important;
        float: none !important;
        width: 100%;
        background: #333; /* メニューの背景色 */
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .nav__primary.menu-open .sf-menu > li {
        float: none !important;
        border-bottom: 1px solid #444;
    }

    .nav__primary.menu-open .sf-menu > li > a {
        display: block;
        padding: 15px;
        color: #fff !important;
        font-size: 16px;
        text-decoration: none;
    }
    
    /* スティックアップ機能（メニュー固定）がスマホで邪魔になる場合の解除 */
    .pseudoStickyMenu {
        display: none !important;
    }
}

/* --- ハンバーガーメニューの修正版 --- */

/* PCではボタンを隠す */
.menu-toggle {
    display: none;
}

/* スマホ表示時 (767px以下) */
@media screen and (max-width: 767px) {
    /* 1. 元のメニューを隠す */
    .nav__primary .sf-menu, 
    .select-menu { 
        display: none !important; 
    }

    /* 2. ボタンを強制的に表示 */
    .menu-toggle {
        display: block !important;
        background: #1f497d !important; /* サイトのメインの青色 */
        color: #ffffff !important;
        padding: 15px !important;
        text-align: center !important;
        font-size: 20px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        border-radius: 5px;
        margin: 10px 0;
        visibility: visible !important;
    }

    /* 3. ボタンが押された時（menu-openクラスがついた時）のメニュー表示 */
    .nav__primary.menu-open .sf-menu {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
        background: #f8f8f8 !important; /* メニューの背景色 */
        border: 1px solid #ccc;
    }

    .nav__primary.menu-open .sf-menu > li {
        float: none !important;
        display: block !important;
        border-bottom: 1px solid #ddd !important;
    }

    .nav__primary.menu-open .sf-menu > li > a {
        display: block !important;
        padding: 15px !important;
        color: #333 !important;
        font-size: 16px !important;
        text-align: left !important;
    }
}