/* Mobile Optimizations - Additional improvements for mobile experience */

/* Ensure container padding is appropriate on small screens */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    section {
        padding: 3rem 0.75rem;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
}

/* Ensure all text elements have proper overflow handling */
h1, h2, h3, h4, h5, h6, p, span, a, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Fix for the experience section timeline on mobile */
@media (max-width: 767px) {
    /* Timeline fixes - address the years not appearing properly */
    .timeline {
        position: relative;
        margin-left: 15px; /* Add margin on the left to make space for the dots */
        max-width: calc(100% - 25px); /* Adjust the width accordingly */
        padding-left: 0; /* Remove any existing padding */
    }
    
    .timeline::before {
        content: '';
        position: absolute;
        left: 0; /* Adjust the vertical line position to the far left */
        top: 0;
        bottom: 0;
        width: 2px;
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    }
    
    .timeline-item {
        position: relative;
        padding-left: 30px; /* Reduce left padding */
        margin-bottom: 2.5rem; /* Add more space between items */
        margin-top: 0;
        padding-top: 0;
    }
    
    .timeline-item::before {
        content: '';
        position: absolute;
        left: -6px; /* Move the dot to overlap the line */
        top: 8px;
        width: 14px;
        height: 14px;
        background: var(--primary-color);
        border-radius: 50%;
        border: 2px solid #fff;
        box-shadow: 0 0 0 2px var(--primary-color);
        z-index: 2;
    }
    
    .timeline-date {
        position: relative; /* Change to relative positioning */
        left: 0; /* Reset left position */
        top: 0; /* Reset top position */
        margin-bottom: 0.75rem; /* Add space below date */
        padding: 0.25rem 0.5rem;
        font-weight: 700;
        color: #fff;
        font-size: 0.85rem;
        display: inline-block; /* Display as inline block */
        background-color: var(--primary-color);
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .timeline-content {
        padding: 1rem; /* Reduce padding to save space */
        width: 100%;
        box-sizing: border-box;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--surface);
    }
    
    .position {
        font-size: 1.1rem; /* Slightly smaller font size */
        margin: 0.5rem 0;
    }
    
    /* Ensure company name is clear */
    .company {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    /* Make tags wrap properly */
    .tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .tag {
        margin-bottom: 0.25rem;
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Fix for content overflow on mobile */
@media (max-width: 767px) {
    body {
        overflow-x: hidden; /* Prevent horizontal scrolling */
        width: 100%;
        max-width: 100vw;
    }
    
    .hero-content,
    .about-content,
    .timeline,
    .projects-grid,
    .achievements-grid,
    .impact-metrics,
    .contact-content {
        max-width: 100%;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    .badge {
        max-width: 100%; /* Ensure badges don't overflow */
        box-sizing: border-box;
    }
    
    .professional-badges {
        max-width: 100%;
    }
    
    /* Fix for Associate Dean badge that's too long */
    .badge span {
        max-width: 100%;
        display: inline-block;
        white-space: normal; /* Allow text to wrap */
        font-size: 0.75rem; /* Smaller font size for long text */
    }
    
    /* Fix for scrolling gallery on mobile */
    .scrolling-gallery-section,
    .scrolling-gallery-container,
    .scrolling-gallery-track {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .scrolling-gallery-item {
        max-width: 85vw;
    }
}

/* Optimize card display on smaller screens */
@media (max-width: 480px) {
    .card, .project-card, .expertise-card, .achievement-card, .timeline-item {
        padding: var(--space-md) !important;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }
    
    .projects-grid, .expertise-grid, .credentials-grid {
        gap: var(--space-md);
        width: 100%;
    }
}

/* Additional improvement for mobile specific hamburger menu */
@media (max-width: 480px) {
    .hamburger {
        width: 24px;
        height: 24px;
        padding: 5px;
        margin-right: -5px;
    }
    
    .hamburger .bar {
        width: 16px;
    }
}

/* Ensure proper text sizing on very small screens */
@media (max-width: 375px) {
    :root {
        --text-xs: 0.7rem;
        --text-sm: 0.8rem;
        --text-base: 0.9rem;
        --text-lg: 1rem;
        --text-xl: 1.1rem;
        --text-2xl: 1.25rem;
        --text-3xl: 1.5rem;
        --text-4xl: 1.75rem;
        --text-5xl: 2rem;
    }
}