/* ─────────────────────────────────────────────────────────────────
 * BeautsGO Site Popup — Corner banner
 * Non-blocking promo banner. Desktop: slides in from the bottom-left.
 * Mobile: slides up from the bottom. Scroll-triggered, single-version
 * dismissal, collapses into a reopen dot in the bottom-left corner.
 * Namespace: .bgo-popup / .bgo-popup__*
 * ───────────────────────────────────────────────────────────────── */

.bgo-popup,
.bgo-popup * {
    box-sizing: border-box;
}

.bgo-popup[hidden] {
    display: none !important;
}

/* 角落 banner：固定在左下角，不铺满全屏、不锁页面 */
.bgo-popup {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 100000;
    width: 360px;
    max-width: calc(100vw - 48px);
    animation: bgo-banner-in 440ms cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.bgo-popup__card {
    position: relative;
    width: 100%;
    text-align: center;
    background: transparent;          /* 整图模式：透明背景，由图片(PNG)自身定义形状 */
    overflow: visible;                /* 允许金币 / 礼包等装饰元素冲出卡片边框 */
    font-family: Helvetica, Arial, sans-serif;
}

.bgo-popup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;                      /* ≥44px 触控目标，避免误触可点击的图片 */
    height: 44px;
    display: grid;
    place-items: center;              /* × 精确居中 */
    padding: 0;
    border: none;
    background: #fff;
    color: #2b3a4a;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;                       /* 压在图片和轮播控件(箭头/圆点)之上 */
    box-shadow: 0 2px 10px rgba(13, 27, 42, 0.28);
    transition: transform 180ms ease, box-shadow 180ms ease, color 150ms ease;
}

.bgo-popup__close:hover,
.bgo-popup__close:focus-visible {
    color: #d76499;
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 4px 14px rgba(13, 27, 42, 0.32);
    outline: none;
}

.bgo-popup__close:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 100, 149, 0.45), 0 4px 14px rgba(13, 27, 42, 0.32);
}

.bgo-popup__image-link {
    display: block;
    line-height: 0;
    cursor: pointer;
}

.bgo-popup__image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;                 /* 角落 banner：限高，避免竖图过高 */
    object-fit: contain;              /* 完整显示不裁剪 */
    margin: 0;
}

.bgo-popup__title {
    margin: 16px 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    line-height: 1.25;
    color: #1b2a3a;                   /* 深色：白卡/浅色页面上都清晰（原白色会看不见） */
    font-weight: 600;
}

.bgo-popup__body {
    margin: 0 0 16px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
}

.bgo-popup__cta {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    background: #d76499;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    transition: background 150ms ease, transform 150ms ease;
}

.bgo-popup__cta:hover,
.bgo-popup__cta:focus-visible {
    background: #c14e84;
    color: #fff;
    transform: translateY(-1px);
    outline: none;
}

.bgo-popup__cta:focus-visible {
    box-shadow: 0 0 0 3px rgba(215, 100, 153, 0.35);
}

/* ── Carousel（多活动：单 banner 内轮播多张，控件叠在图片上） ──── */
.bgo-popup__track {
    position: relative;               /* 箭头/圆点的定位参照 */
}

.bgo-popup__slide {
    display: none;
}

.bgo-popup__slide.is-active {
    display: block;
}

.bgo-popup__nav {                     /* 左右切换箭头，半透明叠在图片两侧 */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    color: #2b3a4a;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(13, 27, 42, 0.25);
    transition: background 150ms ease, color 150ms ease;
}

.bgo-popup__nav--prev { left: 8px; }
.bgo-popup__nav--next { right: 8px; }

.bgo-popup__nav:hover,
.bgo-popup__nav:focus-visible {
    background: #fff;
    color: #d76499;
    outline: none;
}

.bgo-popup__nav:focus-visible {
    box-shadow: 0 0 0 3px rgba(215, 100, 153, 0.45), 0 2px 8px rgba(13, 27, 42, 0.25);
}

.bgo-popup__dots {                    /* 底部页码指示，无底托 */
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 7px;
    z-index: 2;
}

.bgo-popup__dot {                     /* 非当前页：淡暖灰小点（品牌墨色低透明，cream 上清晰、不刺眼） */
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(44, 36, 32, 0.28);
    cursor: pointer;
    transition: width 200ms ease, background 200ms ease;
}

.bgo-popup__dot.is-active {           /* 当前页：粉色长条 */
    width: 22px;
    background: #d76499;
}

.bgo-popup__dot:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(215, 100, 153, 0.5);
}

/* 轮播 + 图文混排：底部留出圆点的空间，避免圆点压住正文 / CTA。
   纯图片 slide 不加 padding，圆点照常叠在图片下缘。 */
