/* 
 * Mobile-specific fixes for Tarmeez website
 * Author: Tarmeez Telecommunications & IT
 * Description: Fixes for horizontal scroll and text spacing issues on mobile
 * Version: 1.0
 */

/* ========================================
   GLOBAL MOBILE FIXES
   ======================================== */

/* Prevent horizontal scroll on all devices */
html {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
    position: relative;
}

/* Ensure all elements respect viewport width */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* ========================================
   MOBILE HERO SECTION IMPROVEMENTS
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Hero title with better Arabic text handling */
    .hero-title {
        /* Improved line breaking for Arabic text */
        word-break: keep-all;
        overflow-wrap: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
        
        /* Better spacing for Arabic characters */
        word-spacing: 0.1em;
        letter-spacing: 0.02em;
        
        /* Ensure proper line height for readability */
        line-height: 1.4;
        
        /* Center alignment for better mobile display */
        text-align: center;
        
        /* Prevent text from causing horizontal scroll */
        max-width: 100%;
        width: 100%;
    }
    
    /* Hero description with enhanced line spacing */
    .hero-description {
        line-height: 1.8;
        word-spacing: 0.15em;
        letter-spacing: 0.03em;
        text-align: center;
        max-width: 95%;
        margin: 0 auto 2rem auto;
    }
}

@media screen and (max-width: 480px) {
    
    .hero-title {
        font-size: 2.2rem;
        line-height: 1.35;
        margin-bottom: 1.5rem;
        word-spacing: 0.08em;
        letter-spacing: 0.015em;
    }
    
    .hero-description {
        font-size: 1.1rem;
        line-height: 1.8;
        word-spacing: 0.12em;
        letter-spacing: 0.025em;
        margin-bottom: 2rem;
    }
}

@media screen and (max-width: 320px) {
    
    .hero-title {
        font-size: 1.9rem;
        line-height: 1.3;
        word-spacing: 0.06em;
        letter-spacing: 0.01em;
    }
    
    .hero-description {
        font-size: 1rem;
        line-height: 1.7;
        word-spacing: 0.1em;
        letter-spacing: 0.02em;
    }
}

/* ========================================
   CONTAINER AND LAYOUT FIXES
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Ensure containers never exceed viewport */
    .container {
        max-width: 100%;
        width: 100%;
        padding: 0 1rem;
        margin: 0 auto;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Fix header content overflow */
    .header-content {
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Navigation menu fixes */
    .nav-menu {
        max-width: 100%;
        overflow-x: hidden;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .nav-link {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Grid layout fixes */
    .services-grid,
    .values-grid,
    .stats-grid {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
        gap: 1rem;
        overflow-x: hidden;
    }
    
    /* Contact content layout fix */
    .contact-content {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
        gap: 2rem;
        overflow-x: hidden;
    }
    
    /* Footer content fix */
    .footer-content {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
        text-align: center;
        gap: 1.5rem;
    }
}

/* ========================================
   TEXT SPACING IMPROVEMENTS
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Enhanced line spacing for all descriptive text */
    .about-description,
    .service-description,
    .value-description,
    .vm-description,
    .footer-description,
    .section-subtitle {
        line-height: 1.8;
        word-spacing: 0.15em;
        letter-spacing: 0.03em;
        text-align: right;
    }
    
    /* Form text improvements */
    .form-input,
    .form-textarea {
        line-height: 1.6;
        word-spacing: 0.1em;
        letter-spacing: 0.02em;
    }
    
    /* Button text improvements */
    .cta-button,
    .submit-button {
        word-spacing: 0.1em;
        letter-spacing: 0.02em;
    }
}

/* ========================================
   IMAGE AND MEDIA FIXES
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Ensure all images fit within viewport */
    img,
    .hero-bg-image,
    .about-img,
    .company-logo {
        max-width: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    /* Hero background image fix */
    .hero-background {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .hero-bg-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        max-width: none;
    }
}

/* ========================================
   CARD AND COMPONENT FIXES
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Service cards */
    .service-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Value items */
    .value-item {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Contact items */
    .contact-info,
    .contact-form-section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Form elements */
    .form-input,
    .form-textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ========================================
   SPECIFIC MOBILE BREAKPOINT FIXES
   ======================================== */

@media screen and (max-width: 480px) {
    
    .container {
        padding: 0 0.8rem;
    }
    
    /* Better text spacing for small screens */
    .about-description,
    .service-description,
    .value-description {
        line-height: 1.7;
        word-spacing: 0.12em;
        letter-spacing: 0.025em;
    }
}

@media screen and (max-width: 320px) {
    
    .container {
        padding: 0 0.6rem;
    }
    
    /* Compact text spacing for very small screens */
    .about-description,
    .service-description,
    .value-description {
        line-height: 1.6;
        word-spacing: 0.1em;
        letter-spacing: 0.02em;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION FIXES
   ======================================== */

@media screen and (max-height: 500px) and (orientation: landscape) {
    
    .hero {
        min-height: 80vh;
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

@media screen and (max-width: 768px) {
    
    /* Improve touch targets */
    .nav-link,
    .cta-button,
    .submit-button,
    .contact-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
    }
    
    /* Improve focus indicators */
    .nav-link:focus,
    .cta-button:focus,
    .submit-button:focus,
    .form-input:focus,
    .form-textarea:focus {
        outline: 2px solid #ff6b35;
        outline-offset: 2px;
    }
    
    /* Improve text selection */
    .hero-title,
    .section-title,
    .service-title,
    .value-title {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
}