/* ================================================
フローティングバナー（AIチャットボット）
================================================ */

/* 描画前にheadのインラインスクリプトが付与するクラスで即非表示にする */
.js-banner-closed .floating-banner {
    display: none !important;
}

/* --------------------------------------------------
PC基準（デフォルト）
左右アニメーション・右下固定
チャットボットウィジェット: position:fixed; bottom:3%; height:60px の上に配置
-------------------------------------------------- */

@keyframes banner-float-pc {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-8px);
    }
}

@keyframes banner-float-sp {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* 画像ロード前は非表示→ロード完了で is-loaded クラス付与してフェードイン */
.floating-banner {
    position: fixed;
    z-index: 9000;
    right: 0;
    bottom: calc(3% + 70px);
    animation: banner-float-pc 3s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-banner.is-loaded {
    opacity: 1;
}

/* サイズ・位置はチャットボットウィジェットの閉じるボタンに合わせる
   right: 6px にして viewport右端からのはみ出しを防ぐ */
.floating-banner__close {
    position: absolute;
    top: -6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--color-main);
    border: 2px solid #fff;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 0;
    line-height: 1;
    transition: background-color 0.2s;
}

.floating-banner__close:hover {
    background-color: var(--color-sub);
}

.floating-banner__close svg {
    display: block;
    flex-shrink: 0;
}

.floating-banner__picture {
    display: block;

    img {
        display: block;
        width: auto;
        height: auto;
        max-width: 290px;
        max-height: max(200px, calc(100vh - 190px));
    }
}

/* --------------------------------------------------
SP（width < 800px）
上下アニメーション・幅274px（チャットボットバナー同幅）
-------------------------------------------------- */

@media (width < 800px) {
    .floating-banner {
        right: 0;
        bottom: calc(3% + 70px);
        animation: banner-float-sp 3s ease-in-out infinite;
    }

    .floating-banner__picture img {
        max-width: 300px;
        max-height: max(250px, calc(100vh - 160px));
    }
}