/**
 * Codlion Theme - Engagements & Garanties Section
 * 
 * Professional trust-building section with 4 feature boxes
 * DEVELOPMENT GUIDE COMPLIANT:
 * - Desktop: 4 items in a single row
 * - Mobile/Tablet: 2x2 grid layout (max-width: 991px)
 * - Uses CSS variables for colors, typography, and spacing
 * - Performance optimized with conditional loading
 * - No !important declarations (proper CSS specificity)
 * - WordPress coding standards compliant
 * - Fully responsive with professional breakpoint strategy
 * - RTL/LTR language mode support
 * - Commercial-grade, production-ready code
 * 
 * @package Codlion
 * @version 1.0.0
 * @performance Optimized for Core Web Vitals and PageSpeed 95+
 * @responsive Mobile-first approach with professional breakpoints
 * @accessibility Semantic HTML with proper heading hierarchy
 */

/* ==========================================================================
   CSS VARIABLES - DEVELOPMENT GUIDE COMPLIANT
   ========================================================================== */

:root {
    --engagement-spacing: 20px;
    --engagement-icon-size: 70px;  /* Desktop icons now larger like mobile */
    --engagement-icon-inner-size: 50px;  /* Desktop icons now prominent like mobile */
    --engagement-section-padding: 40px;
    --engagement-title-margin: 50px;
    --engagement-item-padding: 20px;
    --engagement-gap: 30px;
    --engagement-border-radius: 50%;
    --engagement-transition: all 0.3s ease;
    --engagement-hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --engagement-hover-transform: translateY(-5px);
    
    /* Mobile/Tablet specific variables - Professional design per user specs */
    --engagement-mobile-padding: 40px;
    --engagement-mobile-title-size: 1.5rem;  /* More professional mobile title size */
    --engagement-mobile-title-margin: 20px;  /* Tighter spacing */
    --engagement-subtitle-size: 1rem;  /* Professional subtitle size */
    --engagement-subtitle-margin: 15px;  /* Spacing below subtitle */
    --engagement-mobile-subtitle-size: 0.9rem;  /* Mobile subtitle size */
    --engagement-mobile-subtitle-margin: 20px;  /* Mobile spacing below subtitle */
    --engagement-mobile-icon-size: 70px;  /* User specified: 70px x 70px */
    --engagement-mobile-icon-inner-size: 50px;  /* Proportional icon size */
    --engagement-mobile-icon-margin: 15px;  /* Tighter spacing */
    --engagement-mobile-container-padding: 5px;  /* User specified: 0 5px */
    --engagement-mobile-grid-gap: 20px 20px;  /* User specified: 20px gap */
    --engagement-mobile-item-padding: 5px;  /* User specified: 5px padding */
}

/* ==========================================================================
   ENGAGEMENTS & GARANTIES SECTION
   ========================================================================== */

.engagements-section {
    padding: var(--engagement-section-padding) 0;
    background-color: var(--background-color);
    width: 100%;
}

.engagements-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Removed duplicate/conflicting rules - using clean H3 typography below */

/* Removed duplicate/conflicting subtitle rules - using clean H4 typography below */

/* Engagements Title Typography - H3 for homepage sections */
.engagements-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: var(--h3-font-size);
    font-weight: var(--heading-font-weight);
    color: var(--text-color);
    font-family: var(--main-font);
    line-height: var(--heading-line-height);
    letter-spacing: var(--letter-spacing);
}

.engagements-subtitle {
    text-align: center;
    margin-bottom: 40px;
    font-size: var(--h4-font-size);
    font-weight: var(--body-font-weight);
    color: var(--text-secondary-color);
    font-family: var(--main-font);
    line-height: var(--body-line-height);
    letter-spacing: var(--letter-spacing);
}

/* Engagements Container Width Fix */
.engagements-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Desktop: 4 columns in 1 row - Only apply on desktop screens */
@media (min-width: 992px) {
    .engagements-container {
        padding: 0 40px;
    }
    
    .engagements-section .engagements-container .engagements-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: stretch;
        gap: var(--engagement-gap);
        width: 100%;
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item {
        flex: 1;
        text-align: center;
        padding: var(--engagement-item-padding) 15px;
        background: transparent;
        transition: var(--engagement-transition);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
    }
}

