/*===============================
  MOBILE & RESPONSIVE STYLES
  Portfolio Daniel Urbano
  Optimized for all devices
===============================*/

/* Mobile First Approach - Base Styles for Mobile */

/* ===== GLOBAL MOBILE OVERFLOW FIXES ===== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    * {
        box-sizing: border-box;
    }
    
    /* Prevent any element from causing horizontal overflow */
    * {
        max-width: 100%;
    }
    
    /* Prevent ScrollReveal animations from causing overflow */
    [data-sr] {
        overflow: visible !important;
        transform: none !important;
    }
    
    /* Ensure ScrollReveal elements don't exceed container width */
    .expertise-card[data-sr],
    .service-card[data-sr],
    .portfolio-item[data-sr],
    .section-header[data-sr] {
        max-width: 100% !important;
        overflow-x: hidden !important;
        transform: translateX(0) !important;
    }
    
    /* Solo aplicar overflow a las secciones problemáticas específicas */
    .about,
    .expertise,
    .services,
    .portfolio,
    .contact {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    
    .about .container,
    .expertise .container,
    .services .container,
    .portfolio .container,
    .contact .container,
    .expertise-grid,
    .services-grid,
    .portfolio-grid {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
}

/* ===== MOBILE BREAKPOINTS ===== */
/* 
  xs: 0px - 480px     (Small phones)
  sm: 481px - 768px   (Large phones / Small tablets)
  md: 769px - 1024px  (Tablets / Small laptops)
  lg: 1025px - 1440px (Laptops / Desktops)
  xl: 1441px+         (Large desktops)
*/

/* ===== HEADER MOBILE ===== */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 5%;
        backdrop-filter: blur(20px);
    }

    .header .container {
        padding: 0 2rem; /* Ensure proper padding for header content */
    }

    .logo {
        font-size: 2.2rem;
        margin-left: 1rem; /* Add left margin for better spacing */
    }

    #menu-icon {
        display: block !important;
        font-size: 3rem;
        color: var(--text-light);
        cursor: pointer;
        z-index: 1001;
        transition: var(--transition-fast);
    }

    #menu-icon.bx-x {
        transform: rotate(90deg);
        color: var(--accent-color);
    }

    .navbar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: var(--card-gradient);
        backdrop-filter: blur(30px);
        border-left: 2px solid rgba(255, 255, 255, 0.1);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3rem;
        transition: var(--transition-smooth);
        z-index: 1000;
        padding: 2rem;
    }

    .navbar.active {
        right: 0;
        box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .navbar a {
        display: flex;
        align-items: center;
        gap: 1rem;
        width: 100%;
        padding: 1.5rem 2rem;
        font-size: 1.8rem;
        color: var(--text-light);
        background: rgba(255, 255, 255, 0.05);
        border-radius: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: var(--transition-fast);
        justify-content: center;
    }

    .navbar a:hover,
    .navbar a.active {
        background: var(--accent-gradient);
        transform: translateX(10px);
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    }

    .navbar a i {
        font-size: 2rem;
        display: block; /* Show icons on mobile */
    }

    .navbar a span {
        display: block; /* Show text on mobile */
        font-size: 1.4rem;
        margin-top: 0.5rem;
    }

    /* Mobile menu overlay */
    .navbar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-smooth);
        z-index: -1;
    }

    .navbar.active::before {
        opacity: 1;
        visibility: visible;
    }
}

