:root {
    /* Exact Logo Colors */
    --primary-blue-start: #0F4B96;
    /* Deep Logo Blue */
    --primary-blue-end: #3AB4E6;
    /* Logo Cyan */
    --primary-green-start: #238C6A;
    /* Logo Dark Green */
    --primary-green-end: #83D39B;
    /* Logo Light Green */

    --bg-main: #0a0a0a;
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --border-color: rgba(255, 255, 255, 0.05);

    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --text-invert: #000000;

    --gradient-blue: linear-gradient(135deg, var(--primary-blue-start), var(--primary-blue-end));
    --gradient-green: linear-gradient(135deg, var(--primary-green-start), var(--primary-green-end));

    /* Main gradient for text: Default is white-ish for dark mode */
    --gradient-text: linear-gradient(135deg, #ffffff 0%, #a0a0a0 100%);

    /* Typography */
    --font-ar: 'Tajawal', sans-serif;
    --font-en: 'Inter', sans-serif;

    /* Spacing */
    --container-width: 1200px;
    --section-padding: 100px 0;
}

:root.light-mode {
    --bg-main: #f4f6f9;
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);

    --text-main: #2b2b2b;
    --text-muted: #6c757d;
    --text-invert: #ffffff;

    /* Strong contrast text for Light Mode headers */
    --gradient-text: linear-gradient(135deg, #0F4B96 0%, #238C6A 100%);
}

* {
    cursor: none;
    /* Hide default cursor */
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ar);
    /* Default to Arabic */
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    direction: rtl;
    /* Arabic first */
    transition: background-color 0.4s ease, color 0.4s ease;
}

html[dir="ltr"] body {
    font-family: var(--font-en);
}

/* Custom Cursor */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: var(--primary-blue-end);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

.custom-cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(58, 180, 230, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, border-color 0.2s;
    transition-timing-function: ease-out;
}

.custom-cursor.hover {
    width: 50px;
    height: 50px;
    background-color: rgba(58, 180, 230, 0.2);
}

.custom-cursor-follower.hover {
    width: 80px;
    height: 80px;
    border-color: transparent;
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
}

.logo-text {
    font-size: 3rem;
    font-family: var(--font-en);
    font-weight: 800;
    letter-spacing: 5px;
    background: var(--gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    margin-bottom: 20px;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-blue);
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

a,
button,
.icon-btn {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: none;
    /* Let custom cursor handle it */
}

img {
    max-width: 100%;
    display: block;
}

/* Container */
.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header-main {
    padding: 15px 5%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    /* Keep it fixed at the top */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(30, 30, 30, 0.95);
    /* Distinct from background */
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

:root.light-mode .header-main {
    background: rgba(245, 245, 245, 0.95);
}

.main-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    color: var(--text-main);
}

.icon-btn:hover {
    background: rgba(128, 128, 128, 0.1);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.font-en {
    font-family: var(--font-en);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Typography Utility */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--text-main);
}

h1 {
    font-size: 3.5rem;
}

h2 {
    font-size: 2.5rem;
}

h3 {
    font-size: 1.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.main-gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--gradient-blue);
    color: #fff !important;
    /* Always white text on primary regardless of theme */
    box-shadow: 0 4px 15px rgba(15, 75, 150, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 75, 150, 0.6);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-blue-start);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(15, 75, 150, 0.1);
    border-color: var(--primary-blue-end);
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

/* --- Hero Section --- */
.hero {
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
    /* Account for the fixed header */
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, var(--bg-card) 0%, var(--bg-main) 70%);
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    font-size: 2rem;
    color: var(--primary-blue-end);
    opacity: 0.05;
    /* Super faint opacity as requested */
    font-family: monospace;
    /* For code tokens */
    font-weight: bold;
    animation: floatCode 15s infinite ease-in-out alternate;
}

@keyframes floatCode {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-150px) rotate(180deg);
        opacity: 0.1;
    }
}

.hero-content {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    text-align: center;
    /* Enforce centering */
}

.hero-content .highlight {
    background: var(--gradient-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-buttons {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* --- Services Section --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s, border-color 0.3s;
    border: 1px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-blue-end);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    /* gradient on emoji is tricky, leaving default */
}

/* --- Portfolio Swiper Carousel 3D --- */
.swiper {
    width: 100%;
    padding-top: 20px;
    padding-bottom: 50px;
}

.swiper-slide {
    background-position: center;
    background-size: cover;
    width: 320px;
    height: 450px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .swiper-slide {
        width: 400px;
        height: 500px;
    }
}

.project-img {
    height: 50%;
    background-size: cover;
    background-position: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.project-info {
    padding: 20px;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.project-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.project-info p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.swiper-pagination-bullet {
    background: var(--primary-blue-end) !important;
}

/* Footer */
.main-footer {
    background: var(--bg-card);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.social-links a {
    color: var(--text-muted);
}

.social-links a:hover {
    color: var(--primary-blue-end);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    * {
        cursor: auto !important;
    }

    .custom-cursor,
    .custom-cursor-follower {
        display: none !important;
    }

    .header-main {
        flex-direction: column;
        gap: 15px;
        position: relative;
        /* Push down content instead of overlapping */
        background: rgba(30, 30, 30, 0.95);
        padding: 15px;
    }

    :root.light-mode .header-main {
        background: rgba(245, 245, 245, 0.95);
    }

    .logo img {
        height: 60px !important;
        margin-bottom: 5px;
        margin-top: 5px;
        object-fit: contain;
        /* Prevent logo breaking */
    }

    h1 {
        font-size: 2.2rem !important;
        /* Smaller header for mobile */
        line-height: 1.3;
    }

    .hero-content p {
        font-size: 1rem !important;
        padding: 0 15px;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 20px;
    }

    .hero-buttons .btn {
        width: 100%;
        /* Full width buttons on mobile */
        margin-bottom: 10px;
    }

    .hero-buttons .btn-outline {
        margin-top: 5px;
    }

    .main-nav {
        display: none;
    }
}