/* ═══════════════════════════════════════════════════════════
 * MK W8 Testimonials — Styles
 * All classes prefixed with .mk-w8t- to avoid collisions.
 * ═══════════════════════════════════════════════════════════ */

/* ── Section ─────────────────────────────────────────────── */
/*
 * The testimonials section uses the 100vw "break-out" trick so that the
 * grey background spans the full viewport edge-to-edge even when the
 * widget is dropped inside a boxed Elementor container (which is the
 * default for sections built via the Elementor container experiment).
 * The inner wrappers (.mk-w8t-wrapper / .mk-w8t-grid) keep their own
 * max-width so the actual card content stays centred and readable.
 *
 * Cards have avatars positioned at top:-50px and bleed UP out of the
 * card. The .mk-w8t-wrapper reserves padding-top:50px for them so they
 * stay inside the section's visual area — but they ALSO need to escape
 * any ancestor clipping (the parent Elementor container sometimes has
 * overflow:hidden). The carousel viewport is overflow-x:hidden but
 * vertically visible so the avatars on the to-slide-in cards aren't
 * chopped.
 */
.mk-w8t-section {
    padding: 80px 30px;
    background-color: #f8f8f8;
    position: relative;
    /* Break out of a boxed parent so the dark/grey band spans the viewport. */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    /* Avoid horizontal page-scroll caused by the 100vw break-out when a
       vertical scrollbar reserves space (Chrome/Edge on Windows). */
    box-sizing: border-box;
    max-width: 100vw;
    /* Don't clip the avatars or anything else inside the section. */
    overflow: visible;
}

/*
 * Defensive override: any Elementor container that DIRECTLY wraps the
 * mk_w8_testimonials widget would otherwise impose overflow:hidden on
 * the widget's contents, clipping avatars and arrows. The widget renders
 * its own boundaries, so allowing the parent to be visible is safe.
 */
.elementor-widget-mk_w8_testimonials,
.elementor-widget-mk_w8_testimonials .elementor-widget-container {
    overflow: visible !important;
}

.mk-w8t-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 10px;
}

.mk-w8t-subtitle {
    font-size: 1.1rem;
    color: #666;
    text-align: center;
    margin-bottom: 50px;
}

/* ── Card (shared across all modes) ──────────────────────── */
.mk-w8t-card {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 50px 30px 30px;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ── Avatar ──────────────────────────────────────────────── */
.mk-w8t-avatar {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid #333;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: #fff;
}

.mk-w8t-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* ── Name ────────────────────────────────────────────────── */
.mk-w8t-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 5px;
}

/* ── Role ────────────────────────────────────────────────── */
.mk-w8t-role {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: #999;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
}

/* ── Divider ─────────────────────────────────────────────── */
.mk-w8t-divider {
    width: 50px;
    height: 1px;
    background: #666;
    margin: 0 auto 25px;
}

