/* Enhanced Custom Styles to extend Tailwind */
html {
    overflow-x: hidden; /* Prevents horizontal scroll */
    max-width: 100vw; /* Prevents viewport from exceeding screen width */
    /* Optimize for scroll performance */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto; /* Changed to auto for better performance */
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden; /* Prevents horizontal scroll from decorative elements */
    max-width: 100vw; /* Prevents viewport from exceeding screen width */
    scroll-behavior: auto; /* Changed to auto for better scroll performance */
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #374151; /* gray-700 - cleaner base text */
    line-height: 1.6;
    letter-spacing: -0.01em;
}

/* Clean typography hierarchy - inspired by Continero */
h1, h2, h3, h4, h5, h6 {
    color: #1e293b; /* slate-800 - professional dark */
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

p {
    color: #4b5563; /* gray-600 */
    line-height: 1.7;
}

/* Primary brand color - clean blue like Continero */
:root {
    --primary: #3b82f6; /* blue-500 */
    --primary-dark: #2563eb; /* blue-600 */
    --accent: #f97316; /* orange-500 */
}

/* Loading indicator styles */
#loading-indicator {
    transition: opacity 0.3s ease-out;
}

#loading-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Enhanced focus styles for better accessibility */
*:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Style for the small red dot next to 'Career' */
.career-dot::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #ef4444; /* red-500 */
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: super;
}

/* Enhanced tech logo animations */
.tech-logo {
    transition: opacity 0.2s ease-out;
}

.tech-logo:hover {
    opacity: 0.8;
}

/* Enhanced mobile overlay menu with better animations */
#mobile-menu-overlay {
    transform: translateY(-100%); /* Start off-screen upwards */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    overflow-y: auto; /* Allow scrolling if menu content exceeds height */
    /* Removed backdrop-filter for better scroll performance */
    background: rgba(255, 255, 255, 0.98);
}

#mobile-menu-overlay.open {
    transform: translateY(0); /* Slide into view */
    opacity: 1;
}

/* Enhanced mobile menu navigation items */
#mobile-menu-overlay nav a {
    position: relative;
    border-radius: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    letter-spacing: 0.01em;
    text-align: center;
}

#mobile-menu-overlay nav a:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(249, 115, 22, 0.08));
    color: #4f46e5;
}

#mobile-menu-overlay nav a:active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(249, 115, 22, 0.12));
}

/* Mobile menu divider styling */
#mobile-menu-overlay .border-t {
    border-color: rgba(229, 231, 235, 0.8);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

/* Ensure footer links are clickable on mobile */
footer {
    position: relative;
    z-index: 35;
}

footer a {
    position: relative;
    z-index: 1;
    pointer-events: auto !important;
    touch-action: manipulation;
    cursor: pointer;
    min-height: 44px; /* Minimum touch target size for mobile */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced mobile dropdown content with smooth animations */
.mobile-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    width: 100%; /* Ensure it takes full width in mobile menu */
    opacity: 0;
}

.mobile-dropdown-content.expanded {
    max-height: 1000px; /* Generous value to ensure full content display */
    opacity: 1;
}

/* Enhanced dropdown arrow rotation */
.mobile-dropdown-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-dropdown-toggle.active svg {
    transform: rotate(180deg);
}

/* Enhanced service card animations */
.service-card {
    transition: box-shadow 0.2s ease-out;
}

