/* --- כללי --- */
:root {
    --primary-color: #2A333C;
    --secondary-color: #4A90E2;
    --accent-dark: #0056b3;
    --text-color-dark: #333;
    --text-color-light: #555;
    --bg-light: #f8f8f8;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --button-bg-download: #004D70; /* כחול שמיים עמוק */
    --button-hover-download: #005f8d; /* כחול כהה יותר ל-hover */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;
}

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background: var(--bg-light);
    line-height: 1.7;
    color: var(--text-color-dark);
}

.container {
    padding: 2rem;
    max-width: 900px;
    margin: 2rem auto;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.section {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 0.2rem;
}

h2 {
    font-size: 2.2rem;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.content-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* --- דו-לשוניות --- */
[data-lang="he"] {
    /* Only controls visibility */
}
[data-lang="en"] {
    /* Only controls visibility */
}

/* --- Header & Profile Section --- */
.hero-section {
    background: var(--primary-color);
    color: white;
    padding: 2.5rem 1rem;
    display: flex;
    flex-direction: column; /* Default: column for mobile */
    align-items: center; /* Center items horizontally in column layout */
    justify-content: center;
    position: relative; /* Crucial for absolute positioning of lang-switch */
    overflow: hidden; /* Helps contain absolute elements if they overflow */
}

.profile-intro {
    display: flex;
    flex-direction: column; /* Default: column for mobile */
    align-items: center; /* Center items horizontally within profile-intro */
    gap: 1.5rem;
    margin-bottom: 1rem;
    text-align: center; /* Center text within profile-intro */
}

.profile-pic {
    border-radius: 50%;
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 4px solid var(--secondary-color);
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.2);
}

.text-content {
    /* No specific text-align here, will inherit from profile-intro or be handled by LTR/RTL */
}

.hero-section h1 {
    color: white;
    font-size: 2.8rem;
    margin-bottom: 0.2rem;
}

.hero-section p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0;
}

.lang-switch {
    display: flex;
    gap: 0.5rem;
    /* Default positioning for mobile (column layout), will be overridden for desktop */
    margin-top: 1rem; 
}

.lang-switch button {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.lang-switch button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: white;
}

/* --- ניווט (Navigation) --- */
nav {
    background: var(--bg-white);
    text-align: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

nav a {
    margin: 0 1.2rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--secondary-color);
}

nav a:hover::after {
    width: 100%;
}

/* --- כרטיסי פרויקטים (Project Cards) --- */
.project-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2.5rem;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.project-card h3 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.project-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.project-card ul {
    list-style-type: disc;
    margin-left: 1.2rem; /* Default for LTR */
    padding: 0;
    color: var(--text-color-light);
}

.project-card li {
    margin-bottom: 0.6rem;
}

/* --- קישורי הורדה ופרויקטים --- */
.project-link, .download-link {
    display: inline-block;
    margin-top: 1.5rem;
    background-color: var(--button-bg-download);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.project-link:hover, .download-link:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
}

/* --- רספונסיביות (Media Queries) --- */

