/**
 * Alakhbar24 - YouTube "صوت وصورة"
 */

.ak24-youtube-section {
    width: 100%;
}

/* =========================
   DESKTOP GRID
   ========================= */

.ak24-youtube-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr)
        minmax(0, 1.65fr);

    grid-template-rows: repeat(2, 220px);

    gap: 18px;
    width: 100%;
    direction: ltr;
}

/*
 * Featured video on the RIGHT.
 */
.ak24-youtube-card.is-featured {
    grid-column: 3;
    grid-row: 1 / 3;
}

/* Normal cards */
.ak24-youtube-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #071d3d;
}

/* =========================
   CLICKABLE CARD
   ========================= */

.ak24-youtube-open {
    position: relative;

    display: block;

    width: 100%;
    height: 100%;

    padding: 0;
    margin: 0;

    border: 0;
    background: transparent;

    cursor: pointer;
    overflow: hidden;

    font: inherit;
    text-align: right;
}

/* =========================
   IMAGE
   ========================= */

.ak24-youtube-thumb {
    position: absolute;
    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    overflow: hidden;
}

.ak24-youtube-thumb::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            to top,
            rgba(3, 17, 40, 0.92) 0%,
            rgba(3, 17, 40, 0.48) 36%,
            rgba(3, 17, 40, 0.03) 68%
        );
}

.ak24-youtube-thumb img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transition:
        transform 0.4s ease,
        filter 0.4s ease;
}

.ak24-youtube-open:hover .ak24-youtube-thumb img {
    transform: scale(1.045);
    filter: brightness(0.92);
}

/* =========================
   PLAY BUTTON
   ========================= */

.ak24-youtube-play {
    position: absolute;

    top: 50%;
    left: 50%;

    z-index: 3;

    width: 48px;
    height: 48px;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.94);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.24);

    transition:
        transform 0.25s ease,
        background 0.25s ease;
}

.ak24-youtube-play::before {
    content: "";

    position: absolute;

    top: 50%;
    left: 53%;

    transform: translate(-50%, -50%);

    width: 0;
    height: 0;

    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid #ed1c24;
}

.ak24-youtube-open:hover .ak24-youtube-play {
    transform:
        translate(-50%, -50%)
        scale(1.08);

    background: #fff;
}

/* Bigger play button for featured video */

.ak24-youtube-card.is-featured .ak24-youtube-play {
    width: 62px;
    height: 62px;
}

.ak24-youtube-card.is-featured .ak24-youtube-play::before {
    border-top-width: 9px;
    border-bottom-width: 9px;
    border-left-width: 14px;
}

/* =========================
   VIDEO TITLE
   ========================= */

.ak24-youtube-title {
    position: absolute;

    right: 16px;
    bottom: 14px;
    left: 16px;

    z-index: 4;

    display: -webkit-box;
    overflow: hidden;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    color: #fff;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.55;

    text-align: right;
    direction: rtl;

    text-shadow:
        0 2px 5px rgba(0, 0, 0, 0.55);
}

.ak24-youtube-card.is-featured .ak24-youtube-title {
    right: 22px;
    bottom: 20px;
    left: 22px;

    font-size: 23px;
    line-height: 1.5;
}

/* =========================
   POPUP
   ========================= */

.ak24-youtube-modal[hidden] {
    display: none !important;
}

.ak24-youtube-modal {
    position: fixed;
    inset: 0;

    z-index: 999999;

    display: grid;
    place-items: center;

    padding: 24px;
}

.ak24-youtube-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.82);

    backdrop-filter: blur(4px);
}

.ak24-youtube-dialog {
    position: relative;

    z-index: 1;

    width: min(1000px, 94vw);
}

.ak24-youtube-player {
    position: relative;

    width: 100%;
    aspect-ratio: 16 / 9;

    overflow: hidden;

    border-radius: 12px;

    background: #000;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5);
}

.ak24-youtube-player iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
}

.ak24-youtube-close {
    position: absolute;

    top: -46px;
    left: 0;

    z-index: 2;

    width: 38px;
    height: 38px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #fff;
    color: #071d3d;

    font-size: 26px;
    line-height: 38px;

    cursor: pointer;
}

body.ak24-youtube-modal-open {
    overflow: hidden;
}

/* =========================
   TABLET
   ========================= */

@media (max-width: 1024px) {

    .ak24-youtube-grid {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            minmax(0, 1.45fr);

        grid-template-rows: repeat(2, 190px);

        gap: 14px;
    }

    .ak24-youtube-title {
        font-size: 14px;
    }

    .ak24-youtube-card.is-featured .ak24-youtube-title {
        font-size: 20px;
    }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 767px) {

    .ak24-youtube-grid {
        display: flex;

        width: 100%;

        gap: 12px;

        overflow-x: auto;

        padding-bottom: 8px;

        direction: rtl;

        scroll-snap-type: x mandatory;

        -webkit-overflow-scrolling: touch;

        scrollbar-width: none;
    }

    .ak24-youtube-grid::-webkit-scrollbar {
        display: none;
    }

    .ak24-youtube-card,
    .ak24-youtube-card.is-featured {
        flex: 0 0 86%;

        height: 235px;

        scroll-snap-align: start;
    }

    .ak24-youtube-title,
    .ak24-youtube-card.is-featured .ak24-youtube-title {
        right: 14px;
        bottom: 14px;
        left: 14px;

        font-size: 17px;
        line-height: 1.5;
    }

    .ak24-youtube-play,
    .ak24-youtube-card.is-featured .ak24-youtube-play {
        width: 50px;
        height: 50px;
    }

    .ak24-youtube-modal {
        padding: 12px;
    }

    .ak24-youtube-dialog {
        width: 100%;
    }
}