/* ROOT VARIABLES : Make colors easily editable here */
:root {
    /* Primary Colors mapped to AEB.ma brand */
    --primary-color: #00adb5;
    --primary-hover: #008f96;
    
    /* Dark Theme Colors */
    --bg-color: #1a1d21; /* Slightly darker for better contrast */
    --card-bg: #212428;
    --nav-bg: rgba(26, 29, 33, 0.9); /* Glassmorphic dark */
    
    /* Text Colors */
    --text-white: #ffffff;
    --text-light: #c4cfde;
    --text-muted: #878e99;
    
    /* UI details */
    --glass-bg: rgba(33, 36, 40, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 15px 40px rgba(0, 173, 181, 0.2);
    
    /* Typography - Updated to Tajawal */
    --font-main: 'Tajawal', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cross-Document View Transitions */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
}

/* GENERAL STYLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
    overflow-x: clip;
}

html[dir="ltr"],
html.lang-ltr {
    direction: ltr;
}

html.lang-ltr {
    font-family: var(--font-en);
}

html.lang-rtl {
    font-family: var(--font-ar);
}

html[dir="rtl"],
html.lang-rtl {
    direction: rtl;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-light);
    line-height: 1.7;
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-white);
    font-weight: 700;
    line-height: 1.3;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: 100px 0;
}

/* UTILITIES */
.highlight {
    color: var(--primary-color);
}
.dot {
    color: var(--primary-color);
}
.text-center {
    text-align: center;
}
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.sub-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 10px;
}

.section-header {
    margin-bottom: 4rem;
}
.section-title {
    font-size: 2.8rem;
    margin-bottom: 1rem;
}
.section-title span {
    color: var(--primary-color);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: var(--font-main);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(0, 173, 181, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 173, 181, 0.4);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-white);
    border: 2px solid var(--text-white);
}

.btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

/* HEADER & NAVBAR */
.header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1100px;
    z-index: 1000;
    transition: var(--transition);
}

.header.scrolled .navbar {
    padding: 12px 30px;
    background-color: rgba(26, 29, 33, 0.95);
    box-shadow: var(--shadow);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 40px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.logo h3 {
    font-size: 1.8rem;
    letter-spacing: 1px;
}

/* Added for RTL compatibility in nav */
.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-light);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0; /* RTL change from left to right */
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-white);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* HERO SECTION */
.hero {
    min-height: 100vh;
    padding-top: 120px;
    display: flex;
    align-items: center;
}

.hero-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.hero-text {
    max-width: 600px;
}

.greeting {
    display: inline-block;
    padding: 8px 24px;
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    margin-bottom: 25px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-white);
}

.hero-title {
    font-size: 4rem;
    line-height: 1.15;
    margin-bottom: 25px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.hero-cta {
    display: flex;
    gap: 20px;
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transform-style: preserve-3d;
}

.hero-image-container {
    position: relative;
    width: 350px;
    height: 450px;
    z-index: 2;
    transform: translateZ(20px);
}

.shape-circle {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 350px;
    height: 350px;
    background-color: var(--primary-color);
    border-radius: 50% 50% 10px 10px;
    z-index: -1;
}

.hero-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 10px; 
}

.floating-badge {
    position: absolute;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: float 6s ease-in-out infinite;
    transform: translateZ(50px);
}

/* Safe badge positioning to prevent viewport overflow */
.floating-badge.right-badge {
    right: 0;
    top: 50px;
    max-width: 250px;
}

.floating-badge.left-badge {
    left: 0;
    bottom: 50px;
    animation-delay: 2s;
}

@keyframes float {
    0% { transform: translateY(0px) translateZ(50px); }
    50% { transform: translateY(-15px) translateZ(50px); }
    100% { transform: translateY(0px) translateZ(50px); }
}

/* MARQUEE - Remediated Overflow */
.marquee-wrapper {
    overflow: hidden;
    contain: paint;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

.marquee-section {
    background-color: var(--primary-color);
    color: #fff;
    padding: 20px 0;
    overflow: hidden;
    position: relative;
    transform: rotate(1.5deg);
    margin: 40px 0;
    width: 100%;
    max-width: 100vw;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    contain: paint;
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-flex;
    align-items: center;
    gap: 50px;
    animation: marquee-rtl 25s linear infinite;
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Marquee animation inverted for RTL */
@keyframes marquee-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* ABOUT SECTION */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.image-wrapper {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transform-style: preserve-3d;
}

.image-wrapper::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px; /* changed left to right */
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    z-index: -1;
    transform: translateZ(-10px);
}

.image-wrapper img {
    border-radius: 20px;
    transition: var(--transition);
}

.about-text .section-desc {
    margin-bottom: 40px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.stat-item h3 {
    font-size: 3rem;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 5px;
    font-family: Arial, sans-serif; /* Keep numbers clean */
}

/* SERVICES */
.services {
    background-color: var(--card-bg);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 30px;
}

.service-card {
    background-color: var(--bg-color);
    padding: 40px 30px;
    border-radius: 15px;
    transition: var(--transition);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    z-index: 1;
    transform-style: preserve-3d;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(0,173,181,0.1), transparent);
    z-index: -1;
    opacity: 0;
    transition: var(--transition);
}

.service-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
}

.service-card:hover::before {
    opacity: 1;
}

.service-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    transform: translateZ(20px);
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    transform: translateZ(10px);
}

.service-card p {
    color: var(--text-muted);
    transform: translateZ(5px);
    margin-bottom: 15px;
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    transform: translateZ(15px);
}

.service-link:hover {
    color: var(--text-white);
    transform: translateZ(15px) translateX(-4px);
}

