/*
 * Portfolio Hero Mobile Responsive - نفس تنسيق صفحة الخدمات بالضبط
 * تطابق كامل مع services-hero-mobile.css
 */

/* ===== MOBILE RESPONSIVE (768px and below) ===== */
@media (max-width: 768px) {
    
    /* === Hero Section Container === */
    section#home {
        padding-top: clamp(2.5rem, 6vh, 4rem) !important;
        padding-bottom: clamp(0.3rem, 1.5vh, 0.75rem) !important;
        padding-left: clamp(0.5rem, 2vw, 1rem) !important;
        padding-right: clamp(0.5rem, 2vw, 1rem) !important;
        min-height: 100vh !important;
        overflow: hidden !important;
    }
    
    /* === Grid Layout - Keep Original Structure === */
    section#home .grid {
        gap: 1rem !important;
    }
    
    /* === LTR/RTL Support - Both centered === */
    [dir="ltr"] section#home .grid > div:first-child {
        text-align: center !important;
    }
    
    [dir="rtl"] section#home .grid > div:first-child {
        text-align: center !important;
    }
    
    /* === Left Content (Text Section) === */
    
    /* Badge - متجاوب تلقائي */
    section#home .inline-flex.items-center.gap-3 {
        padding: clamp(0.4rem, 1.5vh, 0.6rem) clamp(0.75rem, 2vw, 1.25rem) !important;
        font-size: clamp(0.7rem, 2vw, 0.9rem) !important;
        gap: clamp(0.3rem, 1vw, 0.5rem) !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    /* Main Title - متجاوب تلقائي */
    section#home h1 {
        font-size: clamp(1.5rem, 5vw, 2.5rem) !important;
        line-height: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    /* Description Text - سطرين فقط */
    section#home p.text-lg {
        font-size: clamp(0.8rem, 2.8vw, 1rem) !important;
        line-height: 1.5 !important;
        width: 100% !important;
        max-width: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        text-align: center !important;
        display: block !important;
        height: clamp(3.2rem, 8vh, 4rem) !important;
        overflow: hidden !important;
        margin: clamp(0.75rem, 1.5vh, 1.25rem) auto !important;
        padding: 0 clamp(0.5rem, 2vw, 1rem) !important;
    }
    
    /* === Buttons Section === */
    section#home .flex.flex-col {
        gap: clamp(0.75rem, 2vh, 1.25rem) !important;
        max-width: 100% !important;
        width: 100% !important;
        flex-direction: column !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    /* Primary Button */
    section#home .flex.flex-col > a:first-child {
        padding: clamp(0.75rem, 2vh, 1rem) clamp(1.5rem, 3vw, 2.5rem) !important;
        font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
        width: auto !important;
        min-width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Secondary Button */
    section#home .flex.flex-col > a:last-child {
        padding: clamp(0.75rem, 2vh, 1rem) clamp(1.5rem, 3vw, 2.5rem) !important;
        font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
        width: auto !important;
        min-width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* === Statistics Section === */
    section#home .flex.items-center.justify-center.gap-8 {
        gap: clamp(0.5rem, 2vw, 1.5rem) !important;
        padding-top: clamp(1rem, 2vh, 2rem) !important;
    }
    
    /* Stat Circles */
    section#home .w-20.h-20 {
        width: clamp(3rem, 12vw, 5rem) !important;
        height: clamp(3rem, 12vw, 5rem) !important;
        margin-bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* Stat Numbers */
    section#home .w-20 .text-2xl {
        font-size: clamp(1.125rem, 3vw, 1.75rem) !important;
    }
    
    /* Stat Labels */
    section#home .text-sm.text-white {
        font-size: clamp(0.65rem, 2vw, 0.95rem) !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
        gap: clamp(0.2rem, 0.5vh, 0.3rem) !important;
    }
    
    #scroll-indicator .w-6.h-10 {
        display: none !important;
    }
    
    #scroll-indicator span {
        font-size: clamp(0.65rem, 1.5vw, 0.8rem) !important;
        font-weight: 600 !important;
    }
    
    #scroll-indicator i {
        font-size: clamp(0.75rem, 2vw, 1rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: clamp(1.5rem, 5vw, 2.5rem) !important;
    }
    
    section#home h1 .block:last-child {
        font-size: clamp(1.3rem, 4.5vw, 2.2rem) !important;
        margin-top: clamp(0.3rem, 1vh, 0.5rem) !important;
    }
    
    /* === Hide Right Visual Section (Video & Icons) === */
    section#home .grid > div:last-child {
        display: none !important;
    }
    
    /* === Hide All Visual Elements === */
    section#home .relative.h-\[650px\] {
        display: none !important;
    }
    
    section#home .w-\[500px\].h-\[320px\],
    section#home .w-\[600px\].h-\[600px\] {
        display: none !important;
    }
    
    section#home .w-4.h-4,
    section#home .w-3.h-3,
    section#home .w-2.h-2 {
        display: none !important;
    }
    
    /* === Hide Background Effects === */
    section#home .absolute.top-20.left-10,
    section#home .absolute.bottom-20.right-10,
    section#home .absolute.top-1\/2.left-1\/2 {
        display: none !important;
    }
}

