/* 
   Modern Portfolio Logic
   Theme: Dark Glassmorphism 
   Fonts: Outfit (Headings), Inter (Body)
*/

:root {
    --bg-color: #12181f;
    /* Navy Background */
    --bg-secondary: #0f141a;
    /* Darker Navy */
    --text-primary: #ffffff;
    --text-secondary: #8da3b6;
    /* Silver/Slate Neutral */
    --accent-primary: #c89b68;
    /* Luxury Gold Main Accent */
    --accent-secondary: #6e8496;
    /* Slate Secondary Accent */
    --glass-bg: rgba(18, 24, 31, 0.7);
    --glass-border: rgba(200, 155, 104, 0.2);
    --transition: all 0.3s ease;
    --container-width: 1200px;
    --header-height: 80px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-color: #f2f5f9;
    --bg-secondary: #ffffff;
    --text-primary: #12181f;
    --text-secondary: #5a6b7c;
    --accent-primary: #a67c52;
    /* Darker Gold for contrast */
    --accent-secondary: #5a6b7c;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(166, 124, 82, 0.15);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

html[lang="ar"] {
    direction: rtl;
    font-family: 'Cairo', sans-serif;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6 {
    font-family: 'Cairo', sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
    /* Ensure headings have breathing room */
}

/* Fluid Typography for better scaling */
h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
}

h2 {
    font-size: clamp(2rem, 4vw + 1rem, 2.5rem);
}

h3 {
    font-size: clamp(1.5rem, 3vw + 1rem, 1.8rem);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

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

/* Utility Classes */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 100px 0;
}

@media (max-width: 768px) {
    .section {
        padding: 60px 0;
        /* Reduced padding on mobile */
    }
}

.section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 3rem;
    background: linear-gradient(to right, var(--text-primary), var(--accent-primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.section-title.start {
    text-align: left;
}

html[lang="ar"] .section-title.start {
    text-align: right;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(191, 207, 217, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(191, 207, 217, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--text-primary);
    margin-left: 1rem;
}

html[lang="ar"] .btn-secondary {
    margin-left: 0;
    margin-right: 1rem;
}

.btn-secondary:hover {
    background: rgba(191, 207, 217, 0.1);
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    /* Shade of White */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Force dark text explicitly */
    color: #12181f;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--container-width);
    margin: 0 auto;
    height: 100%;
    padding: 0 2rem;
}

.logo {
    font-size: 1.8rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.logo .dot {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
    color: #12181f;
}

.nav-link:not(.btn-primary)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: var(--transition);
}

html[lang="ar"] .nav-link:not(.btn-primary)::after {
    left: auto;
    right: 0;
}

.nav-link:not(.btn-primary):hover::after {
    width: 100%;
}

.lang-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    margin-left: 1rem;
    display: inline-block;
}

.theme-btn {
    padding: 8px 12px;
    font-size: 1rem;
    margin-left: 0.5rem;
    display: inline-block;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    justify-content: center;
    color: #12181f;
    /* Force dark icons/text */
    border: none;
}

html[lang="ar"] .lang-btn,
html[lang="ar"] .theme-btn {
    margin-left: 0;
    margin-right: 0.5rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #12181f;
    /* Force dark hamburger */
    margin: 5px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10%;
    /* More generous padding for desktop */
    position: relative;
    overflow: hidden;
}

/* Background Abstract Blob */
.hero-section::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(191, 207, 217, 0.2) 0%, rgba(10, 10, 10, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(60px);
}

.hero-content {
    max-width: 600px;
    z-index: 1;
}

.tagline {
    display: block;
    font-size: 1.2rem;
    color: var(--accent-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-title {
    /* Font size handled by generic h1 clamp rule above now, but we can override if needed */
    margin-bottom: 2rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.hero-buttons .btn {
    min-width: 220px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
}

[data-theme="light"] .hero-subtitle {
    color: var(--accent-primary);
}

.hero-visual {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gradient-sphere {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    /* Using new palette variables */
    background: radial-gradient(circle at 30% 30%, var(--accent-primary), transparent 70%);
    filter: blur(60px);
    /* The "glow" effect */
    opacity: 0.25;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.1);
    }

    100% {
        transform: translateY(0px) scale(1);
    }
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.about-text strong {
    color: var(--text-primary);
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.stat-card:hover {
    background: var(--bg-secondary);
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Skills Section */
.alt-bg {
    background-color: var(--bg-secondary);
}

.skills-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

@media (max-width: 768px) {
    .skills-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.skill-category h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.skill-category i {
    color: var(--accent-secondary);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: rgba(191, 207, 217, 0.1);
    border: 1px solid rgba(191, 207, 217, 0.3);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Experience Section - Vertical Timeline */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: var(--glass-border);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    right: -8px;
    background-color: var(--bg-color);
    border: 4px solid var(--accent-primary);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-item:nth-child(even)::after {
    left: -8px;
}

/* RTL Timeline Adjustments */
html[lang="ar"] .timeline-item:nth-child(odd) {
    left: auto;
    right: 0;
    text-align: left;
}

html[lang="ar"] .timeline-item:nth-child(even) {
    left: auto;
    right: 50%;
    text-align: right;
    /* Maintain standard logic or flip */
}

html[lang="ar"] .timeline-item:nth-child(even)::after {
    left: auto;
    right: -8px;
}

html[lang="ar"] .timeline-item::after {
    right: auto;
    left: -8px;
}

html[lang="ar"] .timeline-item:nth-child(even)::after {
    right: auto;
    left: -8px;
    /* Actually for RTL timeline we need to mirror everything. 
       Let simplifies: The timeline logic uses left: 0 and left: 50%.
       In RTL, we can keep the logic but swap text alignment.
    */
}

html[lang="ar"] .timeline-item:nth-child(odd) .timeline-content {
    text-align: left;
}

html[lang="ar"] .timeline-item:nth-child(even) .timeline-content {
    text-align: right;
}

.timeline-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.timeline-content:hover {
    border-color: var(--accent-primary);
}

.timeline-content .date {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.timeline-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Education Grid */
.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.cert-card {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.cert-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-5px);
}

.cert-card .icon {
    width: 60px;
    height: 60px;
    background: rgba(191, 207, 217, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.cert-card .icon img,
.cert-card .icon svg {
    /* Standardized size: ~55% of container */
    width: 55%;
    height: 55%;
    object-fit: contain;
    filter: none;
    /* Restore original colors */
    transition: var(--transition);
}

.cert-card:hover .icon img,
.cert-card:hover .icon svg {
    transform: scale(1.1);
    /* Subtle zoom on hover instead of color change */
}

.cert-card h4 {
    margin-bottom: 0.5rem;
}

.cert-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Contact Section */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info .contact-desc {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

html[lang="ar"] .fade-in-left {
    transform: translateX(30px);
}

html[lang="ar"] .fade-in-right {
    transform: translateX(-30px);
}

.contact-item i {
    color: var(--accent-primary);
    width: 30px;
}

.contact-form {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.full-width {
    width: 100%;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 2rem;
}

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

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

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

/* Animations */
.fade-in-up,
.fade-in-left,
.fade-in-right {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.fade-in-left {
    transform: translateX(-30px);
}

.fade-in-right {
    transform: translateX(30px);
}

.fade-in-up.visible,
.fade-in-left.visible,
.fade-in-right.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left.visible,
.fade-in-right.visible {
    transform: translateX(0);
}

.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

/* Responsive Media Queries */
@media (max-width: 968px) {
    .hero-section {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding-top: 150px;
        /* Better clearing for fixed header */
        padding-bottom: 60px;
    }

    .hero-visual {
        margin-top: 3rem;
        width: 300px;
        height: 300px;
        order: 1;
    }

    /* Center align stats on tablet/mobile */
    .about-stats {
        grid-template-columns: 1fr;
        /* Stack stats on very small screens? or kept 2 col on tablet */
    }

    .timeline::after {
        left: 31px;
    }

    /* RTL Mobile Timeline Fix */
    html[lang="ar"] .timeline::after {
        right: 31px;
        left: auto;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    html[lang="ar"] .timeline-item {
        padding-right: 70px;
        padding-left: 25px;
        text-align: right;
    }

    .timeline-item::after {
        left: 23px;
    }

    html[lang="ar"] .timeline-item::after {
        right: 23px;
        left: auto;
    }

    .timeline-item:nth-child(even) {
        left: 0;
    }

    html[lang="ar"] .timeline-item:nth-child(even) {
        right: 0;
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        text-align: left;
    }

    html[lang="ar"] .timeline-item:nth-child(odd),
    html[lang="ar"] .timeline-item:nth-child(even) {
        text-align: right;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: 0;
        /* Hidden by default */
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: flex-start;
        /* Top align content in menu */
        overflow: hidden;
        transition: height 0.3s ease;
        padding-top: 0;
        gap: 0;
    }

    .nav-links.active {
        height: calc(100vh - var(--header-height));
        padding-top: 2rem;
    }

    /* Mobile Groups removal - restoring standard mobile list if groups gone */


    .mobile-toggle {
        display: block;
    }

    .mobile-toggle.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .mobile-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .mobile-toggle.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    .hero-title {
        /* Clamp handles this, but ensuring line-height is tight */
        line-height: 1.2;
    }

    .btn-secondary {
        margin-left: 0;
        margin-top: 1rem;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .about-stats {
        grid-template-columns: 1fr;
        /* Stack stats fully on mobile */
    }

    .contact-container {
        gap: 3rem;
    }

    /* Allow horizontal scroll for tags if they overflow or wrap? Wrap is default. */
    .tags {
        justify-content: center;
    }

    .timeline::after {
        left: 20px;
    }

    html[lang="ar"] .timeline::after {
        right: 20px;
    }

    .timeline-item {
        padding-left: 50px;
        padding-right: 15px;
    }

    html[lang="ar"] .timeline-item {
        padding-right: 50px;
        padding-left: 15px;
    }

    .timeline-item::after {
        left: 12px;
    }

    html[lang="ar"] .timeline-item::after {
        right: 12px;
    }
}

/* Interactive Profile Picture */
.hero-visual {
    perspective: 1000px;
}

.profile-container {
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
    will-change: transform;
}

.profile-img {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

/* Hover Scale Effect */
.hero-visual:hover .profile-img {
    transform: scale(1.05);
}

/* Make contact items that are links interactive on hover */
a.contact-item {
    transition: color 0.3s ease;
}

a.contact-item:hover {
    color: var(--accent-primary);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}