/* ==========================================================================
   Khayal Agency - Premium Design System (CSS)
   ========================================================================== */

:root {
    /* Core Dark Theme Palette */
    --bg-deep: #05050A;
    --surface: #0A0A14;
    --surface-bright: #12121E;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B0;
    
    /* Luxury Creative Gradients */
    --purple-grad: linear-gradient(135deg, #8B5CF6, #A78BFA);
    --orange-grad: linear-gradient(135deg, #F97316, #FB923C);
    --cyan-grad: linear-gradient(135deg, #06B6D4, #22D3EE);
    
    /* Layout Tokens */
    --grid: 8px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    
    /* Micro-Interactions & Animations */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Settings & Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* تشغيل كرسر الماوس المخصص فقط على الأجهزة المكتبية لتفادي مشاكل الـ UX */
body.custom-cursor-active * {
    cursor: none;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-deep);
}

body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-deep);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.en-text { 
    font-family: 'Inter', sans-serif; 
    font-size: 0.8rem; 
    letter-spacing: 1px; 
    color: #8B5CF6;
}

/* خلفية النويز الفاخرة (Cinematic Noise Overlay) */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

/* Custom Fluid Cursor */
.cursor-dot, .cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 0; left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 10000;
    opacity: 0;
    display: none;
}
body.custom-cursor-active .cursor-dot,
body.custom-cursor-active .cursor-outline {
    display: block;
}
.cursor-dot {
    width: 6px; height: 6px;
    background-color: #FFF;
}
.cursor-outline {
    width: 30px; height: 30px;
    border: 1px solid rgba(255,255,255,0.4);
}

/* Grid Layout Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 calc(var(--grid) * 4);
}

/* Typography Styles */
h1 { font-size: clamp(34px, 6.5vw, 64px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: clamp(26px, 3.8vw, 38px); line-height: 1.2; margin-bottom: calc(var(--grid) * 2); text-align: center;}
h3 { font-size: 20px; margin-bottom: calc(var(--grid) * 2); font-weight: 600; }

.section-header {
    text-align: center;
    margin-bottom: 60px;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}
.section-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 12px;
}

/* Header Navigation (Glassmorphism) */
.nav {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: calc(var(--grid) * 3) 0;
    z-index: 1000;
    transition: all 0.4s var(--ease-out-expo);
}
.nav.scrolled {
    padding: calc(var(--grid) * 1.5) 0;
    background: rgba(5, 5, 10, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.brand { text-decoration: none; color: #FFF; font-weight: 700; font-size: 22px; }
.nav-links { display: flex; gap: calc(var(--grid) * 4); align-items: center; }
.nav-link { 
    color: var(--text-secondary); 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 14px;
    transition: color 0.3s;
}
.nav-link:hover { color: #FFF; }
.nav-cta {
    background: #FFF; color: #000;
    padding: 10px 24px; border-radius: 999px;
    text-decoration: none; font-weight: 700; font-size: 14px;
    transition: transform 0.3s var(--ease-out-expo), background-color 0.3s;
}
.nav-cta:hover { transform: scale(1.05); background-color: #f0f0f0; }

/* Hamburger Menu Icon (Mobile Only) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}
.menu-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background-color: #FFF;
    transition: all 0.3s var(--ease-standard);
}

/* Hero Section & Background Glows */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 120px;
    padding-bottom: 60px;
}
.hero-bg-glow {
    position: absolute;
    top: 35%; left: 50%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    filter: blur(80px);
    z-index: -1;
}
.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #FB923C;
    margin-bottom: 24px;
}
.gradient-text {
    background: var(--purple-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-description {
    color: var(--text-secondary); font-size: 17px; max-width: 600px;
    margin: 24px 0 40px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* Core Buttons System */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 16px 32px; border-radius: 999px;
    font-weight: 700; text-decoration: none;
    transition: all 0.4s var(--ease-out-expo);
    border: none; font-size: 15px;
}
.btn-primary {
    background: var(--orange-grad); color: #FFF;
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.2);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 15px 35px rgba(249, 115, 22, 0.35); }
.btn-secondary {
    background: rgba(255,255,255,0.03); color: #FFF; border: 1px solid rgba(255,255,255,0.08);
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); transform: translateY(-2px); }
.btn-outline {
    border: 1px solid rgba(255,255,255,0.08); color: var(--text-secondary);
    background: transparent; gap: 8px;
}
.btn-outline:hover { border-color: #FFF; color: #FFF; background: rgba(255,255,255,0.02); }
.btn-messenger {
    background: #0084FF; color: #FFF; width: 100%; gap: 10px;
}
.btn-messenger:hover { background: #0073e6; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 132, 255, 0.25); }

/* Animation Reveal Engine */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
    transition-delay: calc(var(--delay, 0) * 0.1s);
}

/* Why Us Section & Grid Cards */
.services { padding: 100px 0; }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.service-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.02);
    transition: all 0.4s var(--ease-out-expo);
}
.service-card:hover {
    transform: translateY(-6px);
    background: var(--surface-bright);
    border-color: rgba(139, 92, 246, 0.15);
}
.service-icon {
    width: 48px; height: 48px; border-radius: 12px; margin-bottom: 24px;
    display: flex; align-items: center; justify-content: center; font-size: 18px; color: #FFF;
}
.service-icon.purple { background: var(--purple-grad); box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15); }
.service-icon.orange { background: var(--orange-grad); box-shadow: 0 8px 20px rgba(249, 115, 22, 0.15); }
.service-icon.cyan { background: var(--cyan-grad); box-shadow: 0 8px 20px rgba(6, 182, 212, 0.15); }

/* Projects Grid (Portfolio) */
.portfolio { padding: 100px 0; }
.portfolio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.portfolio-item { position: relative; border-radius: var(--radius-lg); overflow: hidden; height: 440px; background: var(--surface); border: 1px solid rgba(255,255,255,0.02); }
.portfolio-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.8s var(--ease-out-expo);
}
.portfolio-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%;
    padding: 32px; background: linear-gradient(to top, rgba(5,5,10,0.98) 0%, rgba(5,5,10,0.5) 70%, transparent 100%);
    transform: translateY(12px); transition: all 0.4s var(--ease-out-expo);
}
.portfolio-overlay .category {
    font-size: 11px; color: #A78BFA; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; display: block;
}
.portfolio-overlay h4 { font-size: 20px; margin-bottom: 6px; }
.overlay-desc { font-size: 13.5px; color: var(--text-secondary); opacity: 0; transition: opacity 0.3s; }
.portfolio-item:hover .portfolio-overlay { transform: translateY(0); }
.portfolio-item:hover .overlay-desc { opacity: 1; }
.portfolio-item:hover img { transform: scale(1.04); }
.view-more { text-align: center; margin-top: 48px; }

