/* ==========================================
   リセット
========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* ==========================================
   ページ全体
========================================== */

body {

    background-color: #0b1d4d;

    overflow-x: hidden;
}


/*
 * モーダル表示中、
 * 背景ページをスクロールさせません。
 */
body.modal-open {

    overflow: hidden;
}


/* ==========================================
   タイトル
========================================== */

.page-title {

    margin-top: 80px;

    margin-bottom: 80px;

    text-align: center;

    color: white;

    font-size: 4vw;

    font-weight: bold;
}


/* ==========================================
   ステッカー一覧
========================================== */

.sticker-grid {

    width: 90%;

    margin:
        0
        auto
        120px
        auto;

    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    gap: 30px;
}


/* ==========================================
   ステッカーカード
========================================== */

.sticker-card {

    position: relative;

    aspect-ratio: 1 / 1;

    background: white;

    overflow: hidden;

    cursor: pointer;

    border-radius: 20px;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}


.sticker-card:hover {

    transform:
        translateY(-6px);

    box-shadow:
        0 12px 30px
        rgba(
            0,
            0,
            0,
            0.25
        );
}


/* ==========================================
   ステッカー画像
========================================== */

.sticker-image {

    width: 100%;

    height: 100%;

    object-fit: contain;

    display: block;
}


/* ==========================================
   PC hover用オーバーレイ
========================================== */

.sticker-overlay {

    position: absolute;

    inset: 0;

    background:
        rgba(
            0,
            0,
            0,
            0
        );

    opacity: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    transition:
        opacity 0.3s ease,
        background 0.3s ease;

    pointer-events: none;
}


.sticker-card:hover
.sticker-overlay {

    opacity: 1;

    background:
        rgba(
            0,
            0,
            0,
            0.35
        );
}


/* ==========================================
   都道府県名
========================================== */

.sticker-overlay p {

    color: white;

    font-size: 2vw;

    font-weight: bold;

    text-align: center;
}


/* ==========================================
   モーダル背景
========================================== */

.modal {

    position: fixed;

    inset: 0;

    background:
        rgba(
            0,
            0,
            0,
            0
        );

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 9999;

    transition:
        opacity 0.4s ease,
        background 0.4s ease,
        visibility 0.4s ease;
}


.modal.show {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    background:
        rgba(
            0,
            0,
            0,
            0.75
        );
}


/* ==========================================
   モーダル本体
========================================== */

.modal-content {

    width: 70vmin;

    aspect-ratio: 1 / 1;

    background: white;

    border-radius: 24px;

    position: relative;

    overflow: visible;

    transform:
        translateY(30px)
        scale(0.95);

    opacity: 0;

    transition:
        transform 0.45s ease,
        opacity 0.45s ease;
}


.modal.show
.modal-content {

    transform:
        translateY(0)
        scale(1);

    opacity: 1;
}


/* ==========================================
   閉じるボタン
========================================== */

.close-button {

    position: absolute;

    top: -20px;

    right: -20px;

    width: 72px;

    height: 72px;

    border: none;

    border-radius: 50%;

    background: #10204a;

    color: white;

    font-size: 36px;

    font-weight: bold;

    display: flex;

    justify-content: center;

    align-items: center;

    cursor: pointer;

    z-index: 100;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
}


.close-button:hover {

    transform:
        scale(1.1);

    background: #1c3479;
}


.close-button:active {

    transform:
        scale(0.95);
}


/* ==========================================
   カード反転
========================================== */

.flip-card {

    width: 100%;

    height: 100%;

    perspective: 1500px;

    cursor: pointer;
}


.flip-card-inner {

    width: 100%;

    height: 100%;

    position: relative;

    transform-style:
        preserve-3d;

    transition:
        transform
        0.8s
        ease;
}


.flip-card-inner.flipped {

    transform:
        rotateY(180deg);
}


/* ==========================================
   表面・裏面
========================================== */

.flip-front,
.flip-back {

    position: absolute;

    inset: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    backface-visibility: hidden;

    -webkit-backface-visibility: hidden;
}


.flip-back {

    transform:
        rotateY(180deg);
}


/* ==========================================
   モーダル内画像
========================================== */

.flip-front img,
.flip-back img {

    width: 90%;

    height: 90%;

    object-fit: contain;

    display: block;
}


/* ==========================================
   タブレット
========================================== */

@media screen and (max-width: 1200px) {

    .sticker-grid {

        grid-template-columns:
            repeat(4, 1fr);
    }

}


@media screen and (max-width: 900px) {

    .sticker-grid {

        grid-template-columns:
            repeat(3, 1fr);
    }


    .sticker-overlay p {

        font-size: 4vw;
    }

}


/* =========================================================
   スマホ版
========================================================= */

@media screen and (max-width: 768px) {


    /* ==========================================
       タイトル
    ========================================== */

    .page-title {

        width: 85%;

        margin:
            90px
            auto
            50px;

        font-size: 8vw;

        line-height: 1.4;
    }


    /* ==========================================
       ステッカー一覧
       2列
    ========================================== */

    .sticker-grid {

        width: 92%;

        margin:
            0
            auto
            80px;

        grid-template-columns:
            repeat(2, 1fr);

        gap: 14px;
    }


    /* ==========================================
       カード
    ========================================== */

    .sticker-card {

        border-radius: 14px;
    }


    /*
     * スマホではhoverによる
     * 上方向への移動を無効化します。
     */
    .sticker-card:hover {

        transform: none;

        box-shadow: none;
    }


    /*
     * スマホではhoverオーバーレイを
     * 表示しません。
     *
     * カードをタップすると
     * 直接モーダルを開きます。
     */
    .sticker-overlay {

        display: none;
    }


    /* ==========================================
       モーダル
    ========================================== */

    .modal {

        padding:
            0
            5%;
    }


    .modal-content {

        /*
         * スマホ画面に収まる
         * 正方形にします。
         */
        width: 88vw;

        max-width: 520px;

        aspect-ratio: 1 / 1;

        border-radius: 18px;
    }


    /* ==========================================
       閉じるボタン
    ========================================== */

    .close-button {

        /*
         * スマホでも押しやすい
         * サイズを確保します。
         */
        width: 54px;

        height: 54px;

        top: -18px;

        right: -8px;

        font-size: 30px;
    }


    /* ==========================================
       モーダル画像
    ========================================== */

    .flip-front img,
    .flip-back img {

        width: 92%;

        height: 92%;
    }

}


/* =========================================================
   小さいスマホ
========================================================= */

@media screen and (max-width: 480px) {

    .page-title {

        font-size: 9vw;
    }


    .sticker-grid {

        gap: 10px;
    }


    .modal-content {

        width: 90vw;
    }


    .close-button {

        width: 50px;

        height: 50px;

        font-size: 28px;
    }

}