/* TIMELINE / RESUME */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    width: 2px;
    background-color: var(--glass-border);
    top: 0;
    bottom: 0;
    right: 50%; /* center line, right-based */
    transform: translateX(50%);
}

.timeline-item {
    padding: 20px 50px;
    position: relative;
    width: 50%;
    margin-bottom: 40px;
}

/* Adjust timeline for RTL layout */
.timeline-item:nth-child(odd) {
    right: 0;
    text-align: left; /* text flows left towards center */
}

.timeline-item:nth-child(even) {
    right: 50%;
    text-align: right;
}

.timeline-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 50%;
    top: 30px;
    left: -10px; /* reversed */
    box-shadow: 0 0 0 5px var(--bg-color);
    transition: var(--transition);
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.3);
    box-shadow: 0 0 0 5px rgba(0,173,181,0.2);
}

.timeline-item:nth-child(even) .timeline-dot {
    right: -10px;
    left: auto;
}

.timeline-date h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.timeline-date span {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.timeline-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-top: 15px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.timeline-content:hover {
    box-shadow: var(--shadow);
    border-color: rgba(0,173,181,0.3);
}

/* PORTFOLIO */
.portfolio {
    background-color: var(--card-bg);
}

.portfolio-filter {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    border-radius: 30px;
    background-color: var(--bg-color);
    color: var(--text-white);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-family: var(--font-main);
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 30px;
}

.portfolio-card {
    background-color: var(--bg-color);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    transform-style: preserve-3d;
}

.portfolio-card:hover {
    box-shadow: var(--shadow-hover);
}

.card-img {
    position: relative;
    overflow: hidden;
    height: 280px;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 173, 181, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition);
    transform: translateZ(30px);
}

.portfolio-card:hover .card-img img {
    transform: scale(1.1);
}

.portfolio-card:hover .card-overlay {
    opacity: 1;
}

.view-btn {
    width: 60px; height: 60px;
    background-color: #fff;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transform: translateY(20px);
    transition: var(--transition);
}

.portfolio-card:hover .view-btn {
    transform: translateY(0);
}

.card-info {
    padding: 25px;
    transform: translateZ(20px);
}

.card-info span {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 1px;
}

.card-info h3 {
    margin-top: 10px;
    font-size: 1.3rem;
}

/* TESTIMONIALS */
.testimonial-slider {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.testimonial-card {
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    max-width: 480px;
    transition: var(--transition);
    transform-style: preserve-3d;
}

.testimonial-card:hover {
    border-color: var(--primary-color);
}

.quote-icon {
    font-size: 2.5rem;
    color: rgba(0, 173, 181, 0.3);
    margin-bottom: 20px;
    transform: translateZ(30px);
}

.testimonial-card p {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-light);
    transform: translateZ(20px);
}

.client-info {
    margin-top: 30px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    transform: translateZ(10px);
}

.client-stars {
    color: #ffb400;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* CTA & CONTACT */
.cta-box {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
    border: 1px solid var(--glass-border);
    padding: 80px 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.cta-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,173,181,0.1) 0%, transparent 60%);
    z-index: 0;
}

.cta-box > * {
    position: relative;
    z-index: 1;
    transform: translateZ(30px);
}

.cta-box h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.cta-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
}

.cta-form input {
    padding: 15px 30px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background-color: rgba(0,0,0,0.2);
    color: #fff;
    width: 100%;
    max-width: 400px;
    outline: none;
    font-family: var(--font-main);
    font-size: 1rem;
}

.cta-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0,173,181,0.2);
}

.contact-direct {
    display: flex;
    justify-content: center;
    gap: 40px;
    color: var(--text-light);
}

.contact-direct a:hover {
    color: var(--primary-color);
}

/* FOOTER */
.footer {
    background-color: var(--card-bg);
    padding: 80px 0 30px;
    border-top: 1px solid var(--glass-border);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 50px;
    margin-bottom: 50px;
}

.footer-logo h3 {
    font-size: 2rem;
}

.footer-logo p {
    color: var(--text-muted);
    margin-top: 20px;
    max-width: 350px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links h4, .footer-social h4 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-right: 5px; /* changed from left to right */
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 45px; height: 45px;
    background-color: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.social-icons a:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
}

/* RESPONSIVE STYLES */
@media screen and (max-width: 992px) {
    .hero-content-wrapper { grid-template-columns: 1fr; text-align: center; }
    .hero-text { max-width: 100%; margin-bottom: 40px; }
    .hero-cta { justify-content: center; }
    .hero-title { font-size: 3.5rem; }
    
    .about-grid { grid-template-columns: 1fr; }
    .about-image { order: 2; margin-top: 30px; }
    .about-text { order: 1; text-align: center; }
    .stats-grid { justify-content: center; }
    
    /* timeline RTL adjustments for tablet */
    .timeline::before { right: 40px; transform: none; left: auto; }
    .timeline-item { width: 100%; padding-right: 90px; padding-left: 20px; }
    .timeline-item:nth-child(even), .timeline-item:nth-child(odd) { right: 0; text-align: right; }
    .timeline-dot { right: 30px !important; left: auto !important; }
}

@media screen and (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu-btn { display: block; }
    .header { width: 95%; top: 10px; }
    
    .hero-title { font-size: 2.8rem; }
    .floating-badge { display: none; } 
    .hero-visual { height: 350px; }
    .hero-image-container { width: 100%; max-width: 300px; height: 350px; }
    .shape-circle { width: 300px; height: 300px; }
    
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-logo p { margin: 15px auto; }
    .social-icons { justify-content: center; }
    
    .cta-form { flex-direction: column; align-items: center; }
    .contact-direct { flex-direction: column; gap: 15px; }
}
