/*
 * Showcase Video Shield - two-click video embeds.
 * (C) 2026 SSK-Extensions (Schule für mittelalterlichen Schwertschaukampf UG) - GNU GPL v2 or later
 *
 * Layout: image with play symbol on top, a separate bar below for title, channel and notice
 * (text on top of the image would be unreadable depending on the picture).
 * All colours are CSS variables - override them in your template, e.g. .svs-video { --svs-accent: #b8860b; }
 */

.svs-video {
    --svs-background: #1b1d21;
    --svs-bar: #26282d;
    --svs-text: #f2f2f0;
    --svs-muted: #b6b6b0;
    --svs-accent: #3d8fd1;
    --svs-ratio: 16 / 9;
    margin: 1.5rem 0;
    width: 100%;
}

/* The whole box is the button - deliberately a <button>, reachable by keyboard and announced by screen readers. */
.svs-video .svs-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    overflow: hidden;
    background: var(--svs-background);
    color: var(--svs-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.svs-video .svs-button:hover,
.svs-video .svs-button:focus-visible {
    border-color: var(--svs-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--svs-accent) 35%, transparent);
    outline: none;
}

/* ---- Image area ---- */

.svs-video .svs-image-area,
.svs-video .svs-stage {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--svs-ratio, 16 / 9);
    overflow: hidden;
    background: var(--svs-background);
}

.svs-video .svs-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Play symbol drawn in CSS - no image file, no font, no outside request.
   YouTube: red rounded rectangle with white triangle; Vimeo: the same in Vimeo blue. */
.svs-video .svs-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4.25rem;
    height: 2.98rem;
    border-radius: .9rem;
    background: var(--svs-play, #212327);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .38);
    transition: background-color .18s ease, transform .18s ease;
}

.svs-youtube .svs-play { --svs-play: #f00; }
.svs-vimeo .svs-play { --svs-play: #1ab7ea; }

.svs-video .svs-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 53%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: .62rem 0 .62rem 1.04rem;
    border-color: transparent transparent transparent #fff;
}

.svs-video .svs-button:hover .svs-play,
.svs-video .svs-button:focus-visible .svs-play {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 3px 16px rgba(0, 0, 0, .5);
}

.svs-youtube .svs-button:hover .svs-play,
.svs-youtube .svs-button:focus-visible .svs-play { --svs-play: #c00; }

.svs-vimeo .svs-button:hover .svs-play,
.svs-vimeo .svs-button:focus-visible .svs-play { --svs-play: #0f9ccb; }

/* ---- Bar below the image ---- */

.svs-video .svs-bar {
    display: block;
    padding: .62rem .9rem .7rem;
    background: var(--svs-bar);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.svs-video .svs-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.32;
}

.svs-video .svs-channel {
    display: block;
    margin-top: .12rem;
    font-size: .86rem;
    line-height: 1.35;
    color: #d6d6d1;
}

.svs-video .svs-notice {
    display: block;
    margin-top: .42rem;
    padding-top: .38rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .8rem;
    line-height: 1.4;
    color: var(--svs-muted);
}

/* ---- After the click ---- */

.svs-video .svs-stage > iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.svs-open {
    border-radius: 8px;
    overflow: hidden;
}

/* ---- Tile grid: {videos columns="3" format="portrait"} ... {/videos} ---- */

.svs-grid {
    --svs-columns: 3;
    display: grid;
    grid-template-columns: repeat(var(--svs-columns), minmax(0, 1fr));
    gap: 1.1rem;
    margin: 1.5rem 0;
}

.svs-grid .svs-video {
    margin: 0;
}

.svs-grid .svs-title {
    font-size: .95rem;
}

.svs-grid .svs-notice {
    font-size: .74rem;
}

@media (max-width: 991px) {
    .svs-grid { grid-template-columns: repeat(min(var(--svs-columns), 2), minmax(0, 1fr)); }
}

@media (max-width: 575px) {
    .svs-grid { grid-template-columns: 1fr; }
    .svs-grid-portrait { grid-template-columns: repeat(min(var(--svs-columns), 2), minmax(0, 1fr)); gap: .7rem; }
    .svs-grid-portrait .svs-bar { padding: .5rem .6rem .55rem; }
    .svs-grid-portrait .svs-notice { font-size: .68rem; }
}

/* ---- Special cases ---- */

.svs-error {
    margin: 1.5rem 0;
    padding: .7rem .9rem;
    border-left: 3px solid #9a9a95;
    background: #f4f4f2;
    color: #55554f;
    font-size: .9rem;
}

@media (max-width: 480px) {
    .svs-video .svs-play { width: 3.3rem; height: 2.32rem; border-radius: .7rem; }
    .svs-video .svs-play::before { border-width: .48rem 0 .48rem .8rem; }
    .svs-video .svs-title { font-size: .94rem; }
    .svs-video .svs-notice { font-size: .74rem; }
}

@media (prefers-reduced-motion: reduce) {
    .svs-video .svs-button,
    .svs-video .svs-play { transition: none; }
    .svs-video .svs-button:hover .svs-play { transform: translate(-50%, -50%); }
}
