:root {
    /* Color Palette - Dark Mode (Default) */
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    
    /* Spacing & Layout */
    --container-width: 1200px;
    --header-height: 80px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-sans: 'Inter', sans-serif;
}

body.light-mode {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

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

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

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

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

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff; /* Always white for contrast on standard buttons */
}
body.light-mode .btn-primary {
    color: #fff; /* Ensure contrast */
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--text-muted);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: rgba(15, 23, 42, 0.85); /* Slightly transparent dark */
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease;
}
body.light-mode .navbar {
    background-color: rgba(255, 255, 255, 0.85);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

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

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

.nav-links a:not(.btn) {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a:not(.btn):hover {
    color: var(--primary);
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-main);
    margin-left: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sun { display: none; }
body.light-mode .moon { display: none; }
body.light-mode .sun { display: block; }

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-toggle .bar {
    width: 25px;
    height: 2px;
    background-color: var(--text-main);
    transition: 0.3s;
}

/* Hero Section */
.hero {
    position: relative;
    height: 100vh;
    min-height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--header-height);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

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

.hero-bg .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.8), var(--bg-body));
}
body.light-mode .hero-bg .overlay {
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0.8), var(--bg-body));
}

.hero-content {
    text-align: center;
    max-width: 800px;
}

.greeting {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hero .title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    color: var(--text-main);
}

.hero .subtitle {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.tech-stack {
    font-family: monospace;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}
body.light-mode .tech-stack {
    background: rgba(2, 132, 199, 0.1);
}

.hero .description {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.cta-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Sections General */
.section {
    padding: 6rem 0;
}

/* About Overlay */
.about {
    overflow: hidden;
}

.about .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.text-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.image-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
}

.image-wrapper img {
    width: 600px;
    height: 600px;
    object-fit: contain;
    background: var(--bg-surface);
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-card {
    background-color: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.icon-box {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.skill-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.skill-list li {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.skill-list li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.card-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-card h3 {
    margin-bottom: 0.5rem;
}

.project-type {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    display: block;
}

.btn-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

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

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background-color: var(--border);
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 3rem;
}

.timeline-marker {
    position: absolute;
    top: 5px;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 0 4px var(--bg-body);
}

.timeline-content {
    background-color: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.timeline-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.time {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.company {
    display: block;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.timeline-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.timeline-content li {
    margin-bottom: 0.5rem;
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.service-card {
    background-color: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}

.service-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.section-subtitle {
    text-align: center;
    font-size: 1.25rem;
    max-width: 600px;
    margin: -2rem auto 3rem;
}


/* Objective */
.objective-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(56, 189, 248, 0.1) 100%);
    padding: 3rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

/* Contact */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 3rem;
    border: 1px solid var(--border);
}

.contact-info p {
    margin-bottom: 2rem;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.method {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--bg-body);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.method:hover:not(.disabled) {
    border-color: var(--primary);
    transform: translateX(5px);
}

.method.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.method ion-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.3s;
}

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

/* Footer */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    background-color: var(--bg-surface);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
}

.back-to-top {
    font-size: 0.9rem;
    color: var(--primary);
}

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

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

/* Responsive */
@media (max-width: 900px) {
    .about .container {
        grid-template-columns: 1fr;
    }

    .mobile-reverse {
        display: flex;
        flex-direction: column-reverse;
        gap: 2rem;
    }

    .contact-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero .title {
        font-size: 2.5rem;
    }
    
    .nav-links {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        height: calc(100vh - var(--header-height));
        width: 100%;
        background-color: var(--bg-surface);
        flex-direction: column;
        justify-content: center;
        transition: right 0.3s ease;
        padding: 2rem;
    }

    .nav-links.active {
        right: 0;
    }

    .mobile-toggle {
        display: flex;
    }
    
    .image-wrapper img {
        width: 100%;
        height: auto;
    }
}
/* Language Switcher */
.lang-switch {
    margin: 0 1.5rem;
}

#language-selector {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.3s ease;
}

#language-selector:hover,
#language-selector:focus {
    border-color: var(--primary);
    color: var(--text-main);
}

#language-selector option {
    background-color: var(--bg-surface);
    color: var(--text-main);
}

/* RTL Adjustments */
[dir='rtl'] .nav-links {
    margin-right: auto;
    margin-left: 0;
}

[dir='rtl'] .lang-switch {
    order: -1; /* Move language to left in RTL if flex ordered, but straightforward in flex is usually fine unless specified */
}

/* Fix timeline in RTL */
[dir='rtl'] .timeline::before {
    left: auto;
    right: 0;
}

[dir='rtl'] .timeline-item {
    padding-left: 0;
    padding-right: 2rem;
}

[dir='rtl'] .timeline-marker {
    left: auto;
    right: -4px;
}

[dir='rtl'] .skill-list li::before {
    margin-left: 0;
    margin-right: -1em;
    padding-left: 1rem;
}

[dir='rtl'] .btn-link ion-icon {
    transform: rotate(180deg);
}

[dir='rtl'] .contact-wrapper {
    text-align: right;
}

[dir='rtl'] .services-grid,
[dir='rtl'] .skills-grid,
[dir='rtl'] .projects-grid {
    direction: rtl;
}

[dir='rtl'] .timeline-header,
[dir='rtl'] .footer-content {
    flex-direction: row;
}

[dir='rtl'] .input, 
[dir='rtl'] .textarea {
    text-align: right;
}

[dir='rtl'] .contact-methods .method {
    flex-direction: row;
}

