/* Post video gallery + modal (styles_video.css) */

.sr-video-gallery {
    margin: 0;
    clear: both;
}

.sr-video-gallery > h2 {
    margin: 0 0 0.5rem;
}

.sr-video-gallery__intro {
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

.sr-video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    margin-bottom: 0.75rem;
}

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

.sr-video-item--inline,
.sr-video-item--popup {
    margin-bottom: 0;
}

.sr-video-item__title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.sr-video-item__description {
    line-height: 1.6;
}

.sr-video-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sr-video-thumb__image-wrap {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #111;
}

.sr-video-thumb--popup .sr-video-thumb__image-wrap,
.sr-video-grid__thumb .sr-video-thumb__image-wrap {
    background: transparent;
    border-radius: 0;
}

.sr-video-popup-preview {
    display: block;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sr-video-popup-preview .sr-video-embed--popup-preview {
    margin-bottom: 0;
}

.sr-video-popup-preview .sr-video-embed--popup-preview iframe {
    pointer-events: none;
}

.sr-video-popup-preview__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: transparent;
}

.sr-video-popup-preview:hover .sr-video-embed--popup-preview,
.sr-video-popup-preview:focus-visible .sr-video-embed--popup-preview {
    outline: 2px solid rgba(0, 0, 0, 0.12);
    outline-offset: 2px;
}

.sr-video-thumb__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

/* Undo article-wide img rules in styles_new.css (700px width, height: auto). */
.post__text .sr-video-gallery .sr-video-thumb__image {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin-left: 0;
    margin-right: 0;
    object-fit: cover;
}

body.sr-video-modal-open {
    overflow: hidden;
}

.sr-video-thumb:hover .sr-video-thumb__image,
.sr-video-thumb:focus-visible .sr-video-thumb__image {
    transform: scale(1.02);
}

.sr-video-thumb__caption {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.35;
}

.sr-video-carousel--scroll {
    width: 100%;
}

.sr-video-carousel__viewport {
    width: 100%;
    overflow: visible;
}

.sr-video-featured {
    width: 100%;
    margin-bottom: 1.25rem;
}

.sr-video-featured .sr-video-embed--featured {
    margin-bottom: 0.75rem;
}

.sr-video-featured__title {
    margin-bottom: 0;
}

.sr-video-carousel__track {
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.sr-video-carousel--rows-2 .sr-video-carousel__track {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: min(52vw, 280px);
    align-items: start;
}

.sr-video-carousel--rows-2.sr-video-carousel--small .sr-video-carousel__track {
    grid-auto-columns: min(42vw, 200px);
}

.sr-video-carousel--rows-2.sr-video-carousel--medium .sr-video-carousel__track {
    grid-auto-columns: min(52vw, 280px);
}

.sr-video-carousel--rows-2.sr-video-carousel--big .sr-video-carousel__track {
    grid-auto-columns: min(72vw, 360px);
}

.sr-video-carousel--rows-1 .sr-video-carousel__track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
}

.sr-video-carousel--rows-1.sr-video-carousel--small .sr-video-carousel__slide {
    flex: 0 0 auto;
    width: min(42vw, 200px);
}

.sr-video-carousel--rows-1.sr-video-carousel--medium .sr-video-carousel__slide {
    flex: 0 0 auto;
    width: min(52vw, 280px);
}

.sr-video-carousel--rows-1.sr-video-carousel--big .sr-video-carousel__slide {
    flex: 0 0 auto;
    width: min(72vw, 360px);
}

.sr-video-carousel__slide {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    scroll-snap-align: start;
}

.sr-video-carousel__slide-title {
    margin-top: 0.65rem;
    font-size: 1rem;
}

.sr-video-carousel__slide-desc {
    margin-top: 0.35rem;
    font-size: 0.92rem;
}

.sr-video-gallery__grid--small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 1rem 1.25rem;
    width: 100%;
}

.sr-video-gallery__grid-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sr-video-gallery__grid-title {
    margin-top: 0.55rem;
    font-size: 0.95rem;
}

.sr-video-gallery__grid-desc {
    margin-top: 0.35rem;
    font-size: 0.92rem;
}

