/* ============================================================
   HD Cases Carousel — 组件样式
   版本：2.1.0
   色值：主色 #D32027
   ============================================================ */

/* ── 1. 外层容器 ────────────────────────────────────────────── */
.hd-cases-carousel-wrapper {
    position: relative;
    /* 覆盖 Swiper 11 CSS 变量，防止其默认主题色污染分页样式 */
    --swiper-theme-color: #D32027;
    --swiper-pagination-color: #D32027;
    --swiper-pagination-bullet-inactive-color: #cccccc;
    --swiper-pagination-bullet-inactive-opacity: 1;
}

/* ── 2. Swiper 主体 ─────────────────────────────────────────── */
.hd-cases-carousel {
    overflow: hidden;
    width: 100%;
}

/* ── 3. 单张卡片 ────────────────────────────────────────────── */
.hd-carousel-slide {
    position: relative;
    height: 420px;       /* 默认高度，Elementor 控制项会覆盖此值 */
    overflow: hidden;
    cursor: pointer;
    background-color: #1a1a1a;
}

/* ── 4. 背景图片层 ──────────────────────────────────────────── */
.hd-carousel-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition: transform 0.4s ease;
    will-change: transform;
}

/* 无图片时的占位背景 */
.hd-carousel-bg--placeholder {
    background-color: #2c2c2c;
    background-image: repeating-linear-gradient(
        45deg,
        #333 0,
        #333 1px,
        transparent 0,
        transparent 50%
    );
    background-size: 10px 10px;
}

/* 悬停放大（由 Elementor 开关控制） */
.hd-carousel--hover-scale .hd-carousel-slide:hover .hd-carousel-bg {
    transform: scale(1.05);
}

/* ── 5. 渐变遮罩层 ──────────────────────────────────────────── */
.hd-carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 65%);
    pointer-events: none;
    z-index: 1;
}

/* ── 6. 内容区（标题 + 按钮）────────────────────────────────── */
.hd-carousel-content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    padding: 24px;
    pointer-events: none;
}

/* ── 7. 标题 ────────────────────────────────────────────────── */
.hd-carousel-title {
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.45;
    max-width: 65%;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: auto;
}

/* ── 8. Details 按钮 ─────────────────────────────────────────── */
.hd-carousel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 12px;

    position: relative;       /* 供 ::after 伪元素定位 */
    overflow: visible;

    color: #ffffff;
    background-color: transparent;
    border: none !important;  /* 去掉外边框 */
    border-radius: 0;

    /* 左右 padding 设为 0：按钮宽度 = 文字宽度，下划线不会超出文字 */
    padding: 6px 0;
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: none;
    letter-spacing: 0.03em;

    pointer-events: auto;
    transition: color 0.3s ease;
}

/* 下划线伪元素：宽度 100% = 文字宽度（因左右 padding 为 0） */
.hd-carousel-btn::after {
    content: '';
    position: absolute;
    bottom: 3px;              /* 紧贴文字底部下方 */
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #ffffff;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s ease;
}

.hd-carousel-btn:hover::after,
.hd-carousel-btn:focus-visible::after {
    transform: scaleX(1);
}

.hd-carousel-btn:hover,
.hd-carousel-btn:focus-visible {
    background-color: transparent !important;
    border-color: transparent !important;
    color: #ffffff;
    outline: none;
}

/* ── 9. 导航箭头 ─────────────────────────────────────────────── */
.hd-carousel-prev,
.hd-carousel-next {
    position: absolute;
    top: calc(50% - 20px);
    transform: translateY(-50%);
    z-index: 20;

    /* 重置所有背景，覆盖 Swiper 默认样式 */
    background: none !important;
    background-color: transparent !important;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;

    font-size: 24px;
    color: #888888;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;

    transition: color 0.3s ease;

    --swiper-navigation-size: 0;
}

.hd-carousel-prev::after,
.hd-carousel-next::after {
    display: none !important;
}

.hd-carousel-prev {
    left: 0;
}

.hd-carousel-next {
    right: 0;
}

.hd-carousel-prev:hover,
.hd-carousel-next:hover {
    color: #D32027;
}

/* 禁用状态 */
.hd-carousel-prev.swiper-button-disabled,
.hd-carousel-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ── 10. 导航点容器 ──────────────────────────────────────────── */
/*
 * 容器的 position/width/display 由 JS（fixPaginationBullets）通过内联样式控制，
 * 此处仅保留 CSS 兜底样式（JS 未执行时的降级显示）。
 */
.hd-carousel-pagination {
    position: relative;
    bottom: auto;
    left: auto;
    width: 132px;
    height: 2px;
    display: flex;
    flex-direction: row;
    margin: 16px auto 0;
    text-align: left;
}

/* 每段线段 — 非激活色；宽度由 JS 设置 */
.hd-carousel-pagination .swiper-pagination-bullet {
    display: block;
    height: 2px !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    margin: 0 !important;
    cursor: pointer;
    transition: background-color 0.3s ease;
    transform: none !important;
}

/* 高优先级选择器：非激活色，覆盖 Swiper CSS 变量 */
.hd-cases-carousel-wrapper .hd-carousel-pagination .swiper-pagination-bullet {
    background-color: #cccccc;
    background: #cccccc;
}

/* 高优先级选择器：激活色 #D32027，覆盖 Swiper CSS 变量 */
.hd-cases-carousel-wrapper .hd-carousel-pagination .swiper-pagination-bullet-active {
    background-color: #D32027;
    background: #D32027;
    transform: none !important;
}

/* ── 11. 响应式适配 ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .hd-carousel-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hd-carousel-title {
        font-size: 0.9375rem;
        -webkit-line-clamp: 2;
    }

    .hd-carousel-btn {
        font-size: 0.8125rem;
    }

    /* 移动端隐藏导航箭头 */
    .hd-carousel-prev,
    .hd-carousel-next {
        display: none !important;
    }
}