/* ===== SMALL MOBILE (640px and below) ===== */
@media (max-width: 640px) {
    
    /* Switch to single column layout with custom order */
    section#home .grid {
        display: flex !important;
        flex-direction: column !important;
        gap: clamp(0.75rem, 2vh, 1.5rem) !important;
        text-align: center !important;
    }
    
    /* 1. IMAGE SECTION (First - Top) */
    section#home .grid > div:last-child {
        order: 1 !important;
        margin-bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* 2. TEXT CONTENT (Second - Middle) */
    section#home .grid > div:first-child {
        order: 2 !important;
    }
    
    /* Move Statistics to Bottom (Outside Grid) */
    section#home .flex.items-center.justify-center.gap-8 {
        order: 3 !important;
        position: relative !important;
        margin-top: clamp(0.3rem, 1vh, 0.75rem) !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: clamp(0.3rem, 1vw, 0.75rem) !important;
        padding: clamp(0.5rem, 1.5vh, 1rem) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 1rem !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    /* --- Precise Vertical Spacing & Alignment Solution --- */
    section#home .grid > div:first-child {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0 !important;
    }

    /* Adjust top margin for each element individually for perfect spacing */
    section#home .grid > div:first-child > h1 {
        margin-top: 1rem;
    }

    section#home .grid > div:first-child > p {
        margin-top: 1.5rem;
    }

    section#home .grid > div:first-child > .sm\:flex-row {
        margin-top: 2rem;
        width: 100%;
        max-width: 400px;
    }
    
    /* Further size reductions - مع تمدد كامل */
    section#home h1 {
        font-size: 2.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.5rem !important;
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    /* Description text - تمدد كامل */
    section#home p.text-lg {
        font-size: 1.1875rem !important;
        line-height: 1.6 !important;
        width: 100% !important;
        max-width: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 1rem !important;
        text-align: center !important;
        display: block !important;
        margin: clamp(0.75rem, 1.5vh, 1.25rem) auto !important;
        letter-spacing: 0.3px !important;
    }
    
    /* Buttons - Vertical Stack */
    section#home .flex.flex-col {
        max-width: 350px !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: clamp(0.75rem, 2vh, 1.25rem) !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    section#home .flex.flex-col > a {
        width: auto !important;
        min-width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Statistics - Enhanced Single Row Design */
    section#home .flex.items-center.justify-center.gap-8 {
        gap: 0.75rem !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        max-width: 350px !important;
        margin: 2rem auto 0 auto !important;
    }
    
    /* Individual Stat Item */
    section#home .flex.flex-col.items-center {
        flex: 1 !important;
        min-width: 0 !important;
        text-align: center !important;
    }
    
    section#home .w-20.h-20 {
        width: 3.5rem !important;
        height: 3.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    section#home .w-20 .text-2xl {
        font-size: 1.125rem !important;
        font-weight: 800 !important;
    }
    
    /* Stat Labels - Better Typography */
    section#home .text-sm.text-white {
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(1rem, 3vh, 2rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: 2.75rem !important;
    }
    
    section#home h1 .block:last-child {
        font-size: 2.4rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ===== EXTRA SMALL MOBILE (480px and below) ===== */