.sr-video-modal[hidden] {
    display: none !important;
}

.sr-video-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
}

.sr-video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.sr-video-modal__dialog {
    position: relative;
    max-width: 920px;
    width: calc(100% - 2rem);
    margin: 2rem auto;
    background: #fff;
    border-radius: 8px;
    padding: 2.75rem 1.25rem 1.25rem;
    max-height: calc(100vh - 4rem);
    overflow: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.sr-video-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: #f3f3f3;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}

.sr-video-modal__close:hover,
.sr-video-modal__close:focus-visible {
    background: #e8e8e8;
}

.sr-video-modal__close-icon {
    position: relative;
    display: block;
    width: 14px;
    height: 14px;
}

.sr-video-modal__close-icon::before,
.sr-video-modal__close-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background: #333;
    border-radius: 1px;
}

.sr-video-modal__close-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.sr-video-modal__close-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.sr-video-modal__video {
    margin-top: 0;
    width: 700px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.sr-video-modal__video .sr-video-embed {
    margin-bottom: 0;
    width: 100%;
}

.sr-video-modal__rail {
    margin: 1.25rem 0 0;
    width: 100%;
}

.sr-video-modal__rail-label {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.sr-video-modal__carousel {
    width: 100%;
}

.sr-video-modal__carousel .sr-video-carousel__track {
    padding: 4px 4px 0.35rem;
    overflow-y: visible;
}

.sr-video-modal__rail-slide.is-active .sr-video-modal__switch {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.sr-video-featured .sr-video-popup-preview {
    width: 100%;
    max-width: 100%;
}

.sr-video-modal__title {
    width: 700px;
    max-width: 100%;
    margin: 0 auto 0.5rem;
    font-size: 1.2rem;
}

.sr-video-modal__description {
    line-height: 1.6;
    width: 100%;
    max-width: none;
    margin: 0.75rem 0 0;
}

/* —— Smartreading post layout —— */

.post__text .sr-video-item--inline,
.post__text .sr-video-item--popup {
    margin-top: 48px;
    margin-bottom: 48px;
}

.post__text .sr-video-item--popup .sr-video-popup-preview {
    width: 700px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.post__text .sr-video-item--inline .sr-video-embed {
    width: 700px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.post__text .sr-video-item--inline .sr-video-item__title,
.post__text .sr-video-item--inline .sr-video-item__description,
.post__text .sr-video-item--popup .sr-video-item__title,
.post__text .sr-video-item--popup .sr-video-item__description {
    width: 700px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.post__content .sr-video-gallery--carousel,
.post__content .sr-video-gallery--featured_carousel {
    margin-top: 48px;
    margin-bottom: 48px;
    clear: both;
}

.post__text .sr-video-gallery--carousel > h2,
.post__text .sr-video-gallery--featured_carousel > h2 {
    margin: 0 0 24px;
}

.post__content .sr-video-gallery--carousel .sr-video-gallery__intro,
.post__content .sr-video-gallery--featured_carousel .sr-video-gallery__intro {
    margin: 0 0 20px;
}

.post__content .sr-video-gallery--featured_carousel .sr-video-featured {
    width: 100%;
}

.post__content .sr-video-gallery--featured_carousel .sr-video-featured .sr-video-popup-preview {
    width: 100%;
    max-width: 100%;
}

.post__content .sr-video-gallery--carousel .sr-video-carousel,
.post__content .sr-video-gallery--featured_carousel .sr-video-carousel {
    width: 100%;
}

.post__content .sr-video-gallery--carousel .sr-video-carousel__track,
.post__content .sr-video-gallery--featured_carousel .sr-video-carousel__track {
    gap: 16px;
    padding-bottom: 8px;
    scroll-padding-inline: 0;
}

.post__content .sr-video-gallery--carousel + .sr-related-posts,
.post__content .sr-video-gallery--featured_carousel + .sr-related-posts,
.post__content .sr-video-gallery--carousel + .comments_wrap,
.post__content .sr-video-gallery--featured_carousel + .comments_wrap {
    margin-top: 48px;
}