/* Standards / Process Section */
.process-section { padding: 100px 0; background: rgba(255,255,255,0.005); }
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.process-step { background: var(--surface); padding: 32px; border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,0.01); }
.step-number { font-size: 32px; font-weight: 800; background: var(--purple-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 16px; opacity: 0.35; font-family: 'Inter'; }
.process-step h4 { font-size: 17px; margin-bottom: 12px; }
.process-step p { font-size: 13.5px; color: var(--text-secondary); }

/* Pricing Cards System */
.pricing { padding: 100px 0; }
.pricing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; max-width: 880px; margin: 0 auto; align-items: flex-start; }
.pricing-card { background: var(--surface); padding: 44px; border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.02); position: relative; overflow: hidden; }
.pricing-card.featured { background: var(--surface-bright); border: 1px solid rgba(139, 92, 246, 0.35); box-shadow: 0 15px 40px rgba(139, 92, 246, 0.05); }
.popular-tag { position: absolute; top: 16px; left: -34px; background: var(--purple-grad); color: #FFF; padding: 6px 36px; font-size: 11px; font-weight: 700; transform: rotate(-45deg); text-align: center; width: 140px; }
.price { font-size: 42px; font-weight: 800; margin: 16px 0; font-family: 'Inter'; color: #FFF; }
.price small { font-size: 15px; color: var(--text-secondary); font-weight: 400; }
.pricing-badge { color: #FB923C; font-weight: 700; font-size: 13px; margin-bottom: 20px; }
.pricing-card ul { list-style: none; margin-bottom: 32px; }
.pricing-card li { margin-bottom: 12px; color: var(--text-secondary); font-size: 14.5px; position: relative; padding-right: 22px; text-align: right;}
.pricing-card li::before { content: "✓"; position: absolute; right: 0; color: #10B981; font-weight: 700; }
.pricing-card .btn { width: 100%; }

/* Advanced Contact Section & Form Elements */
.contact { padding: 100px 0; }
.contact-card { background: var(--surface); padding: 60px; border-radius: var(--radius-lg); max-width: 800px; margin: 0 auto; border: 1px solid rgba(255,255,255,0.02); }
.contact-header { text-align: center; margin-bottom: 40px; }
.contact-header p { color: var(--text-secondary); margin-top: 10px; }
.contact-form { display: flex; flex-direction: column; gap: 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Material Fluid Input Architecture */
.input-group { position: relative; width: 100%; }
.input-group input, .input-group textarea {
    width: 100%; padding: 16px; background: rgba(255,255,255,0.01); border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md); color: #FFF; font-size: 14.5px; outline: none;
    transition: all 0.3s var(--ease-standard); font-family: inherit;
}
.input-group textarea { height: 120px; resize: none; }
.input-group label {
    position: absolute; right: 16px; top: 16px; color: var(--text-secondary); pointer-events: none;
    transition: all 0.3s var(--ease-standard); font-size: 14.5px;
}
.input-group input:focus, .input-group textarea:focus { border-color: #8B5CF6; background: rgba(255,255,255,0.03); box-shadow: 0 0 15px rgba(139, 92, 246, 0.08); }
.input-group input:focus ~ label, .input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label, .input-group textarea:not(:placeholder-shown) ~ label {
    top: -10px; right: 12px; font-size: 11.5px; color: #A78BFA; background: var(--surface); padding: 0 6px;
}

.or-separator { text-align: center; margin: 8px 0; color: var(--text-secondary); position: relative; font-size: 13.5px; }
.or-separator::before, .or-separator::after { content: ""; position: absolute; top: 50%; width: 42%; height: 1px; background: rgba(255,255,255,0.06); }
.or-separator::before { left: 0; } .or-separator::after { right: 0; }

/* Loader CSS for Async Form Transitions */
.submit-btn { position: relative; }
.submit-btn .loader {
    display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%; border-top-color: #FFF; animation: spin 0.6s linear infinite;
    position: absolute;
}
.submit-btn.loading span { opacity: 0; }
.submit-btn.loading .loader { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Universal Footer Design */
.footer { border-top: 1px solid rgba(255,255,255,0.04); padding: 40px 0; background: var(--surface); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; color: var(--text-secondary); font-size: 14px; }
.social-links { display: flex; gap: 20px; }
.social-links a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s; display: flex; align-items: center; gap: 6px; }
.social-links a:hover { color: #FFF; }

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

@media (max-width: 1024px) {
    .process-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 768px) {
    .portfolio-grid, .pricing-grid, .form-row { grid-template-columns: 1fr; }
    .process-grid { grid-template-columns: 1fr; }
    
    /* Mobile Off-Canvas Menu Slide System */
    .menu-toggle { display: flex; }
    .nav-links {
        position: fixed; top: 0; right: -100%; width: 280px; height: 100vh;
        background: var(--surface-bright); flex-direction: column; align-items: flex-start;
        padding: 100px 40px; gap: 30px; box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        transition: right 0.4s var(--ease-out-expo);
    }
    .nav-links.open { right: 0; }
    .nav-cta { width: 100%; text-align: center; }
    
    /* Cross Line Animation for Burger Button */
    .menu-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.open span:nth-child(2) { opacity: 0; }
    .menu-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    
    .contact-card { padding: 40px 24px; }
    .hero { text-align: center; padding-top: 140px; }
    .hero-description { margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .hero-actions .btn { width: 100%; }
}