/* =============================================================================
   MT About Grid Widget — mtfe- prefix
   ============================================================================= */

.mtfe-about-grid {
    width: 100%;
    box-sizing: border-box;
}

/* ── Grid container ──────────────────────────────────────────────────────── */

.mtfe-about-grid__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

.mtfe-about-grid__grid--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.mtfe-about-grid__grid--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mtfe-about-grid__grid--cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ── Cell base + scroll-in animation (fade in from top with delay) ─────────── */

.mtfe-about-grid__cell {
    --cell-index: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    border-radius: 24px;
    overflow: hidden;
    padding: 32px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.55s ease-out, transform 0.4s ease-out;
    transition-delay: calc(var(--cell-index) * 80ms);
}

.mtfe-about-grid--in-view .mtfe-about-grid__cell,
.elementor-element-edit-mode .mtfe-about-grid__cell {
    opacity: 1;
    transform: translateY(0);
}

.mtfe-about-grid--in-view .mtfe-about-grid__cell:hover,
.elementor-element-edit-mode .mtfe-about-grid__cell:hover {
    transform: translateY(-6px);
    transition-delay: 0ms;
}

/* ── Text cell ───────────────────────────────────────────────────────────── */

.mtfe-about-grid__cell--text {
    /* layout controlled by inline justify-content from editor */
}

/* ── Image cell ──────────────────────────────────────────────────────────── */

.mtfe-about-grid__cell--image {
    padding: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* ── Video cell ──────────────────────────────────────────────────────────── */

.mtfe-about-grid__cell--video {
    padding: 0;
    /* Ensure the cell has enough height to show the video */
    min-height: 300px;
}

/* ── Eyebrow label ───────────────────────────────────────────────────────── */

.mtfe-about-grid__eyebrow {
    margin: 0 0 16px 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.85;
    line-height: 1.4;
}

/* ── Heading ─────────────────────────────────────────────────────────────── */

.mtfe-about-grid__heading {
    margin: 0 0 16px 0;
    line-height: 1.1;
    word-break: break-word;
}

/* ── Description ─────────────────────────────────────────────────────────── */

.mtfe-about-grid__description {
    margin: 0;
    line-height: 1.5;
}

.mtfe-about-grid__description p:last-child {
    margin-bottom: 0;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */

.mtfe-about-grid__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── Overlay text content (image / video) ────────────────────────────────── */

.mtfe-about-grid__overlay-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 32px;
    z-index: 2;
    box-sizing: border-box;
}

.mtfe-about-grid__overlay-heading {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    line-height: 1.2;
    word-break: break-word;
}

.mtfe-about-grid__overlay-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

/* ── Video ───────────────────────────────────────────────────────────────── */

.mtfe-about-grid__video-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.mtfe-about-grid__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mtfe-about-grid__iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Cover any container aspect ratio (portrait or landscape) with a 16:9 video */
    height: 100%;
    width: auto;
    aspect-ratio: 16 / 9;
    min-width: 100%;
    transform: translate(-50%, -50%);
    border: 0;
    pointer-events: none;
}

/* Editor placeholder for video blocks */
.mtfe-about-grid__video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.875rem;
    font-family: monospace;
}

/* ── Disable hover animation ─────────────────────────────────────────────── */

