/* --- General Setup & Variables --- */
:root {
    --bg-color: #111827;
    --card-bg-color: #1f2937;
    --border-color: #374151;
    --primary-text-color: #f9fafb;
    --secondary-text-color: #9ca3af;
    --accent-color: #34d399;
    --accent-hover-color: #6ee7b7;
    --font-family: 'Vazirmatn', sans-serif;
    --container-width: 1100px;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    line-height: 1.7;
    direction: rtl;
}

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

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

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

section {
    padding: 5rem 0;
}

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

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

/* --- Header & Navigation --- */
.main-header {
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

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

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

.nav-list {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--secondary-text-color);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary-text-color);
    position: relative;
    transition: transform 0.3s ease, background 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 3px;
    background: var(--primary-text-color);
    left: 0;
    transition: transform 0.3s ease;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    bottom: -8px;
}

/* Mobile Nav styles */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 0;
        left: 100%;
        width: 100%;
        height: 100vh;
        background-color: var(--bg-color);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: left 0.3s ease-in-out;
    }

    .main-nav.active {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .nav-link {
        font-size: 1.5rem;
        color: var(--primary-text-color);
    }
    
    .nav-toggle {
        display: block;
    }

    .nav-toggle.active .hamburger {
        background: transparent;
    }

    .nav-toggle.active .hamburger::before {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .nav-toggle.active .hamburger::after {
        transform: rotate(-45deg) translate(5px, -6px);
    }
}


/* --- Profile Section --- */
.profile-section {
    padding-top: 10rem;
    padding-bottom: 5rem;
    display: flex;
    align-items: center;
    gap: 3rem;
    min-height: 80vh;
}

.profile-image-container {
    flex-shrink: 0;
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 5px solid var(--accent-color);
    object-fit: cover;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.profile-content .name {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-text-color);
}

.profile-content .title {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.profile-content .summary {
    color: var(--secondary-text-color);
    max-width: 60ch;
    margin-bottom: 1.5rem;
}

.key-info {
    margin-bottom: 1.5rem;
}

.key-info-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.key-info-item strong {
    color: var(--primary-text-color);
}

.key-info-item span {
    color: var(--secondary-text-color);
}

.profile-links {
    display: flex;
    gap: 1rem;
}

.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--card-bg-color);
    color: var(--primary-text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.profile-link:hover {
    background-color: var(--border-color);
    color: var(--primary-text-color);
    transform: translateY(-2px);
}

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

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

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.25rem;
    color: var(--primary-text-color);
    margin-bottom: 0.5rem;
}

.project-description {
    color: var(--secondary-text-color);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.project-techs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem; /* Added margin to create space for the link */
}

.tech-tag {
    background-color: var(--border-color);
    color: var(--accent-color);
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

/* --- NEW STYLES FOR THE PROJECT LINK --- */
.project-link {
    display: inline-block;
    margin-top: auto; /* Pushes the link to the bottom of the card */
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.project-link:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

/* --- Experience & Education Section --- */
.timeline-container {
    display: flex;
    gap: 4rem;
    justify-content: center;
}
.timeline-column {
    flex: 1;
    max-width: 500px;
}
.timeline {
    position: relative;
    padding-right: 2rem;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: 5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

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

.timeline-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-text-color);
}

.timeline-subtitle {
    display: block;
    color: var(--secondary-text-color);
    margin-bottom: 0.5rem;
}

.timeline-date {
    color: var(--accent-color);
    font-size: 0.9rem;
}

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

.skill-category {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.skill-category-title {
    font-size: 1.25rem;
    color: var(--primary-text-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.skill-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-item {
    background-color: var(--border-color);
    color: var(--secondary-text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
}

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

.main-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--secondary-text-color);
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
        padding-top: 8rem;
    }
    .profile-content .summary {
        margin-right: auto;
        margin-left: auto;
    }
    .key-info-item {
        justify-content: center;
    }
    .profile-links {
        justify-content: center;
    }
}
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    .profile-content .name {
        font-size: 2.5rem;
    }

    .profile-content .title {
        font-size: 1.25rem;
    }
    
    .timeline-container {
        flex-direction: column;
        gap: 3rem;
    }
    
    .main-footer .container {
        flex-direction: column;
        text-align: center;
    }
}