/* 官網頂部公告列：右邊「官方 LINE 加好友」＋ ×（2026-10-07 老闆：打開網頁上方要出 LINE，客人可按 × 關掉）
   HTML：partials/wx_top_banner.php；JS：assets/js/wx-banner-countdown.js（公告到期換成只顯示 LINE、按 × 7 天不顯示）
   高度固定 40px（跟原本公告列一樣），有沒有 LINE 都不改高度，開頁不跳動。
   選擇器至少兩個 class，才能蓋過首頁 index.php 內嵌的 .top-banner／.banner-msg 規則。 */

/* 有公告時：LINE 是右邊的白色膠囊＋× */
.top-banner .top-banner__line {
    position: absolute;
    right: 8px;
    top: 6px;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
    z-index: 2;
    letter-spacing: 0;
}

.top-banner .top-banner__line-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px 0 8px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--pos-bg-color, var(--banner-color));
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.top-banner .top-banner__line-icon {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.top-banner .top-banner__line-long {
    display: none;
}

.top-banner .top-banner__line-x {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    font-weight: 400;
    line-height: 26px;
    letter-spacing: 0;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.top-banner .top-banner__line-x:focus-visible,
.top-banner .top-banner__line-add:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

@media (hover: hover) and (pointer: fine) {
    .top-banner .top-banner__line-x:hover {
        background: rgba(255, 255, 255, 0.18);
    }
}

/* 公告文字讓出右邊 LINE 的位置；電腦平板左右對稱留白，文字仍置中 */
.top-banner.top-banner--has-line .banner-msg {
    padding-left: 132px;
    padding-right: 132px;
}

@media (max-width: 767.98px) {
    .top-banner.top-banner--has-line .banner-msg {
        padding-left: 12px;
        padding-right: 128px;
    }
}

/* 沒有公告時：整條只有「加入官方 LINE 好友 @ID」置中，× 在最右邊 */
.top-banner.top-banner--line-only .banner-msg {
    display: none;
}

.top-banner.top-banner--line-only .top-banner__line {
    position: static;
    width: 100%;
    height: 40px;
    justify-content: center;
}

.top-banner.top-banner--line-only .top-banner__line-add {
    min-width: 0;
    max-width: 100%;
    height: 40px;
    padding: 0 34px;
    background: transparent;
    color: #ffffff;
    font-size: 14px;
}

.top-banner.top-banner--line-only .top-banner__line-short {
    display: none;
}

.top-banner.top-banner--line-only .top-banner__line-long {
    display: inline;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 2026-10-21 老闆：@325esidy 的 y 下半截被切掉看起來像 v（行高 1＋超出截斷會切掉字母往下延伸的部分） */
    line-height: 1.4;
}

.top-banner.top-banner--line-only .top-banner__line-x {
    position: absolute;
    right: 8px;
    top: 7px;
}

/* 整條只有 LINE 時連結跟公告列一樣高，焦點外框畫在裡面才不會被切掉 */
.top-banner.top-banner--line-only .top-banner__line-add:focus-visible {
    outline-offset: -3px;
}

@media (max-width: 359.98px) {
    .top-banner.top-banner--line-only .top-banner__line-add {
        padding: 0 30px;
        font-size: 13px;
    }
}

/* 公告倒數（2026-10-08，後台勾「顯示倒數」）：接在公告文字後面；顏色沿用官網原本倒數的淡黃色，數字等寬，每秒更新不會左右晃 */
.top-banner .banner-msg .banner-msg__cd {
    margin-left: 10px;
    color: #fef08a;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    white-space: nowrap;
}

/* 有倒數的公告：空間不夠時先截公告文字（…），倒數永遠完整顯示（320 手機也看得到時間） */
.top-banner .banner-msg.banner-msg--cd {
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-banner .banner-msg.banner-msg--cd[hidden] {
    display: none;
}

.top-banner .banner-msg--cd .banner-msg__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-banner .banner-msg--cd .banner-msg__cd {
    flex: 0 0 auto;
}
