/* Mobile Experience Enhancements */

/* Touch Optimizations */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .social-link,
    .project-card,
    .skill-card,
    .timeline-card {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    .nav-toggle {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
    }
    
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    /* Navigation Improvements */
    .navbar {
        padding: 0.5rem 0;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        border-radius: 0 0 20px 20px;
        box-shadow: 0 10px 30px rgba(0, 255, 136, 0.1);
    }
    
    .nav-link {
        padding: 1rem 2rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-link:hover {
        background: rgba(0, 255, 136, 0.1);
        border-radius: 10px;
        margin: 0 1rem;
    }
    
    /* Hero Section Mobile */
    .hero {
        min-height: 100vh;
        padding: 120px 0 40px;
    }
    
    .hero-container {
        padding: 0 1rem;
    }
    
    .hero-content {
        text-align: center;
        gap: 2rem;
    }
    
    .hero-text h1 {
        font-size: clamp(2rem, 8vw, 3rem);
        line-height: 1.2;
    }
    
    .hero-role {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }
    
    .hero-description {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .hero-stats {
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .btn {
        width: 80%;
        max-width: 280px;
        justify-content: center;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
        margin: 2rem 0;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.05);
        padding: 1rem;
        border-radius: 10px;
        border-left: 3px solid var(--primary-color);
    }
    
    .stat-number {
        order: 2;
    }
    
    .stat-label {
        order: 1;
        font-size: 0.9rem;
        text-align: left;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 0 20px;
    }
    
    .hero-content {
        gap: 1rem;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-stats {
        margin: 1rem 0;
    }
}

/* Swipe Gestures */
.swipeable {
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Navigation Gestures */
@media (max-width: 768px) {
    .nav-menu {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu.swiping {
        transition: none;
    }
}

/* Ensure desktop nav is not shifted by mobile transforms */
@media (min-width: 769px) {
    .nav-menu {
    transform: none !important;
    margin-left: auto; /* keep buttons on the right */
    }
}

/* Pull to Refresh (Visual Only) */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: var(--bg-dark);
    padding: 0.5rem 1rem;
    border-radius: 0 0 10px 10px;
    font-size: 0.9rem;
    transition: top 0.3s ease;
    z-index: 999;
}

.pull-to-refresh.active {
    top: 0;
}

/* Mobile Scroll Enhancements */
@supports (-webkit-overflow-scrolling: touch) {
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    .navbar {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .hero {
        padding-top: max(120px, calc(120px + env(safe-area-inset-top)));
    }
    
    .footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* Android Status Bar */
@media (display-mode: standalone) {
    .navbar {
        padding-top: calc(1rem + 24px);
    }
}

/* Improved Mobile Forms */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-input,
    .form-textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 1rem;
        border-radius: 12px;
    }
    
    .form-submit {
        width: 100%;
        height: 54px;
        font-size: 1.1rem;
    }
}

/* Mobile Timeline */
@media (max-width: 768px) {
    .timeline-line {
        left: 20px;
    }
    
    .timeline-item {
        margin-left: 0;
        padding-left: 50px;
    }
    
    .timeline-dot {
        left: 13px;
    }
    
    .timeline-item.left,
    .timeline-item.right {
        text-align: left;
    }
    
    .timeline-card {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Mobile Projects Grid */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-card {
        margin: 0;
    }
}

/* Mobile Skills */
@media (max-width: 768px) {
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .skill-category {
        padding: 1.5rem;
    }
}

/* Optimize for very small screens */
@media (max-width: 320px) {
    .hero-text h1 {
        font-size: 1.8rem;
    }
    
    .hero-role {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .nav-container {
        padding: 0 0.5rem;
    }
}