.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
    gap: 1rem;
    margin: 3rem 1rem;
}
.video-card {
    position: relative;
    background:#000;
    color:#fff;
    border-radius:8px;
    overflow:hidden;
    cursor:pointer;
    min-height:150px;
    max-width: 500px;
    display:flex;
    flex-direction:column;
}
.video-card .thumb {
    background-size:cover;
    background-position:center;
    width:100%;
    padding-top:56.25%; /* 16:9 ratio */
}
.video-card .play {
    position:absolute;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    background:rgba(0,0,0,0.6);
    border:2px solid #fff;
    color:#fff;
    width:56px;
    height:56px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
    font-size:14px;
    pointer-events:none; /* card handles clicks */
}
.video-card .meta {
    padding:0.5rem 0.75rem;
    background:#111;
    color:#ddd;
    font-size:0.95rem;
}
.video-card:focus {
    outline:3px solid #3b82f6;
    outline-offset:2px;
}

.video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}
.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Thumbnail grid */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin: 1rem;
}
.thumb {
    width: 100%;
    height: 0;
    padding-top: 66.666%; /* 3:2-ish thumbnail ratio */
    object-fit: cover;
    background-size: cover;
    background-position: center;
    display: block;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.thumb[src] {
    /* make image fill the padding box */
    height: auto;
    padding-top: 0;
    aspect-ratio: 3 / 2;
    width: 100%;
    object-fit: cover;
}
.thumb:hover { transform: scale(1.03); }

/* Lightbox overlay */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    z-index: 1200;
    padding: 1rem;
}
.lightbox.open { display: flex; }

.lightbox-content {
    position: relative;
    max-width: 100%;
    width: 100%;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox img {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    display: block;
}

/* Controls */
.lb-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(2px);
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    color: #fff;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

/* Caption */
.lb-caption {
    margin-top: 0.6rem;
    color: #ddd;
    font-size: 0.95rem;
    text-align: center;
    max-width: 90%;
}

/* Small-screen adjustments */
@media (max-width: 480px) {
    .lb-btn { width: 38px; height: 38px; }
    .lb-close { font-size: 26px; }
}
