/* ===== Mobile Optimizations ===== */
/* Enhanced mobile-first responsive design for better mobile user experience */

/* Touch-friendly spacing and sizing */
@media (max-width: 968px) {
    /* Improve touch targets */
    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }

    /* Better spacing for mobile */
    section {
        padding: 3rem 0;
    }

    /* Optimize hero section for mobile */
    .hero {
        min-height: auto;
        padding: 5rem 0 3rem;
    }

    .hero-content {
        gap: 2rem;
    }

    /* Make profile image smaller on tablets */
    .profile-image-wrapper {
        max-width: 300px;
        margin: 0 auto;
    }

    /* Improve button visibility */
    .hero-buttons {
        gap: 1rem;
    }

    .btn {
        padding: 1rem 1.75rem;
        font-size: 1rem;
        min-height: 48px; /* Minimum touch target size */
    }

    /* Social links touch-friendly */
    .social-link {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    /* Improve competency cards spacing */
    .competencies-grid {
        gap: 1.5rem;
    }

    .competency-card {
        padding: 1.75rem;
    }

    /* Timeline adjustments */
    .timeline-content {
        padding: 1.5rem;
    }

    /* Project cards optimization */
    .project-card {
        padding: 1.75rem;
    }

    /* Skills section */
    .skills-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Root font size adjustment for better readability */
    html {
        font-size: 15px;
    }

    /* Navbar mobile menu improvements */
    .nav-menu {
        padding: 1.5rem 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .nav-menu.active {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }

    .nav-toggle {
        width: 40px;
        height: 40px;
    }

    /* Dark mode in mobile nav */
    [data-theme="dark"] .nav-menu {
        background: var(--bg-secondary);
    }

    /* Hero section mobile */
    .hero {
        padding: 4rem 0 2rem;
    }

    .hero-title {
        font-size: 2.2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1.4rem;
    }

    .hero-description {
        font-size: 1.05rem;
        margin-bottom: 2rem;
    }

    .hero-buttons {
        gap: 0.75rem;
    }

    .profile-image-wrapper {
        max-width: 280px;
    }

    /* Social links grid for mobile */
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 300px;
        margin: 0 auto;
    }

    /* Section titles */
    .section-title {
        font-size: 2.2rem;
        margin-bottom: 2rem;
    }

    /* About section */
    .about-content {
        gap: 2rem;
    }

    .about-text {
        font-size: 1rem;
    }

    .about-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .info-item {
        justify-content: flex-start;
        padding: 0.75rem;
    }

    /* Competency cards - single column */
    .competencies-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .competency-card {
        padding: 1.5rem;
        text-align: left;
    }

    .competency-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    /* Experience timeline mobile */
    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        padding-left: 60px;
    }

    .timeline-marker {
        left: 11px;
    }

    .timeline-content {
        padding: 1.25rem;
    }

    .timeline-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .timeline-header h3 {
        font-size: 1.25rem;
    }

    .timeline-company {
        font-size: 1.1rem;
    }

    /* Projects grid - single column */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-card {
        padding: 1.5rem;
    }

    .project-title {
        font-size: 1.3rem;
    }

    .project-tags {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .project-tag {
        font-size: 0.85rem;
        padding: 0.35rem 0.75rem;
    }

    .project-links {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .project-link {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    /* Skills section */
    .skills-grid {
        gap: 1.25rem;
    }

    .skill-category {
        padding: 1.5rem;
    }

    .skill-category h3 {
        font-size: 1.3rem;
    }

    .skills-list {
        gap: 0.5rem;
    }

    .skill-item {
        font-size: 0.95rem;
        padding: 0.5rem 1rem;
    }

    /* Education section */
    .education-cards {
        gap: 1.5rem;
    }

    .education-card {
        padding: 1.5rem;
    }

    /* Certifications */
    .certifications-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .cert-card {
        padding: 1.25rem;
    }

    /* Contact section */
    .contact-content {
        gap: 2rem;
    }

    .contact-info {
        order: 2; /* Move info below form */
    }

    .contact-form {
        padding: 1.75rem;
    }

    .form-group input,
    .form-group textarea {
        font-size: 1rem;
        padding: 0.875rem;
    }

    .form-group textarea {
        min-height: 150px;
    }

    .form-group button {
        width: 100%;
        padding: 1rem;
        font-size: 1.05rem;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Theme toggle positioning */
    .theme-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    html {
        font-size: 14px;
    }

    /* Container padding */
    .container {
        padding: 0 1.25rem;
    }

    /* Navbar */
    .navbar .container {
        padding: 0 1rem;
    }

    /* Hero section */
    .hero {
        padding: 3rem 0 2rem;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 1.85rem;
        margin-bottom: 0.75rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Stack buttons vertically on small screens */
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Social links - 2 rows */
    .social-links {
        max-width: 100%;
        gap: 0.75rem;
    }

    .social-link {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .profile-image-wrapper {
        max-width: 250px;
    }

    /* Section spacing */
    section {
        padding: 2.5rem 0;
    }

    .section-title {
        font-size: 1.85rem;
        margin-bottom: 1.5rem;
    }

    /* About section */
    .about-text h3 {
        font-size: 1.3rem;
    }

    .about-text p {
        font-size: 0.95rem;
    }

    .competency-card h4 {
        font-size: 1.15rem;
    }

    .competency-card p {
        font-size: 0.9rem;
    }

    /* Timeline */
    .timeline::before {
        left: 15px;
    }

    .timeline-item {
        padding-left: 50px;
    }

    .timeline-marker {
        left: 6px;
        width: 18px;
        height: 18px;
    }

    .timeline-content {
        padding: 1rem;
    }

    .timeline-header h3 {
        font-size: 1.15rem;
    }

    .timeline-company {
        font-size: 1rem;
    }

    .timeline-date {
        font-size: 0.85rem;
    }

    .timeline-list li {
        font-size: 0.9rem;
    }

    /* Projects */
    .project-card {
        padding: 1.25rem;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .project-description {
        font-size: 0.9rem;
    }

    .project-tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.65rem;
    }

    /* Skills */
    .skill-category {
        padding: 1.25rem;
    }

    .skill-category h3 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .skill-item {
        font-size: 0.85rem;
        padding: 0.45rem 0.85rem;
    }

    /* Education */
    .education-card {
        padding: 1.25rem;
    }

    .education-degree {
        font-size: 1.15rem;
    }

    .education-school {
        font-size: 1rem;
    }

    /* Certifications */
    .cert-card {
        padding: 1rem;
    }

    .cert-card h4 {
        font-size: 1.1rem;
    }

    /* Contact */
    .contact-form {
        padding: 1.5rem;
    }

    .contact-item {
        padding: 0.75rem;
    }

    .social-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    /* Theme toggle */
    .theme-toggle {
        top: 85px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* Landscape mode for small devices */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .hero-content {
        gap: 1.5rem;
    }

    .profile-image-wrapper {
        max-width: 200px;
    }

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

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

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

/* Improve touch scrolling */
* {
    -webkit-overflow-scrolling: touch;
}

/* Better font rendering on mobile */
@media (max-width: 768px) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
}

/* Fix for iOS Safari bottom bar */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
}

/* Improve accessibility - larger tap targets */
@media (max-width: 768px) {
    a, button, .btn, .social-link, .project-link {
        min-height: 44px;
        min-width: 44px;
    }
}

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

/* Loading screen mobile */
@media (max-width: 768px) {
    .loading-screen {
        backdrop-filter: blur(10px);
    }

    .loader-content {
        transform: scale(0.8);
    }
}

/* Scroll indicator mobile */
@media (max-width: 768px) {
    .scroll-indicator {
        bottom: 1rem;
    }
}

/* Improve card shadows on mobile */
@media (max-width: 768px) {
    .project-card,
    .competency-card,
    .timeline-content,
    .skill-category,
    .education-card,
    .cert-card,
    .contact-form {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    [data-theme="dark"] .project-card,
    [data-theme="dark"] .competency-card,
    [data-theme="dark"] .timeline-content,
    [data-theme="dark"] .skill-category,
    [data-theme="dark"] .education-card,
    [data-theme="dark"] .cert-card,
    [data-theme="dark"] .contact-form {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
}