/* עבור מסכים גדולים יותר מ-768px (שולחן עבודה/טאבלט לרוחב) */
@media (min-width: 768px) {
    .hero-section {
        flex-direction: row; /* תמונה וטקסט בשורה בכותרת */
        justify-content: space-between; /* מרווח בין התמונה/טקסט לכפתורי השפה */
        align-items: center; /* ממקם פריטים אנכית למרכז */
        padding: 3rem;
    }

    .profile-intro {
        flex-direction: row; /* תמונה וטקסט בשורה */
        align-items: center; /* יישור אנכי של תמונה וטקסט בתוך profile-intro */
        margin-bottom: 0;
        /* Remove explicit text-align here, let dir handle it */
    }

    .profile-pic {
        order: 0; /* Default order for LTR (image first) */
    }

    .text-content {
        order: 1; /* Default order for LTR (text second) */
        margin-left: 1.5rem; /* Space after image */
        margin-right: 0;
        text-align: left; /* Text alignment for LTR */
    }

    .hero-section h1 {
        font-size: 3.5rem;
    }

    .hero-section p {
        font-size: 1.2rem;
    }

    .lang-switch {
        position: absolute;
        top: 2.5rem;
        right: 3rem; /* Position for LTR (right side) */
        left: auto; /* Ensure left is auto for LTR */
        margin-top: 0;
    }

    nav {
        display: flex;
        justify-content: center;
        gap: 2rem;
    }

    nav a {
        font-size: 1.2rem;
    }

    .container {
        padding: 3rem;
    }

    .section h2 {
        text-align: left; /* Default for LTR */
    }

    /* **כללים עבור RTL (עברית) במסכים רחבים:** */
    html[dir="rtl"] .hero-section {
        /* No flex-direction: row-reverse needed here, we'll control with order */
        /* justify-content and align-items remain the same */
    }

    html[dir="rtl"] .profile-intro {
        flex-direction: row-reverse; /* Image right, text left */
        /* text-align: right; (Handled by .text-content now) */
    }

    html[dir="rtl"] .profile-pic {
        order: 1; /* Image after text for RTL (visual right) */
    }

    html[dir="rtl"] .text-content {
        order: 0; /* Text before image for RTL (visual left) */
        margin-left: 0; /* No space before image */
        margin-right: 1.5rem; /* Space after image */
        text-align: right; /* Text alignment for RTL */
    }

    html[dir="rtl"] .lang-switch {
        right: auto; /* Remove right positioning */
        left: 3rem; /* Position for RTL (left side) */
    }

    html[dir="rtl"] nav a::after {
        left: auto;
        right: 50%;
        transform: translateX(50%);
    }

    html[dir="rtl"] .section h2 {
        text-align: right;
    }

    html[dir="rtl"] .project-card h3 {
        text-align: right;
    }

    html[dir="rtl"] .project-card ul {
        margin-left: 0;
        margin-right: 1.2rem;
    }
    html[dir="rtl"] .project-card li {
        text-align: right;
    }

    html[dir="rtl"] footer {
        text-align: right;
    }
}

/* עבור מסכים קטנים מ-600px (טלפונים ניידים) */
@media (max-width: 600px) {
    body {
        font-size: 0.9rem;
    }

    .container {
        padding: 1.5rem;
        margin: 1rem auto;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.4rem;
    }
    
    .hero-section {
        padding: 1.5rem 0.8rem;
        /* Default for mobile is column, centered via align-items */
    }

    .profile-pic {
        width: 120px;
        height: 120px;
        order: 0; /* Ensure image is first for mobile in both LTR/RTL */
    }

    .text-content {
        order: 1; /* Ensure text is second for mobile in both LTR/RTL */
    }

    .lang-switch {
        margin-top: 1rem;
        justify-content: center;
        width: 100%;
        position: static; /* Remove absolute positioning for mobile */
        top: auto; right: auto; left: auto; /* Reset positions */
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
        padding: 0.8rem 0;
    }

    nav a {
        margin: 0.5rem 0.8rem;
        font-size: 1rem;
    }

    .project-card {
        padding: 1.2rem;
        margin-bottom: 1.5rem;
    }

    /* **כללים עבור RTL (עברית) בנייד - לוודא יישור נכון:** */
    html[dir="rtl"] .profile-intro {
        text-align: right; /* יישור לימין גם בנייד */
    }
    html[dir="rtl"] .text-content {
        text-align: right; /* יישור לימין גם בנייד */
    }
    html[dir="rtl"] .project-card ul {
        margin-left: 0;
        margin-right: 1.2rem;
    }
    html[dir="rtl"] .project-card li {
        text-align: right;
    }
    html[dir="rtl"] nav {
        text-align: right;
    }
    html[dir="rtl"] footer {
        text-align: right;
    }
}