.mtfe-about-grid--no-hover .mtfe-about-grid__cell,
.mtfe-about-grid--no-hover.mtfe-about-grid--in-view .mtfe-about-grid__cell:hover,
.elementor-element-edit-mode .mtfe-about-grid--no-hover .mtfe-about-grid__cell:hover {
    transform: none !important;
    box-shadow: none !important;
    transition: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .mtfe-about-grid__grid--cols-3,
    .mtfe-about-grid__grid--cols-4 {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 767px) {
    .mtfe-about-grid__grid {
        grid-template-columns: 1fr !important;
    }

    .mtfe-about-grid__cell {
        grid-column: span 1 !important;
    }
}

/* =============================================================================
   MODERN LAYOUT — Asymmetric Editorial Grid
   ============================================================================= */

/* ── Grid ─────────────────────────────────────────────────────────────────── */

.mtfe-about-grid__grid--modern {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(260px, auto);
}

/*
 * Pattern (repeating every 6 cells):
 *  1 tall (rows 1–2, col 1)  |  2 short (row 1, col 2)
 *                            |  3 short (row 2, col 2)
 *  4 short (row 3, col 1)   |  5 tall (rows 3–4, col 2)
 *  6 short (row 4, col 1)   |
 */
.mtfe-about-grid__grid--modern .mtfe-about-grid__cell:nth-child(6n+1),
.mtfe-about-grid__grid--modern .mtfe-about-grid__cell:nth-child(6n+5) {
    grid-row: span 2;
}

/* ── Modern card style ────────────────────────────────────────────────────── */

.mtfe-about-grid--layout-modern .mtfe-about-grid__cell {
    border-radius: 24px;
    min-height: 260px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.35s ease;
    transition-delay: calc(var(--cell-index) * 80ms);
}

.mtfe-about-grid--layout-modern.mtfe-about-grid--in-view .mtfe-about-grid__cell:hover,
.elementor-element-edit-mode .mtfe-about-grid--layout-modern .mtfe-about-grid__cell:hover {
    transform: scale(1.025) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
    transition-delay: 0ms;
}

/* keep in-view lift override only for classic */
.mtfe-about-grid--layout-modern.mtfe-about-grid--in-view .mtfe-about-grid__cell,
.elementor-element-edit-mode .mtfe-about-grid--layout-modern .mtfe-about-grid__cell {
    transform: translateY(0);
}

/* ── Button ───────────────────────────────────────────────────────────────── */

.mtfe-about-grid__btn-wrap {
    margin-top: auto;
    padding-top: 20px;
}

.mtfe-about-grid__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: gap 0.2s ease, background 0.25s ease, color 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Solid */
.mtfe-about-grid__btn--solid {
    background: #111;
    color: #fff;
    border: 2px solid #111;
}
.mtfe-about-grid__btn--solid:hover {
    background: transparent;
    color: #111;
}

/* Outline */
.mtfe-about-grid__btn--outline {
    background: transparent;
    color: currentColor;
    border: 2px solid currentColor;
}
.mtfe-about-grid__btn--outline:hover {
    box-shadow: inset 0 0 0 2px currentColor;
    opacity: 0.8;
}

/* Ghost / Arrow */
.mtfe-about-grid__btn--ghost {
    background: transparent;
    color: currentColor;
    border: none;
    padding-left: 0;
    padding-right: 0;
    border-radius: 0;
}
.mtfe-about-grid__btn--ghost:hover {
    gap: 14px;
}

/* Arrow icon */
.mtfe-about-grid__btn-arrow {
    display: inline-block;
    font-style: normal;
    transition: transform 0.2s ease;
    line-height: 1;
}
.mtfe-about-grid__btn:not(.mtfe-about-grid__btn--ghost):hover .mtfe-about-grid__btn-arrow {
    transform: translateX(3px);
}

/* ── Modern responsive ────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .mtfe-about-grid__grid--modern {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: minmax(260px, auto);
    }
}

@media (max-width: 767px) {
    .mtfe-about-grid__grid--modern {
        grid-template-columns: 1fr !important;
        grid-auto-rows: auto !important;
    }

    .mtfe-about-grid__grid--modern .mtfe-about-grid__cell {
        grid-row: span 1 !important;
        min-height: 280px;
    }
}

/* =============================================================================
   BENTO LAYOUT — Free Span Grid
   ============================================================================= */

/* ── Grid ─────────────────────────────────────────────────────────────────── */

.mtfe-about-grid__grid--bento {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(200px, auto);
}

/* ── Bento card style ─────────────────────────────────────────────────────── */

.mtfe-about-grid--layout-bento .mtfe-about-grid__cell {
    border-radius: 20px;
    min-height: 200px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease;
    transition-delay: calc(var(--cell-index) * 60ms);
}

.mtfe-about-grid--layout-bento.mtfe-about-grid--in-view .mtfe-about-grid__cell:hover,
.elementor-element-edit-mode .mtfe-about-grid--layout-bento .mtfe-about-grid__cell:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
                0 0 0 2px rgba(255, 255, 255, 0.6) inset;
    transition-delay: 0ms;
}

/* keep in-view base state for bento (override the classic translateY) */
.mtfe-about-grid--layout-bento.mtfe-about-grid--in-view .mtfe-about-grid__cell,
.elementor-element-edit-mode .mtfe-about-grid--layout-bento .mtfe-about-grid__cell {
    transform: translateY(0);
}

/* ── Bento responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .mtfe-about-grid__grid--bento {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(180px, auto);
    }

    .mtfe-about-grid__grid--bento .mtfe-about-grid__cell {
        grid-column: span 1 !important;
    }
}

@media (max-width: 767px) {
    .mtfe-about-grid__grid--bento {
        grid-template-columns: 1fr !important;
        grid-auto-rows: auto !important;
    }

    .mtfe-about-grid__grid--bento .mtfe-about-grid__cell {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 220px;
    }
}
