/* ============================================================
   MF Swiper Slider — Frontend
   ============================================================ */

/* Reset Elementor widget container padding nếu có */
.elementor-widget-mf-swiper-slider,
.elementor-widget-mf-swiper-slider .elementor-widget-container,
.elementor-widget-mf-posts-slider,
.elementor-widget-mf-posts-slider .elementor-widget-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}

.mf-swiper-wrapper {
    position: relative;
    width: 100%;
}

/* ── Slide ─────────────────────────────────────────────────── */
.mf-swiper-wrapper,
.mf-swiper,
.mf-swiper-wrapper > .swiper-wrapper,
.mf-swiper-wrapper > .swiper > .swiper-wrapper,
.mf-swiper-wrapper > .swiper > .swiper-wrapper > .swiper-slide {
    height: 100vh;
    /* dvh: dynamic viewport height — tự trừ thanh địa chỉ trình duyệt mobile */
    height: 100dvh;
}

.mf-slide-inner {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.mf-slide-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
}

/* Mobile: đảm bảo full width kể cả khi Elementor section có padding */
@media (max-width: 767px) {
    .mf-swiper-wrapper {
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
    }

    .mf-swiper-wrapper,
    .mf-swiper,
    .mf-swiper-wrapper > .swiper-wrapper,
    .mf-swiper-wrapper > .swiper > .swiper-wrapper,
    .mf-swiper-wrapper > .swiper > .swiper-wrapper > .swiper-slide {
        height: 100vh;
        height: 100dvh;
    }
}

.mf-slide-link {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* ── Caption ───────────────────────────────────────────────── */
.mf-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 18px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
    z-index: 3;
}

/* ── Play Button ── vị trí bottom-right, hình tròn ────────── */
.mf-play-btn {
    background: rgba(32, 34, 38, 0.7);
    position: absolute;
    right: calc(calc(100vw - 57.292rem) / 2);
    z-index: 9;
    bottom: 150px !important;
    right: calc(calc(100vw - 57.292rem) / 2) !important;
    width: 7.5rem !important;
    height: 7.5rem !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    /* Tạo stacking context riêng để z-index của ::before/::after hoạt động đúng */
    isolation: isolate;
}

/* Triangle icon — nằm trên ring và pulse */
.mf-play-triangle {
    position: relative;
    z-index: 3;
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    /* Scale theo button: ~30% chiều cao, ~35% chiều rộng của 7.5rem */
    border-width: 1.3rem 0 1.3rem 2.2rem;
    border-color: transparent transparent transparent #fff;
    margin-left: 0.4rem;
    flex-shrink: 0;
    pointer-events: none;
}

/* ── Spinning ring ───────────────────────────────────────── */
.mf-play-ring {
    position: absolute;
    inset: -6px !important;
    border-radius: 50%;
    border: 2px solid transparent;
    /* Arc sáng ở trên, mờ dần 2 bên, tắt ở dưới */
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.35);
    border-bottom-color: transparent;
    border-left-color: rgba(255, 255, 255, 0.35);
    animation: mfSpin 2.5s linear infinite;
    pointer-events: none;
    z-index: 2;
    box-sizing: border-box;
}

@keyframes mfSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Pulse rings — z-index: -1 để nằm sau triangle ──────── */
.mf-play-btn::before,
.mf-play-btn::after {
    content: "";
    position: absolute;
    /* !important để override giá trị cũ Elementor lưu trong database */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    z-index: -1;
    animation: mfPulse 2.4s ease-out infinite;
    pointer-events: none;
}

.mf-play-btn::after {
    animation-delay: 1.2s;
}

@keyframes mfPulse {
    0% {
        transform: scale(1);
        opacity: 0.65;
    }
    60% {
        transform: scale(1.9);
        opacity: 0;
    }
    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

/* ── Swiper Nav / Dots ─────────────────────────────────────── */
.mf-swiper .swiper-button-prev,
.mf-swiper .swiper-button-next {
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background 0.2s;
}

.mf-swiper .swiper-button-prev:hover,
.mf-swiper .swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.mf-swiper .swiper-button-prev::after,
.mf-swiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: 700;
}

.mf-swiper .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.55;
}

.mf-swiper .swiper-pagination-bullet-active {
    opacity: 1;
}

/* ============================================================
   MF Posts Slider — Project Card
   ============================================================ */

.mf-posts-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.mf-posts-swiper {
    overflow: visible;
    padding-bottom: 20px;
    height: auto;
}

.mf-posts-swiper .swiper-wrapper {
    height: auto;
}

.mf-posts-swiper .swiper-slide {
    height: auto;
}

/* Card wrapper */
.mf-project-card {
    margin: 0;
    padding: 0;
}

/* Grid layout: info | photo */
.project-card__link {
    display: grid;
    grid-template-columns: 20% minmax(0, 1fr);
    align-items: center;
    text-decoration: none;
    color: inherit;
}

/* Info box — chồng lên ảnh */
.project-card__info {
    box-shadow: rgba(0, 0, 0, 0.7) 0px 4px 30px 0px;
    margin-right: -150px;
    position: relative;
    z-index: 1;
    background: #ffffff;
    padding: 2.25rem 1.625rem;
}

.project-card__date {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.6rem;
}

.project-card__name {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card__name:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.project-card__desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Photo */
.project-card__photo {
    overflow: hidden;
    position: relative;
}

.project-card__photo img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
}

/* Inactive slides: mờ hơn */
.mf-posts-swiper .swiper-slide {
    opacity: 0.5;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mf-posts-swiper .swiper-slide-active {
    opacity: 1;
}

/* Mobile */
@media (max-width: 767px) {
    .project-card__link {
        grid-template-columns: 1fr;
    }

    .project-card__info {
        margin-right: 0;
        margin-bottom: -40px;
    }

    .project-card__photo img {
        height: 240px;
    }
}

/* Editor: tắt animation để không gây rối khi preview */
.mf-editor-preview .mf-play-btn::before,
.mf-editor-preview .mf-play-btn::after,
.mf-editor-preview .mf-play-ring {
    animation: none;
    opacity: 0;
}
