/*
 * The pictures and videos of the text of an article (BlogFigures, BlogVideos, the editor's figure and video): a figure is a picture (or several, a gallery) with a
 * caption. In the middle it has the whole width of the text, at the left or the right (data-align) the text flows around it. On the page of an article (.blog-page,
 * not in the editor) a gallery is its first picture with the others as a row of tiny thumbnails under it and a click on a picture opens the lightbox (js/lightbox.js, the dialog is css/lightbox.css).
 */
.blog-body figure[data-blog-figure] {
    position: relative;
    margin: 1.5rem 0;
}

.blog-body figure[data-blog-figure] img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    /* an outline in the colour of the article, so that a screenshot with a white background does not melt into the page */
    border: 2px solid var(--blog-fill);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
}

.blog-body figure[data-blog-figure] figcaption {
    margin-top: .5rem;
    color: #5a6878;
    font-size: .9rem;
    line-height: 1.4;
}

.blog-body h2 {
    clear: both;
}

@media (min-width: 768px) {
    .blog-body figure[data-align="left"],
    .blog-body figure[data-align="right"] {
        width: 44%;
        margin-top: .35rem;
        margin-bottom: 1rem;
    }

    .blog-body figure[data-align="left"] {
        float: left;
        margin-right: 1.75rem;
    }

    .blog-body figure[data-align="right"] {
        float: right;
        margin-left: 1.75rem;
    }
}

/* the page of an article: a picture can be enlarged, a gallery shows its first picture big and the others as tiny thumbnails under it (a click opens the lightbox on it) */
.blog-page .blog-body figure[data-blog-figure] img,
.blog-page .blog-body > img {
    cursor: zoom-in;
}

.blog-page .blog-body figure[data-more] {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.blog-page .blog-body figure[data-more] img:first-of-type {
    flex: 0 0 100%;
}

.blog-page .blog-body figure[data-more] img:nth-of-type(n+2) {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 3.4rem;
    object-fit: cover;
    border-width: 1px;
    border-radius: 6px;
    box-shadow: none;
    opacity: .8;
    transition: opacity .15s ease;
}

.blog-page .blog-body figure[data-more] img:nth-of-type(n+2):hover {
    opacity: 1;
}

.blog-page .blog-body figure[data-more] figcaption {
    flex: 0 0 100%;
    margin-top: .1rem;
}

@media (prefers-reduced-motion: reduce) {
    .blog-page .blog-body figure[data-more] img:nth-of-type(n+2) {
        transition: none;
    }
}

html[data-theme="dark"] .blog-body figure[data-blog-figure] figcaption {
    color: var(--dark-muted);
}

/* ---- a video from YouTube: a dark area with the button Play, the player comes only when the reader presses it (BlogVideos, js/blog-video.js) ---- */
.blog-body .blog-video {
    clear: both;
    margin: 1.75rem 0;
}

.blog-video-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #22344d, #0f1722);
    border-radius: 12px;
}

.blog-video-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    width: 100%;
    height: 100%;
    padding: 0;
    background: none;
    border: 0;
    color: #fff;
    cursor: pointer;
}

.blog-video-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    background: #e62117;
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
    font-size: 2.6rem;
    transition: transform .18s ease;
}

.blog-video-play:hover .blog-video-icon,
.blog-video-play:focus-visible .blog-video-icon {
    transform: scale(1.1);
}

.blog-video-play:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -6px;
}

.blog-video-note {
    padding: 0 1rem;
    color: #c3ccd7;
    font-size: .9rem;
}

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

.blog-body .blog-video figcaption {
    margin-top: .5rem;
    color: #5a6878;
    font-size: .9rem;
}

html[data-theme="dark"] .blog-body .blog-video figcaption {
    color: var(--dark-muted);
}

@media (prefers-reduced-motion: reduce) {
    .blog-video-icon {
        transition: none;
    }
}
