/* Modern Swiss Tech Design Language */
:root {
    /* Color Palette */
    --color-bg-base: #FFFFFF;
    --color-bg-soft: #F5F7FA;
    --color-text-primary: #1E293B;
    --color-text-secondary: #64748B;
    --color-accent-blue: #3B82F6;
    --color-accent-violet: #8B5CF6;
    --color-dark-surface: #0F172A;
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    /* Arabic Font */

    /* Spacing & Layout */
    --container-width: 1200px;
    --padding-section: 6rem;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px -12px rgba(0, 0, 0, 0.12);

    /* Avant-Garde Glass */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--border-radius-lg);
}

.text-gradient {
    background: linear-gradient(135deg, var(--color-text-primary) 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-blue {
    background: linear-gradient(135deg, var(--color-accent-blue) 0%, var(--color-accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}


/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-base);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* RTL Support */
html[dir="rtl"] body {
    font-family: var(--font-arabic);
    text-align: right;
}

html[dir="rtl"] .nav-links {
    margin-right: auto;
    margin-left: 0;
}

html[dir="rtl"] .hero-actions {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

html[dir="rtl"] .btn span {
    transform: rotate(180deg);
    display: inline-block;
}

/* Fix direction for hero actions in RTL mobile */
@media (max-width: 768px) {
    html[dir="rtl"] .hero-actions {
        justify-content: center;
    }
}


h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--color-text-primary);
    line-height: 1.2;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
    font-family: var(--font-arabic);
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--color-text-primary) 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

p {
    color: var(--color-text-secondary);
    font-size: 1.125rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Main Background Canvas */
#main-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--color-bg-base);
    /* Fallback/Base */
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 769px) {

    /* Only apply margin auto trick on desktop */
    .nav-links {
        margin-left: auto;
        /* Pushes links to the right by default (LTR) */
        margin-right: 2rem;
    }

    html[dir="rtl"] .nav-links {
        margin-left: 2rem;
        margin-right: auto;
        /* Pushes links to the left in RTL */
    }
}


.nav-links a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.nav-links a:hover {
    color: var(--color-accent-blue);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    /* Pill shape */
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent-blue) 0%, var(--color-accent-violet) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-text {
    background: transparent;
    color: var(--color-accent-blue);
    padding: 0.75rem 1rem;
}

.btn-text:hover {
    color: var(--color-accent-violet);
    text-decoration: underline;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background-color: var(--color-text-primary);
    transition: 0.3s;
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.mobile-menu a {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Hero Section */
.hero {
    padding: 8rem 0;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.sub-headline {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    max-width: 540px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.hero-visual {
    position: relative;
    height: 400px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#hero-canvas {
    width: 100%;
    height: 100%;
}

/* Services Section */
.services {
    padding: var(--padding-section) 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header p {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.service-card {
    background: rgba(255, 255, 255, 0.7);
    /* Unified 70% Transparency */
    backdrop-filter: blur(12px);
    /* Glass effect */
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Subtle border for glass */
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.icon-box {
    width: 50px;
    height: 50px;
    background: var(--color-bg-soft);
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: var(--color-accent-blue);
    margin-bottom: 1.5rem;
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.service-card p {
    font-size: 1rem;
    line-height: 1.5;
}

/* Innovation Strip */
.innovation-strip {
    background-color: var(--color-dark-surface);
    color: white;
    padding: 4rem 0;
}

.innovation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    text-align: center;
}

.innovation-grid h3 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.innovation-grid p {
    color: #94A3B8;
    font-size: 1rem;
}

/* Contact Section */
.contact {
    padding: var(--padding-section) 0;
}

.contact-container {
    max-width: 600px;
    text-align: center;
}

.contact-header {
    margin-bottom: 3rem;
}

.contact-form {
    text-align: left;
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
}

html[dir="rtl"] .contact-form {
    text-align: right;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E2E8F0;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

html[dir="rtl"] .form-group input,
html[dir="rtl"] .form-group textarea {
    font-family: var(--font-arabic);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-block {
    width: 100%;
}

/* Footer */
.footer {
    padding: 3rem 0;
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-logo {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    display: inline-block;
}

.footer-brand p {
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.footer-links a:hover {
    color: var(--color-text-primary);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-visual {
        height: 300px;
    }

    .nav-links,
    .nav-actions {
        display: none !important;
        /* Hide desktop nav and actions */
    }

    .mobile-menu-btn {
        display: flex;
        z-index: 101;
    }

    .navbar .container {
        padding: 0 1.5rem;
    }
}

/* Innovation Gallery (Homepage) */
.innovation-gallery {
    padding: var(--padding-section) 0;
    background-color: transparent;
    /* Or slight variation to distinguish sections */
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: 250px;
    /* Base row height */
    gap: 2rem;
    grid-auto-flow: dense;
    /* Crucial for masonry packing */
}

.gallery-card {
    background: rgba(255, 255, 255, 0.7);
    /* Unified 70% Transparency */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(59, 130, 246, 0.2);
}

/* Size Variants */
.card-wide {
    grid-column: span 2;
}

.card-tall {
    grid-row: span 2;
}

/* Card Content Styles */
.gallery-icon {
    font-size: 2rem;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.gallery-card:hover .gallery-icon {
    color: var(--color-accent-blue);
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.view-case-study {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-accent-blue);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.gallery-card:hover .view-case-study {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Fix for Gallery */
@media (max-width: 768px) {

    .card-wide,
    .card-tall {
        grid-column: span 1 !important;
        /* Force single column on mobile */
        grid-row: span 1 !important;
        /* Reset height */
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        /* Single column */
        grid-auto-rows: minmax(250px, auto);
    }
}


/* Service Detail Template (Split-Screen) */
.service-detail-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.split-screen-container {
    display: flex;
    min-height: 80vh;
    /* Fill most of the viewport */
    padding-top: 4rem;
    /* Space from navbar */
    padding-bottom: 4rem;
}

.sticky-sidebar {
    width: 40%;
    padding-right: 4rem;
    position: sticky;
    top: 8rem;
    /* Offset for sticky header */
    height: fit-content;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

html[dir="rtl"] .sticky-sidebar {
    padding-right: 0;
    padding-left: 4rem;
}

.portfolio-stream {
    width: 60%;
    padding-left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

html[dir="rtl"] .portfolio-stream {
    padding-left: 0;
    padding-right: 2rem;
    border-left: none;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    /* Optional divider */
}

.portfolio-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.portfolio-card:hover {
    box-shadow: var(--shadow-hover);
}

.portfolio-visual {
    height: 250px;
    background: #E2E8F0;
    /* Fallback */
    display: flex;
    justify-content: center;
    align-items: center;
    color: #94A3B8;
    font-size: 3rem;
    font-weight: 700;
}

/* Placeholder generators */
.bg-gradient-1 {
    background: linear-gradient(135deg, #E0F2FE 0%, #DBEAFE 100%);
}

.bg-gradient-2 {
    background: linear-gradient(135deg, #F3E8FF 0%, #E0E7FF 100%);
}

.bg-gradient-3 {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.portfolio-content {
    padding: 2rem;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: #F1F5F9;
    color: var(--color-text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.portfolio-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

/* Service Page Responsive */
@media (max-width: 992px) {

    .split-screen-container {
        flex-direction: column;
        padding-top: 2rem;
    }
}

/* Service List Styling */
.service-list ul {
    list-style: none;
    padding: 0;
}

.service-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

.service-list li::before {
    content: "•";
    color: var(--color-accent-blue);
    font-weight: bold;
    position: absolute;
    left: 0;
}

html[dir="rtl"] .service-list li {
    padding-left: 0;
    padding-right: 1.5rem;
}

html[dir="rtl"] .service-list li::before {
    left: auto;
    right: 0;
}

/* Language Visibility Utilities */
html[lang='ar'] .lang-en {
    display: none !important;
}

html[lang='en'] .lang-ar {
    display: none !important;
}