/* ============================================================
   Medialis — Rubrik Video CSS  (v3 — adaptive aspect ratio)
   ============================================================ */

/* ─── Section wrapper ─── */
.mvr-section { margin-bottom: 36px; }

/* ================================================================
   CAROUSEL HORIZONTAL
   ================================================================ */
.mvr-carousel-wrap { position: relative; }

.mvr-grid--md {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    padding-left: 2px;
    padding-right: 2px;
}
.mvr-grid--md::-webkit-scrollbar { display: none; }

.mvr-card--md {
    flex: 0 0 200px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-radius: var(--brad, 10px);
    overflow: hidden;
    background: var(--cbg, #fff);
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    transition: box-shadow .2s, transform .18s;
}
.mvr-card--md:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,.14);
    transform: translateY(-2px);
}

/* Arrow nav */
.mvr-arrow {
    display: none;
    position: absolute;
    top: 38%;
    transform: translateY(-50%);
    z-index: 2;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background .15s, box-shadow .15s;
    padding: 0;
    color: #333;
}
.mvr-arrow:hover { background: var(--cp, #e01c44); color: #fff; }
.mvr-arrow--prev { left: -14px; }
.mvr-arrow--next { right: -14px; }

/* ─── Sidebar list ─── */
.mvr-grid--sm { display: flex; flex-direction: column; gap: 10px; }

.mvr-card--sm {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cbdr, #e5e7eb);
}
.mvr-card--sm:last-child { border-bottom: none; padding-bottom: 0; }

/* ─── Thumbnail ─── */
.mvr-card__thumb-wrap {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.mvr-card--md .mvr-card__thumb-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
}
.mvr-card--sm .mvr-card__thumb-wrap {
    width: 82px; height: 58px;
    border-radius: 7px;
}
.mvr-card__thumb {
    width: 100%; height: 100%;
    background: #1a1a2e;
    overflow: hidden;
}
.mvr-card__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.mvr-card--md:hover .mvr-card__thumb img { transform: scale(1.05); }

/* ─── Play overlay ─── */
.mvr-card__play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.32);
    border: none; cursor: pointer;
    transition: background .2s;
    padding: 0; width: 100%; height: 100%;
}
.mvr-card__play:hover { background: rgba(0,0,0,.5); }
.mvr-card__play svg { filter: drop-shadow(0 1px 4px rgba(0,0,0,.5)); transition: transform .18s; }
.mvr-card__play:hover svg { transform: scale(1.18); }

/* ─── Card body ─── */
.mvr-card__body { flex: 1; padding: 9px 10px 10px; min-width: 0; }
.mvr-card--sm .mvr-card__body { padding: 0; }

