/* ===================
   基本設定・全体スタイル
   =================== */
html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    background-color: #E5E5E5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.orientation-guidance {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #E5E5E5;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1199;
    text-align: center;
}

.orientation-guidance img {
    width: 18.875rem;
    height: auto;
    margin-top: 0.625rem;
}

.hidden {
    display: none;
}


/* ================
   ヘッダーのスタイル
   ================ */
.header-bar {
    width: 100%;
    height: 2.1875rem;
    background-color: #333;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
}

.hero-container {
    margin-top: 1.5rem;
    width: fit-content;
}

.header-text {
    position: relative;
    z-index: 1100;
    color: #000;
    text-align: left;
    font-family: "Noto Sans", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: normal;
    margin-bottom: 0.875rem;
}


/* ========================
   ヒーローセクションのスタイル
   ======================== */
.hero {
    position: relative;
    width: 64.5rem;
    height: 30rem;
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: 0.9375rem;
    background: url(img/body/3_mchl_studio_W_side.webp) lightgray 50% / cover no-repeat;
    border-radius: 0.9375rem;
    box-shadow: 4px 4px 8px rgba(102, 102, 102, 0.25);
    transition: background-image 0.5s ease;
}

.hero-icon {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4rem;
    height: 0.625rem;
    background: url('img/icon/view.svg') center/contain no-repeat;
}

.hero-footer {
    position: absolute;
    bottom: 0.375rem;
    right: 1.4375rem;
    color: #000;
    text-align: right;
    font-family: "Noto Sans", sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: normal;
}

/* 共通のボタンスタイル */
.hero .button {
    position: absolute;
    width: 2.8125rem;
    height: 2.8125rem;
    border-radius: 50%;
    background-color: #fff;
    border: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.hero .front-view {
    left: 0.75rem;
    top: 13.0625rem;
    background-image: url('img/icon/viewChange.svg');
}

.hero .open-popup {
    right: 1.4375rem;
    top: 1.0625rem;
    background-image: url('img/icon/zoom-in.svg');
}

.hero .side-view {
    right: 1.4375rem;
    top: 13.0625rem;
    background-image: url('img/icon/viewChange.svg');
    transform: rotate(180deg);
    transform-origin: center;
    display: none;
}


/* ===========================
   サブコンテナ・ボックスのスタイル
   =========================== */
.sub-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    width: 100%;
    height: 8.9375rem;
    gap: 1.5rem;
}

.sub-box {
    height: 100%;
    background: #F2F2F2;
    border-radius: 0.9375rem;
    box-shadow: 4px 4px 8px rgba(102, 102, 102, 0.25);
    position: relative;
}

/* 個別のボックス設定 */
.sub-box:nth-child(1) {
    width: 15rem;
    background: #000;
    background-image: url('img/banner/tire-3.webp');
    background-size: 13.0625rem 6.80338rem;
    background-position: bottom center;
    background-repeat: no-repeat;
}

.sub-box:nth-child(2) {
    width: 31.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    flex-grow: 0;
}

.sub-box:nth-child(3) {
    width: 15rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
}


/* =====================
   タイヤ情報関連のスタイル
   ===================== */
.tire-visual-text {
    position: absolute;
    top: 1.25rem;
    left: 0.62rem;
    color: #FFF;
    font-family: "Noto Sans", sans-serif;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: normal;
}

.tire-type-text {
    position: absolute;
    top: 1.25rem;
    left: 0.62rem;
    color: #000;
    font-family: "Noto Sans", sans-serif;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: normal;
}