/* ===== HERO SECTION MOBILE ===== */
@media (max-width: 768px) {
    .hero {
        min-height: 100vh;
        padding: 8rem 5% 4rem;
        text-align: center;
        position: relative;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .hero .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100%;
    }

    .hero-content {
        flex-direction: column;
        gap: 4rem;
        position: relative;
        z-index: 2;
        padding: 0 1rem;
        margin: 0 auto;
    }

    .hero-text {
        order: 1;
        max-width: 100%;
        overflow: visible !important;
        display: flex;
        flex-direction: column;
        align-items: center; /* Center align the hero text content */
        text-align: center; /* Center align text */
    }

    .hero-title {
        font-size: clamp(2.5rem, 8vw, 4rem);
        line-height: 1.2;
        margin-bottom: 2rem;
    }

    .greeting {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
    }

    .name {
        display: block;
        margin: 1rem 0;
    }

    .role {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        margin-top: 1rem;
    }

    .hero-description {
        font-size: 1.4rem;
        line-height: 1.6;
        margin: 2rem 0;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 250px;
        padding: 1.2rem 2rem;
        font-size: 1.4rem;
    }

    .hero-visual {
        order: 2;
        max-width: 300px;
        margin: 0 auto;
        position: relative;
        opacity: 1 !important; /* Asegurar opacidad completa */
        transform: none !important; /* Force remove any scroll reveal transforms */
    }

    /* Floating elements - mobile optimization */
    .floating-elements {
        display: none; /* Completely hide on mobile for performance */
    }

    .floating-element {
        display: none; /* Hide floating elements on mobile for better performance */
    }

    /* Alternative mobile hero decoration */
    .hero::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 200px;
        height: 200px;
        background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
        border-radius: 50%;
        z-index: 1;
        animation: pulse 4s ease-in-out infinite;
    }

    /* Scroll Indicator Mobile Optimization */
    .scroll-indicator {
        position: absolute !important;
        bottom: 2rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        text-align: center !important;
        width: auto !important;
        max-width: none !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 10 !important;
    }

    .scroll-line {
        width: 2px !important;
        height: 3rem !important;
        margin: 0 auto 0.5rem !important;
    }

    .scroll-text {
        font-size: 1rem !important;
        text-align: center !important;
    }
}

/* ===== ABOUT SECTION MOBILE ===== */
@media (max-width: 768px) {
    .about {
        padding: 6rem 5% 4rem;
        overflow-x: hidden;
    }

    .about .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100%;
        overflow-x: hidden;
    }

    .about-content {
        flex-direction: column;
        gap: 4rem;
        text-align: center;
        padding: 0 1rem;
        margin: 0 auto;
    }

    .about-visual {
        order: 1;
        max-width: 250px;
        margin: 0 auto;
    }

    .about-text {
        order: 2;
    }

    .about-role {
        font-size: 2rem;
    }

    .about-description {
        font-size: 1.4rem;
        line-height: 1.7;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin: 3rem 0;
    }

    /* Tech Circle Mobile Optimization */
    .tech-circle {
        width: 24rem;
        height: 24rem;
        margin: 0 auto;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: none;
    }

    .center-tech {
        width: 10rem;
        height: 10rem;
    }

    .center-tech i {
        font-size: 3rem;
    }

    .floating-tech {
        width: 4rem;
        height: 4rem;
        animation: orbit-mobile 20s linear infinite;
        transition: none;
        transform-origin: center;
    }

    .floating-tech:hover {
        transform: none;
        transition: none;
    }

    .floating-tech i {
        font-size: 1.5rem;
    }

    .floating-tech span {
        font-size: 0.8rem;
    }

    /* Individual orb animations for varied movement */
    .tech-1 {
        animation: orbit-mobile 18s linear infinite;
    }

    .tech-2 {
        animation: orbit-mobile-reverse 25s linear infinite;
    }

    .tech-3 {
        animation: orbit-mobile-fast 15s linear infinite;
    }

    .tech-4 {
        animation: orbit-mobile-slow-reverse 28s linear infinite;
    }

    .tech-5 {
        animation: orbit-mobile 22s linear infinite;
    }

    .tech-6 {
        animation: orbit-mobile-reverse 20s linear infinite;
    }

    /* Slower orbit animation for mobile */
    @keyframes orbit-mobile {
        0% {
            transform: rotate(0deg) translateX(8rem) rotate(0deg);
        }
        100% {
            transform: rotate(360deg) translateX(8rem) rotate(-360deg);
        }
    }

    /* Reverse orbit animation */
    @keyframes orbit-mobile-reverse {
        0% {
            transform: rotate(0deg) translateX(8rem) rotate(0deg);
        }
        100% {
            transform: rotate(-360deg) translateX(8rem) rotate(360deg);
        }
    }

    /* Faster orbit animation */
    @keyframes orbit-mobile-fast {
        0% {
            transform: rotate(0deg) translateX(8rem) rotate(0deg);
        }
        100% {
            transform: rotate(360deg) translateX(8rem) rotate(-360deg);
        }
    }

    /* Slower reverse orbit */
    @keyframes orbit-mobile-slow-reverse {
        0% {
            transform: rotate(0deg) translateX(8rem) rotate(0deg);
        }
        100% {
            transform: rotate(-360deg) translateX(8rem) rotate(360deg);
        }
    }

    .stat-item {
        padding: 2rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .stat-label {
        font-size: 1.2rem;
    }
}

