@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

.aafe-morphing-feature-pills-wrapper h1,
.aafe-morphing-feature-pills-wrapper h2,
.aafe-morphing-feature-pills-wrapper h3,
.aafe-morphing-feature-pills-wrapper h4,
.aafe-morphing-feature-pills-wrapper h5,
.aafe-morphing-feature-pills-wrapper h6 {
    font-family: 'Inter Tight', sans-serif;
}
.aafe-morphing-feature-pills-wrapper p,
.aafe-morphing-feature-pills-wrapper span,
.aafe-morphing-feature-pills-wrapper li,
.aafe-morphing-feature-pills-wrapper a,
.aafe-morphing-feature-pills-wrapper label,
.aafe-morphing-feature-pills-wrapper button {
    font-family: 'Inter', sans-serif;
}

/* ================================================
   GLOBAL RESET WITHIN WIDGET
   ================================================ */
.aafe-morphing-feature-pills-wrapper,
.aafe-morphing-feature-pills-wrapper *,
.aafe-morphing-feature-pills-wrapper *::before,
.aafe-morphing-feature-pills-wrapper *::after {
    box-sizing: border-box !important;
}

/* ================================================
   BASE WRAPPER
   ================================================ */
.aafe-morphing-feature-pills-wrapper {
    width: 100%;
    max-width: 100%;
    /* Prevent horizontal overflow */
    overflow-x: hidden;
    position: relative;
}

/* ================================================
   LAYOUT — GRID
   ================================================ */
.aafe-morphing-feature-pills__container {
    display: grid;
    grid-template-columns: var(--aafe-mfp-col-left, 1fr) var(--aafe-mfp-col-right, 1fr);
    gap: var(--aafe-mfp-gap, 40px);
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Tablet (769px – 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .aafe-morphing-feature-pills__container {
        gap: var(--aafe-mfp-gap, 28px);
    }
}

/* Mobile (≤ 768px) — stack vertically */
@media (max-width: 768px) {
    .aafe-morphing-feature-pills-wrapper .aafe-morphing-feature-pills__container {
        display: flex;
        flex-direction: var(--aafe-mfp-mobile-dir, column);
        gap: var(--aafe-mfp-gap, 16px);
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        overflow-x: hidden;
    }
}

/* ================================================
   LEFT COLUMN
   ================================================ */
.aafe-morphing-feature-pills__left {
    display: flex;
    flex-direction: column;
    gap: var(--aafe-mfp-item-gap, 16px);
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 768px) {
    .aafe-morphing-feature-pills-wrapper .aafe-morphing-feature-pills__left {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        align-items: stretch;
    }
}

/* ================================================
   PILL ITEM — BASE
   ================================================ */
.aafe-morphing-feature-pills__item {
    background-color: #2a2a2a;
    border-radius: var(--aafe-mfp-pill-radius, 40px);
    padding: var(--aafe-mfp-pill-padding, 12px 24px);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    max-width: min(var(--aafe-mfp-pill-max-width, 400px), 100%);
    width: fit-content;
    transform: var(--aafe-mfp-pill-transform, none);
    min-width: 0;
    transition:
        width            var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        transform        var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        background-color var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        border-color     var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        box-shadow       var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        border-radius    var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        padding          var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        max-width        var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1);
}

/* Active pill — card state */
.aafe-morphing-feature-pills__item.is-active {
    background-color: #2a2a2a;
    border-radius: var(--aafe-mfp-card-radius, 24px);
    padding: var(--aafe-mfp-card-padding, 24px);
    max-width: 100%;
    cursor: default;
    width: 100%;
    transform: none !important;
}