.tire-info {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.tire-info img {
    position: absolute;
    top: 0.87rem;
    left: 5.62rem;
    width: auto;
    height: 1.6875rem;
    max-width: 100%;
}

.tire-caption {
    position: absolute;
    top: 7.37rem;
    left: 1.37rem;
    width: 28.8125rem;
    height: 1.1875rem;
    background-image: url('img/annotation/caption.svg');
    background-size: auto;
    background-repeat: no-repeat;
}


/* =============================
   タイヤ切り替えボタン関連のスタイル
   ============================= */
.circle-button-container {
    display: inline-flex;
    align-items: center;
    gap: 1.5625rem;
    position: absolute;
    top: 3.75rem;
    left: 0;
    width: 100%;
    justify-content: center;
}

.circle-button {
    width: 2.8125rem;
    height: 2.8125rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: #F2F2F2;
    font-family: "Noto Sans", sans-serif;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    transition: background-color 0.3s ease;
}

.circle-button.selected {
    position: relative;
    background-color: #DC2526;
    color: #fff;
}

.circle-button.selected::after,
.sub-box:nth-child(3) .body-color.selected::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3.3438rem;
    height: 3.3438rem;
    border-radius: 50%;
    border: 0.1875rem solid #27509B;
    z-index: 1;
}

/* サブボックス2内の特定ボタンスタイル */
.sub-box:nth-child(2) .circle-button:nth-child(-n+3) {
    background-color: #DC2526;
    color: #fff;
}

.sub-box:nth-child(2) .circle-button:nth-child(4) {
    background-color: #737477;
    color: #fff;
}

.sub-box:nth-child(2) .circle-button:nth-child(5) {
    background-color: #D1D2D4;
    color: #1A1A1A;
}

/* ボタン5を押したときの固有スタイル */
.special-tire-style {
    background-size: auto 3.375rem !important;
    background-position: 0.625rem 3.75rem !important;
    background-repeat: no-repeat !important;
}


/* ================================
   ボディーカラー選択ボタン関連のスタイル
   ================================ */
.color-text {
    position: absolute;
    top: 1.25rem;
    left: 0.62rem;
    color: #000;
    font-family: "Noto Sans", sans-serif;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: normal;
}

.color-name {
    position: absolute;
    top: 0.85rem;
    left: 4rem;
    color: #000;
    font-family: "Noto Sans", sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: normal;
}

.color-button-container {
    display: inline-flex;
    align-items: center;
    gap: 1.38rem;
    position: absolute;
    top: 3.75rem;
    left: 0;
    width: 100%;
    justify-content: center;
}