/* ── Rating Stars ────────────────────────────────────────── */
.mk-w8t-rating {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.mk-w8t-star {
    color: #444;
    transition: color 0.2s ease;
}

.mk-w8t-star--filled {
    color: #fbbf24;
}

/* ── Quote / Content ─────────────────────────────────────── */
.mk-w8t-quote {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: #ccc;
    text-align: center;
    line-height: 1.8;
    position: relative;
}

.mk-w8t-quote::before {
    content: '\201C';
    font-size: 2.5rem;
    color: #444;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.6;
    line-height: 1;
}

.mk-w8t-quote p {
    margin-top: 0;
}

/* ── Read More ───────────────────────────────────────────── */
.mk-w8t-read-more {
    display: inline-block;
    margin-top: 10px;
    color: #999;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mk-w8t-read-more:hover {
    color: #fff;
}

/* ── Date ────────────────────────────────────────────────── */
.mk-w8t-date {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.75rem;
    color: #777;
    text-align: center;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── "View All" CTA ──────────────────────────────────────── */
.mk-w8t-view-all-wrap {
    text-align: center;
    margin-top: 50px;
}

.mk-w8t-view-all {
    display: inline-block;
    padding: 14px 36px;
    background: #b50a1e;
    color: #fff;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    border-radius: 2px;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 14px rgba(181, 10, 30, 0.25);
}

.mk-w8t-view-all:hover,
.mk-w8t-view-all:focus {
    background: #8a0717;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(181, 10, 30, 0.4);
}

@media (max-width: 768px) {
    .mk-w8t-view-all {
        padding: 12px 28px;
        font-size: 0.8rem;
        letter-spacing: 1.5px;
    }
    .mk-w8t-view-all-wrap {
        margin-top: 35px;
    }
}

/* ═══════════════════════════════════════════════════════════
 * CAROUSEL MODE
 * ═══════════════════════════════════════════════════════════ */
.mk-w8t-wrapper {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
    /* Room for avatars sticking out the top of each card (avatar is top: -50px).
       Because overflow:hidden clips at the padding edge (not the content edge),
       avatars positioned at top:-50px from each card sit at y=0 of the wrapper's
       content box (which is at padding-top:50px from the wrapper's padding edge)
       — so they're well INSIDE the clipping region and render normally.       */
    padding-top: 50px;
    /* Side padding gives the arrows their own gutter inside the boxed container
       so they never sit on top of the cards. Arrows are positioned at
       left/right:5px, which is INSIDE the wrapper, so they aren't clipped.    */
    padding-left: 60px;
    padding-right: 60px;
}

.mk-w8t-carousel {
    display: flex;
    gap: 30px;
    transition: transform 0.5s ease;
}

.mk-w8t-carousel .mk-w8t-card {
    flex: 0 0 calc(33.333% - 20px);
}

/* ── Navigation Arrows ───────────────────────────────────── */
.mk-w8t-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #666;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mk-w8t-nav:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.mk-w8t-prev {
    /* Sit inside the wrapper's 60px side padding so the arrow has a
       comfortable gutter between itself and the first card, but is
       still safely inside the boxed parent container's edge. */
    left: 5px;
}

.mk-w8t-next {
    right: 5px;
}

/* ── Dots ────────────────────────────────────────────────── */
.mk-w8t-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.mk-w8t-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease, transform 0.3s ease;
}

.mk-w8t-dot:hover {
    background: #999;
}

.mk-w8t-dot--active {
    background: #1a1a1a;
    transform: scale(1.2);
}

/* ═══════════════════════════════════════════════════════════
 * SLIDER MODE (single card, fade transition)
 * ═══════════════════════════════════════════════════════════ */
.mk-w8t-slider {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    min-height: 300px;
}

.mk-w8t-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.mk-w8t-slide--active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

