/* ============================================================
 * 轮播幻灯片小部件
 * 宽度自适应（100%），高度由控件自定义
 * ============================================================ */

.qing-slideshow {
    position: relative;
    width: 100%;
}

.qing-slideshow-viewport {
    position: relative;
    width: 100%;
    height: 420px; /* 固定高度模式的默认值，实际由控件覆盖 */
    overflow: hidden;
}

/*
  按宽高比自适应：宽度 100%，高度 = 宽度 ÷ 比例（aspect-ratio）。
  屏幕变窄时宽高等比缩小，画面裁切比例保持不变，不会被额外裁掉。
*/
.qing-slideshow--h-ratio .qing-slideshow-viewport {
    height: auto;
    aspect-ratio: var(--qing-ratio, 16 / 9);
}

/* 兼容不支持 aspect-ratio 的旧浏览器：退回一个合理的响应式高度 */
@supports not (aspect-ratio: 16 / 9) {
    .qing-slideshow--h-ratio .qing-slideshow-viewport {
        height: 56.25vw;
        max-height: 640px;
    }
}

/* ── 滑动模式 ─────────────────────────────── */
.qing-slideshow-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.5s ease;
}

.qing-slideshow-slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.qing-slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 图片遮罩（仅在有文字内容时视觉更清晰，默认轻微） */
.qing-slideshow-slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
    z-index: 1;
}

/* 整张图片可点击链接层 */
.qing-slideshow-link {
    position: absolute;
    inset: 0;
    z-index: 3;
}

/* ── 文字内容 ─────────────────────────────── */
.qing-slideshow-caption {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 24px clamp(24px, 8%, 120px);
    box-sizing: border-box;
    pointer-events: none;
}

.qing-slideshow-caption > * {
    pointer-events: auto;
}

.qing-slideshow-title {
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.qing-slideshow-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    max-width: 640px;
}

.qing-slideshow-btn {
    display: inline-block;
    margin-top: 4px;
    padding: 10px 24px;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.qing-slideshow-btn:hover {
    opacity: 0.88;
}

/* ── 左右箭头 ─────────────────────────────── */
.qing-slideshow-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    color: #fff;
    transition: background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
}

.qing-slideshow-arrow:hover {
    background: rgba(0, 0, 0, 0.6);
}

.qing-slideshow-arrow svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    display: block;
}

.qing-slideshow-arrow i {
    font-size: 22px;
    line-height: 1;
    color: inherit;
}

.qing-slideshow-prev { left: 16px; }
.qing-slideshow-next { right: 16px; }

.qing-slideshow-arrow[hidden] { display: none; }

/* ── 底部圆点 ─────────────────────────────── */
.qing-slideshow-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.qing-slideshow-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.qing-slideshow-dot.active {
    background: #fff;
    transform: scale(1.25);
}

/* ── 淡入淡出模式 ─────────────────────────── */
.qing-slideshow--fade .qing-slideshow-track {
    display: block;
    transition: none;
}

.qing-slideshow--fade .qing-slideshow-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
    z-index: 0;
}

.qing-slideshow--fade .qing-slideshow-slide.is-active {
    opacity: 1;
    z-index: 1;
}

/* ── 响应式 ───────────────────────────────── */
@media (max-width: 767px) {
    .qing-slideshow-title { font-size: 22px; }
    .qing-slideshow-subtitle { font-size: 14px; }
    .qing-slideshow-arrow { width: 38px; height: 38px; }
    .qing-slideshow-arrow svg { width: 18px; height: 18px; }
    .qing-slideshow-arrow i { font-size: 18px; }
}
