/* ==============================
   AfterEnd スマートフォン表示用の補正

   スマートフォンでもPC版に近い全体表示を維持するため、
   viewportはブラウザ標準のデスクトップ幅を使用する。
   ここではレイアウト全体を組み替えず、はみ出し・文字切れだけを直す。
============================== */

/*
   viewportメタタグを設定していないスマートフォンでは、
   ブラウザのレイアウト幅がおおむね980pxになる。
   PCの狭いウィンドウにも適用されるが、全体構成は変更しない。
*/
@media (max-width: 1000px) {
    /* Flex/Grid配下の要素が内容幅に引っ張られて横へ飛び出すのを防ぐ。 */
    .main-content,
    .main-content section,
    .main-content article,
    .main-content form,
    .main-content div {
        min-width: 0;
    }

    /* ------------------------------
       チャット投稿フォーム
       PC版の見た目を維持したまま、800px固定幅だけ解除する。
    ------------------------------ */
    .chat-compose-box,
    .chat-compose-form,
    .chat-compose__content,
    .chat-compose__control-row,
    .chat-compose__body-area,
    .chat-compose__bottom-row {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .chat-compose__main {
        grid-template-columns: 60px minmax(0, 1fr);
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .chat-compose__body-area textarea {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .chat-compose__control-row {
        flex-wrap: wrap;
    }

    .chat-compose__control-group {
        max-width: 100%;
    }

    .chat-compose__secret-recipient {
        margin-left: 0;
    }

    /* ------------------------------
       ホーム現在地カード
       906×198画像の比率に枠を合わせ、文字とボタンは画像内に重ねる。
    ------------------------------ */
    .home-location-card {
        width: 100%;
        height: auto;
        min-height: 0;
        aspect-ratio: 906 / 198;
        box-sizing: border-box;
        overflow: hidden;
        background-size: cover;
        background-position: center;
    }

    .home-location-card__overlay {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 0;
        box-sizing: border-box;
        padding: 12px;
    }

    .home-location-card__title {
        position: static;
        font-size: 22px;
        line-height: 1.15;
    }

    .home-location-card__description {
        position: absolute;
        left: 12px;
        right: 190px;
        bottom: 12px;
        margin: 0;
        font-size: 12px;
        line-height: 1.25;
        white-space: normal;
        overflow: visible;
        overflow-wrap: break-word;
    }

    .home-location-card__actions {
        position: absolute;
        right: 12px;
        bottom: 12px;
        left: auto;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        margin: 0;
        z-index: 3;
        visibility: visible;
        opacity: 1;
    }

    .home-location-card__explore-form {
        width: auto;
        margin: 0;
    }

    .home-location-card__link {
        width: auto;
        max-width: none;
        padding: 5px 8px;
        font-size: 12px;
        white-space: nowrap;
        visibility: visible;
        opacity: 1;
    }

    /* ------------------------------
       移動画面のエリアプレビュー
       横長デザインを保ったまま、説明全文を収める高さを確保する。
    ------------------------------ */
    .area-preview-panel {
        aspect-ratio: auto;
        min-height: 190px;
        background-size: cover;
    }

    .area-preview-panel h2,
    .area-preview-panel h3,
    .area-preview-panel__title {
        top: 14px;
        left: 20px;
        right: 20px;
        font-size: 24px;
    }

    .area-preview-panel p,
    .area-preview-panel__description {
        left: 20px;
        right: 20px;
        bottom: 16px;
        max-height: none;
        font-size: 15px;
        line-height: 1.4;
        white-space: pre-wrap;
        overflow: visible;
        overflow-wrap: break-word;
    }

    /* 入力欄共通の最終安全策。ページ幅以上には広げない。 */
    .main-content input,
    .main-content select,
    .main-content textarea {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ==============================
   iPhone Chrome / Safari：
   現在地カードの自動文字拡大を防止
============================== */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 1000px) {
        .home-location-card,
        .home-location-card * {
            -webkit-text-size-adjust: none;
            text-size-adjust: none;
        }

        .home-location-card__title {
            font-size: 22px !important;
            line-height: 1.15 !important;
        }

        .home-location-card__description {
            font-size: 12px !important;
            line-height: 1.25 !important;
        }

        .home-location-card__link,
        .home-location-card__actions button {
            font-size: 12px !important;
            line-height: 1.2 !important;
        }
    }
}