.service-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Enhanced button animations */
.btn-primary {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Enhanced text animations */
.text-animate {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced scroll to top button */
#scrollToTopBtn {
    transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out;
    z-index: 1000;
}

#scrollToTopBtn:hover {
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

/* Enhanced focus ring for better accessibility */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

/* Enhanced hover effects for interactive elements */
.hover-lift {
    transition: transform 0.2s ease-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Enhanced loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Enhanced responsive typography */
@media (max-width: 640px) {
    .text-responsive {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }
}

/* Prevent horizontal scrolling on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        position: relative;
    }
    
    /* Ensure box-sizing is border-box for all elements */
    *, *::before, *::after {
        box-sizing: border-box;
    }
    
    /* Constrain media elements */
    img, video, iframe {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Constrain containers */
    .container {
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        overflow-x: hidden;
    }
    
    /* Ensure flex and grid containers don't overflow */
    .flex, [class*="grid"], nav, section, div {
        max-width: 100%;
    }
    
    /* Constrain header elements */
    header {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Fix image overlap issues on mobile */
    section {
        position: relative;
        overflow: visible;
    }
    
    /* Ensure proper spacing between sections on mobile */
    section + section {
        margin-top: 3rem !important;
    }
    
    /* Prevent image overflow in services section */
    .grid img {
        margin-bottom: 2rem;
        display: block;
    }
    
    /* Ensure services section text doesn't overlap image on mobile */
    section[aria-labelledby="services-heading"] > div.text-center {
        margin-bottom: 3rem !important;
        padding-bottom: 2rem !important;
        position: relative;
        z-index: 10;
        background-color: transparent;
    }
    
    section[aria-labelledby="services-heading"] > div.text-center p {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        display: block;
    }
    
    /* Ensure grid has spacing from text above */
    section[aria-labelledby="services-heading"] > .grid {
        margin-top: 4rem !important;
        padding-top: 2rem !important;
        position: relative;
        z-index: 1;
    }
    
    /* Ensure service cards appear before image on mobile */
    section[aria-labelledby="services-heading"] .order-first {
        margin-bottom: 4rem !important;
        margin-top: 0 !important;
        padding-bottom: 2rem !important;
    }
    
    /* Ensure image container has proper spacing and appears below service cards on mobile */
    section[aria-labelledby="services-heading"] .order-last {
        margin-top: 2rem !important;
        padding-top: 2rem !important;
        margin-bottom: 0 !important;
        position: relative;
        z-index: 1;
    }
    
    /* Prevent any negative margins causing overlap */
    section[aria-labelledby="services-heading"] .order-last * {
        margin-top: 0 !important;
    }
    
    /* Ensure image doesn't have negative positioning */
    section[aria-labelledby="services-heading"] .order-last img {
        position: relative;
        top: 0 !important;
        margin-top: 0 !important;
    }
    
    /* Separate main content picture from text on mobile */
    main .grid {
        display: flex;
        flex-direction: column;
        gap: 2rem !important;
        /* Optimize for scroll performance */
        transform: translateZ(0);
    }
    
    main .grid > div:first-child {
        margin-bottom: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    main .grid > div:last-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Remove absolute positioning from main image on mobile */
    main img {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        object-fit: contain !important;
    }
    
    /* Remove padding-bottom trick for responsive images on mobile */
    main .relative[style*="padding-bottom"] {
        padding-bottom: 0 !important;
        height: auto !important;
    }
    
    /* Ensure all images in main are separated */
    main .grid img {
        display: block;
        margin: 2rem auto !important;
    }
}

/* Enhanced dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background-color: #1f2937;
        color: #f9fafb;
    }
}

/* Enhanced print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* Enhanced reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Enhanced selection styles */
::selection {
    background-color: rgba(99, 102, 241, 0.2);
    color: inherit;
}

/* Enhanced scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Enhanced image optimization */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Optimize for scroll performance */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Remove will-change for images to improve scroll performance */
}

/* Enhanced form elements */
input, textarea, select {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Enhanced link styles */
a {
    transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

a:hover {
    text-decoration-color: currentColor;
}

/* Enhanced grid animations */
.grid-item {
    animation: fadeInScale 0.6s ease-out;
    animation-fill-mode: both;
}

.grid-item:nth-child(1) { animation-delay: 0.1s; }
.grid-item:nth-child(2) { animation-delay: 0.2s; }
.grid-item:nth-child(3) { animation-delay: 0.3s; }
.grid-item:nth-child(4) { animation-delay: 0.4s; }
.grid-item:nth-child(5) { animation-delay: 0.5s; }
.grid-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Trusted By Logo Section - Static Grid */
.trusted-by-section {
    padding: 2rem 0 3rem;
}

@media (min-width: 640px) {
    .trusted-by-section {
        padding: 3rem 0;
    }
}

.trusted-by-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    width: 100%;
    padding: 0.75rem;
    opacity: 0.6;
    transition: all 0.3s ease;
    filter: grayscale(100%);
}

@media (min-width: 640px) {
    .trusted-by-logo {
        height: 100px;
        padding: 1rem;
    }
}

.trusted-by-logo:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.05);
}

.trusted-by-logo:active {
    transform: scale(0.98);
}

.trusted-by-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 44px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.trusted-by-logo img {
    max-height: 50px;
    max-width: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
}

@media (min-width: 640px) {
    .trusted-by-logo img {
        max-height: 60px;
        max-width: 180px;
    }
}

/* Reduced motion support for carousel */
@media (prefers-reduced-motion: reduce) {
    .trusted-by-wrapper {
        animation: none;
    }
    
    .trusted-by-wrapper {
        overflow-x: auto;
        scroll-behavior: smooth;
    }
}