/* ── MOBILE: Prevent Overflow & Clamp Widths ── */
@media (max-width: 768px) {
    /* Maximum specificity to override Elementor overflow bugs without breaking layout controls */
    html body .elementor-widget .aafe-morphing-feature-pills-wrapper {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    html body .elementor-widget .aafe-morphing-feature-pills__container {
        max-width: 100% !important;
    }
    html body .elementor-widget .aafe-morphing-feature-pills__left,
    html body .elementor-widget .aafe-morphing-feature-pills__right {
        max-width: 100% !important;
    }
    html body .elementor-widget .aafe-morphing-feature-pills__item {
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* ================================================
   PILL INNER LAYOUT
   ================================================ */
.aafe-morphing-feature-pills__pill-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
}

/* ================================================
   PILL CONTENT WRAPPERS — JS ANIMATED HEIGHT
   CSS handles opacity/visibility; JS sets height
   via inline style for perfectly smooth animation.
   ================================================ */
.aafe-morphing-feature-pills__pill-wrapper {
    overflow: hidden;
    /* height set by JS: starts at natural height, animates to 0 */
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        height      0.36s cubic-bezier(0.25, 1, 0.5, 1),
        opacity     0.25s ease,
        visibility  0.25s ease;
}

.aafe-morphing-feature-pills__item.is-active .aafe-morphing-feature-pills__pill-wrapper {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* height animated to 0 by JS */
}

/* Card wrapper — JS sets height from 0 to scrollHeight */
.aafe-morphing-feature-pills__card-wrapper {
    overflow: hidden;
    /* starts at height: 0 set by JS */
    height: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Absolute position prevents inactive card content from stretching the pill width */
    position: absolute;
    width: 100%;
    transition:
        height      0.42s cubic-bezier(0.25, 1, 0.5, 1),
        opacity     0.3s  ease 0.06s,
        visibility  0.3s  ease 0.06s;
}

.aafe-morphing-feature-pills__item.is-active .aafe-morphing-feature-pills__card-wrapper {
    /* height animated to scrollHeight by JS, then set to 'auto' */
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.aafe-morphing-feature-pills__item.is-active .aafe-morphing-feature-pills__card-wrapper,
.aafe-morphing-feature-pills__item.is-closing .aafe-morphing-feature-pills__card-wrapper {
    position: relative;
    width: auto;
}

.aafe-morphing-feature-pills__card-inner {
    width: 100%;
    min-width: 0;
    /* Ensure content wraps and doesn't blow out */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ================================================
   PILL HOVER
   ================================================ */
.aafe-morphing-feature-pills__item:not(.is-active):hover {
    transform: var(--aafe-mfp-pill-transform-hover, translateY(-4px));
}

/* ================================================
   PILL TITLE
   ================================================ */
.aafe-morphing-feature-pills__pill-title {
    color: var(--aafe-mfp-pill-color, #fff);
    margin: 0;
    transition: color var(--aafe-mfp-hover-duration, 0.4s) ease;
    /* Default: allow wrapping on all screens */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    min-width: 0;
    flex: 1 1 auto;
    /* No overflow:hidden — that clips text rendering */
}



/* Desktop only: single-line with ellipsis */
@media (min-width: 769px) {
    .aafe-morphing-feature-pills__pill-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: unset;
        max-width: calc(100% - 40px); /* leave room for icon */
    }
}

.aafe-morphing-feature-pills__item:not(.is-active):hover .aafe-morphing-feature-pills__pill-title {
    color: var(--aafe-mfp-pill-color-hover, var(--aafe-mfp-pill-color, #fff));
}

/* ================================================
   ICON
   ================================================ */
.aafe-morphing-feature-pills__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--aafe-mfp-icon-box-size, 28px);
    height: var(--aafe-mfp-icon-box-size, 28px);
    min-width: var(--aafe-mfp-icon-box-size, 28px);
    background-color: var(--aafe-mfp-icon-bg, rgba(255,255,255,0.12));
    border-radius: 50%;
    color: var(--aafe-mfp-icon-color, #aaa);
    font-size: var(--aafe-mfp-icon-size, 12px);
    flex-shrink: 0;
    transition:
        background-color var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        color            var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1),
        transform        var(--aafe-mfp-hover-duration, 0.4s) cubic-bezier(0.25, 1, 0.5, 1);
}
.aafe-morphing-feature-pills__item:not(.is-active):hover .aafe-morphing-feature-pills__icon {
    background-color: var(--aafe-mfp-icon-bg-hover, rgba(255,255,255,0.22));
    color: var(--aafe-mfp-icon-color-hover, var(--aafe-mfp-icon-color, #aaa));
    transform: rotate(45deg);
}
.aafe-morphing-feature-pills__icon i,
.aafe-morphing-feature-pills__icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: block;
}

/* ================================================
   CARD CONTENT
   ================================================ */
.aafe-morphing-feature-pills__card-title {
    color: var(--aafe-mfp-card-title-color, #fff);
    margin: 0 0 var(--aafe-mfp-card-title-margin, 10px) 0;
    word-break: break-word;
    overflow-wrap: break-word;
}
.aafe-morphing-feature-pills__card-desc {
    color: var(--aafe-mfp-card-desc-color, #aaa);
    margin: 0;
    line-height: 1.65;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ================================================
   CARD BUTTON
   ================================================ */
.aafe-morphing-feature-pills__card-btn {
    display: inline-block;
    margin-top: var(--aafe-mfp-card-btn-margin-top, 16px);
    background-color: var(--aafe-mfp-card-btn-bg, transparent);
    color: var(--aafe-mfp-card-btn-color, #ffffff);
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.3s ease,
        color            0.3s ease,
        border-color     0.3s ease,
        box-shadow       0.3s ease;
    border-radius: 4px;
    max-width: 100%;
    word-break: break-word;
}
.aafe-morphing-feature-pills__card-btn:hover {
    background-color: var(--aafe-mfp-card-btn-bg-hover, transparent);
    color: var(--aafe-mfp-card-btn-color-hover, #ffffff);
}

/* ================================================
   RIGHT COLUMN — MEDIA CONTAINER
   ================================================ */
.aafe-morphing-feature-pills__right {
    position: relative;
    border-radius: var(--aafe-mfp-media-radius, 24px);
    background-color: var(--aafe-mfp-media-bg, #1a1a1a);
    overflow: hidden;
    min-height: var(--aafe-mfp-media-min-height, 500px);
    display: flex;
    flex-shrink: 0;
    transition:
        border-color 0.3s ease,
        box-shadow   0.3s ease;
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .aafe-morphing-feature-pills__right {
        min-height: var(--aafe-mfp-media-min-height, 400px);
    }
}

/* ── MOBILE MEDIA ──
   --aafe-mfp-mobile-h is set by JS from the Elementor control.
   Falls back to 220px. !important overrides the desktop var.
   ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .aafe-morphing-feature-pills-wrapper .aafe-morphing-feature-pills__right {
        width: 100% !important;
        max-width: 100% !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        /* Default: image on top (JS adds .media-top / .media-bottom class) */
        order: -1 !important;
    }
    .aafe-morphing-feature-pills-wrapper .aafe-morphing-feature-pills__container.media-bottom .aafe-morphing-feature-pills__right {
        order: 1 !important;
    }
    .aafe-morphing-feature-pills-wrapper .aafe-morphing-feature-pills__container.media-top .aafe-morphing-feature-pills__right {
        order: -1 !important;
    }
}

/* ================================================
   AUTO-ADVANCE PROGRESS BAR
   ================================================ */
.aafe-morphing-feature-pills__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--aafe-mfp-progress-color, rgba(255,255,255,0.7));
    z-index: 10;
    border-radius: 0 2px 2px 0;
    pointer-events: none;
}

/* ================================================
   CLOSE BUTTON
   ================================================ */
.aafe-morphing-feature-pills__close-btn {
    position: absolute;
    top: var(--aafe-mfp-close-pos-top, 14px);
    right: var(--aafe-mfp-close-pos-right, 14px);
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    background-color: var(--aafe-mfp-close-bg, rgba(255,255,255,0.15));
    color: var(--aafe-mfp-close-color, #fff);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.7) rotate(-45deg);
    transition:
        background-color 0.3s cubic-bezier(0.25, 1, 0.5, 1),
        color            0.3s cubic-bezier(0.25, 1, 0.5, 1),
        transform        0.3s cubic-bezier(0.25, 1, 0.5, 1),
        opacity          0.3s cubic-bezier(0.25, 1, 0.5, 1),
        box-shadow       0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 0;
    border: none;
    outline: none;
    border-radius: 50%;
    flex-shrink: 0;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}
.aafe-morphing-feature-pills__close-btn i { font-size: inherit; line-height: 1; display: block; pointer-events: none; }
.aafe-morphing-feature-pills__close-btn svg { width: 1em; height: 1em; display: block; fill: currentColor; pointer-events: none; }
.aafe-morphing-feature-pills__right.has-active .aafe-morphing-feature-pills__close-btn {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) rotate(0deg);
}
.aafe-morphing-feature-pills__close-btn:hover {
    background-color: var(--aafe-mfp-close-bg-hover, rgba(255,255,255,0.28));
    color: var(--aafe-mfp-close-color-hover, #fff);
}

/* ================================================
   MEDIA ITEMS — CROSSFADE
   ================================================ */
.aafe-morphing-feature-pills__media {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.04);
    transition:
        opacity    var(--aafe-morphing-feature-pills-media-duration, 0.55s) cubic-bezier(0.25, 1, 0.5, 1),
        transform  var(--aafe-morphing-feature-pills-media-duration, 0.55s) cubic-bezier(0.25, 1, 0.5, 1),
        visibility var(--aafe-morphing-feature-pills-media-duration, 0.55s) ease;
    z-index: 1;
}
.aafe-morphing-feature-pills__media.is-active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 2;
}
.aafe-morphing-feature-pills__media img,
.aafe-morphing-feature-pills__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ================================================
   ENTRANCE ANIMATIONS — KEYFRAMES
   ================================================ */
@keyframes aafe-morphing-feature-pills-fade-up {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes aafe-morphing-feature-pills-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes aafe-morphing-feature-pills-slide-left {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes aafe-morphing-feature-pills-slide-right {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes aafe-morphing-feature-pills-scale-up {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes aafe-morphing-feature-pills-clip-reveal {
    from { clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); opacity: 0; }
    to   { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 1; }
}
@keyframes aafe-morphing-feature-pills-flip {
    from { opacity: 0; transform: perspective(600px) rotateX(-18deg); }
    to   { opacity: 1; transform: perspective(600px) rotateX(0deg); }
}

.aafe-morphing-feature-pills-wrapper [data-aafe-animate] {
    opacity: 0;
    animation-fill-mode: forwards;
}
.aafe-morphing-feature-pills-wrapper [data-aafe-animate].aafe-morphing-feature-pills--visible {
    animation-duration: var(--aafe-morphing-feature-pills-duration, 600ms);
    animation-timing-function: var(--aafe-morphing-feature-pills-ease, cubic-bezier(0.25, 1, 0.5, 1));
}
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="fade-up"].aafe-morphing-feature-pills--visible    { animation-name: aafe-morphing-feature-pills-fade-up; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="fade-in"].aafe-morphing-feature-pills--visible    { animation-name: aafe-morphing-feature-pills-fade-in; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="slide-left"].aafe-morphing-feature-pills--visible  { animation-name: aafe-morphing-feature-pills-slide-left; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="slide-right"].aafe-morphing-feature-pills--visible { animation-name: aafe-morphing-feature-pills-slide-right; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="scale-up"].aafe-morphing-feature-pills--visible   { animation-name: aafe-morphing-feature-pills-scale-up; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="clip-reveal"].aafe-morphing-feature-pills--visible { animation-name: aafe-morphing-feature-pills-clip-reveal; }
.aafe-morphing-feature-pills-wrapper [data-aafe-animate="flip"].aafe-morphing-feature-pills--visible       { animation-name: aafe-morphing-feature-pills-flip; }

/* ================================================
   PREFERS REDUCED MOTION
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    .aafe-morphing-feature-pills-wrapper [data-aafe-animate] { opacity: 1 !important; animation: none !important; }
    .aafe-morphing-feature-pills__item,
    .aafe-morphing-feature-pills__pill-wrapper,
    .aafe-morphing-feature-pills__card-wrapper,
    .aafe-morphing-feature-pills__icon,
    .aafe-morphing-feature-pills__pill-title,
    .aafe-morphing-feature-pills__media,
    .aafe-morphing-feature-pills__close-btn,
    .aafe-morphing-feature-pills__card-btn,
    .aafe-morphing-feature-pills__right { transition: none !important; animation: none !important; }
    .aafe-morphing-feature-pills__media { opacity: 0; visibility: hidden; transform: none; }
    .aafe-morphing-feature-pills__media.is-active { opacity: 1; visibility: visible; }
    .aafe-morphing-feature-pills__pill-wrapper { opacity: 1; visibility: visible; }
    .aafe-morphing-feature-pills__item.is-active .aafe-morphing-feature-pills__pill-wrapper { opacity: 0; visibility: hidden; }
    .aafe-morphing-feature-pills__card-wrapper { height: 0; opacity: 0; visibility: hidden; }
    .aafe-morphing-feature-pills__item.is-active .aafe-morphing-feature-pills__card-wrapper { height: auto; opacity: 1; visibility: visible; }
    .aafe-morphing-feature-pills__close-btn { opacity: 0; transform: none; }
    .aafe-morphing-feature-pills__right.has-active .aafe-morphing-feature-pills__close-btn { opacity: 1; pointer-events: auto; }
}

/* ================================================
   FOCUS — Keyboard Accessibility
   ================================================ */
.aafe-morphing-feature-pills__item:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 3px;
}
.aafe-morphing-feature-pills__close-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 3px;
}
