/* ==========================================================================
   Web Development Section
   ========================================================================== */

/* CSS Variables for consistency */
:root {
    --text-dark-mode: #FFFFFF;
    --text-light-mode: #000000;
    --card-bg-dark-mode: rgba(0, 0, 0, 0.7);
    --card-bg-light-mode: rgba(255, 255, 255, 0.8);
    --text-shadow-dark-mode: 0 0 4px rgba(0, 0, 0, 0.5);
    --button-shadow-dark-mode: 0 0 15px rgba(255, 255, 255, 0.5);
    --button-shadow-light-mode: 0 0 15px rgba(0, 0, 0, 0.3);
}

/* Ensure container visibility and prevent horizontal overflow */
#desarrollo-web {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 100px !important;
    overflow-x: hidden !important; /* Prevent horizontal scrollbar */
}

/* Dark Mode (default) */
#desarrollo-web h1,
#desarrollo-web h2,
#desarrollo-web h3,
#desarrollo-web p,
#desarrollo-web a,
#desarrollo-web img {
    color: var(--text-dark-mode) !important;
    text-shadow: var(--text-shadow-dark-mode) !important;
    display: block !important;
    visibility: visible !important;
    z-index: 10 !important;
    position: relative !important;
}

/* Ensure buttons are visible */
#desarrollo-web a.pulse-button {
    display: inline-block !important;
    color: var(--text-dark-mode) !important;
}

/* Card containers */
#desarrollo-web .trust-block-container,
#desarrollo-web .service-block-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 24px !important;
    padding: 0 16px !important;
    justify-items: center !important;
}

#desarrollo-web .client-block-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important; /* Increased min width for larger cards */
    gap: 24px !important;
    padding: 0 16px !important;
    justify-items: center !important;
}

/* Card blocks */
#desarrollo-web .trust-block,
#desarrollo-web .service-block {
    width: 100% !important;
    max-width: 360px !important; /* Original max width for other cards */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

#desarrollo-web .client-block {
    width: 100% !important;
    max-width: 480px !important; /* Increased max width for larger client cards */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Card content */
#desarrollo-web .trust-block .content,
#desarrollo-web .service-block .content {
    background: var(--card-bg-dark-mode) !important;
    backdrop-filter: blur(12px) !important;
    border-radius: 8px !important;
    padding: 24px !important;
    z-index: 5 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 240px !important; /* Fixed height for text-based cards */
    box-sizing: border-box !important;
    visibility: visible !important;
    transition: transform 0.4s ease-out, z-index 0.4s ease-out !important; /* Smoother scaling transition */
}

#desarrollo-web .client-block .content {
    background: var(--card-bg-dark-mode) !important;
    backdrop-filter: blur(12px) !important;
    border-radius: 8px !important;
    padding: 24px !important;
    z-index: 5 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: auto !important; /* Allow height to adapt to content */
    box-sizing: border-box !important;
    visibility: visible !important;
    transition: transform 0.4s ease-out, z-index 0.4s ease-out !important; /* Smoother scaling transition */
}

/* Hover effect for cards */
#desarrollo-web .trust-block .content:hover,
#desarrollo-web .service-block .content:hover,
#desarrollo-web .client-block .content:hover {
    transform: scale(1.05) !important; /* Scale up on hover */
    z-index: 10 !important; /* Ensure card is above others */
}

/* Card text */
#desarrollo-web .trust-block .content h3,
#desarrollo-web .service-block .content h3,
#desarrollo-web .client-block .content h3 {
    color: var(--text-dark-mode) !important;
    font-size: 1.5rem !important;
    margin-bottom: 12px !important;
    font-weight: 600 !important;
    text-align: center !important; /* Center titles for all cards */
}

#desarrollo-web .trust-block .content p,
#desarrollo-web .service-block .content p {
    color: var(--text-dark-mode) !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    margin-bottom: 16px !important;
    flex-grow: 1 !important; /* Ensure text takes available space */
}

