/* The same play-button icon font the legacy iframe used. Single glyph at U+E800.
   Served from /assets/fonts/, bind-mounted via docker-compose. */
@font-face {
    font-family: 'play-icon';
    src: url('/assets/fonts/play-icon.woff') format('woff'),
         url('/assets/fonts/play-icon.ttf') format('truetype');
    font-display: swap;
}

/*
 * RI Videos — frontend styling. Inline preview (Phase 5: no more iframe).
 *
 * Container-query-based sizing: title/play-button dimensions are % of the
 * container width (cqw), not the viewport. This way the preview scales
 * correctly when the video is in a sidebar, a half-width column, etc.,
 * matching the original iframe-based behavior (where vw == container width
 * because each iframe had its own viewport).
 *
 * CSS custom properties (set inline by the shortcode renderer):
 *   --ri-vid-color       — accent color (title text + play button)
 *   --ri-vid-title-size  — title font size, in cqw
 *   --ri-vid-title-top   — title vertical position, in cqw
 *   --ri-vid-btn-size    — play button size, in cqw
 *   --ri-vid-btn-top     — play button vertical position, in cqw
 */

.ri-vid-container {
    container-type: inline-size;
    container-name: ri-vid;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #eee;
    overflow: hidden;
    box-sizing: border-box;
}

.ri-vid-iframe {
    border: 0;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: initial !important;
}

/* ---- inline preview (the click-to-play surface) ---- */

.ri-vid-preview {
    cursor: pointer;
}

.ri-vid-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Title overlay — always positioned via `top:` from the container top
   (matches legacy behavior). The renderer pre-computes the base value:
   0cqw for the top variant, 30cqw for the bottom variant, plus the user's
   title_offset. Text grows downward from that anchor. */
.ri-vid-overlay-title {
    position: absolute;
    top: var(--ri-vid-title-top, 30cqw);
    left: 0;
    right: 0;
    text-align: center;
    color: var(--ri-vid-color, #fff900);
    font-family: "Patua One", "Asap", Arial, sans-serif;
    font-weight: 400;
    font-size: var(--ri-vid-title-size, 7cqw);
    line-height: 1.1;
    /* Strong drop-shadow so light yellow text stays readable on any thumbnail. */
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 1);
    padding: 1.5cqw 2cqw;
    pointer-events: none;
    z-index: 2;
}

/* Play button — uses the legacy play-icon font (U+E800 = single play-button
   glyph from Fontello). Sized in cqw so it tracks the container's width.
   Centered by default; user offsets shift via --ri-vid-btn-offset.
   All :hover / :focus / :active states are pinned to the same styling
   (transparent background, accent color, no outline) so theme button
   hover rules don't bleed through. */
.ri-vid-play,
.ri-vid-play:hover,
.ri-vid-play:focus,
.ri-vid-play:focus-visible,
.ri-vid-play:active {
    background: transparent;
    border: 0;
    outline: none;
    box-shadow: none;
    color: var(--ri-vid-color, #fff900);
    text-shadow: 0 0 15px rgba(0, 0, 0, 1);
    text-decoration: none;
}

.ri-vid-play {
    position: absolute;
    left: 50%;
    top: calc(50% + var(--ri-vid-btn-offset, 0cqw));
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: 'play-icon';
    font-size: var(--ri-vid-btn-size, 19cqw);
    line-height: 1;
    transition: transform 200ms ease;
    z-index: 1;
}

.ri-vid-play::before {
    content: "\E800";
}

/* Only the parent-hover triggers the scale — keeps the icon style consistent
   while still giving the slight enlarge cue. */
.ri-vid-preview:hover .ri-vid-play,
.ri-vid-preview:focus-within .ri-vid-play {
    transform: translate(-50%, -50%) scale(1.06);
}

h3.ri-vid {
    margin: 0 0 6px;
}
