/*
 * Swiper Slider — 前台樣式（單張 banner 輪播 .custom-hero-swiper）
 * 來源：k:/editor_components/css/style.css 的 hero-swiper 區塊（已自包含，不依賴外部 style.css）
 * 編輯器內預覽（contentsCss）與 poster.php 共用同一份。
 * 大標 / 小標順序依專案需求調整為「大標在上、小標在下」。
 */

/* ---------- 外殼 ---------- */
.custom-hero-swiper {
    position: relative;
    margin-bottom: 48px;
}

.custom-hero-swiper .hero-swiper {
    overflow: hidden;
    border-radius: 15px;
}

/* 確保每張 slide 不被 flex 壓縮成 0 寬（避免被其他 CSS 蓋掉 Swiper 預設的 flex-shrink:0，
   導致 Swiper 只算到第一張、第二張寬度 0 而無法切換）。!important 保證勝出。 */
.custom-hero-swiper .swiper-wrapper > .swiper-slide {
    flex-shrink: 0 !important;
    width: 100% !important;
}


.custom-hero-swiper .hero-banner {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 440px;
    overflow: hidden;
    background: #e9e7e1;
}

.custom-hero-swiper .hero-banner__media {
    position: absolute;
    z-index: 0;
    /* 比 slide 寬一些（左右各多 18%），讓 parallax 平移時不會露出邊緣 */
    top: 0;
    bottom: 0;
    left: -18%;
    width: 136%;
}

.custom-hero-swiper .hero-banner__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 由左往右的暗色漸層（預設 left 對齊），讓白字在任何圖上都讀得清楚 */
.custom-hero-swiper .hero-banner__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(17, 19, 21, 0.78) 0%, rgba(17, 19, 21, 0.5) 42%, rgba(17, 19, 21, 0.05) 100%);
}

.custom-hero-swiper .hero-banner__inner {
    position: relative;
    z-index: 1;
    max-width: 560px;
    padding: 48px 56px 56px;
    color: #ffffff;
}

/* 大標在上 */
.custom-hero-swiper .hero-banner__title {
    color: #ffffff;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    margin: 0 0 12px;
}