.sub-box:nth-child(3) .body-color {
    width: 2.8125rem;
    height: 2.8125rem;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.sub-box:nth-child(3) .body-color:first-child {
    background-color: #fff;
    border: 1px solid #000;
}

.sub-box:nth-child(3) .body-color:last-child {
    background-color: #000;
    border: none;
}


/* ===================
   モーダル関連のスタイル
   =================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(229, 229, 229, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.modal-content {
    top: 2.3125rem;
    background: #fff;
    border-radius: 0.9375rem;
    position: relative;
    width: 53.4375rem;
    height: 37.5625rem;
    transition: transform 0.3s ease;
    box-shadow: 4px 4px 8px rgba(102, 102, 102, 0.25);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-button {
    position: absolute;
    top: 0.75rem;
    right: 1.125rem;
    width: 2.8125rem;
    height: 2.8125rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-image: url(img/icon/zoom-out.svg);
    background-size: contain;
    z-index: 1000;
}


/* ===========================
   画像比較コンポーネントのスタイル
   =========================== */
.image-comparison {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0.9375rem;
}

.image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0.9375rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.before-image,
.after-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.before-image {
    z-index: 1;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0.0625rem;
    background: #fff;
    transform: translateX(-50%);
    z-index: 2;
    cursor: ew-resize;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.8125rem;
    height: 2.8125rem;
    border: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background-size: contain;
    background-image: url(img/icon/move.svg);
}

.popup-footer {
    position: absolute;
    bottom: 0.5rem;
    right: 1.625rem;
    color: #000;
    text-align: right;
    font-family: "Noto Sans", sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: normal;
    z-index: 1000;
}



/* =========================================================
レスポンシブデザイン対応
===================== */
@media (max-width: 500px) {
    body {
        min-height: 100svh;
    }


    /* =============
    ヘッダーのスタイル
    ================ */
    .header-text {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
    }


    /* =====================
    ヒーローセクションのスタイル
    ======================== */
    .hero {
        width: 20.5rem;
        height: 17.6875rem;
        margin-bottom: 0.875rem;
        background: url(img/M-body/3_mchl_studio_W_side-M.webp);
        background-size: cover;
    }

    .hero-icon {
        top: 0.75rem;
    }

    .hero-footer {
        bottom: 0.38rem;
        right: 0.56rem;
        font-size: 0.625rem;
    }

    /* 共通のボタンスタイル */
    .hero .button {
        width: 2.1875rem;
        height: 2.1875rem;
    }

    .hero .front-view {
        left: 0.38rem;
        top: 7.75rem;
    }

    .hero .open-popup {
        right: 0.56rem;
        top: 0.75rem;
    }

    .hero .side-view {
        right: 0.56rem;
        top: 7.75rem;
    }


    /* ========================
    サブコンテナ・ボックスのスタイル
    =========================== */
    .sub-container {
        display: grid;
        grid-template-areas: "box2 box2" "box1 box3";
        grid-template-columns: 1fr 1fr;
        gap: 0.875rem;
        width: 20.5rem;
        height: auto;
    }

    /* 個別のボックス設定 */
    .sub-box:nth-child(1) {
        grid-area: box1;
        width: 9.75rem;
        height: 7rem;
        background-size: 9.75rem 4.8125rem;
    }

    .sub-box:nth-child(2) {
        grid-area: box2;
        width: 100%;
        height: 8.5625rem;
    }

    .sub-box:nth-child(3) {
        grid-area: box3;
        width: 9.75rem;
        height: 7rem;
    }

    /* ==================
    タイヤ情報関連のスタイル
    ===================== */
    .tire-visual-text {
        top: 0.31rem;
        font-size: 0.6875rem;
    }

    .tire-type-text {
        top: 0.31rem;
        font-size: 0.625rem;
    }


    .tire-info img {
        top: 1.19rem;
        left: 0.625rem;
        width: auto;
        height: 1.375rem;
    }

    .tire-caption {
        top: 6.88rem;
        left: 3.75rem;
        width: 12.875rem;
        height: 1.25rem;
        background-image: url('img/annotation/caption-M.svg');
    }


    /* ==========================
    タイヤ切り替えボタン関連のスタイル
    ============================ */
    .circle-button-container {
        gap: 1.12rem;
        top: 3.38rem;
    }

    /* ボタン5を押したときの固有スタイル */
    .special-tire-style {
        background-size: auto 2.35rem !important;
        background-position: 0.625rem 3.25rem !important;
        background-repeat: no-repeat !important;
    }


    /* =============================
    ボディーカラー選択ボタン関連のスタイル
    ================================ */
    .color-text {
        top: 0.31rem;
        font-size: 0.625rem;
    }

    .color-name {
        top: 1.25rem;
        left: 0.63rem;
        font-size: 0.9375rem;
    }

    .color-button-container {
        top: 3.25rem;
    }

    /* ====================
        モーダル関連のスタイル
        =================== */
    .modal-overlay {
        display: none !important;
    }

}

@media (max-height: 500px) {

    /* =================
    ヘッダーのスタイル
    ================ */
    .header-bar {
        z-index: 990;
    }

    .header-text {
        z-index: 990;
    }

    /* ====================
        モーダル関連のスタイル
        =================== */
    .modal-overlay {
        background: rgba(229, 229, 229, 1);
    }

    .modal-content {
        top: 0;
        border-radius: 0rem;
        box-shadow: 0px 0px 0px rgba(102, 102, 102, 0.25);
        height: 100%;
        max-height: 100%;
        width: auto;
        max-width: 100%;
        aspect-ratio: 855 / 601;
    }

    .close-button {
        top: 0.9375rem;
        right: 0.3125rem;
    }

    /* ========================
    画像比較コンポーネントのスタイル
    =========================== */
    .image-comparison {
        border-radius: 0rem;
    }

    .image-wrapper {
        border-radius: 0rem;
    }

    .popup-footer {
        bottom: 0.625rem;
        right: 0.3125rem;
        font-size: 0.625rem;
    }

}