/* ===== EXPERTISE SECTION MOBILE ===== */
@media (max-width: 768px) {
    .expertise {
        padding: 6rem 5% 4rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100vw !important;
        width: 100% !important;
        position: relative; /* Ensure proper stacking context */
    }

    .expertise .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        box-sizing: border-box;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
        position: relative; /* Ensure proper containment */
    }
    
    /* Hide WebKit scrollbar for expertise container */
    .expertise .container::-webkit-scrollbar {
        display: none !important;
    }

    .expertise-content {
        text-align: center;
        padding: 0 1rem;
        margin: 0 auto;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .expertise-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto;
        padding: 0;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
        position: relative; /* Proper stacking context */
        contain: layout; /* CSS containment for better performance */
    }
    
    /* Hide WebKit scrollbar for expertise grid */
    .expertise-grid::-webkit-scrollbar {
        display: none !important;
    }

    .expertise-card {
        padding: 2.5rem 2rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
        overflow-x: hidden;
        position: relative; /* Ensure proper positioning */
        /* Prevent ScrollReveal from moving cards outside viewport */
        transform: none !important;
        transition: transform 0.3s ease-in-out;
    }
    
    /* Ensure cards don't move during ScrollReveal animations */
    .expertise-card[data-sr] {
        transform: none !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .expertise-icon {
        width: 60px;
        height: 60px;
    }

    .expertise-icon i {
        font-size: 2.5rem;
    }

    .expertise-title {
        font-size: 1.8rem;
        margin: 1.5rem 0 1rem;
    }

    .expertise-description {
        font-size: 1.3rem;
    }

    .tech-stack {
        flex-wrap: wrap;
        gap: 0.8rem;
        margin-top: 2rem;
    }

    .tech-item {
        padding: 0.6rem 1.2rem;
        font-size: 1.1rem;
    }
}

/* ===== SERVICES SECTION MOBILE ===== */
@media (max-width: 768px) {
    .services {
        padding: 6rem 5% 4rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        position: relative;
    }

    .services .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100%;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    /* Hide WebKit scrollbar for services container */
    .services .container::-webkit-scrollbar {
        display: none !important;
    }

    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100% !important;
        contain: layout; /* CSS containment */
    }

    .service-card {
        padding: 2.5rem 2rem;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        position: relative;
        /* Prevent ScrollReveal from moving cards outside viewport */
        transform: none !important;
    }
    
    /* Ensure service cards don't move during ScrollReveal animations */
    .service-card[data-sr] {
        transform: none !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
}