/* 小標（副標）在大標下方 */
.custom-hero-swiper .hero-banner__eyebrow {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 18px;
    color: var(--main-color-1, #03aed2);
}

.custom-hero-swiper .hero-banner__desc {
    font-size: 0.98rem;
    line-height: 1.8;
    margin: 0 0 28px;
    color: rgba(255, 255, 255, 0.86);
}

.custom-hero-swiper .hero-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

/* ---------- 按鈕 ---------- */
.custom-hero-swiper .hero-banner__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
    transition:
        color 0.25s ease,
        background-color 0.3s ease,
        border-color 0.25s ease,
        transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.custom-hero-swiper .hero-banner__btn--primary {
    background: var(--main-color-1, #03aed2);
    border-color: var(--main-color-1, #03aed2);
    color: #ffffff;
}
.custom-hero-swiper .hero-banner__btn--primary:hover {
    transform: translateY(-2px);
    background: var(--main-color-3, #2bc4e0);
    border-color: var(--main-color-3, #2bc4e0);
}

.custom-hero-swiper .hero-banner__btn--ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.6);
    color: #ffffff;
}
.custom-hero-swiper .hero-banner__btn--ghost:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: #111315;
}

/* 自訂背景色按鈕（使用者選色）：背景/邊框由 inline style 指定、文字強制白色，
   hover 僅微浮起不改色，避免蓋掉使用者選的背景 */
.custom-hero-swiper .hero-banner__btn--custom {
    color: #ffffff;
}
.custom-hero-swiper .hero-banner__btn--custom:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.custom-hero-swiper .hero-banner__btn:focus-visible {
    outline: 2px solid var(--main-color-1, #03aed2);
    outline-offset: 3px;
}

/* ---------- 導覽箭頭（深色版：圖片上）---------- */
.custom-hero-swiper .hero-swiper__btn {
    position: relative;
    width: 46px;
    height: 46px;
    flex: none;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    cursor: pointer;
    background: rgba(17, 19, 21, 0.28);
    backdrop-filter: blur(2px);
    color: #ffffff;
    transition:
        border-color 0.25s ease,
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}

.custom-hero-swiper .hero-swiper__btn::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 22px;
    height: 11px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2026%2012'%20fill='none'%20stroke='%23000'%20stroke-width='1.4'%20stroke-linecap='square'%3E%3Cpath%20d='M0%206%20H23%20M18%201%20L24%206%20L18%2011'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2026%2012'%20fill='none'%20stroke='%23000'%20stroke-width='1.4'%20stroke-linecap='square'%3E%3Cpath%20d='M0%206%20H23%20M18%201%20L24%206%20L18%2011'/%3E%3C/svg%3E") no-repeat center / contain;
}

.custom-hero-swiper .hero-swiper__btn--prev::after {
    transform: scaleX(-1);
}

.custom-hero-swiper .hero-swiper__btn:hover {
    border-color: var(--main-color-1, #03aed2);
    background: var(--main-color-1, #03aed2);
    color: #ffffff;
    transform: translateY(-2px);
}

.custom-hero-swiper .hero-swiper__btn:focus-visible {
    outline: 2px solid var(--main-color-1, #03aed2);
    outline-offset: 3px;
}

.custom-hero-swiper .hero-swiper__btn.swiper-button-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ---------- 控制列：箭頭 + 分頁點集中在 banner 右下角，避開左側文字（預設 left）---------- */
.custom-hero-swiper .hero-swiper__nav {
    position: absolute;
    z-index: 2;
    right: 56px;
    bottom: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* 分頁點 */
.custom-hero-swiper .hero-swiper__pagination.swiper-pagination-bullets {
    position: static;
    inset: auto;
    transform: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    margin-right: 4px;
}

.custom-hero-swiper .hero-swiper__pagination.swiper-pagination-bullets .swiper-pagination-bullet {
    width: 11px;
    height: 11px;
    margin: 0 !important;
    background: transparent;
    border: 1px solid #ffffff;
    opacity: 1;
    border-radius: 50%;
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease;
}

.custom-hero-swiper .hero-swiper__pagination.swiper-pagination-bullets .swiper-pagination-bullet-active {
    background: #ffffff;
    border-color: #ffffff;
}

/* ---------- 內容對齊（data-align：left（預設）/ center / right）----------
   控制列會移到與文字相反的一側，避免壓到內容 */

/* 置中：文字與按鈕置中、上下置中，控制列移到底部正中 */
.custom-hero-swiper[data-align="center"] .hero-banner {
    justify-content: center;
    align-items: center;
}

.custom-hero-swiper[data-align="center"] .hero-banner__media::after {
    background: linear-gradient(180deg, rgba(17, 19, 21, 0.2) 0%, rgba(17, 19, 21, 0.55) 100%);
}

.custom-hero-swiper[data-align="center"] .hero-banner__inner {
    text-align: center;
    padding-top: 56px;
    padding-bottom: 56px;
}

.custom-hero-swiper[data-align="center"] .hero-banner__actions {
    justify-content: center;
}

/* 置中版控制列：nav 撐滿整個 banner，箭頭垂直置中固定在左右兩側、分頁點置中於底部 */
.custom-hero-swiper[data-align="center"] .hero-swiper__nav {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
}

.custom-hero-swiper[data-align="center"] .hero-swiper__btn,
.custom-hero-swiper[data-align="center"] .hero-swiper__pagination.swiper-pagination-bullets {
    pointer-events: auto;
}

.custom-hero-swiper[data-align="center"] .hero-swiper__btn--prev,
.custom-hero-swiper[data-align="center"] .hero-swiper__btn--next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.custom-hero-swiper[data-align="center"] .hero-swiper__btn--prev {
    left: 24px;
}

.custom-hero-swiper[data-align="center"] .hero-swiper__btn--next {
    right: 24px;
}

.custom-hero-swiper[data-align="center"] .hero-swiper__pagination.swiper-pagination-bullets {
    transform: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 28px;
    margin-right: 0;
    justify-content: center;
}

/* 靠右：文字與按鈕靠右、漸層鏡像，控制列移到左下角 */
.custom-hero-swiper[data-align="right"] .hero-banner {
    justify-content: flex-end;
}

.custom-hero-swiper[data-align="right"] .hero-banner__media::after {
    background: linear-gradient(270deg, rgba(17, 19, 21, 0.78) 0%, rgba(17, 19, 21, 0.5) 42%, rgba(17, 19, 21, 0.05) 100%);
}

.custom-hero-swiper[data-align="right"] .hero-banner__inner {
    text-align: right;
}

.custom-hero-swiper[data-align="right"] .hero-banner__actions {
    justify-content: flex-end;
}

.custom-hero-swiper[data-align="right"] .hero-swiper__nav {
    right: auto;
    left: 56px;
}

/* ---------- 進場動畫 ---------- */
@keyframes hero-rise {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-hero-swiper .hero-banner__eyebrow,
.custom-hero-swiper .hero-banner__title,
.custom-hero-swiper .hero-banner__desc,
.custom-hero-swiper .hero-banner__actions {
    opacity: 0;
}

.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__eyebrow,
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__title,
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__desc,
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__actions {
    animation: hero-rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* 大標在上→先動，小標其次 */
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__title { animation-delay: 0.1s; }
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__eyebrow { animation-delay: 0.22s; }
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__desc { animation-delay: 0.34s; }
.custom-hero-swiper.is-inview .swiper-slide-active .hero-banner__actions { animation-delay: 0.46s; }

@media (prefers-reduced-motion: reduce) {
    .custom-hero-swiper .hero-banner__eyebrow,
    .custom-hero-swiper .hero-banner__title,
    .custom-hero-swiper .hero-banner__desc,
    .custom-hero-swiper .hero-banner__actions {
        opacity: 1;
        animation: none !important;
    }
}

/* ---------- 手機版（max-width:767）---------- */
@media (max-width: 767px) {
    .custom-hero-swiper .hero-banner {
        min-height: 380px;
    }

    .custom-hero-swiper .hero-banner__media::after {
        background: linear-gradient(0deg, rgba(17, 19, 21, 0.82) 0%, rgba(17, 19, 21, 0.4) 60%, rgba(17, 19, 21, 0.15) 100%);
    }

    .custom-hero-swiper .hero-banner__inner {
        padding: 32px 24px 40px;
        max-width: 100%;
    }

    /* nav 移到 banner 下方一列置中（紙底，淺色箭頭） */
    .custom-hero-swiper .hero-swiper__nav {
        position: static;
        justify-content: center;
        gap: 14px;
        margin-top: 18px;
    }

    .custom-hero-swiper[data-align="center"] .hero-swiper__nav {
        pointer-events: auto;
        inset: auto;
        position: static;
    }

    .custom-hero-swiper[data-align="center"] .hero-swiper__btn--prev,
    .custom-hero-swiper[data-align="center"] .hero-swiper__btn--next {
        position: relative;
        transform: none;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        margin: 0;
    }

    .custom-hero-swiper[data-align="center"] .hero-swiper__pagination.swiper-pagination-bullets {
        transform: none;
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        margin: 0;
    }

    /* 排序：上一張 → 分頁點 → 下一張 */
    .custom-hero-swiper[data-align="center"] .hero-swiper__btn--prev { order: 0; }
    .custom-hero-swiper[data-align="center"] .hero-swiper__pagination.swiper-pagination-bullets {
        transform: none;
        order: 1;
        flex: 0 0 auto;
        width: auto;
    }
    .custom-hero-swiper[data-align="center"] .hero-swiper__btn--next { order: 2; }

    /* 右對齊手機版 nav 也回到下方置中 */
    .custom-hero-swiper[data-align="right"] .hero-swiper__nav {
        left: auto;
    }

    /* 手機版 nav 改用淺色版（透明底 + 墨色描邊/箭頭） */
    .custom-hero-swiper .hero-swiper__btn {
        width: 40px;
        height: 40px;
        background: transparent;
        border-color: #d6d8db;
        backdrop-filter: none;
        color: #111315;
    }

    .custom-hero-swiper .hero-swiper__pagination.swiper-pagination-bullets .swiper-pagination-bullet {
        border-color: #111315;
    }

    .custom-hero-swiper .hero-swiper__pagination.swiper-pagination-bullets .swiper-pagination-bullet-active {
        background: #111315;
        border-color: #111315;
    }
}

/* ---------- 編輯器內靜態預覽 fallback ----------
   僅「編輯器內」（.cke_editable 但非 .cke-preview）不跑 Swiper JS，
   只顯示第一張、其餘隱藏、文字直接顯示。
   ★ 必須排除 .cke-preview：NewPreview 預覽視窗的 body 同時帶 cke_editable 與 cke-preview，
     若不排除，這條會把預覽裡的第 2 張以後 slide 隱藏，導致 Swiper 算不到、箭頭/頁碼失效。 */
.cke_editable:not(.cke-preview) .custom-hero-swiper .swiper-slide:not(:first-child) {
    display: none;
}
.cke_editable:not(.cke-preview) .custom-hero-swiper .hero-banner__eyebrow,
.cke_editable:not(.cke-preview) .custom-hero-swiper .hero-banner__title,
.cke_editable:not(.cke-preview) .custom-hero-swiper .hero-banner__desc,
.cke_editable:not(.cke-preview) .custom-hero-swiper .hero-banner__actions {
    opacity: 1;
}
.cke_editable:not(.cke-preview) .custom-hero-swiper .hero-banner__media {
    left: 0;
    width: 100%;
}