@media (max-width: 480px) {
    
    section#home {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    section#home h1 {
        font-size: 2.25rem !important;
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.5rem !important;
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    /* Description text - تمدد كامل */
    section#home p.text-lg {
        font-size: 1.125rem !important;
        line-height: 1.6 !important;
        width: 100% !important;
        max-width: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.75rem !important;
        text-align: center !important;
        display: block !important;
        margin: clamp(0.75rem, 1.5vh, 1.25rem) auto !important;
        letter-spacing: 0.3px !important;
    }
    
    /* Buttons - Vertical Stack */
    section#home .flex.flex-col {
        max-width: 300px !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    section#home .flex.flex-col > a {
        width: auto !important;
        min-width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Statistics - Compact Single Row for Small Screens */
    section#home .flex.items-center.justify-center.gap-8 {
        max-width: 300px !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
        margin: 1.5rem auto 0 auto !important;
    }
    
    section#home .w-20.h-20 {
        width: 2.75rem !important;
        height: 2.75rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    section#home .w-20 .text-2xl {
        font-size: 1rem !important;
        font-weight: 700 !important;
    }
    
    section#home .text-sm.text-white {
        font-size: 0.625rem !important;
        line-height: 1.1 !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(1rem, 3vh, 2rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: 2.25rem !important;
    }
    
    section#home h1 .block:last-child {
        font-size: 2rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ===== MEDIUM MOBILE (600px and below) ===== */
@media (max-width: 600px) and (min-width: 481px) {
    section#home {
        padding-top: 4rem !important;
        padding-bottom: 0.5rem !important;
        min-height: 100vh !important;
    }
    
    section#home h1 {
        font-size: 2.25rem !important;
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    section#home p.text-lg {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
        margin: clamp(0.75rem, 1.5vh, 1.25rem) auto !important;
        letter-spacing: 0.3px !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: 2.25rem !important;
    }
    
    section#home h1 .block:last-child {
        font-size: 2rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ===== EXTRA EXTRA SMALL (360px and below) ===== */
@media (max-width: 360px) {
    section#home {
        padding-top: 3.5rem !important;
        padding-bottom: 0.5rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        min-height: 100vh !important;
    }
    
    section#home h1 {
        font-size: 1.875rem !important;
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
        margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem) !important;
    }
    
    section#home p.text-lg {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
        margin: clamp(0.75rem, 1.5vh, 1.25rem) auto !important;
        letter-spacing: 0.2px !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: 1.875rem !important;
    }
    
    section#home h1 .block:last-child {
        font-size: 1.625rem !important;
        margin-top: 0.3rem !important;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    
    section#home {
        padding-top: 3rem !important;
        padding-bottom: 1rem !important;
        min-height: auto !important;
    }
    
    section#home .grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
        align-items: center !important;
    }
    
    section#home h1 {
        font-size: 1.5rem !important;
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
    }
    
    section#home p.text-lg {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        letter-spacing: 0.2px !important;
        margin-bottom: clamp(0.5rem, 1vh, 0.75rem) !important;
    }
    
    section#home .flex.items-center.justify-center.gap-8 {
        gap: 0.75rem !important;
        margin-top: clamp(0.5rem, 1vh, 0.75rem) !important;
    }
    
    section#home .w-20.h-20 {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    /* === Scroll Down Indicator - Center it === */
    #scroll-indicator {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: clamp(0.3rem, 1vh, 0.5rem) !important;
    }
    
    /* === Title Sizing - Make first and second title proportional === */
    section#home h1 .block:first-child {
        font-size: 1.5rem !important;
    }
    
    section#home h1 .block:last-child {
        font-size: 1.3rem !important;
        margin-top: 0.3rem !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    section#home * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== RTL/LTR SUPPORT ===== */
@media (max-width: 640px) {
    /* Center the main content block */
    section#home .grid > div:first-child {
        text-align: center !important;
    }

    /* Make paragraph full width and align its internal text */
    section#home .grid > div:first-child > p {
        width: 100% !important;
    }
    [dir="ltr"] section#home .grid > div:first-child > p { text-align: center !important; }
    [dir="rtl"] section#home .grid > div:first-child > p { text-align: center !important; }
    
    /* Both LTR & RTL - Centered alignment */
    [dir="ltr"] section#home .grid > div:first-child,
    [dir="rtl"] section#home .grid > div:first-child {
        text-align: center !important;
        align-items: center !important;
    }
    
    [dir="ltr"] section#home h1,
    [dir="rtl"] section#home h1 {
        text-align: center !important;
    }
    
    [dir="ltr"] section#home .inline-flex.items-center.gap-3,
    [dir="rtl"] section#home .inline-flex.items-center.gap-3 {
        justify-content: center !important;
    }
    
    [dir="ltr"] section#home .flex.flex-col.sm\:flex-row,
    [dir="rtl"] section#home .flex.flex-col.sm\:flex-row {
        justify-content: center !important;
    }
}