.bgo-popup--carousel .bgo-popup__slide:has(.bgo-popup__title) .bgo-popup__card,
.bgo-popup--carousel .bgo-popup__slide:has(.bgo-popup__body) .bgo-popup__card,
.bgo-popup--carousel .bgo-popup__slide:has(.bgo-popup__cta) .bgo-popup__card {
    padding-bottom: 30px;
}

/* ── Slide-out close（收回左下角，再露出 launcher 小点） ─────────── */
.bgo-popup--closing {
    pointer-events: none;             /* 收起动画期间不再响应点击 */
    animation: bgo-banner-out 360ms cubic-bezier(0.5, 0, 0.75, 0.4) forwards;
}

/* ── Launcher（收起后的重新打开：贴左边缘的竖向"优惠"标签） ───── */
.bgo-popup-launcher {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 9px 14px;
    border: none;
    border-radius: 0 14px 14px 0;     /* 贴左边缘：左侧平、右侧圆角 */
    background: #d76499;
    color: #fff;
    line-height: 1;
    cursor: pointer;
    box-shadow: 3px 2px 14px rgba(13, 27, 42, 0.3);
    animation: bgo-tab-in 320ms cubic-bezier(0.2, 0.85, 0.3, 1);
    transition: transform 160ms ease, background 160ms ease;
}

.bgo-popup-launcher[hidden] {
    display: none !important;
}

.bgo-popup-launcher__icon {
    font-size: 20px;
}

.bgo-popup-launcher__text {
    writing-mode: vertical-rl;        /* 竖排文字，标签更瘦、最不挡内容 */
    text-orientation: mixed;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bgo-popup-launcher:hover,
.bgo-popup-launcher:focus-visible {
    background: #c14e84;
    transform: translate(3px, -50%);  /* 轻微向右探出 */
    outline: none;
}

.bgo-popup-launcher:focus-visible {
    box-shadow: 0 0 0 3px rgba(215, 100, 153, 0.45), 3px 2px 14px rgba(13, 27, 42, 0.3);
}

/* ── Mobile：贴底全宽，从下方滑上来 ─────────────────────────────── */
@media (max-width: 600px) {
    .bgo-popup {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        padding: 12px 12px max(12px, env(safe-area-inset-bottom));
        animation-name: bgo-banner-in-mobile;
    }

    .bgo-popup--closing {
        animation-name: bgo-banner-out-mobile;
    }

    .bgo-popup__card {
        max-width: 440px;
        margin: 0 auto;               /* 贴底但水平居中 */
        padding: 10px;
        background: #FAF6F3;          /* frontpage cream 底：填掉透明区域、和站点同色系，不再"乱" */
        border-radius: 16px;
        overflow: hidden;             /* 圆角裁切，内容收进卡片（文字行会被下方 :has 规则改回可滚动） */
        box-shadow: 0 8px 28px rgba(13, 27, 42, 0.28);
    }

    /* 图文混排（图片+标题+正文+按钮）在矮屏/横屏可能顶出视口，关闭按钮够不到。
       仅在有文字内容时限高 + 内部滚动；纯图片 banner 不受影响，保留装饰外溢 */
    .bgo-popup__card:has(.bgo-popup__title),
    .bgo-popup__card:has(.bgo-popup__body) {
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }

    .bgo-popup__title {
        font-size: 1.25rem;
    }

    .bgo-popup__body {
        font-size: 0.9rem;
    }

    .bgo-popup__image {
        max-height: 60vh;             /* 手机端不盖住整屏 */
    }

    .bgo-popup-launcher {
        padding: 10px 7px 12px;
    }

    .bgo-popup-launcher__icon {
        font-size: 18px;
    }

    .bgo-popup-launcher__text {
        font-size: 12px;
    }

    .bgo-popup__nav {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .bgo-popup__dots {
        bottom: 8px;
    }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bgo-popup,
    .bgo-popup--closing,
    .bgo-popup-launcher {
        animation: none;
    }

    .bgo-popup__cta,
    .bgo-popup__close,
    .bgo-popup__nav,
    .bgo-popup__dot,
    .bgo-popup-launcher {
        transition: none;
    }
}

/* ── Keyframes ──────────────────────────────────────────────────── */
@keyframes bgo-banner-in {           /* 桌面：从左侧滑入左下角 */
    from { transform: translateX(-120%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes bgo-banner-out {          /* 桌面：滑回左侧收起 */
    from { transform: translateX(0);     opacity: 1; }
    to   { transform: translateX(-120%); opacity: 0; }
}

@keyframes bgo-banner-in-mobile {    /* 手机：从下方滑上来 */
    from { transform: translateY(110%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes bgo-banner-out-mobile {   /* 手机：向下滑回收起 */
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(110%); opacity: 0; }
}

@keyframes bgo-tab-in {              /* 标签从左边缘滑入（保持垂直居中） */
    from { transform: translate(-100%, -50%); opacity: 0; }
    to   { transform: translate(0, -50%);     opacity: 1; }
}