#desarrollo-web .service-block .content a,
#desarrollo-web .client-block .content a {
    color: var(--text-dark-mode) !important;
    display: inline-block !important;
    text-align: center !important;
    align-self: center !important; /* Center button horizontally */
    margin-top: auto !important; /* Push button to bottom */
}

/* Client preview images */
#desarrollo-web .client-block .content .client-preview-img {
    width: 100% !important;
    max-height: 360px !important; /* Increased max height for larger images */
    object-fit: contain !important; /* Respect intrinsic aspect ratio */
    border-radius: 12px !important; /* Pronounced rounded border */
    margin-bottom: 16px !important;
}

/* Explore Our Services Section */
#desarrollo-web .explore-services {
    padding: 4rem 1rem !important;
}

#desarrollo-web .explore-services h2 {
    color: var(--text-dark-mode) !important;
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    margin-bottom: 3rem !important;
}

#desarrollo-web .explore-services .service-subsection {
    margin-bottom: 3rem !important;
}

#desarrollo-web .explore-services .service-subsection h3 {
    color: var(--text-dark-mode) !important;
    font-size: 1.75rem !important;
    font-weight: 600 !important;
    margin-bottom: 1.5rem !important;
}

#desarrollo-web .explore-services .service-description {
    background: var(--card-bg-dark-mode) !important;
    backdrop-filter: blur(12px) !important;
    border-left: 4px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    padding: 1.5rem !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

#desarrollo-web .explore-services .service-description:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

#desarrollo-web .explore-services .service-description h3 {
    margin-bottom: 1rem !important;
}

#desarrollo-web .explore-services .service-description p {
    color: var(--text-dark-mode) !important;
    font-size: 1.125rem !important;
    line-height: 1.75 !important;
    margin-bottom: 1rem !important;
    text-align: left !important;
}

#desarrollo-web .explore-services .service-description p:last-child {
    margin-bottom: 0 !important;
}

body.light-mode #desarrollo-web .explore-services h2,
body.light-mode #desarrollo-web .explore-services h3,
body.light-mode #desarrollo-web .explore-services .service-description p {
    color: var(--text-light-mode) !important;
}

body.light-mode #desarrollo-web .explore-services .service-description {
    background: var(--card-bg-light-mode) !important;
    border-left: 4px solid rgba(0, 0, 0, 0.3) !important;
}

body.light-mode #desarrollo-web .explore-services .service-description:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Languages We Master Section */
#desarrollo-web .section .container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 16px !important;
    box-sizing: border-box !important; /* Ensure padding doesn't cause overflow */
}

#desarrollo-web .section .overflow-x-hidden {
    overflow-x: hidden !important; /* Prevent horizontal scrollbar */
    position: relative !important;
    width: 100% !important; /* Ensure full width */
    box-sizing: border-box !important;
}

#desarrollo-web .animate-scroll {
    display: flex !important;
    flex-wrap: nowrap !important; /* Prevent wrapping to ensure horizontal scroll */
    animation: scroll 20s linear infinite !important;
    will-change: transform !important;
    width: auto !important; /* Adjust width to prevent overflow */
    min-width: 100% !important; /* Ensure container is at least as wide as viewport */
}

#desarrollo-web .language-item {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    padding: 10px 15px !important; /* Reduced padding to minimize width */
    min-width: 120px !important; /* Reduced min-width for better fit */
    opacity: 1 !important; /* Ensure visibility by default */
    transform: none !important; /* Remove transform for testing */
    transition: opacity 0.5s ease, transform 0.5s ease !important;
}

#desarrollo-web .language-item.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Staggered animation delays */
#desarrollo-web .language-item:nth-child(1) { transition-delay: 0.1s !important; }
#desarrollo-web .language-item:nth-child(2) { transition-delay: 0.2s !important; }
#desarrollo-web .language-item:nth-child(3) { transition-delay: 0.3s !important; }
#desarrollo-web .language-item:nth-child(4) { transition-delay: 0.4s !important; }
#desarrollo-web .language-item:nth-child(5) { transition-delay: 0.5s !important; }

