:root {
    --primary-color: #1a1a2e;
    /* Dark Navy */
    --accent-color: #c9a227;
    /* Muted Gold */
    --secondary-color: #16213e;
    /* Lighter Navy */
    --text-main: #333333;
    --text-light: #f4f4f4;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --transition: all 0.3s ease;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --font-en: 'Outfit', sans-serif;
    --font-ar: 'Tajawal', sans-serif;
}

/* Dark Mode / Premium Feel Prefs */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    /* Default to Arabic font initially */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: var(--text-main);
    background-color: var(--bg-white);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Utility */
.uppercase {
    text-transform: uppercase;
}

.text-white {
    color: var(--text-light) !important;
}

.bg-dark {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.bg-light {
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    font-family: inherit;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #b08d1f;
    transform: translateY(-2px);
}

.btn-outline {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background-color: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover {
    color: var(--accent-color);
}

.btn-lang {
    background: transparent;
    border: 1px solid var(--primary-color);
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-lang:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Hero Section */
.hero {
    padding: 100px 0;
    min-height: 80vh;
    display: flex;
    align-items: center;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.hero-content {
    flex: 1;
    z-index: 2;
}

.hero-name {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero-title {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 30px;
    font-weight: 500;
}

.hero-contact-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 40px;
    color: #555;
}

.hero-contact-info span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-contact-info a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.hero-contact-info a:hover {
    color: var(--accent-color);
}

.hero-image-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.image-frame {
    width: 400px;
    height: 400px;
    /* Modern Blob Shape */
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    overflow: hidden;
    /* Soft shadow instead of solid block */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2), inset 0 0 0 8px rgba(255, 255, 255, 0.2);
    z-index: 2;
    position: relative;
    /* Floating and Morphing Animation */
    animation: blob-bounce 8s ease-in-out infinite;
    transition: all 0.5s ease;
}

.image-frame:hover {
    box-shadow: 0 30px 60px rgba(201, 162, 39, 0.3), inset 0 0 0 10px rgba(255, 255, 255, 0.3);
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.decorative-circle {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.2) 0%, rgba(201, 162, 39, 0) 70%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    animation: pulse-glow 4s ease-in-out infinite alternate;
}

/* Sections General */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--accent-color);
}

/* About */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    color: #555;
}

.about-content p {
    margin-bottom: 20px;
}

/* Cards Grid (Education, Expertise) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    border-top: 3px solid transparent;
}

.card:hover {
    transform: translateY(-5px);
    border-top-color: var(--accent-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.card p {
    color: #666;
    font-size: 0.95rem;
}

/* Expertise Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.tag {
    background: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
    font-weight: 500;
    border: 1px solid #eee;
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-3px);
}

/* Projects - Timeline Style */
.projects-timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.project-item {
    background: #232d4b;
    /* Slightly lighter than bg-dark */
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    border-right: 4px solid var(--accent-color);
    /* RTL Default */
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.project-content {
    flex: 1;
}

/* Brand Grid */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    text-align: center;
}

.brand-item {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

.brand-note {
    text-align: center;
    font-style: italic;
    color: #777;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
}

/* Styled List (Roles, Approach) */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.styled-list {
    list-style: none;
    padding: 0;
}

.styled-list li {
    background: #fff;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 15px;
}

.styled-list li::before {
    content: '✓';
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Contact */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.contact-card {
    background: #fff;
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
    text-decoration: none;
    color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.contact-card i {
    font-size: 2.5rem;
    color: var(--accent-color);
}

.contact-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
}

/* Mobile & Responsive */
.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    /* LTR default, will flip in RTL */
    width: 250px;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 50px 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu a {
    padding: 15px 0;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    border-bottom: 1px solid #fafafa;
}

.close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: block;
    }

    .hero-container {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-contact-info {
        align-items: center;
    }

    .image-frame {
        width: 280px;
        height: 280px;
    }

    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .hero-name {
        font-size: 2.5rem;
    }
}

/* RTL Specific Adjustments */
html[dir="rtl"] .project-item {
    border-right: 4px solid var(--accent-color);
    border-left: none;
}


html[dir="rtl"] .mobile-menu {
    left: 0;
    right: auto;
    transform: translateX(-100%);
}

html[dir="rtl"] .mobile-menu.active {
    transform: translateX(0);
}

html[dir="rtl"] .close-menu {
    left: 20px;
    right: auto;
}

html[dir="rtl"] .hero-contact-info span {
    flex-direction: row;
    /* Icons stay next to text */
}

/* LTR Specific Adjustments */
html[dir="ltr"] body {
    font-family: var(--font-en);
}

html[dir="ltr"] .project-item {
    border-left: 4px solid var(--accent-color);
    border-right: none;
}



html[dir="ltr"] .mobile-menu {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

html[dir="ltr"] .mobile-menu.active {
    transform: translateX(0);
}

/* Project Logo Styling */
.project-logo-container {
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    flex-shrink: 0;
}

.project-logo {
    height: 50px;
    width: auto;
    display: block;
}

@media (max-width: 768px) {
    .project-item {
        flex-direction: column-reverse;
    }

    .project-logo-container {
        align-self: flex-start;
        margin-bottom: 15px;
        /* Add margin only on mobile when stacked */
    }
}

/* Animations */
@keyframes blob-bounce {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: translateY(0);
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
        transform: translateY(-15px);
    }

    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: translateY(0);
    }
}

@keyframes pulse-glow {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

/* Modal Overlay Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 2.5%;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #333;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    line-height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.close-modal-btn:hover {
    background: #f0f0f0;
    color: var(--accent-color);
}

.modal-body {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #f9f9f9;
}

#modal-iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* RTL Adjustment for close button */
html[dir="rtl"] .close-modal-btn {
    right: auto;
    left: 20px;
}

/* External Link Button in Modal */
.modal-external-link {
    position: absolute;
    top: 15px;
    right: 70px;
    /* Positioned left of the close button (LTR) */
    color: #333;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    z-index: 10;
    text-decoration: none;
}

.modal-external-link:hover {
    background: #f0f0f0;
    color: var(--accent-color);
}

html[dir="rtl"] .modal-external-link {
    right: auto;
    left: 70px;
    /* Positioned right of the close button (RTL) */
}

/* Modal Placeholder Message */
.modal-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    z-index: 0;
    width: 80%;
}

#modal-iframe {
    position: relative;
    z-index: 1;
    background: transparent;
    /* Allow placeholder to show if iframe is empty/loading */
}

/* Hover effect for clickable brand items */
.brand-item-link:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(201, 162, 39, 0.05);
    /* Slight tint */
}

/* Clickable Role Link Style */
.role-link {
    transition: var(--transition);
}

.role-link:hover {
    color: var(--accent-color);
}