/* ==========================================================
   JT MAISON — Ecosystem Widget
   ========================================================== */

.jtm-ecosystem {
    width: 100%;
    padding: 120px 10px;
    background: var(--jtm-white);
    box-sizing: border-box;
    overflow: hidden;
}

.jtm-ecosystem__inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.jtm-ecosystem__header {
    max-width: 650px;
    margin-bottom: 100px;
}

.jtm-ecosystem__subtitle {
    font-family: var(--jtm-font-ui);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--jtm-dark);
    text-transform: uppercase;
    margin: 0 0 16px 0;
    font-weight: 500;
}

.jtm-ecosystem__title {
    font-family: var(--jtm-font-ui);
    font-size: clamp(32px, 5vw, 42px);
    font-weight: bold;
    color: var(--jtm-dark);
    margin: 0 0 24px 0;
    line-height: 1.2;
}

.jtm-ecosystem__desc {
    font-family: var(--jtm-font-ui);
    font-size: 16px;
    color: rgba(0,0,0,0.6);
    line-height: 1.6;
    margin: 0;
}

/* Grid */
.jtm-ecosystem__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: flex-start;
}

.jtm-ecosystem__card {
    padding: 0 40px;
    border-left: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.jtm-ecosystem__card:first-child {
    border-left: none;
    padding-left: 0;
}

.jtm-ecosystem__card:last-child {
    padding-right: 0;
}

/* Stagger the middle card */
.jtm-ecosystem__card:nth-child(2) {
    margin-top: 140px;
}

.jtm-ecosystem__card-icon {
    height: 30px;
    margin-bottom: 24px;
}

.jtm-ecosystem__card-icon img {
    height: 100%;
    width: auto;
    display: block;
}

.jtm-ecosystem__card-title {
    font-family: var(--jtm-font-ui);
    font-size: 32px;
    font-weight: bold;
    color: var(--jtm-dark);
    margin: 0 0 16px 0;
}

.jtm-ecosystem__card-desc {
    font-family: var(--jtm-font-ui);
    font-size: 18px;
    color: rgba(0,0,0,0.5);
    line-height: 1.6;
    margin: 0;
}

/* Button (hollow border) */
.jtm-ecosystem__card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    padding: 16px 32px;
    font-family: var(--jtm-font-ui);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--jtm-dark);
    border: 1px solid rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.jtm-ecosystem__card-btn:hover {
    background: var(--jtm-dark);
    color: var(--jtm-white);
    border-color: var(--jtm-dark);
}

/* Swipe Indicator (Hidden on Desktop) */
.jtm-ecosystem__swipe {
    display: none;
}

/* Responsive Tablet */
@media (max-width: 1024px) {
    .jtm-ecosystem {
        padding: 80px 24px;
    }
    
    .jtm-ecosystem__card {
        padding: 0 20px;
    }
    
    .jtm-ecosystem__card:nth-child(2) {
        margin-top: 0; /* Remove stagger on tablet to save vertical space */
    }
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .jtm-ecosystem {
        padding: 60px 24px;
    }
    
    .jtm-ecosystem__header {
        margin-bottom: 60px;
    }
    
    .jtm-ecosystem__grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        gap: 0;
        margin: 0 -24px;
        padding: 0 24px;
    }
    
    .jtm-ecosystem__grid::-webkit-scrollbar {
        display: none;
    }
    
    .jtm-ecosystem__card {
        flex: 0 0 85%;
        scroll-snap-align: start;
        border-left: none; /* Remove left border */
        border-right: 1px solid rgba(0,0,0,0.06); /* Add right border instead so it separates items while scrolling */
        padding: 0 24px 0 0;
        margin-right: 24px;
        margin-top: 0 !important; /* Remove the stagger! */
    }
    
    .jtm-ecosystem__card:last-child {
        border-right: none;
        margin-right: 24px; /* Space at end of scroll */
    }
    
    /* Swipe Arrow on Mobile */
    .jtm-ecosystem__swipe {
        display: block;
        margin-top: 40px;
        color: var(--jtm-dark);
        opacity: 0.5;
        cursor: pointer;
        width: max-content;
    }
}

/* === ENTRANCE ANIMATIONS === */
.jtm-ecosystem__subtitle,
.jtm-ecosystem__title,
.jtm-ecosystem__desc,
.jtm-ecosystem__card {
    opacity: 1;
    transform: translateX(-60px);
    clip-path: inset(0 100% 0 0);
    transition: transform 1.8s cubic-bezier(0.25, 1, 0.5, 1), clip-path 1.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, clip-path;
}

/* Staggered card slides (custom border transition for hover) */
.jtm-ecosystem__card {
    transform: translateX(-60px);
    transition: transform 1.8s cubic-bezier(0.25, 1, 0.5, 1), clip-path 1.8s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.5s ease;
}

/* --- TRIGGERED STATES (is-visible) --- */
.jtm-ecosystem.is-visible .jtm-ecosystem__subtitle,
.jtm-ecosystem.is-visible .jtm-ecosystem__title,
.jtm-ecosystem.is-visible .jtm-ecosystem__desc,
.jtm-ecosystem.is-visible .jtm-ecosystem__card {
    transform: translateX(0);
    clip-path: inset(0 0 0 0);
}

.jtm-ecosystem.is-visible .jtm-ecosystem__subtitle { transition-delay: 0.1s; }
.jtm-ecosystem.is-visible .jtm-ecosystem__title { transition-delay: 0.25s; }
.jtm-ecosystem.is-visible .jtm-ecosystem__desc { transition-delay: 0.4s; }

/* Staggered card reveals */
.jtm-ecosystem.is-visible .jtm-ecosystem__card:nth-child(1) { transition-delay: 0.5s; }
.jtm-ecosystem.is-visible .jtm-ecosystem__card:nth-child(2) { transition-delay: 0.7s; }
.jtm-ecosystem.is-visible .jtm-ecosystem__card:nth-child(3) { transition-delay: 0.9s; }


/* --- CARD HOVER MICRO-INTERACTIONS --- */
.jtm-ecosystem__card:hover {
    transform: translateY(-8px);
    border-left-color: var(--jtm-dark);
}

/* Card elements transitions */
.jtm-ecosystem__card-icon img {
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.jtm-ecosystem__card-title {
    transition: color 0.4s ease;
}

.jtm-ecosystem__card-desc {
    transition: color 0.4s ease;
}

/* Hover shifts */
.jtm-ecosystem__card:hover .jtm-ecosystem__card-icon img {
    transform: translateY(-4px) scale(1.08);
}

.jtm-ecosystem__card:hover .jtm-ecosystem__card-title {
    color: #666;
}

.jtm-ecosystem__card:hover .jtm-ecosystem__card-desc {
    color: rgba(0,0,0,0.7);
}

/* Prevent animations/hiding in Elementor active editor preview */
.elementor-editor-active .jtm-ecosystem__header,
.elementor-editor-active .jtm-ecosystem__card,
.elementor-editor-active .jtm-ecosystem__title,
.elementor-editor-active .jtm-ecosystem__subtitle,
.elementor-editor-active .jtm-ecosystem__desc,
.elementor-editor-active .jtm-ecosystem__card-icon img,
.elementor-editor-active .jtm-ecosystem__card-title,
.elementor-editor-active .jtm-ecosystem__card-desc {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    clip-path: none !important;
    letter-spacing: 0.1em !important;
}
