/**
 * Video hub (/video page template + the homepage "ویدیو" block). Loaded
 * only where it's needed — see techrato_video_hub_needs_assets() in
 * inc/video-hub.php. Uses the main site's own light theme and tokens
 * (--green, --page-width), not the dark product-landing look.
 */

.video-hub .container,
.video-home-block .container {
    width: min(var(--page-width, 1240px), calc(100% - 44px));
    margin-inline: auto;
}

.video-hub__notice {
    padding: 60px 0;
    text-align: center;
    color: #777;
    font-size: 15px;
}

/* ---------- Section heads shared by the hub's rows ---------- */

.video-shorts-row__head,
.video-long-grid__head,
.video-home-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.video-shorts-row__head h2,
.video-long-grid__head h2,
.video-home-block__head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.video-home-block__more {
    font-size: 13px;
    font-weight: 700;
    color: var(--green-dark, #3a8f10);
    white-space: nowrap;
}

.video-shorts-row,
.video-long-grid {
    padding-block: 26px;
}

/* ---------- Stories row (circular avatars) ---------- */

.video-stories-row {
    padding-block: 18px;
    border-bottom: 1px solid #eee;
}

.video-stories-row__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.video-stories-row__track::-webkit-scrollbar {
    display: none;
}

.video-story {
    flex: 0 0 auto;
    width: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

.video-story__ring {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    padding: 2px;
    background: linear-gradient(135deg, var(--green), #2aa72a);
}

.video-story__ring img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
}

.video-story__label {
    max-width: 100%;
    font-size: 11px;
    color: #444;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Hero (big featured long-form video) ---------- */

.video-hero {
    padding-block: 22px;
}

.video-hero__frame {
    position: relative;
    display: block;
    aspect-ratio: 16 / 8;
    border-radius: 24px;
    overflow: hidden;
    background: #111;
}

.video-hero__frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-hero__play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #161616;
}

.video-hero__play svg {
    width: 26px;
    height: 26px;
}

.video-hero__copy {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 20px clamp(18px, 4vw, 40px) 24px;
    background: linear-gradient(0deg, rgba(0, 0, 0, .82), transparent 75%);
    color: #fff;
}

.video-hero__copy h1 {
    margin: 8px 0 8px;
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 800;
    max-width: 760px;
}

.video-hero__copy p {
    margin: 0;
    max-width: 640px;
    font-size: 14px;
    line-height: 1.8;
    color: #e2e2e2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Shorts carousel (vertical-aspect cards) ---------- */

.video-shorts-row__track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.video-shorts-row__track::-webkit-scrollbar {
    display: none;
}

.video-short-thumb {
    position: relative;
    flex: 0 0 150px;
    aspect-ratio: 9 / 16;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    background: #111;
    scroll-snap-align: start;
    cursor: pointer;
}

.video-short-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-short-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, .75), transparent 55%);
}

.video-short-thumb__play {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 1;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: #161616;
}

.video-short-thumb__play svg {
    width: 13px;
    height: 13px;
}

.video-short-thumb__title {
    position: absolute;
    z-index: 1;
    inset-inline: 10px;
    bottom: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    text-align: start;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Long-form video card (category rows + home block grid) ---------- */

.video-card {
    display: flex;
    flex-direction: column;
}

.video-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    overflow: hidden;
    background: #eee;
    margin-bottom: 10px;
}

.video-card__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card__play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #161616;
}

.video-card__play svg {
    width: 18px;
    height: 18px;
}

.video-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.7;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-long-grid__grid,
.video-home-block__long-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.video-home-block__long-grid {
    margin-top: 22px;
}

/* ---------- Homepage block ---------- */

.video-home-block {
    padding-block: 34px;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* ---------- Full-screen shorts viewer ---------- */

.video-shorts-viewer {
    position: fixed;
    inset: 0;
    z-index: 700;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-shorts-viewer[hidden] {
    display: none !important;
}

body.video-shorts-open {
    overflow: hidden;
}

.video-shorts-viewer__stage {
    width: min(100%, 460px);
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.video-shorts-viewer__stage::-webkit-scrollbar {
    display: none;
}

.video-short {
    position: relative;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    background: #000;
}

.video-short__media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-short__overlay {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 20px 76px 26px 18px;
    background: linear-gradient(0deg, rgba(0, 0, 0, .8), transparent 65%);
}

.video-short__title {
    display: block;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
}

.video-short__actions {
    position: absolute;
    inset-inline-end: 14px;
    bottom: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.video-short__action,
.video-short__mute {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.video-short__action .icon {
    width: 21px;
    height: 21px;
}

.video-short__action.is-active {
    color: var(--green);
}

.video-short__action .article-like-count {
    display: block;
    margin-top: 2px;
    font-size: 10px;
}

.video-short__mute .icon-unmuted {
    display: none;
}

.video-shorts-viewer.is-muted .video-short__mute .icon-muted {
    display: block;
}

.video-shorts-viewer:not(.is-muted) .video-short__mute .icon-muted {
    display: none;
}

.video-shorts-viewer:not(.is-muted) .video-short__mute .icon-unmuted {
    display: block;
}

.video-short__mute svg {
    width: 20px;
    height: 20px;
}

.video-shorts-viewer__close {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.video-shorts-viewer__nav {
    position: absolute;
    z-index: 2;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    display: none;
    place-items: center;
    cursor: pointer;
}

.video-shorts-viewer__nav--prev {
    top: 18px;
}

.video-shorts-viewer__nav--next {
    bottom: 18px;
}

/* Prev/next buttons only make sense with a mouse/trackpad — touch users
   already have the natural vertical swipe. */
@media (hover: hover) and (pointer: fine) {
    .video-shorts-viewer__nav {
        display: grid;
    }
}

/* ---------- Mobile ---------- */

@media (max-width: 650px) {
    .video-long-grid__grid,
    .video-home-block__long-grid {
        grid-template-columns: 1fr;
    }

    .video-hero__frame {
        aspect-ratio: 4 / 3;
        border-radius: 18px;
    }

    .video-short-thumb {
        flex-basis: 130px;
    }
}