/* ─── Platform badge ─── */
.mvr-plat {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 8.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .07em;
    padding: 2px 6px; border-radius: 3px; margin-bottom: 5px;
    background: var(--cp, #e01c44); color: #fff; line-height: 1.4;
}
.mvr-plat--yt  { background: #ff0000; }
.mvr-plat--fb  { background: #1877f2; }
.mvr-plat--ig  { background: linear-gradient(135deg, #f58529, #dd2a7b, #515bd4); }

/* ─── Title / Expert ─── */
.mvr-card__title {
    font-size: 13px; font-weight: 700; line-height: 1.4; margin: 0 0 3px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mvr-card__title-link { color: var(--ctxt, #1a1a1a); text-decoration: none; }
.mvr-card__title-link:hover { color: var(--cp, #e01c44); }
.mvr-card__expert { font-size: 10.5px; color: var(--cmut, #6b7280); margin: 3px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================================================================
   MODAL — adaptive portrait/landscape
   ================================================================ */
.mvr-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.mvr-modal[style*="display:none"],
.mvr-modal[style*="display: none"] { pointer-events: none; }

.mvr-modal__overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.85);
    cursor: pointer;
    animation: mvrFadeIn .18s ease;
}

/* ── Box utama ── */
.mvr-modal__box {
    position: relative; z-index: 1;
    background: var(--cbg, #fff);
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,.55);
    animation: mvrSlideUp .22s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
}
.mvr-modal__box::-webkit-scrollbar { display: none; }

/* LANDSCAPE mode (YouTube) — lebar, max 520px */
.mvr-modal__box--landscape {
    max-width: 520px;
}

/* PORTRAIT mode (Reels Instagram/Facebook) — narrow, max 380px */
.mvr-modal__box--portrait {
    max-width: 380px;
}

@keyframes mvrFadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes mvrSlideUp {
    from { opacity:0; transform: translateY(28px) scale(.96); }
    to   { opacity:1; transform: translateY(0) scale(1); }
}

/* ─── Close button mengambang ─── */
.mvr-modal__close {
    position: absolute; top: 10px; right: 10px; z-index: 10;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    border: none; border-radius: 50%;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff;
    transition: background .18s;
    padding: 0; flex-shrink: 0;
}
.mvr-modal__close:hover { background: rgba(0,0,0,.85); }

/* ─── Player wrapper — rasio dikontrol oleh JS via class ─── */
.mvr-modal__player {
    position: relative;
    width: 100%;
    background: #000;
    flex-shrink: 0;
}

/* Landscape: 16:9 */
.mvr-modal__player--landscape {
    aspect-ratio: 16 / 9;
}

/* Portrait / Reels: 9:16 */
.mvr-modal__player--portrait {
    aspect-ratio: 9 / 16;
    /* Batasi tinggi agar tidak terlalu panjang di desktop */
    max-height: 58vh;
}

.mvr-modal__player iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: none; display: block;
}

/* ─── Info artikel ─── */
.mvr-modal__info {
    padding: 14px 16px 18px;
    display: flex; flex-direction: column; gap: 7px;
    flex: 1;
    background: var(--cbg, #fff);
}

.mvr-modal__plat-row {
    display: flex; align-items: center;
    justify-content: space-between; gap: 8px;
}

.mvr-modal__expert-tag {
    font-size: 10px; color: var(--cmut, #6b7280);
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 55%; text-align: right;
}

.mvr-modal__title {
    font-size: 15px; font-weight: 800; line-height: 1.4;
    color: var(--ctxt, #111);
    margin: 0; text-decoration: none; display: block;
    transition: color .15s;
}
.mvr-modal__title:hover { color: var(--cp, #e01c44); }

.mvr-modal__excerpt {
    font-size: 13px; line-height: 1.6;
    color: var(--cmut, #6b7280); margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}

.mvr-modal__readmore {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 700;
    color: var(--cp, #e01c44);
    text-decoration: none; margin-top: 2px;
    transition: opacity .18s; align-self: flex-start;
}
.mvr-modal__readmore:hover { opacity: .75; }

/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
    .mvr-modal__box  { background: #161616; }
    .mvr-modal__info { background: #161616; }
    .mvr-modal__title   { color: #f0f0f0; }
    .mvr-modal__excerpt { color: #9ca3af; }
}

/* ─── Mobile bottom-sheet ─── */
@media (max-width: 600px) {
    .mvr-modal { padding: 0; align-items: flex-end; }
    .mvr-modal__box {
        max-width: 100% !important;
        border-radius: 18px 18px 0 0;
        max-height: 92vh;
    }
    /* Portrait reels: batasi tinggi frame lebih ketat di mobile */
    .mvr-modal__player--portrait { max-height: 52vh; }
}

/* ─── Responsive kartu ─── */
@media (max-width: 479px) {
    .mvr-card--md { flex: 0 0 165px; }
}

/* ================================================================
   CAROUSEL KOMPAK — widget sidebar & bawah artikel
   ================================================================ */

/* Track: kartu lebih kecil, gap lebih rapat */
.mvr-grid--sm-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 3px;
    padding-left: 1px;
    padding-right: 1px;
}
.mvr-grid--sm-carousel::-webkit-scrollbar { display: none; }

/* Kartu compact: thumbnail atas, info bawah — lebar 140px */
.mvr-grid--sm-carousel .mvr-card--sm {
    /* Override layout: ubah jadi kolom (vertikal) */
    flex: 0 0 140px;
    flex-direction: column;
    gap: 0;
    padding-bottom: 0;
    border-bottom: none;
    background: var(--cbg, #fff);
    border-radius: var(--brad, 8px);
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,.07);
    scroll-snap-align: start;
    transition: box-shadow .18s, transform .18s;
    align-items: stretch;
}
.mvr-grid--sm-carousel .mvr-card--sm:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

/* Thumbnail mengisi penuh lebar kartu */
.mvr-grid--sm-carousel .mvr-card--sm .mvr-card__thumb-wrap {
    width: 100%;
    height: 80px;
    border-radius: 0;
}
.mvr-grid--sm-carousel .mvr-card--sm .mvr-card__thumb-wrap img {
    border-radius: 0;
}

/* Body: padding dalam */
.mvr-grid--sm-carousel .mvr-card--sm .mvr-card__body {
    padding: 7px 8px 9px;
}

/* Judul: max 3 baris, font lebih kecil */
.mvr-grid--sm-carousel .mvr-card--sm .mvr-card__title {
    font-size: 11.5px;
    -webkit-line-clamp: 3;
}

/* Arrow di carousel kompak: posisi tengah area thumbnail */
.mvr-carousel-wrap:has(.mvr-grid--sm-carousel) .mvr-arrow {
    top: 38px;   /* tengah thumbnail 80px */
}
