/* =========================================================
   thefun.com.tw － 首頁輪播（取代 Header Image Slider）
   放置位置：wp-content/themes/crreb/thefun-slider.css
   只在首頁載入（由 functions.php 控制）

   結構：
     .tf-slider              外框
       .tf-slider__track     圖片區（高度由第一張圖撐開）
         .tf-slide           每一張圖
       .tf-slider__arrow     左右箭頭（JS 產生）
       .tf-slider__dots      下方圓點（JS 產生）
   ========================================================= */

#content .tf-slider {
    position: relative;
    width: 100%;
    margin: 0 0 10px;
    overflow: hidden;
    background: #f2f2f2;
    border-radius: 3px;
    -webkit-user-select: none;
    user-select: none;
}

#content .tf-slider__track {
    position: relative;
}

/* ---------- 每一張圖 ---------- */
/* 第一張用一般排版撐出高度，其餘疊在它上面 */
#content .tf-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
    transition-property: opacity;
    transition-timing-function: ease;
    transition-duration: 800ms; /* 實際值由 JS 依設定覆蓋 */
}
#content .tf-slide:first-child {
    position: relative;
    height: auto;
}

/* 目前顯示的那張：疊在最上層並淡入 */
#content .tf-slide.is-active {
    opacity: 1;
    z-index: 3;
}
/* 上一張：在新圖淡入期間保持不透明墊在下面，避免中途露出灰底 */
#content .tf-slide.is-prev {
    opacity: 1;
    z-index: 2;
    transition: none;
}

#content .tf-slider .tf-slide img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}
#content .tf-slider .tf-slide:not(:first-child) img {
    height: 100%;
    object-fit: cover;
}

/* ---------- 左右箭頭 ---------- */
#content .tf-slider__arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    cursor: pointer;
    opacity: .85;
    transition: opacity .2s, background-color .2s;
    -webkit-appearance: none;
    appearance: none;
}
#content .tf-slider__arrow:hover,
#content .tf-slider__arrow:focus-visible {
    opacity: 1;
    background: #fff;
}
#content .tf-slider__arrow--prev { left: 10px; }
#content .tf-slider__arrow--next { right: 10px; }

/* 箭頭符號用 CSS 畫，不需要圖片 */
#content .tf-slider__arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 9px;
    margin: -5px 0 0 -3px;
    border-top: 2px solid #0085B0;
    border-left: 2px solid #0085B0;
    transform: rotate(-45deg);
}
#content .tf-slider__arrow--next::before {
    margin-left: -7px;
    transform: rotate(135deg);
}

/* ---------- 下方圓點 ---------- */
#content .tf-slider__dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}
#content .tf-slider__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(255, 255, 255, .4);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
#content .tf-slider__dot.is-active {
    background: #0085B0;
    border-color: #fff;
}

/* ---------- 手機 ---------- */
@media screen and (max-width: 767px) {
    #content .tf-slider {
        border-radius: 0;
    }
    #content .tf-slider__arrow {
        width: 30px;
        height: 30px;
        margin-top: -15px;
    }
    #content .tf-slider__arrow--prev { left: 6px; }
    #content .tf-slider__arrow--next { right: 6px; }
    #content .tf-slider__dots {
        bottom: 6px;
    }
}

/* 使用者在系統設定「減少動態效果」時，取消淡入動畫 */
@media (prefers-reduced-motion: reduce) {
    #content .tf-slide {
        transition-duration: 0ms !important;
    }
}
