/* ============================================
   轮播图样式
   ============================================ */

/* --- Custom Carousel Styles --- */
.custom-carousel {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-top: 0;
}

/* Home hero should sit right under (and behind) the navbar like Infinix */
.home .custom-carousel {
    margin-top: calc(-1 * var(--header-height));
    height: calc(100vh + var(--header-height));
    min-height: calc(100vh + var(--header-height));
}
.page-template-front-page .custom-carousel {
    margin-top: calc(-1 * var(--header-height));
    height: calc(100vh + var(--header-height));
    min-height: calc(100vh + var(--header-height));
}
.home .custom-carousel .carousel-slide,
.page-template-front-page .custom-carousel .carousel-slide {
    height: calc(100vh + var(--header-height));
    min-height: calc(100vh + var(--header-height));
}

/* 移动端：覆盖桌面端的高度设置 */
@media (max-width: 900px) {
    .home .custom-carousel,
    .page-template-front-page .custom-carousel {
        margin-top: 0;
        flex-direction: column;
    }
}

.carousel-track {
    display: flex;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    height: 100%;
    width: 100%;
    align-items: flex-start;
}

/* 移动端 track 布局调整 */
@media (max-width: 900px) {
    .carousel-track {
        height: auto;
    }
}

.carousel-slide {
    min-width: 100%;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* 桌面端覆盖层 */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* 移动端：伪元素用于显示图片 */
@media (max-width: 900px) {
    .carousel-slide::before {
        position: relative;
        z-index: 0;
    }
}

.carousel-content {
    position: absolute;
    top: 50%;
    left: 12%;
    transform: translateY(-50%);
    z-index: 5;
    text-align: left;
    color: var(--hero-title-color, #ffffff);
    width: 100%;
    max-width: 520px;
    pointer-events: none;
}

.carousel-title {
    font-size: clamp(36px, 2vw, 36px);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: none;
    margin-bottom: 16px;
    opacity: 0.92;
    line-height: 1.4;
    color: var(--hero-title-color, #ffffff);
}

.carousel-subtitle {
    font-size: clamp(26px, 4vw, 44px);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.4px;
    margin: 0 0 16px 0;
    color: var(--hero-subtitle-color, #ffffff);
    max-width: 640px;
    font-size: 22px;
}

.carousel-subtitle br {
    display: block;
    line-height: 1.3;
}

.carousel-learn-more {
    position: absolute;
    top: 50%;
    left: 12%;
    transform: translateY(120px);
    z-index: 10;
   
}

.carousel-learn-more-btn {
    display: inline-block;
    padding: 14px 40px;
    background: var(--hero-btn-bg, rgba(255, 255, 255, 0.95));
    color: var(--hero-btn-text, #000);
    text-decoration: none;
    border-radius: 0;
    font-weight: 500;
    font-size: 14px;
    transition: none; /* remove hover animation */
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.carousel-learn-more-btn:hover {
    background: var(--hero-btn-bg, rgba(255, 255, 255, 1));
    transform: none; /* keep position on hover */
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.custom-carousel:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn.prev { left: 40px; }
.carousel-btn.next { right: 40px; }

.carousel-btn:hover { 
    color: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.carousel-dots {
    position: absolute;
    left: 50%;
    top: 75%;
    transform: translate(-50%, 130px);
    display: flex;
    gap: 18px;
    z-index: 10;
}

.carousel-dots button {
    all: unset;
    cursor: pointer;
    position: relative;
}

/* Override dots style to number-with-underline */
.carousel-dots {
    gap: 10px;
}

.carousel-dot {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    white-space: nowrap;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--hero-dot-text-80, #ffffff) !important;
    
    font-size: 22px !important;
    letter-spacing: 1px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    transition: color 0.2s ease;
    background: var(--hero-btn-bg, transparent);
    border-radius: 4px;
    
}

/* 原来的数字标签显示 */
/* .carousel-dot-label {
    display: inline-block;
} */

/* 隐藏数字标签 */
.carousel-dot-label {
    display: none;
}

/* 原来的进度条默认隐藏 */
/* .carousel-dot-bar {
    position: relative;
    display: none; 
    vertical-align: middle;
    flex: 0 0 auto;
    width: 0;
    height: 4px;
    background: transparent;
    margin: 0;
} */

/* 修改：所有进度条都显示 */
.carousel-dot-bar {
    position: relative;
    display: inline-block; /* 默认显示所有进度条 */
    vertical-align: middle;
    flex: 0 0 auto;
    width: 50px; /* 设置固定宽度 */
    height: 4px;
    margin: 0 10px;
    background: var(--hero-dot-underline-20, rgba(255,255,255,0.2));
    
}

.carousel-dot.active {
    color: var(--hero-dot-text, #ffffff) !important;
}

/* 原来的激活进度条样式 */
/* .carousel-dot.active .carousel-dot-bar {
    display: inline-block;
    width: 50px;
    flex: 0 0 50px;
    margin: 0 20px;
    background: var(--hero-dot-underline-20, rgba(255,255,255,0.2));
} */

/* 修改：激活状态的进度条样式 */
.carousel-dot.active .carousel-dot-bar {
    background: var(--hero-dot-underline-20, rgba(255,255,255,0.2)); /* 激活时更亮的底色 */
}

/* 原来的未激活进度条隐藏规则 */
/* .carousel-dot:not(.active) .carousel-dot-bar {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    flex: 0 0 0 !important;
} */

/* 现在所有进度条都显示，所以不需要这个规则 */

.carousel-dot-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hero-dot-underline, #ffffff);
    transform: scaleX(0);
    transform-origin: left center;
}

.carousel-dot.active .carousel-dot-bar::after {
    animation: carousel-progress var(--carousel-interval, 5000ms) linear forwards;
}

.carousel-dot:hover {
    color: var(--hero-dot-text, #ffffff);
}

@keyframes carousel-progress {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@media (max-width: 900px) {
    .home .custom-carousel,
    .page-template-front-page .custom-carousel {
        height: auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }
    .home .custom-carousel .carousel-slide,
    .page-template-front-page .custom-carousel .carousel-slide {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
        padding-bottom: 0;
        background-image: none !important;
        position: relative;
        align-items: stretch;
    }
    /* 图片区域 - 使用伪元素显示背景图片 */
    .home .custom-carousel .carousel-slide::before,
    .page-template-front-page .custom-carousel .carousel-slide::before {
        content: '';
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 129.6%; /* 750 × 972 的宽高比 (972/750 = 1.296) */
        background-size: contain;
        background-position: center top;
        background-repeat: no-repeat;
        background-image: var(--carousel-bg-image, none);
        flex-shrink: 0;
        order: 1;
        z-index: 0;
    }
    .carousel-content {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        z-index: 5;
        text-align: left;
        color: var(--text-color) !important;
        width: 100%;
        max-width: 100%;
        padding: 20px 5%;
        pointer-events: auto;
        order: 2;
    }
    .carousel-title {
        font-size: 20px;
        letter-spacing: 0.5px;
        margin-bottom: 12px;
        line-height: 1.3;
        color: var(--text-color) !important;
    }
    .carousel-subtitle {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 20px;
        color: var(--text-color) !important;
    }
    .carousel-learn-more {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        z-index: 10;
        padding: 0 5% 20px;
        order: 3;
    }
    .carousel-learn-more-btn {
        padding: 12px 28px;
        font-size: 12px;
        letter-spacing: 1.5px;
        background: var(--text-color) !important;
        color: var(--bg-light) !important;
        border: 1px solid var(--text-color) !important;
    }
    .carousel-learn-more-btn:hover {
        background: var(--text-color) !important;
        color: var(--bg-light) !important;
        opacity: 0.9;
    }
    .carousel-dots {
        display: none !important; /* 移动端隐藏指示器 */
    }
    .carousel-dot {
        font-size: 16px !important;
        padding: 4px 8px;
        color: var(--text-color) !important;
        opacity: 0.5;
    }
    .carousel-dot.active {
        color: var(--text-color) !important;
        opacity: 1;
    }
    .carousel-dot:hover {
        color: var(--text-color) !important;
        opacity: 0.8;
    }
    .carousel-dot-bar {
        flex: 0 0 30px !important;
        width: 30px !important;
        margin: 0 12px !important;
    }
    .carousel-dot.active .carousel-dot-bar {
        width: 30px !important;
        margin: 0 12px !important;
        background: var(--text-color) !important;
        opacity: 0.2;
    }
    .carousel-dot.active .carousel-dot-bar::after {
        background: var(--text-color) !important;
    }
}

@media (max-width: 600px) {
    .home .custom-carousel,
    .page-template-front-page .custom-carousel {
        height: auto;
        min-height: auto;
    }
    .home .custom-carousel .carousel-slide,
    .page-template-front-page .custom-carousel .carousel-slide {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
        padding-bottom: 0;
        background-image: none !important;
        position: relative;
    }
    /* 图片区域 - 使用伪元素显示背景图片 */
    .home .custom-carousel .carousel-slide::before,
    .page-template-front-page .custom-carousel .carousel-slide::before {
        content: '';
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 129.6%; /* 750 × 972 的宽高比 (972/750 = 1.296) */
        background-size: contain;
        background-position: center top;
        background-repeat: no-repeat;
        background-image: var(--carousel-bg-image);
        flex-shrink: 0;
        order: 1;
    }
    .carousel-content {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        z-index: 5;
        text-align: left;
        color: var(--text-color) !important;
        width: 100%;
        max-width: 100%;
        padding: 16px 4%;
        pointer-events: auto;
        order: 2;
    }
    .carousel-title {
        font-size: 26px;
        letter-spacing: 0.3px;
        margin-bottom: 10px;
        line-height: 1.3;
        color: var(--text-color) !important;
    }
    .carousel-subtitle {
        font-size: 22px;
        line-height: 1.2;
        margin-bottom: 16px;
        letter-spacing: -0.2px;
        color: var(--text-color) !important;
    }
    .carousel-learn-more {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        z-index: 10;
        padding: 0 4% 16px;
        order: 3;
    }
    .carousel-learn-more-btn {
        padding: 10px 24px;
        font-size: 11px;
        letter-spacing: 1px;
        background: var(--text-color) !important;
        color: var(--bg-light) !important;
        border: 1px solid var(--text-color) !important;
    }
    .carousel-learn-more-btn:hover {
        background: var(--text-color) !important;
        color: var(--bg-light) !important;
        opacity: 0.9;
    }
    .carousel-btn { 
        width: 36px; 
        height: 36px; 
        font-size: 18px;
    }
    .carousel-btn.prev { left: 15px; }
    .carousel-btn.next { right: 15px; }
    .carousel-dots {
        display: none !important; /* 移动端隐藏指示器 */
    }
    .carousel-dot {
        color: var(--text-color) !important;
        opacity: 0.5;
    }
    .carousel-dot.active {
        color: var(--text-color) !important;
        opacity: 1;
    }
    .carousel-dot:hover {
        color: var(--text-color) !important;
        opacity: 0.8;
    }
    .carousel-dot.active .carousel-dot-bar {
        background: var(--text-color) !important;
        opacity: 0.2;
    }
    .carousel-dot.active .carousel-dot-bar::after {
        background: var(--text-color) !important;
    }
    .carousel-dot {
        font-size: 14px !important;
        padding: 3px 6px;
        letter-spacing: 0.5px;
    }
    .carousel-dot-bar {
        flex: 0 0 24px !important;
        width: 24px !important;
        margin: 0 10px !important;
        height: 3px !important;
    }
    .carousel-dot.active .carousel-dot-bar {
        width: 24px !important;
        margin: 0 10px !important;
    }
}