.mk-w8t-slider .mk-w8t-card {
    max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════
 * GRID MODE
 * ═══════════════════════════════════════════════════════════ */
.mk-w8t-grid {
    display: grid;
    gap: 50px 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 50px; /* space for avatars */
}

.mk-w8t-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.mk-w8t-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mk-w8t-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ─── Scroll-capped grid ──────────────────────────────────────
 * When --mk-w8t-scroll-rows is set on the grid, cap its height so
 * only N rows are visible at once and the rest are reached by
 * vertical scrolling. Cards are ~360-440px tall depending on quote
 * length; we use a per-row estimate plus the gap to compute max-height.
 * ──────────────────────────────────────────────────────────── */
.mk-w8t-grid--scroll {
    /* Per-row height budget: card (≈ 380px) + grid row-gap (50px).
       Avatars overflow above the first row by 50px, hence the
       existing padding-top on .mk-w8t-grid is preserved.            */
    --mk-w8t-row-height: 460px;
    max-height: calc(
        var(--mk-w8t-scroll-rows, 4) * var(--mk-w8t-row-height)
        + 50px  /* padding-top reserved for first-row avatars */
        + 20px  /* breathing room so bottom row doesn't get clipped */
    );
    overflow-y: auto;
    overflow-x: hidden;
    /* Hint to the user that more content is below the fold. */
    -webkit-mask-image: linear-gradient(
        to bottom,
        #000 0,
        #000 calc(100% - 40px),
        rgba(0, 0, 0, 0.2) 100%
    );
            mask-image: linear-gradient(
        to bottom,
        #000 0,
        #000 calc(100% - 40px),
        rgba(0, 0, 0, 0.2) 100%
    );
    /* Inner padding so card box-shadows + avatar overflow don't get
       clipped by the overflow:hidden side of overflow-y:auto. */
    padding-right: 10px;
    padding-left: 10px;
    scrollbar-gutter: stable both-edges;
}

/* Custom scrollbar — match the dark theme */
.mk-w8t-grid--scroll::-webkit-scrollbar {
    width: 8px;
}
.mk-w8t-grid--scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
.mk-w8t-grid--scroll::-webkit-scrollbar-thumb {
    background: #b50a1e;
    border-radius: 4px;
}
.mk-w8t-grid--scroll::-webkit-scrollbar-thumb:hover {
    background: #d11227;
}
/* Firefox */
.mk-w8t-grid--scroll {
    scrollbar-color: #b50a1e rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
}

/* ═══════════════════════════════════════════════════════════
 * LIST MODE (full-width, expanded)
 * ═══════════════════════════════════════════════════════════ */
.mk-w8t-list {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 50px;
    padding-top: 50px; /* space for avatars */
}

.mk-w8t-list-mode .mk-w8t-card {
    padding: 50px 40px 40px;
}

.mk-w8t-list-mode .mk-w8t-quote {
    font-size: 1.15rem;
    text-align: left;
    font-style: normal;
}

.mk-w8t-list-mode .mk-w8t-quote::before {
    position: static;
    display: block;
    text-align: center;
    transform: none;
    margin-bottom: 10px;
}

.mk-w8t-list-mode .mk-w8t-quote p {
    margin-bottom: 0.8em;
}

.mk-w8t-list-mode .mk-w8t-quote p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
 * RESPONSIVE — Tablet (≤ 1024px)
 * ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .mk-w8t-carousel .mk-w8t-card {
        flex: 0 0 calc(50% - 15px);
    }

    .mk-w8t-section h2 {
        font-size: 2rem;
    }

    .mk-w8t-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .mk-w8t-prev {
        left: 0;
    }

    .mk-w8t-next {
        right: 0;
    }

    .mk-w8t-cols-3,
    .mk-w8t-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════
 * RESPONSIVE — Mobile (≤ 768px)
 * ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .mk-w8t-section {
        padding: 50px 20px;
    }

    .mk-w8t-carousel .mk-w8t-card {
        flex: 0 0 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .mk-w8t-avatar {
        width: 80px;
        height: 80px;
        top: -40px;
    }

    .mk-w8t-name {
        font-size: 1.3rem;
    }

    .mk-w8t-role {
        font-size: 0.7rem;
    }

    .mk-w8t-quote {
        font-size: 1rem;
    }

    .mk-w8t-section h2 {
        font-size: 1.8rem;
    }

    .mk-w8t-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }

    .mk-w8t-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .mk-w8t-prev {
        left: 10px;
        top: 40%;
    }

    .mk-w8t-next {
        right: 10px;
        top: 40%;
    }

    /* Grid: single column on mobile */
    .mk-w8t-cols-2,
    .mk-w8t-cols-3,
    .mk-w8t-cols-4 {
        grid-template-columns: 1fr;
    }

    /* Slider: reduce max-width */
    .mk-w8t-slider {
        max-width: 100%;
    }

    /* List mode: tighter padding */
    .mk-w8t-list-mode .mk-w8t-card {
        padding: 50px 25px 30px;
    }

    .mk-w8t-list-mode .mk-w8t-quote {
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════
 * HORIZONTAL SCROLLER MODE
 * Single horizontal row of cards. Native scroll-snap on touch
 * devices, optional arrow buttons on desktop, no autoplay.
 * ═══════════════════════════════════════════════════════════ */
.mk-w8t-scroller .mk-w8t-scroller-wrapper {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 50px; /* room for avatars sticking out the top */
}

.mk-w8t-scroller-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 10px 30px;
    margin: 0 -30px; /* let cards graze the edges without clipping shadows */
    -webkit-overflow-scrolling: touch;
}

.mk-w8t-scroller-track > .mk-w8t-card {
    flex: 0 0 320px;
    scroll-snap-align: start;
    margin-top: 50px; /* room for avatars sticking out the top */
}

/* Hide scrollbar on desktop, keep keyboard-/touch-scroll functional. */
.mk-w8t-scroller-track::-webkit-scrollbar {
    height: 0;
    background: transparent;
}

.mk-w8t-scroller-track {
    scrollbar-width: none; /* Firefox */
}

.mk-w8t-scroller-prev {
    left: -10px;
}

.mk-w8t-scroller-next {
    right: -10px;
}

/* Hide arrow buttons on touch devices — they get in the way of swipe. */
@media (hover: none) and (pointer: coarse) {
    .mk-w8t-scroller-prev,
    .mk-w8t-scroller-next {
        display: none;
    }
}

@media (max-width: 768px) {
    .mk-w8t-scroller-track > .mk-w8t-card {
        flex: 0 0 80vw;
        max-width: 320px;
    }

    .mk-w8t-scroller-track {
        padding: 10px 20px;
        margin: 0 -20px;
    }
}
