/* Services Section Styles with Enhanced Section Boundary */
.services {
    padding: clamp(6rem, 10vw, 10rem) 0;
    background: linear-gradient(to bottom, rgba(8, 12, 24, 0.98), rgba(11, 15, 28, 0.95));
    position: relative;
}

/* Enhanced section boundary at the top of the services section */
.services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        rgba(255, 123, 0, 0.35), 
        rgba(4, 102, 200, 0.35), 
        rgba(255, 123, 0, 0.35));
    opacity: 1;
    z-index: 1;
    box-shadow: 0 0 4px rgba(255, 123, 0, 0.1);
}

/* Add a subtle gradient shift below the boundary */
.services::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(to bottom, 
        rgba(255, 123, 0, 0.05), 
        rgba(4, 102, 200, 0.02), 
        transparent);
    opacity: 0.8;
    z-index: 0;
}

/* Adjust the mission section to create proper spacing */
.mission-section {
    padding-bottom: 8rem;
    position: relative;
}

/* Add a subtle gradient at the bottom of the mission section */
.mission-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, 
        rgba(8, 12, 24, 0.8), 
        transparent);
    opacity: 0.7;
    z-index: 1;
}

/* Responsive styles for services section */
.services .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.services-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Make the entire header area clearly clickable */
.service-item-header {
    cursor: pointer; /* Indicate clickability */
    padding: 1.5rem 1rem; /* Add vertical and horizontal padding */
    transition: background-color 0.3s ease; /* Smooth hover effect */
    position: relative; /* Needed for potential pseudo-elements */
    display: flex; /* Ensure flex properties apply */
    align-items: center; /* Vertically align content */
    justify-content: space-between; /* Space out elements */
}

/* Optional: Add a subtle hover effect */
.service-item-header:hover {
    background-color: rgba(255, 255, 255, 0.03); /* Very subtle highlight */
}


/* Responsive adjustments for different screen sizes */
@media (max-width: 992px) {
    .service-item-header h3 {
        font-size: clamp(1rem, 2.5vw, 1.4rem);
    }
}

@media (max-width: 768px) {
    .services {
        padding: clamp(4rem, 8vw, 8rem) 0;
    }
    
    .service-item-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .service-item-header h3 {
        font-size: clamp(0.9rem, 2vw, 1.2rem);
        white-space: normal;
    }
    
    .service-item-content {
        margin-left: 2rem;
    }
}

/* High-resolution devices with small viewports (like Pixel 9 Pro XL) */
@media (min-width: 390px) and (max-width: 767px) and (min-resolution: 2dppx) {
    .service-item-header h3 {
        font-size: 1rem;
        white-space: normal;
    }
    
    .service-item-content {
        margin-left: 2rem;
    }
    
    .service-item {
        padding: 1.5rem;
    }
}

/* Animation for content expansion/collapse */
.service-item-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease-in-out,
                margin-top 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* Smoother transition */
    margin-left: 4rem; /* Default margin */
    will-change: max-height, opacity; /* Performance hint */
}

.service-item.expanded .service-item-content {
    max-height: 2000px; /* Use a large fixed value for robust expansion */
    opacity: 1;
    margin-top: 2rem;
    overflow: visible !important; /* Ensure content is not clipped */
}

/* Staggered animation for list items */
@keyframes fadeInListItem {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-item.expanded .service-item-content ul li {
    opacity: 0; /* Start hidden */
    animation: fadeInListItem 0.5s ease forwards;
}

/* Apply stagger delay */
.service-item.expanded .service-item-content ul li:nth-child(1) { animation-delay: 0.1s; }
.service-item.expanded .service-item-content ul li:nth-child(2) { animation-delay: 0.15s; }
.service-item.expanded .service-item-content ul li:nth-child(3) { animation-delay: 0.2s; }
.service-item.expanded .service-item-content ul li:nth-child(4) { animation-delay: 0.25s; }
.service-item.expanded .service-item-content ul li:nth-child(5) { animation-delay: 0.3s; }
/* Add more if needed */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .service-item-content {
        transition: max-height 0.01s linear, opacity 0.01s linear, margin-top 0.01s linear; /* Faster, less noticeable transition */
    }
    
    .service-item.expanded .service-item-content ul li {
        opacity: 1; /* Show immediately */
        animation: none; /* Disable fade-in animation */
    }

    .expand-icon {
        transition: none; /* Disable icon rotation */
    }
}
