/*========================================*/
/* 全体コンテナ（位置・サイズ指定）
/*========================================*/
.collab-unko__outer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    perspective: 1000px;
    width: min(67vw, 430px);
    /* 画像の比率に合わせて高さを自動確保（裏面画像の864x768の比率を基準に設定） */
    aspect-ratio: 864 / 768;
}

/*========================================*/
/* 3D回転・アニメーション用ラッパー（SPデフォルト）
/*========================================*/
.spin__wrapper {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform, margin-top;
    /* スマホ用の浮遊アニメーションを指定 */
    animation: floating-x-sp 8s ease-in-out 2.1s infinite alternate both,
               floating-y-sp 3.6s ease-in-out 2.1s infinite alternate both;
}

.spin__content {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
    animation: flipAnim 15s ease-in-out infinite; /* くるっと回転 */
}

/*========================================*/
/* カードの表面・裏面
/*========================================*/
.spin__item {
    position: absolute; 
    width: 100%; 
    height: 100%; 
    backface-visibility: hidden;
}

.spin__item img {
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    opacity: 0;
    will-change: opacity, transform;
    animation: intro 0.8s ease-out 0.4s forwards;
}

.spin__item.item-1 {
    transform: rotateY(0deg);
}

.spin__item.item-2 {
    transform: rotateY(180deg);
}
.icon--hello {
    width: clamp(117px, 18vw, 217px);
    position: absolute;
    top: 46%;
    left: -6%;
    opacity: 0;
    animation: ani-hello 7.5s linear infinite;
}
/*========================================*/
/* PCレイアウト（画面幅768px以上）
/*========================================*/
@media (min-width: 768px) {
    .collab-unko__outer {
        bottom: auto;
        top: 80%; /* 必要に応じて調整してください */
        left: 0;
        transform: none; /* スマホのtranslateX(-50%)を完全にクリア */
    }

    .spin__wrapper {
        /* PC用のアニメーションに上書き切り替え */
        animation: floating-x-pc 8s ease-in-out 2.1s infinite alternate both,
                   floating-y-pc 3.6s ease-in-out 2.1s infinite alternate both;
    }
}

/*========================================*/
/* アニメーション（キーフレーム）※すべて外に出す
/*========================================*/

/* 1. くるっと回転（共通） */
@keyframes flipAnim {
    0%, 45% { transform: rotateY(0deg); }
    50%, 95% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

/* 2. 【スマホ用】横揺れ */
@keyframes floating-x-sp {
    0% { transform: translateX(0%); }
    50% { transform: translateX(-25%); }
    100% { transform: translateX(25%); }
}

/* 3. 【スマホ用】縦揺れ（transformの競合を防ぐためmarginを使用） */
@keyframes floating-y-sp {
    0% { margin-top: 0px; }
    100% { margin-top: -20px; }
}

/* 4. 【PC用】横揺れ */
@keyframes floating-x-pc {
    0% { transform: translateX(0); }
    50% { transform: translateX(-20%); }
    100% { transform: translateX(25%); }
}

/* 5. 【PC用】縦揺れ（スマホ同様、transformの競合を防ぐためmarginを使用） */
@keyframes floating-y-pc {
    0% { margin-top: 0px; }
    50% { margin-top: -50px; }
    100% { margin-top: 5px; }
}
@keyframes ani-hello {
    0% {
        opacity: 0;
    }
    35% {
        opacity: 0; /* 最初は透明 */
        transform: scale(0.5);
    }
    36% {
        opacity: 1; /* 中間（2秒時点）で不透明（表示） */
        transform: scale(1.2);
    }
    37% {
        transform: scale(1);
    }
    80% {
        opacity: 1;
        transform: scale(1);
    }
    82% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}
/* アニメーションを減らす設定（アクセシビリティ対応） */
@media (prefers-reduced-motion: reduce) {
    .spin__wrapper, .spin__content {
        animation: none;
    }
}
