@charset "Shift_JIS";

/* =========================================================
   共通設定：究極のスクロールバグ対策（iOS Safari向け）
========================================================= */
html, body {
    height: auto !important;
    min-height: 100% !important;
    overflow: auto !important;
    position: static !important;
    -webkit-overflow-scrolling: touch !important;
}

/* 最上部の帯は画面いっぱいに広げ、高さを潰さない */
#header1 {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important; 
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 5px 10px !important;
}

/* 下層ページの#headerはここから除外する（PC版の絶対配置を維持するため） */
#container, #top_content, #footer {
    width: 100% !important;
    max-width: 775px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

/* 画像・iframeのはみ出し防止 */
img {
    max-width: 100% !important;
    height: auto !important;
}
iframe {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 600 / 450 !important;
    height: auto !important;
}

/* =========================================================
   トップページ：PC用の余白調整（<br>削除による詰まり解消）
========================================================= */
/* メイン画像（スライダー）の下に余白を作る */
#mainimg {
    width: 100% !important;
    max-width: 775px !important;
    aspect-ratio: 775 / 244 !important;
    margin: 0 auto 30px auto !important; /* ★下に30pxの余白を追加 */
    overflow: hidden !important;
    position: relative !important;
}
#mainimg img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 「3つの特長」のタイトル画像の下に余白を作る */
#top_point {
    margin-bottom: 20px !important;
}

/* 「当院が得意な症例のご紹介」のタイトル上部に余白を作る */
#top_left_content h2 {
    margin-top: 40px !important;
}

/* =========================================================
   診療時間の表（DIV・Grid版）の共通スタイル
========================================================= */
.schedule-grid {
    display: grid !important;
    grid-template-columns: 2.5fr repeat(7, 1fr) !important; 
    border-top: 1px solid #767676 !important;
    border-left: 1px solid #767676 !important;
    width: 100% !important;
    color: #767676 !important;
    font-size: 13px !important;
    margin: 10px 0 !important;
    box-sizing: border-box !important;
}
.schedule-grid .cell {
    border-right: 1px solid #767676 !important;
    border-bottom: 1px solid #767676 !important;
    padding: 5px 2px !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}
.search-box {
    text-align: right !important;
}

/* 左カラム下部の地図入りアクセス情報 */
.access-flex {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}
.access-address {
    width: 48% !important;
}
.access-schedule {
    width: 50% !important;
}

/* =========================================================
   スマホ用設定（画面幅768px以下の場合に適用）
========================================================= */
@media screen and (max-width: 768px) {
    
    #container {
        padding: 0 10px !important;
    }

    /* =========================================================
       トップページのバナー画像が画面を突き抜けないように強制制御
       （親要素のh2やaタグごと幅を100%に固定してはみ出しをカット！）
    ========================================================= */
    #container #header,
    #container #header h2,
    #container #header a {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important; /* ★超重要：枠からはみ出した部分を強制的に見えなくする */
    }

    #container #header img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
    }

    /* ★追加：PC用に追加した余白をスマホでは小さくリセット */
    #mainimg {
        margin: 0 auto 10px auto !important; 
    }
    #top_point {
        margin-bottom: 10px !important;
    }
    #top_left_content h2 {
        margin-top: 20px !important;
    }

    /* 左右のカラムを強制リセットして縦並びに */
    #top_left_content, 
    #top_right_content {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        display: block !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* 古いTableレイアウトの強制ブロック化と回り込み解除 */
    table, tbody, tr, th, td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    td {
        padding: 15px 0 !important;
        text-align: left !important;
        clear: both !important;
        overflow: hidden !important;
    }

    /* 症例リスト（画像＋テキスト）の整列 */
    #top_point_content2 {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        margin-top: 10px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    #top_point_content2 img {
        float: left !important;
        margin: 5px 15px 15px 0 !important;
        width: 100px !important;
        height: auto !important;
        max-width: 40% !important;
    }

    /* メニューバーの調整（トップ・下層共通） */
    #tp_menu, #menu {
        width: 100% !important;
        height: auto !important;
        margin: 10px 0 !important;
    }
    #tp_menu ul, #menu ul {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    #tp_menu li, #menu li {
        width: auto !important;
        float: none !important;
        list-style: none !important;
        margin: 2px !important;
        padding: 0 !important;
        border: none !important;
    }
    #tp_menu li a, #menu li a {
        display: block !important;
    }

    /* トップページメニューの「Home」と「マスコミ出演」を非表示 */
    #tp_menu li#profile,
    #tp_menu li#schedulecost {
        display: none !important;
    }

    /* 下層ページメニューの「マスコミ出演」と「病気病名検索」を非表示 */
    #menu li#massmedia,
    #menu li#search {
        display: none !important;
    }

    /* 診療時間の表・検索窓の調整 */
    .schedule-grid {
        font-size: 10.5px !important;
    }
    .schedule-grid .cell {
        padding: 5px 1px !important;
        word-break: break-all !important;
    }
    .search-box form input[type="text"] {
        width: 70% !important;
    }

    /* 表示・非表示コントロール（スマホ用） */
    .hide-on-sp {
        display: none !important;
    }
    .access-flex {
        display: block !important;
    }
    .access-address, .access-schedule {
        width: 100% !important;
    }

    /* =========================================================
       ヘッダー文字の調整
    ========================================================= */
    /* トップページグレー帯の行間調整 */
    #header1 h1, #header1 em {
        line-height: 1.4 !important;
        display: block !important;
    }
    
    /* 下層ページヘッダー（H1のみ表示、他は非表示）
       ※トップページのバナー画像（#header）が消えないように「body >」をつけて区別！ */
    body > #header {
        padding: 8px 5px !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        position: static !important;
        float: none !important;
        margin: 0 !important;
        text-align: center !important;
    }
    
    /* H1（サイト名）のみ表示 */
    body > #header h1 {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        position: static !important;
        float: none !important;
        font-size: 10px !important; 
        font-weight: bold !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        text-align: center !important;
    }
    body > #header h1 a {
        display: block !important;
        width: 100% !important;
    }

    /* H1のあとのPとH2はhide */
    body > #header p, 
    body > #header h2 {
        display: none !important;
    }

    /* =========================================================
       下層ページ（病気詳細ページ）用のレイアウト解除
    ========================================================= */
    #t_body, #t_header, #t_images, #bottom_menu, #t_footer {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

    #t_byouki_contents, .t_left_menu {
        float: none !important;
        width: 100% !important;
        display: block !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* オレンジ色の「通院困難な方は…」テキスト（H2）を非表示に */
    #t_byouki_contents h2 {
        display: none !important;
    }

    /* 下層ページのデータ表（例外処理） */
    .table_layout3, .table_layout3 tbody, .table_layout3 tr {
        display: table !important; 
        width: 100% !important;
    }
    .table_layout3 td {
        display: table-cell !important;
        clear: none !important;
        padding: 8px !important;
        border: 1px solid #ccc !important;
    }

    /* 緑色のタイトル文字のはみ出し解消とサイズ縮小 */
    #byoumei_t {
        width: 100% !important;
        height: auto !important;
        box-sizing: border-box !important;
        padding: 10px 0 !important;
        background-size: contain !important;
    }
    #byoumei_t p {
        font-size: 18px !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        margin: 0 !important;
    }
}