/* ═══════════════════════════════════════════════════════
   MOBILE / TABLET  – accordion cards  (all breakpoints)
   ═══════════════════════════════════════════════════════ */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card-mini {
    background: #fdfdfd;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.feature-card-mini:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transform: translateY(-5px);
    border-color: var(--kirvia-purple);
}

.feature-card-mini .icon {
    font-size: 2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.feature-card-mini .icon svg {
    width: 1em;
    height: 1em;
    color: var(--kirvia-purple, #7c5cbf);
}

.feature-card-mini h4 {
    margin-bottom: 10px;
    color: var(--kirvia-dark);
}

.feature-card-mini p {
    font-size: 0.9rem;
    color: #666;
}

.feature-card-mini.is-selected {
    border-color: var(--kirvia-green) !important;
    background-color: #f0faf1 !important;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(6, 173, 47, 0.15);
}

/* Accordion expand box */
.feature-detail-box {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, margin-top 0.3s;
    background: #f9f9ff;
    border-radius: 20px;
    margin-top: 0;
    scroll-margin-top: 80px;
}

.feature-detail-box.active {
    max-height: 1000px;
    margin-top: 40px;
    border: 2px solid #eee;
    padding: 40px;
}

.detail-text { flex: 1; }

.detail-image {
    flex: 1;
    text-align: center;
}

.detail-image img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ── Desktop layout hidden on mobile/tablet ── */
.features-desktop-layout { display: none; }

/* ═══════════════════════════════════════════════════════
   MOBILE OVERRIDES  (max-width: 768px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hero-container,
    .feature-item,
    .feature-item.reverse {
        flex-direction: column;
        text-align: center;
    }

    .hero-text h1 { font-size: 2.4rem; }

    .feature-detail {
        background: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        margin-top: 0 !important;
        box-shadow: none !important;
    }

    .feature-detail-text,
    .feature-detail-img {
        width: 100%;
        text-align: center;
    }

    .detail-text { flex: 1; }
    .detail-image { flex: none; }

    .detail-img {
        max-width: 150px;
        height: auto;
        border-radius: 8px;
        cursor: pointer;
    }

    .image-detail-text,
    .image-detail-img {
        width: 100%;
        text-align: center;
    }
}

/* ── Very small screens ── */
@media (max-width: 480px) {
    .image-detail-text h3 { font-size: 1.4rem; }
    .image-detail-text p  { font-size: 0.9rem; }
    .image-detail-img img {
        max-height: 40vh;
        max-width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════
   IMAGE LIGHTBOX MODAL  (shared, all breakpoints)
   ═══════════════════════════════════════════════════════ */
.image-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-detail-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.image-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.image-detail-content {
    position: relative;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.98);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

@media (min-width: 769px) {
    .image-detail-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }
    .image-detail-text,
    .image-detail-img {
        width: auto;
        text-align: left;
    }
}

.image-detail-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
}

.image-detail-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════
   DESKTOP LAYOUT  (min-width: 1024px)
   Sidebar tabs + content panel
   Mobile accordion is hidden at this size.
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

    /* Hide mobile accordion grid & detail box */
    .features-mobile-grid,
    .feature-detail-box {
        display: none !important;
    }

    /* Show desktop layout */
    .features-desktop-layout {
        display: flex;
        align-items: stretch;
        gap: 32px;
        min-height: 480px;
    }

    /* ── Sidebar ── */
    .features-sidebar {
        flex: 0 0 30%;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0;
    }

    .feat-tab {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 16px 20px;
        border: 2px solid transparent;
        border-radius: 12px;
        background: transparent;
        cursor: pointer;
        text-align: left;
        transition: all 0.3s ease;
        position: relative;
    }

    .feat-tab:hover {
        background: #f5f4ff;
        border-left-color: var(--kirvia-purple, #7c5cbf);
        transform: translateX(4px);
    }

    .feat-tab.active {
        background: #ffffff;
        border: 2px solid var(--kirvia-purple, #7c5cbf);
        box-shadow: 0 4px 14px rgba(124, 92, 191, 0.12);
        transform: translateX(4px);
    }

    .feat-tab-icon {
        font-size: 1.5rem;
        flex-shrink: 0;
        line-height: 1;
        display: flex;
        align-items: center;
    }
    
    .feat-tab-icon svg {
        width: 1em;
        height: 1em;
        color: #4b5563; /* neutral color by default */
        transition: color 0.3s ease;
    }
    
    .feat-tab:hover .feat-tab-icon svg,
    .feat-tab.active .feat-tab-icon svg {
        color: var(--kirvia-purple, #7c5cbf);
    }

    .feat-tab-label {
        font-size: 0.95rem;
        font-weight: 600;
        color: #374151;
        line-height: 1.3;
    }

    .feat-tab.active .feat-tab-label {
        color: var(--kirvia-purple, #7c5cbf);
        font-weight: 700;
    }

    /* ── Content panel ── */
    .features-panel {
        flex: 1;
        background: #ffffff;
        border-radius: 16px;
        border: 1px solid #f1f5f9;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
        padding: 48px 40px;
        display: flex;
        align-items: center;
        justify-content: center; /* helps center the placeholder horizontally */
        overflow: hidden;
        transition: opacity 0.3s ease;
    }

    .fpanel-placeholder {
        text-align: center;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        opacity: 0;
        animation: panelFadeIn 0.5s ease forwards;
    }

    .placeholder-title {
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--kirvia-dark, #1a1a2e);
        margin-bottom: 12px;
    }

    .placeholder-desc {
        font-size: 1.1rem;
        color: #64748b;
        max-width: 450px;
        line-height: 1.6;
    }

    .fpanel-inner {
        display: flex;
        align-items: center;
        gap: 40px;
        width: 100%;
    }

    .fpanel-text {
        flex: 1;
    }

    .fpanel-title {
        font-size: 1.9rem;
        font-weight: 700;
        color: var(--kirvia-dark, #1a1a2e);
        margin-bottom: 16px;
        line-height: 1.2;
    }

    .fpanel-desc {
        font-size: 1.05rem;
        color: #4b5563;
        line-height: 1.75;
        max-width: 480px;
    }

    .fpanel-image {
        flex: 0 0 45%;
        text-align: center;
    }

    .fpanel-img {
        max-width: 100%;
        max-height: 320px;
        object-fit: contain;
        border-radius: 12px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
        cursor: pointer;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .fpanel-img:hover {
        transform: scale(1.03);
        box-shadow: 0 20px 48px rgba(0, 0, 0, 0.14);
    }

    /* Fade animation when switching tabs */
    .features-panel.panel-fade {
        animation: panelFadeIn 0.35s ease forwards;
    }

    @keyframes panelFadeIn {
        from { opacity: 0; transform: translateX(12px); }
        to   { opacity: 1; transform: translateX(0); }
    }
}