﻿.carousel-component {
    --carousel-gap: 10px;
    --carousel-caption-bg: rgba(0, 0, 0, 0.6);
    --carousel-img-height: 200px;
}

    .carousel-component .carousel-container {
        width: 100%;
        overflow: hidden;
        margin: 0 auto;
        padding: 10px 0;
    }

    .carousel-component .carousel-track {
        display: flex;
        transition: transform 0.5s ease;
    }

    .carousel-component .carousel-slide {
        flex: 0 0 auto;
        position: relative;
        margin-right: var(--carousel-gap);
        overflow: hidden;
        border-radius: 8px;
        height: var(--carousel-img-height);
        cursor: pointer;
    }

        .carousel-component .carousel-slide a {
            display: block;
            height: 100%;
            text-decoration: none;
        }
/*
        .carousel-component .carousel-slide img {
            width: auto;
            height: 100%;
            object-fit: cover;
            display: block;
            transition: transform 0.3s ease;
        }*/
        .carousel-component .carousel-slide img {
            max-width: 380px;
            width:100%;
            height: 100%;
            object-fit: cover;
            display: block;
            transition: transform 0.3s ease;
        }

    .carousel-component .carousel-caption {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--carousel-caption-bg);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transition: opacity 0.3s ease;
        padding: 20px;
        text-align: center;
        pointer-events: none;
    }

    .carousel-component .carousel-slide:hover .carousel-caption {
        opacity: 1;
    }

    .carousel-component .carousel-slide:hover img {
        transform: scale(1.05);
    }

    /* 图片放大模态框样式 */
    .carousel-component .carousel-modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.9);
        overflow: auto;
        animation: fadeIn 0.3s;
    }

    .carousel-component .carousel-modal-content {
        margin: auto;
        display: block;
        max-width: 90%;
        max-height: 80vh;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .carousel-component .carousel-modal-caption {
        margin: auto;
        display: block;
        width: 80%;
        text-align: center;
        color: #fff;
        padding: 10px 0;
        position: absolute;
        bottom: 20px;
        left: 10%;
    }

    .carousel-component .carousel-modal-close {
        position: absolute;
        top: 15px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        cursor: pointer;
    }

        .carousel-component .carousel-modal-close:hover {
            color: #bbb;
        }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .carousel-component {
        --carousel-img-height: 180px;
    }

        .carousel-component .carousel-slide {
            min-width: calc(70% - var(--carousel-gap));
        }
}

@media (min-width: 769px) {
    .carousel-component .carousel-slide {
        min-width: calc(25% - var(--carousel-gap));
    }
}