#desarrollo-web .language-item img {
    width: 40px !important;
    height: 40px !important;
    margin-right: 10px !important;
    object-fit: contain !important;
    display: block !important;
}

#desarrollo-web .language-item span {
    color: var(--text-dark-mode) !important;
    font-size: 1.125rem !important;
    font-weight: 500 !important;
    display: block !important;
}

/* Animation for continuous scroll */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Pause animation on hover */
#desarrollo-web .animate-scroll:hover {
    animation-play-state: paused !important;
}

/* Light Mode */
body.light-mode #desarrollo-web h1,
body.light-mode #desarrollo-web h2,
body.light-mode #desarrollo-web h3,
body.light-mode #desarrollo-web p,
body.light-mode #desarrollo-web a,
body.light-mode #desarrollo-web img,
body.light-mode #desarrollo-web .language-item span {
    color: var(--text-light-mode) !important;
    text-shadow: none !important;
}

body.light-mode #desarrollo-web a.pulse-button {
    color: var(--text-light-mode) !important;
}

body.light-mode #desarrollo-web .trust-block .content,
body.light-mode #desarrollo-web .service-block .content,
body.light-mode #desarrollo-web .client-block .content {
    background: var(--card-bg-light-mode) !important;
    backdrop-filter: blur(12px) !important;
}

body.light-mode #desarrollo-web .trust-block .content h3,
body.light-mode #desarrollo-web .trust-block .content p,
body.light-mode #desarrollo-web .service-block .content h3,
body.light-mode #desarrollo-web .service-block .content p,
body.light-mode #desarrollo-web .service-block .content a,
body.light-mode #desarrollo-web .client-block .content h3,
body.light-mode #desarrollo-web .client-block .content p,
body.light-mode #desarrollo-web .client-block .content a {
    color: var(--text-light-mode) !important;
}

body.light-mode #desarrollo-web .client-block .content .client-preview-img {
    color: var(--text-light-mode) !important; /* Ensure consistency, though not directly applicable to img */
}

/* Pulse animation for buttons */
.pulse-button {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pulse-button:hover {
    transform: scale(1.1);
    box-shadow: var(--button-shadow-dark-mode);
}

.pulse-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    animation: pulse 2s ease-out infinite;
}

body.light-mode .pulse-button:hover {
    box-shadow: var(--button-shadow-light-mode);
}

body.light-mode .pulse-button::after {
    background: rgba(0, 0, 0, 0.1);
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #desarrollo-web .trust-block-container,
    #desarrollo-web .service-block-container {
        grid-template-columns: 1fr !important; /* Single column for other cards on mobile */
        gap: 16px !important;
    }

    #desarrollo-web .client-block-container {
        grid-template-columns: 1fr !important; /* Single column for client cards on mobile */
        gap: 16px !important;
    }

    #desarrollo-web .trust-block .content,
    #desarrollo-web .service-block .content {
        min-height: 200px !important; /* Adjusted height for text-based cards on mobile */
        padding: 16px !important;
    }

    #desarrollo-web .client-block .content {
        height: auto !important; /* Allow height to adapt to content on mobile */
        padding: 16px !important;
    }

    #desarrollo-web .client-block {
        max-width: 360px !important; /* Reduced max width for mobile */
    }

    #desarrollo-web .client-block .content .client-preview-img {
        max-height: 260px !important; /* Slightly smaller max height for mobile */
    }

    #desarrollo-web .explore-services {
        padding: 2rem 1rem !important;
    }

    #desarrollo-web .explore-services h2 {
        font-size: 1.75rem !important;
        margin-bottom: 2rem !important;
    }

    #desarrollo-web .explore-services .service-subsection h3 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    #desarrollo-web .explore-services .service-description {
        padding: 1rem !important;
    }

    #desarrollo-web .explore-services .service-description p {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
    }
}