/* Fix for very small screens */
@media (max-width: 480px) {
    .expertise {
        padding: 4rem 3% 3rem;
    }
    
    /* Apply overflow fixes to ALL sections with section-header */
    .about .container,
    .expertise .container,
    .services .container,
    .portfolio .container,
    .contact .container {
        padding: 0 1rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    /* Hide scrollbars for ALL section containers */
    .about .container::-webkit-scrollbar,
    .expertise .container::-webkit-scrollbar,
    .services .container::-webkit-scrollbar,
    .portfolio .container::-webkit-scrollbar,
    .contact .container::-webkit-scrollbar {
        display: none !important; /* WebKit */
    }
    
    .expertise-grid,
    .services-grid {
        gap: 1.5rem;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .expertise-grid::-webkit-scrollbar,
    .services-grid::-webkit-scrollbar {
        display: none !important; /* WebKit */
    }
    
    .expertise-card,
    .service-card {
        padding: 2rem 1.5rem;
        margin: 0;
        width: 100%;
    }
    
    .services {
        padding: 4rem 3% 3rem;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 2rem;
    }

    .service-icon i {
        font-size: 2.5rem;
    }

    .service-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .service-description {
        font-size: 1.3rem;
        margin-bottom: 2rem;
    }

    .service-features {
        gap: 1rem;
    }

    .service-features li {
        font-size: 1.2rem;
    }
    
    /* Eliminar scrollbars de las secciones completas */
    .about,
    .expertise,
    .services,
    .portfolio,
    .contact {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100% !important;
    }
    
    /* Aplicar overflow solo a contenedores específicos, no a elementos animados */
    .about .container,
    .expertise .container,
    .services .container,
    .portfolio .container,
    .contact .container,
    .expertise-grid,
    .services-grid,
    .portfolio-grid,
    .expertise-card,
    .service-card,
    .portfolio-item {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
}

/* ===== PORTFOLIO SECTION MOBILE ===== */
@media (max-width: 768px) {
    .portfolio {
        padding: 6rem 5% 4rem;
        overflow-x: hidden;
    }
    
    .portfolio .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100%;
        overflow-x: hidden;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .portfolio-item {
        padding: 2.5rem 2rem;
    }

    .project-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 2rem;
    }

    .project-icon i {
        font-size: 2.5rem;
    }

    .project-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .project-description {
        font-size: 1.3rem;
        margin-bottom: 2rem;
    }

    .tech-used {
        flex-wrap: wrap;
        gap: 0.8rem;
        margin: 2rem 0;
    }

    .tech-tag {
        padding: 0.6rem 1.2rem;
        font-size: 1.1rem;
    }

    .achievements-list {
        gap: 1rem;
    }

    .achievement-item {
        font-size: 1.2rem;
    }
}

/* ===== CONTACT SECTION MOBILE ===== */
@media (max-width: 768px) {
    .contact {
        padding: 6rem 5% 4rem;
        position: relative;
        overflow: hidden;
    }
    
    .contact .container {
        padding: 0 2rem;
        margin: 0 auto;
        max-width: 100%;
        overflow-x: hidden;
    }

    .contact-content {
        flex-direction: column;
        gap: 4rem;
        text-align: center;
        position: relative;
        z-index: 10;
    }

    .contact-text {
        order: 1;
    }

    .contact-title {
        font-size: clamp(2.5rem, 8vw, 3.5rem);
        margin-bottom: 1.5rem;
    }

    .contact-description {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }

    .contact-visual {
        order: 2;
        margin: 0 auto;
    }

    /* Wave container responsive - mobile optimization */
    .wave-container {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 80px; /* Reduced height for mobile */
        overflow: hidden;
        z-index: 1;
    }

    .wave {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 200%; /* Optimized width for mobile */
        height: 100px; /* Smaller wave height for mobile */
        background: linear-gradient(90deg, 
            rgba(102, 126, 234, 0.1) 0%, 
            rgba(138, 43, 226, 0.1) 50%, 
            rgba(102, 126, 234, 0.1) 100%);
        border-radius: 0; /* Remove border-radius for wave effect */
        animation: wave-motion-mobile 6s ease-in-out infinite;
    }

    .wave:nth-child(1) {
        animation: wave-motion-mobile 6s ease-in-out infinite;
        opacity: 0.8;
    }

    .wave:nth-child(2) {
        animation: wave-motion-mobile 8s ease-in-out infinite reverse;
        animation-delay: -2s;
        opacity: 0.6;
        height: 80px;
    }

    .wave:nth-child(3) {
        animation: wave-motion-mobile 10s ease-in-out infinite;
        animation-delay: -4s;
        opacity: 0.4;
        height: 60px;
    }

    /* Mobile-optimized wave animation */
    @keyframes wave-motion-mobile {
        0%, 100% {
            transform: translateX(-25%) translateY(0px);
        }
        50% {
            transform: translateX(-75%) translateY(-10px);
        }
    }

    /* Contact info responsive */
    .contact-info {
        flex-direction: column;
        gap: 2rem;
        max-width: 100%;
        margin: 0 auto;
        position: relative;
        z-index: 10;
    }

    .contact-item {
        padding: 2rem;
        margin: 1rem 0;
    }

    .contact-item h3 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .contact-item p {
        font-size: 1.4rem;
    }

    .contact-item i {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    /* Reduce animation complexity on very small screens */
    @media (max-width: 480px) {
        .wave-container {
            height: 60px;
        }
        
        .wave {
            height: 70px;
            animation-duration: 8s; /* Slower for performance */
        }
        
        .wave:nth-child(2) {
            height: 60px;
            animation-duration: 10s;
        }
        
        .wave:nth-child(3) {
            height: 50px;
            animation-duration: 12s;
        }
    }

    .wave:nth-child(3) {
        animation: wave-motion 6s ease-in-out infinite;
    }

    /* Floating contact elements - mobile optimization */
    .floating-contact-elements {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 2rem;
        max-width: 300px;
        margin: 2rem auto 0;
    }

    .floating-contact-element {
        position: relative;
        width: 100px;
        height: 100px;
        margin: 0;
        animation: none; /* Remove floating animation on mobile */
        transition: var(--transition-fast);
    }

    .floating-contact-element:hover {
        transform: scale(1.1);
    }

    .floating-contact-element i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .floating-contact-element span {
        font-size: 1rem;
    }

    /* Contact hub - mobile */
    .contact-hub {
        width: 80px;
        height: 80px;
        margin: 2rem auto;
        position: relative;
    }

    .contact-hub i {
        font-size: 2.5rem;
    }
}

/* ===== GLOBAL MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Ensure all sections have proper centering */
    section {
        padding-left: 5%;
        padding-right: 5%;
    }

    .container {
        max-width: 100%;
        margin: 0 auto;
        padding: 0 2rem;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrollbars on all containers */
    }
    
    /* Explicit rules for all section containers */
    .about .container,
    .expertise .container,
    .services .container,
    .portfolio .container,
    .contact .container {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100% !important;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    /* WebKit scrollbar hiding for all section containers */
    .about .container::-webkit-scrollbar,
    .expertise .container::-webkit-scrollbar,
    .services .container::-webkit-scrollbar,
    .portfolio .container::-webkit-scrollbar,
    .contact .container::-webkit-scrollbar {
        display: none !important;
    }

    /* Fix text alignment for all content */
    .hero-content,
    .about-content,
    .expertise-content,
    .services-content,
    .portfolio-content,
    .contact-content {
        padding: 0 1rem;
        margin: 0 auto;
        max-width: 100%;
    }

    /* Override hero-text alignment issues */
    .hero-text {
        align-items: center;
        text-align: center;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS FOR MOBILE ===== */
@media (max-width: 768px) {
    /* Reduce animation complexity for better performance */
    *, *::before, *::after {
        animation-duration: 1.5s;
        animation-iteration-count: infinite;
    }

    /* Disable heavy animations on small screens */
    @media (max-width: 480px) {
        .floating-element,
        .floating-elements {
            animation: none;
            transform: none;
        }
        
        /* Simplify wave animations for performance */
        .wave {
            animation-duration: 10s;
        }
        
        /* Reduce backdrop blur for performance */
        .glass {
            backdrop-filter: blur(5px);
        }
    }

    /* Optimize orbital animations for mobile */
    .orbit-container {
        display: none;
    }

    /* Simplify gradient animations */
    .gradient-text {
        background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        animation: none;
    }
}

/* ===== SMALL MOBILE (480px and below) ===== */
@media (max-width: 480px) {
    .container {
        padding: 0 4%; /* Increase padding for better spacing */
        margin: 0 auto; /* Ensure centering */
    }

    .header {
        padding: 1rem 4%;
    }

    .header .container {
        padding: 0 1.5rem; /* Ensure header content has proper spacing */
    }

    .logo {
        font-size: 2rem;
        margin-left: 1.5rem; /* Increase left margin for better positioning */
    }

    .menu-icon {
        font-size: 2.5rem;
    }

    .navbar {
        width: 100%;
        right: -100%;
    }

    .navbar a {
        font-size: 1.6rem;
        padding: 1.2rem 1.5rem;
    }

    /* Hero section - small mobile */
    .hero {
        padding: 6rem 3% 3rem;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .hero-description {
        font-size: 1.2rem;
    }

    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.2rem;
    }

    /* Sections padding */
    .about,
    .expertise,
    .services,
    .portfolio,
    .contact {
        padding: 4rem 3% 3rem;
    }

    .section-header h2 {
        font-size: 2.5rem;
    }

    .section-header p {
        font-size: 1.2rem;
    }

    /* Cards */
    .expertise-card,
    .service-card,
    .portfolio-item {
        padding: 2rem 1.5rem;
    }

    /* Contact wave container */
    .wave-container {
        width: 250px;
        height: 250px;
    }

    .floating-contact-elements {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        max-width: 250px;
    }

    .floating-contact-element {
        width: 80px;
        height: 80px;
    }

    .floating-contact-element i {
        font-size: 1.8rem;
    }

    .floating-contact-element span {
        font-size: 0.9rem;
    }
}

/* ===== TABLET LANDSCAPE ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 4%;
        overflow-x: hidden; /* Prevent horizontal scrollbars */
    }

    .header {
        padding: 2rem 4%;
    }

    /* Two column grids for tablets */
    .expertise-grid,
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .hero-content {
        gap: 3rem;
    }

    .about-content {
        gap: 3rem;
    }

    .hero-title {
        font-size: clamp(3rem, 6vw, 4.5rem);
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== LARGE TABLETS / SMALL LAPTOPS ===== */
@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }

    .navbar a {
        padding: 0.8rem 1.2rem;
        font-size: 1.4rem;
    }

    .expertise-grid,
    .services-grid,
    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== LARGE DESKTOPS ===== */
@media (min-width: 1441px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 6rem;
    }

    .hero-description {
        font-size: 1.8rem;
    }

    .expertise-grid,
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .navbar a {
        padding: 1rem 2rem;
        font-size: 1.6rem;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .navbar a,
    .expertise-card,
    .service-card,
    .portfolio-item,
    .floating-contact-element {
        transition: none;
    }

    .expertise-card:hover,
    .service-card:hover,
    .portfolio-item:hover {
        transform: none;
    }

    .floating-contact-element:hover {
        transform: scale(1.05);
    }

    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: 1.2rem 2rem;
    }

    .navbar a {
        min-height: 48px;
        padding: 1.5rem 2rem;
    }

    .floating-contact-element {
        min-width: 80px;
        min-height: 80px;
    }
}

/* ===== DARK MODE ADJUSTMENTS ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0a0a0a;
        --card-bg: rgba(20, 20, 20, 0.95);
        --text-light: #f0f0f0;
        --text-muted: #b0b0b0;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --text-light: #ffffff;
        --text-muted: #e0e0e0;
        --accent-color: #0080ff;
    }

    .btn,
    .expertise-card,
    .service-card,
    .portfolio-item {
        border: 2px solid var(--accent-color);
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .floating-element,
    .wave,
    .floating-contact-element {
        animation: none !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .floating-element,
    .wave-container,
    .floating-contact-elements {
        display: none;
    }

    .hero,
    .about,
    .expertise,
    .services,
    .portfolio,
    .contact {
        padding: 2rem 0;
        page-break-inside: avoid;
    }

    .container {
        max-width: 100%;
        margin: 0;
    }

    .hero-title,
    .section-header h2 {
        color: #000;
    }

    .btn {
        display: none;
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 80vh;
        padding: 4rem 5% 2rem;
    }

    .hero-content {
        flex-direction: row;
        gap: 2rem;
    }

    .hero-text {
        flex: 1;
    }

    .hero-visual {
        flex: 0 0 300px;
        max-width: 300px;
        transform: none !important; /* Ensure clean centering */
    }

    /* Tech Circle Smaller Mobile Optimization */
    .tech-circle {
        width: 18rem;
        height: 18rem;
        transition: none;
    }

    .center-tech {
        width: 8rem;
        height: 8rem;
    }

    .center-tech i {
        font-size: 2.5rem;
    }

    .floating-tech {
        width: 3rem;
        height: 3rem;
        animation: orbit-mobile-slow 22s linear infinite;
        transition: none;
        transform-origin: center;
    }

    .floating-tech:hover {
        transform: none;
        transition: none;
    }

    .floating-tech i {
        font-size: 1.2rem;
    }

    .floating-tech span {
        font-size: 0.7rem;
    }

    /* Individual orb animations for very small screens */
    .tech-1 {
        animation: orbit-mobile-fast 16s linear infinite;
    }

    .tech-2 {
        animation: orbit-mobile-slow-reverse 30s linear infinite;
    }

    .tech-3 {
        animation: orbit-mobile-slow 20s linear infinite;
    }

    .tech-4 {
        animation: orbit-mobile-fast 14s linear infinite;
    }

    .tech-5 {
        animation: orbit-mobile-slow-reverse 26s linear infinite;
    }

    .tech-6 {
        animation: orbit-mobile-slow 24s linear infinite;
    }

    /* Ultra slow orbit for very small screens */
    @keyframes orbit-mobile-slow {
        0% {
            transform: rotate(0deg) translateX(6rem) rotate(0deg);
        }
        100% {
            transform: rotate(360deg) translateX(6rem) rotate(-360deg);
        }
    }

    /* Ultra slow reverse orbit */
    @keyframes orbit-mobile-slow-reverse {
        0% {
            transform: rotate(0deg) translateX(6rem) rotate(0deg);
        }
        100% {
            transform: rotate(-360deg) translateX(6rem) rotate(360deg);
        }
    }

    /* Ultra fast orbit for small screens */
    @keyframes orbit-mobile-fast {
        0% {
            transform: rotate(0deg) translateX(6rem) rotate(0deg);
        }
        100% {
            transform: rotate(360deg) translateX(6rem) rotate(-360deg);
        }
    }

    /* Scroll Indicator - Very Small Mobile */
    .scroll-indicator {
        bottom: 1.5rem;
        width: 100%;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .scroll-line {
        width: 1.5px !important;
        height: 2.5rem !important;
        margin: 0 auto 0.5rem !important;
    }

    .scroll-text {
        font-size: 0.9rem !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .hero-title {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
    }

    .btn {
        width: auto;
        min-width: 150px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .floating-element {
        display: none;
    }

    /* Optimize background attachments */
    .hero::before,
    .about::before,
    .contact::before {
        background-attachment: scroll;
    }

    /* Reduce blur effects on mobile */
    .navbar {
        backdrop-filter: blur(15px);
    }

    .header {
        backdrop-filter: blur(10px);
    }

    .expertise-card,
    .service-card,
    .portfolio-item {
        backdrop-filter: blur(10px);
    }

    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Optimize viewport for mobile */
    .container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Larger focus indicators */
    .btn:focus,
    .navbar a:focus,
    .floating-contact-element:focus {
        outline: 3px solid var(--accent-color);
        outline-offset: 2px;
    }

    /* Better color contrast */
    .navbar a {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Skip link for keyboard navigation */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: var(--accent-color);
        color: white;
        padding: 8px;
        text-decoration: none;
        z-index: 10000;
        border-radius: 4px;
    }

    .skip-link:focus {
        top: 6px;
    }

    /* ===== ABOUT SECTION MOBILE ===== */
    .about {
        padding: 6rem 5% 4rem;
    }

    .about-content {
        display: flex;
        flex-direction: column;
        gap: 4rem;
        text-align: center;
    }

    .about-image {
        order: 1;
        max-width: 300px;
        margin: 0 auto;
    }

    .about-text {
        order: 2;
        padding-left: 0;
    }

    .about-role {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .about-description {
        font-size: 1.4rem;
        line-height: 1.6;
        margin-bottom: 3rem;
        text-align: left;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 3rem;
    }

    .stat-item {
        padding: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .stat-label {
        font-size: 1.1rem;
    }

    /* Skills visualization mobile */
    .skills-visualization {
        max-width: 280px;
        margin: 0 auto;
    }

    .skill-orbit {
        width: 250px;
        height: 250px;
    }

    .central-profile {
        width: 80px;
        height: 80px;
    }

    .central-profile i {
        font-size: 2rem;
    }

    .central-profile span {
        font-size: 1rem;
    }

    .central-profile small {
        font-size: 0.8rem;
    }

    .skill-node {
        width: 50px;
        height: 50px;
    }

    .skill-node i {
        font-size: 1.2rem;
    }

    .skill-node span {
        font-size: 0.7rem;
    }

    /* ===== CONTACT SECTION MOBILE ===== */
    .contact {
        padding: 6rem 5% 4rem;
    }

    .contact-content {
        display: flex;
        flex-direction: column;
        gap: 4rem;
    }

    .contact-info {
        order: 1;
        gap: 2rem;
    }

    .contact-visual {
        order: 2;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 1rem;
    }

    .contact-card {
        padding: 2rem;
        margin-bottom: 1.5rem;
    }

    .contact-card h3 {
        font-size: 1.6rem;
        margin: 1rem 0 0.5rem;
    }

    .contact-card p {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .contact-link {
        font-size: 1.3rem;
        padding: 1rem 2rem;
        display: inline-block;
        margin-top: 1rem;
    }

    .contact-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 1rem;
    }

    .contact-icon i {
        font-size: 2rem;
    }

    /* Contact animation mobile optimization */
    .contact-animation {
        max-width: 100%;
        width: 100%;
        height: 300px;
        margin: 0 auto;
        position: relative;
        overflow: hidden;
    }

    .wave-container {
        width: 100%;
        height: 100%;
        position: relative;
    }

    .floating-contact-elements {
        width: 200px;
        height: 200px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .floating-contact-element {
        width: 40px;
        height: 40px;
        animation-duration: 25s;
    }

    .floating-contact-element i {
        font-size: 1.2rem;
    }

    .floating-contact-element span {
        font-size: 0.7rem;
    }

    .central-contact-hub {
        width: 70px;
        height: 70px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .central-contact-hub i {
        font-size: 1.8rem;
    }

    .central-contact-hub span {
        font-size: 0.9rem;
    }
}

/* ===== MOBILE SMALL SCREENS - ABOUT & CONTACT ===== */
@media (max-width: 480px) {
    .about {
        padding: 5rem 4% 3rem;
    }

    .about-content {
        gap: 3rem;
    }

    .about-role {
        font-size: 1.8rem;
    }

    .about-description {
        font-size: 1.3rem;
    }

    .stats-grid {
        gap: 1.5rem;
    }

    .stat-item {
        padding: 1.2rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .skill-orbit {
        width: 200px;
        height: 200px;
    }

    .central-profile {
        width: 60px;
        height: 60px;
    }

    .central-profile i {
        font-size: 1.5rem;
    }

    .skill-node {
        width: 40px;
        height: 40px;
    }

    .skill-node i {
        font-size: 1rem;
    }

    .contact {
        padding: 5rem 4% 3rem;
    }

    .contact-content {
        gap: 3rem;
    }

    .contact-visual {
        width: 100%;
        max-width: 100%;
        padding: 0 0.5rem;
    }

    .contact-card {
        padding: 1.5rem;
    }

    .contact-card h3 {
        font-size: 1.4rem;
    }

    .contact-card p {
        font-size: 1.1rem;
    }

    .contact-link {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }

    .contact-animation {
        width: 100%;
        height: 250px;
        max-width: 100%;
    }

    .wave-container {
        width: 100%;
        height: 100%;
    }

    .floating-contact-elements {
        width: 160px;
        height: 160px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .floating-contact-element {
        width: 35px;
        height: 35px;
    }

    .central-contact-hub {
        width: 60px;
        height: 60px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .central-contact-hub i {
        font-size: 1.5rem;
    }
}

/* ===== FOOTER MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .footer {
        padding: 3rem 0 2rem;
    }
    
    .footer .container {
        padding: 0 1.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .footer-brand h3 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .footer-brand p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .footer-social {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1.5rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding-top: 2rem;
    }
    
    .footer-bottom p {
        font-size: 0.9rem;
        max-width: 100%;
        word-wrap: break-word;
    }
    
    .back-to-top {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    .back-to-top i {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 2.5rem 0 1.5rem;
    }
    
    .footer .container {
        padding: 0 1rem;
    }
    
    .footer-content {
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .footer-brand h3 {
        font-size: 1.8rem;
    }
    
    .footer-brand p {
        font-size: 0.9rem;
    }
    
    .footer-social {
        gap: 1rem;
    }
    
    .footer-social .social-link {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .footer-bottom {
        gap: 1rem;
        padding-top: 1.5rem;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .back-to-top {
        width: 3rem;
        height: 3rem;
    }
    
    .back-to-top i {
        font-size: 1.3rem;
    }
}
