﻿.vid-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 22px
}

.vid-card {
    background: #fff;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .18s ease;
}

    .vid-card:hover,
    .vid-card:focus-within {
        /*transform: translateY(-2px);
                box-shadow: 0 14px 34px rgba(0,0,0,.18);*/
    }

        .vid-card:hover .vid-thumb::before,
        .vid-card:focus-within .vid-thumb::before {
            opacity: 1;
        }

        .vid-card:hover .vid-thumb::after,
        .vid-card:focus-within .vid-thumb::after {
            opacity: 1;
            transform: translate(-50%,-50%) scale(1);
        }

.vid-thumb {
    position: relative;
    aspect-ratio: 12/9;
    background: #f6f7fb;
    overflow: hidden;
    display: block;
    border-radius: 16px;
}

    .vid-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

    .vid-thumb:hover img {
        transform: scale(1.02);
        filter: brightness(.92);
    }

    /* === 播放覆蓋層 + 播放鈕 === */
    .vid-thumb::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,.25);
        opacity: 0;
        transition: opacity .18s ease;
        pointer-events: none;
    }

    .vid-thumb::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: clamp(48px, 10vw, 88px);
        height: clamp(48px, 10vw, 88px);
        transform: translate(-50%,-50%) scale(.92);
        background: url("/images/videoplay.png") no-repeat center/contain;
        opacity: 0;
        transition: opacity .18s ease, transform .18s ease;
        pointer-events: none;
    }


.vid-mask {
    position: relative;
}

    .vid-mask::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 38%;
        background: linear-gradient(0deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .45) 35%, rgba(0, 0, 0, .12) 65%, rgba(0, 0, 0, 0) 100%);
        pointer-events: none;
        z-index: 1;
        opacity: 0;
        transition: opacity .25s ease;
    }

    .vid-mask:hover::after {
        opacity: 1;
    }


.vid-body {
    padding: 12px 10px 16px
}

.vid-title {
    margin: 0 0 6px;
    font-weight: 800;
    line-height: 1.45;
    display: -webkit-box; /* ① 必須 */
    -webkit-box-orient: vertical; /* ② 必須 */
    -webkit-line-clamp: 2; /* 限制 2 行 */
    overflow: hidden; /* ③ 必須，超過隱藏 */
    text-overflow: ellipsis; /* 確保有 … */
    font-size: 20px;
}

.vid-desc {
    color: #666;
    font-size: 18px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* 限制 3 行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.dur {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 12px;
    background: #1976d2;
    color: #fff;
    padding: 4px 8px;
    font-weight: 800;
    letter-spacing: .3px
}

@media (prefers-reduced-motion: reduce) {
    .vid-thumb::before, .vid-thumb::after,
    .vid-card, .vid-card:hover, .vid-card:focus-within {
        transition: none !important;
    }
}

@media (max-width:1100px) {
    .vid-grid {
        grid-template-columns: repeat(3,1fr)
    }
}

@media (max-width:1024px) {
    .vid-title {
        font-size: 18px;
    }

    .vid-desc {
        font-size: 16px;
    }
}


@media (max-width:860px) {
    .vid-grid {
        grid-template-columns: repeat(2,1fr)
    }
}

@media (max-width:560px) {
    .vid-grid {
        grid-template-columns: 1fr
    }
}
