/*
 * スマホ・タブレット対応（960px未満のみ適用）
 * PC表示（960px以上）は style.css / 960.css のまま変更しない。
 */

.sp-tel,
.sp-intro {
    display: none;
}

@media (max-width: 959px) {
    /* ---------- 全体 ---------- */
    #container {
        width: auto;
        background: #f1eedd;
    }

    #container [class*="grid_"] {
        display: block;
        float: none;
        width: auto;
        margin: 0;
    }

    #container .grid_1 {
        display: none;
    }

    /* ---------- ヘッダー ---------- */
    #headertop,
    #header {
        width: auto;
        height: auto;
    }

    #headertop::before,
    #header::before {
        content: "";
        display: block;
        background: url(../img/head1.jpg) no-repeat right 40% / cover;
    }

    #headertop::before {
        aspect-ratio: 940 / 272;
    }

    #header::before {
        aspect-ratio: 940 / 217;
    }

    /* crossSlide は幅・高さ0だと例外を投げ後続の初期化が止まるため、非表示にせず1pxに縮める */
    #animtop,
    #anim {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        opacity: 0;
        pointer-events: none;
    }

    #logo {
        width: 100%;
        height: auto;
        aspect-ratio: 941 / 113;
        overflow: hidden;
        background-size: 100% auto;
    }

    #home {
        top: 0;
        width: 25%;
        height: auto;
        aspect-ratio: 235 / 100;
    }

    #home img {
        width: 100%;
        height: 100%;
    }

    .sp-tel {
        display: block;
        min-height: 44px;
        line-height: 44px;
        background: #592214;
        color: #fff;
        font-size: 15px;
        font-weight: bold;
        text-align: center;
        text-decoration: none;
    }

    ul#navtop,
    ul#nav {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: auto;
        height: auto;
    }

    ul#navtop li,
    ul#nav li {
        float: none;
        width: auto;
        height: auto;
    }

    ul#navtop li a,
    ul#nav li a {
        height: auto;
        aspect-ratio: 235 / 83;
        background-size: 100% 200%;
    }

    ul#navtop li a:hover,
    ul#nav li a:hover {
        background-position: 0 100%;
    }

    /* ---------- 本文 ---------- */
    /* #container [class*="grid_"] より詳細度を上げるため #container を前置 */
    #container #content {
        max-width: 580px;
        margin: 0 auto;
        padding: 20px 16px;
    }

    h1.title,
    h2.title {
        height: auto;
        min-height: 38px;
        font-size: 20px;
        line-height: 1.4;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    #content img:not([src$="dummy.gif"]),
    #content iframe {
        max-width: 100%;
        height: auto;
    }

    #content iframe {
        width: 100%;
        height: 300px;
    }

    /* index.html 冒頭の料理写真: 画像内の文字が読めないため、写真を背景にテキストで表示 */
    #content > img[src="img/main.jpg"] {
        display: none;
    }

    .sp-intro {
        display: block;
        margin-bottom: 10px;
        padding-top: 150px;
        border-radius: 4px;
        overflow: hidden;
        background: url(../img/main_sp.jpg) no-repeat center 30% / cover;
    }

    .sp-intro p {
        margin: 0;
        padding: 12px 14px;
        background: rgba(255, 255, 255, 0.8);
        color: #4a3b2c;
        font-family: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, serif;
        font-size: 14px;
        line-height: 1.8;
    }

    /* index.html「アスリートの声」「プロデュースのお部屋」（280px×2）を横並びのまま縮小 */
    #content a[href$="sports.html#voice"] img,
    #content a[href$="facilities.html#produce"] img {
        width: calc(50% - 10px);
    }

    .newscontent {
        float: none;
        width: auto;
        margin-bottom: 10px;
        overflow: hidden;
    }

    table.tbl td[width],
    table.tbl th[width] {
        width: 6em;
    }

    table.tbl tr td,
    table.tbl tr th {
        padding: 5px 0.5em;
    }

    .sportslist li {
        width: auto;
    }

    /* sports.html の写真（176px固定）を2列に */
    .photo img {
        box-sizing: border-box;
        width: calc(50% - 7px);
        height: auto;
    }

    /* lunch.html のギャラリー（189px / 170px固定）を2列に */
    .lunchgallery,
    .takeoutgallery {
        width: calc(50% - 8px);
        vertical-align: top;
    }

    #content .lunchgallery img,
    #content .takeoutgallery img {
        max-width: calc(100% - 10px);
    }

    /* course.html の地図（インライン指定を上書き） */
    #map {
        width: 100% !important;
        height: 360px !important;
        float: none !important;
        box-sizing: border-box;
    }

    /* ---------- 右サイドバー ---------- */
    #container #rightSide {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 16px;
    }

    #rightSide br {
        display: none;
    }

    #rightSide > a,
    #rightSide > img {
        flex: 0 1 calc(50% - 4px);
        /* 画像を直接置いた項目（WiFi）が元の幅220pxより縮まず折り返すのを防ぐ */
        min-width: 0;
        max-width: 221px;
    }

    #rightSide img {
        display: block;
        width: 100%;
        height: auto;
    }

    /* ---------- フッター ---------- */
    #footer {
        padding-bottom: 20px;
        font-size: 14px;
    }

    ul.footnav {
        margin: 0;
        padding: 20px 16px 0;
    }

    ul.footnav li {
        margin-left: 0;
    }

    ul.footnav li ul {
        margin-bottom: 0;
    }

    ul.footnav li ul li {
        margin-left: 1.5em;
    }

    ul.footnav li a {
        display: inline-block;
        padding: 6px 0;
    }

    img.footlogo {
        display: block;
        margin: 20px auto 0;
    }
}

/* タブレット幅ではナビを1行4列に */
@media (min-width: 600px) and (max-width: 959px) {
    ul#navtop,
    ul#nav {
        grid-template-columns: repeat(4, 1fr);
    }
}

/*
 * facilities.html「私たちがプロデュースしました」画像（575px）上の透明リンクを、
 * 画像の縮小率（本文幅 / 575）に合わせて配置し直す
 */
@media (max-width: 606px) {
    #produce {
        vertical-align: bottom;
    }

    #content img[style*="left: 167px"],
    #content img[style*="left: 405px"] {
        vertical-align: top;
        width: calc((100vw - 32px) * 80 / 575) !important;
        height: calc((100vw - 32px) * 30 / 575) !important;
        top: calc((100vw - 32px) * -37 / 575) !important;
    }

    #content img[style*="left: 167px"] {
        left: calc((100vw - 32px) * 167 / 575) !important;
    }

    /* 直前の透明リンク（幅80相当）と空白4px分を差し引く */
    #content img[style*="left: 405px"] {
        left: calc((100vw - 32px) * 409 / 575 - 4px) !important;
    }
}