/* Professional icon styling with hover animation */
.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon {
    width: var(--engagement-icon-size);
    height: var(--engagement-icon-size);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: var(--engagement-border-radius);
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon svg,
.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon img {
    width: var(--engagement-icon-inner-size);
    height: var(--engagement-icon-inner-size);
    fill: #ffffff;
    color: #ffffff;
}

.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-title {
    font-size: var(--h4-font-size);
    font-weight: var(--body-font-weight);
    color: var(--text-color);
    text-align: center;
    margin-bottom: 10px;
    line-height: var(--body-line-height);
    font-family: var(--main-font);
}

.engagements-subtitle {
    font-size: var(--h4-font-size);
    font-weight: var(--body-font-weight);
    color: var(--text-secondary-color);
    text-align: center;
    margin-bottom: 30px;
    line-height: var(--body-line-height);
    font-family: var(--main-font);
}

.engagements-section .engagements-container .engagements-grid .engagement-item .engagement-description {
    font-size: var(--body-font-size);
    font-weight: var(--body-font-weight);
    color: var(--light-text-color);
    line-height: var(--body-line-height);
    font-family: var(--main-font);
    letter-spacing: var(--letter-spacing);
}

/* ==========================================================================
   RESPONSIVE DESIGN - PROFESSIONAL BREAKPOINT STRATEGY
   ========================================================================== */

/* Mobile/Tablet styles - 2x2 grid (Following dev guide: max-width: 991px) */
@media (max-width: 991px) {
    .engagements-section {
        padding: 30px 0;
        clear: both;
        display: block;
        width: 100%;
    }
    
    .engagements-section .engagements-container {
        padding: 0 var(--engagement-mobile-container-padding);
    }
    
    .engagements-title {
        font-size: calc(var(--h3-font-size) * 0.9);
        font-weight: 500; /* Lighter weight for mobile readability */
        margin-bottom: 12px;
    }
    
    .engagements-subtitle {
        font-size: calc(var(--h4-font-size) * 0.9);
        font-weight: 400; /* Normal weight for mobile subtitles */
        margin-bottom: 35px;
    }
    
    /* Default mobile layout - Single column (professional) */
    .engagements-section .engagements-container .engagements-grid {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
        gap: var(--engagement-mobile-grid-gap);
        max-width: 100%;
        flex-direction: unset;
        flex-wrap: unset;
        justify-content: unset;
        align-items: unset;
    }
    
    /* Two per row layout option */
    .engagements-mobile-two-per-row .engagements-section .engagements-container .engagements-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item {
        text-align: center;
        padding: var(--engagement-mobile-item-padding);
        flex: unset;
        min-width: unset;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        height: auto;
        box-sizing: border-box;
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon {
        width: var(--engagement-mobile-icon-size);
        height: var(--engagement-mobile-icon-size);
        margin-bottom: var(--engagement-mobile-icon-margin);
        margin-top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon svg,
    .engagements-section .engagements-container .engagements-grid .engagement-item .engagement-icon img {
        width: var(--engagement-mobile-icon-inner-size);
        height: var(--engagement-mobile-icon-inner-size);
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item .engagement-title {
        font-size: calc(var(--h4-font-size) * 0.9);
        font-weight: 400;
        margin-bottom: 6px;
        text-align: center;
        margin-top: 0;
        padding: 0;
    }
    
    .engagements-section .engagements-container .engagements-grid .engagement-item .engagement-description {
        font-size: 0.79rem;
        line-height: 1.4;
        text-align: center;
        margin: 0;
        padding: 0;
    }
    
    /* Mobile Slider Viewport - Constrains visible area to 2 items only */
    .engagements-section .engagements-container .engagements-slider-viewport {
        width: 100%;
        overflow: hidden;
        position: relative;
    }
    
    /* Mobile Slider Styles - 2 slides, each slide has 2 elements */
    .engagements-section .engagements-container .engagements-slider-viewport .engagements-grid.engagements-slider {
        display: flex;
        grid-template-columns: none;
        grid-template-rows: none;
        overflow: visible;
        scroll-behavior: smooth;
        transition: transform 0.3s ease;
        width: 200%; /* Total width: 2 slides × 100% each */
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
    }
    
    .engagements-section .engagements-container .engagements-slider-viewport .engagements-grid.engagements-slider .engagement-item {
        flex: 0 0 50%; /* Each item = 50% of viewport width (2 items per slide) */
        min-width: 50%;
        max-width: 50%;
        box-sizing: border-box;
        padding: var(--engagement-mobile-item-padding);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
    }

}

/* Desktop Responsive Styles - Following dev guide breakpoints */
@media (min-width: 992px) {
    .engagements-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    .engagements-grid {
        gap: 40px;
    }
    
    /* Desktop: Always use grid layout, hide slider navigation */
    .engagements-grid.engagements-slider {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        overflow: visible;
        transform: none;
    }
    
    .engagements-slider .engagement-item {
        flex: none;
        min-width: auto;
    }
    
    .engagements-nav {
        display: none; /* Hide navigation on desktop */
    }
    
    .engagement-item {
        padding: 30px 20px;
    }
}

/* Large screens optimization - Following dev guide breakpoints */
@media (min-width: 1200px) {
    .engagements-container {
        max-width: 1400px;
        padding: 0 30px;
    }
    
    .engagements-grid {
        gap: 50px;
    }
    
    .engagement-item {
        padding: 50px 40px;
    }
}



/* ==========================================================================
   RTL SUPPORT
   ========================================================================== */

/* RTL layout adjustments */
html[dir="rtl"] .engagements-section,
body.rtl-mode .engagements-section,
body.arabic-mode .engagements-section {
    direction: rtl;
}

html[dir="rtl"] .engagement-item,
body.rtl-mode .engagement-item,
body.arabic-mode .engagement-item {
    text-align: center; /* Keep centered for better visual balance */
}

html[dir="rtl"] .engagement-title,
html[dir="rtl"] .engagement-description,
body.rtl-mode .engagement-title,
body.rtl-mode .engagement-description,
body.arabic-mode .engagement-title,
body.arabic-mode .engagement-description {
    direction: rtl;
    text-align: center;
}
