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

:root {
    --primary: #6366f1;
    --primary-light: #a5b4fc;
    --primary-dark: #3730a3;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #fff;
    --black: #000;
    --indigo-200: #9FA8DA;
    --indigo-400: #818cf8;
    --indigo-600: #4f46e5;
    --indigo-900: #312e81;
}

html,
body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    scroll-behavior: smooth;
    transition: background-color 0.5s, color 0.5s;
}

html.dark,
html.dark body {
    background: var(--gray-900);
    color: var(--gray-200);
}

.mt-4 {
    margin-top: 1rem;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    min-height: 110vh;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}

.header-section {
    text-align: center;
    min-height: 110vh;
    padding: 5rem 0 4rem;
}

.profile-img {
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.08);
    border: 4px solid var(--white);
    background: var(--primary);
    object-fit: cover;
}

html.dark .profile-img {
    border-color: var(--gray-700);
}

@media (min-width: 768px) {
    .profile-img {
        width: 14rem;
        height: 14rem;
    }
}

.shadow-xl {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.1);
}

.main-title {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 3.5rem;
    color: var(--gray-900);
}

html.dark .main-title {
    color: var(--white);
}

.subtitle {
    margin-top: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

html.dark .subtitle {
    color: var(--indigo-400);
}

.desc {
    margin-top: 1rem;
    /* max-width: 42rem; */
    margin-left: auto;
    margin-right: auto;
    font-size: 1.125rem;
    color: var(--gray-600);
}

html.dark .desc {
    color: var(--gray-300);
}

.social-icons {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
    justify-content: center;
    max-width: 85vw;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap;
}

.social-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    border: 2px solid var(--black);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

html.dark .social-icon {
    border-color: var(--gray-700);
}

.social-icon img {
    width: 2.6rem;
    height: 2.6rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.social-icon::before {
    content: '';
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.8s ease;
    background: var(--bg, #070707);
}

.social-icon:hover::before {
    bottom: 0;
}

.social-icon:hover {
    transform: scale(1.2);
    border-color: transparent;
}

.social-icon:hover img {
    filter: brightness(0) invert(1);
}

/* Social media brand colors */
.social-icon.github::before {
    background: #070707;
}

.social-icon.gitlab::before {
    background: #1d0038;
}

.social-icon.gitlab:hover img {
    /* color: #E24329; */
    filter: invert(32%) sepia(98%) saturate(2058%) hue-rotate(346deg) brightness(92%) contrast(93%);
}

.social-icon.linkedin::before {
    background: #0C66C2;
}

.social-icon.twitter::before {
    background: #070707;
}

.social-icon.instagram::before {
    background: #f09433;
    background: -moz-linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); 
    background: -webkit-linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f09433', endColorstr='#bc1888',GradientType=1 );
}

.social-icon.facebook::before {
    background: #0A66FF;
}

.social-icon.youtube::before {
    background: #ff0000;
}

.social-icon.telegram::before {
    background: #2EA4DE;
}

.social-icon.whatsapp::before {
    background: #25D366;
}

.social-icon.reddit::before {
    background: #FF4500;
}

html.dark .social-icon.reddit::before {
    background: #fff;
}

html.dark .social-icon.reddit:hover img {
    /* color: #FF4500; */
    filter: invert(34%) sepia(59%) saturate(4112%) hue-rotate(0deg) brightness(102%) contrast(106%);
}

.social-icon.twitch::before {
    background: #9146FF;
}

.social-icon.tiktok::before {
    background: #000;
}

.social-icon.snapchat::before {
    background: #FFFA00;
}

.social-icon.snapchat:hover img {
    filter: unset;
}

/* TODO: beter color stackoverflow logo */

.social-icon.stackoverflow::before {
    background: #222426;
}

.social-icon.stackoverflow:hover img {
    filter: invert(59%) sepia(17%) saturate(2464%) hue-rotate(341deg) brightness(97%) contrast(97%);
}

.social-icon.threads::before {
    background: #000;
}

.social-icon.line::before {
    background: #22BA4F;
}

@media screen and (max-width: 640px) {
    .social-icon::before {
        bottom: 0;
    }
    
    .social-icon {
        border-color: transparent;
    }
    
    .social-icon img {
        filter: brightness(0) invert(1);
    }

    .social-icon.gitlab img {
        /* color: #E24329; */
        filter: invert(32%) sepia(98%) saturate(2058%) hue-rotate(346deg) brightness(92%) contrast(93%);
    }

    html.dark .social-icon.reddit img {
        /* color: #FF4500; */
        filter: invert(34%) sepia(59%) saturate(4112%) hue-rotate(0deg) brightness(102%) contrast(106%);
    }

    .social-icon.snapchat img {
        filter: unset;
    }

    .social-icon.stackoverflow img {
        filter: invert(59%) sepia(17%) saturate(2464%) hue-rotate(341deg) brightness(97%) contrast(97%);
    }

}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: white;
    border-radius: 12px;
    background: rgb(49, 46, 129);
    box-shadow: unset;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-download:hover {
    transform: translateY(-2px);
    background: rgb(36, 34, 97);
    box-shadow: 0 4px 10px rgba(36, 34, 97, 0.445);
}

.btn-download svg {
    margin-right: 0.4rem;
    stroke: rgb(255, 255, 255);
}

@media (max-width: 640px) {
    .btn-download {
        padding: 0.65rem 1.2rem;
        font-size: 0.95rem;
        width: 100%;
        text-align: center;
    }
}

.hidden {
    display: none;
}

.section {
    min-height: 110vh;
    padding: 6rem 0rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* text-align: center;* */
}

@media (max-width: 1023px) {
    .section {
        padding: 3rem 0 1rem;
    }
}

.section-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 2.5rem;
}

/* Responsive font sizes */
@media (min-width: 768px) {
    .main-title {
        font-size: 3rem;
    }

    .header-section {
        padding-top: 6rem;
        padding-bottom: 3rem;
    }
}

@media (min-width: 1024px) {
    .main-title {
        font-size: 3.5rem;
    }
}

.about-box, 
.birth-year-box,
.location-box {
    max-width: 700px;
    background: var(--white);
    border-radius: 1.25rem;
    box-shadow: 0px 2px 16px 20px rgb(90 89 90 / 25%);
    padding: 1.75rem;
}

html.dark .about-box, 
html.dark .birth-year-box,
html.dark .location-box {
    background: var(--gray-800);
    box-shadow: 0px 2px 16px 0 rgb(0 0 0 / 0.06);
}

.birth-year-box {
    max-width: 200px;
    margin: 1.5rem auto 0;
    text-align: center;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.location-box {
    margin: 1.5rem auto 0;
    text-align: center;
    padding: 1rem 1.75rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .about-box {
        padding: 1.25rem;
    }
}

.about-text {
    font-size: 1.125rem;
    color: var(--gray-700);
}

html.dark .about-text {
    color: var(--gray-300);
}

.skills-flex {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    max-width: 80vw;
    flex-wrap: wrap;
}

@media (min-width: 1023px) {
    .skills-flex {
        max-width: 43rem;
    }
}

.skill-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    width: 10rem;
    height: 10rem;
    gap: 8px;
    border-radius: 0.75rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 1rem;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.04);
    transition: background-color 0.3s, color 0.3s, transform 0.3s;
    cursor: default;
    flex-wrap: wrap;
}

@media (max-width: 28rem) {
    .skill-box {
        width: 8rem;
        height: 8rem;
        font-size: 0.9rem;
    }
}

.skill-box:hover {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.05);
}

html.dark .skill-box {
    background: var(--indigo-900);
    color: var(--indigo-200);
}

html.dark .skill-box:hover {
    background: var(--indigo-400);
    color: var(--white);
}

.skill-box img {
    width: 100%;
    position: relative;
    height: 70%;
    opacity: 0.9;
}

.skill-box:hover img {
    opacity: 1;
}

@media screen and (max-width: 640px) {
    .skill-box {
        color: var(--white);
    }

    .skill-box img {
        opacity: 1;
    }
}

.skill-box p {
    height: 30%;
    width: 100%;
    text-align: center;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;

}

.portfolio-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--gray-200);
    color: var(--gray-700);
    border: none;
    outline: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.filter-btn.active,
.filter-btn:focus {
    background: var(--indigo-600);
    color: var(--white);
}

html.dark .filter-btn {
    background: var(--gray-700);
    color: var(--gray-300);
}

html.dark .filter-btn.active,
html.dark .filter-btn:focus {
    background: var(--indigo-600);
    color: var(--white);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem;
}

@media (min-width: 768px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.project-img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
}

.project-content {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

html.dark .project-title {
    color: var(--white);
}

.contact-grid {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(1, minmax(min-content, 1fr));
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .contact-grid {
        grid-template-columns: repeat(2, minmax(min-content, 1fr));
    }
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--white);
    border-radius: 0.75rem;
    box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

html.dark .contact-item {
    background: var(--gray-800);
}

.shadow-contact-item {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.shadow-contact-item:hover {
    box-shadow: 0 6px 12px -3px rgb(0 0 0 / 0.1), 0 4px 8px -2px rgb(0 0 0 / 0.1);
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.contact-icon {
    font-size: 2rem;
}

.contact-label {
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

html.dark .contact-label {
    color: var(--gray-400);
}

.contact-value {
    font-weight: bold;
    color: var(--gray-900);
}

html.dark .contact-value {
    color: var(--white);
}

.copy-btn {
    opacity: 0;
    transition: opacity 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 0.5rem;
}

@media screen and (max-width: 640px) {
    .copy-btn {
        opacity: 1;
    }
}

.contact-item:hover .copy-btn {
    opacity: 1;
}

.copy-icon {
    display: inline-block;
    vertical-align: middle;
}

.icon-svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--gray-500);
    transition: color 0.2s;
}

.copy-btn:hover .icon-svg {
    color: var(--indigo-500);
}

html.dark .icon-svg {
    color: var(--gray-400);
}

html.dark .copy-btn:hover .icon-svg {
    color: var(--indigo-400);
}

.copy-feedback {
    display: none;
    color: var(--indigo-600);
    font-weight: 600;
    margin-right: 0.5rem;
}

html.dark .copy-feedback {
    color: var(--indigo-400);
}

.copy-feedback:not(.hidden) {
    display: inline-block;
}

.footer {
    text-align: center;
    padding: 2rem 0 0.5rem;
    margin-top: 3rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-500);
}

html.dark .footer {
    border-top: 1px solid var(--gray-700);
    color: var(--gray-400);
}

.language-toggle-btn,
.theme-toggle-btn {
    position: fixed;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-800);
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background-color 0.3s, color 0.3s;
}

.language-toggle-btn {
    top: 1.5rem;
    right: 1.5rem;
}

.theme-toggle-btn {
    top: 1.5rem;
    left: 1.5rem;
}

.language-toggle-btn:hover,
.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--gray-300);
}

html.dark .language-toggle-btn,
html.dark .theme-toggle-btn {
    background: var(--gray-800);
    color: var(--gray-200);
}

html.dark .language-toggle-btn:hover,
html.dark .theme-toggle-btn:hover {
    background: var(--gray-700);
}

.toggle-icon {
    width: 27px;
    /* height: 1.25rem; */
}

/* Utility classes for transition (if needed) */
.transition-colors {
    transition: color 0.5s, background-color 0.5s;
}

.duration-500 {
    transition-duration: 0.5s;
}

.project-card:not(.active) {
    border-radius: 1rem;
    box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.aos-init.aos-animate.project-card:not(.active):hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 32px 10px rgb(95 95 95 / 25%);
}

html.dark .aos-init.aos-animate.project-card:not(.active):hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 32px 0 rgba(99, 102, 241, 0.12);
}

/* project mila not active */
.project-card:not(.active) .project-description,
.project-card:not(.active) .project-tag,
.project-card:not(.active) .project-link {
    display: none;
}

.project-modal {
    background: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.08);
    position: relative;
    /* transition: 1s all, 0s background; */
}

html.dark .project-card .project-modal {
    background: var(--gray-800);
}

/* --- project mila active --- */

/* Project Descriptions */
.project-card.active .project-description {
    font-size: 0.875rem;
    color: var(--gray-600);
}

html.dark .project-card.active .project-description {
    color: var(--gray-400);
}

/* Project Tags */
.project-card.active .project-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0.25rem 0.25rem 0 0;
    border-radius: 0.375rem;
    background: var(--gray-200);
    color: var(--gray-800);
    font-size: 0.875rem;
}

html.dark .project-card.active .project-tag {
    background: var(--gray-700);
    color: var(--gray-200);
}

/* Project Links */
.project-card.active .project-link {
    display: flex;
    width: fit-content;
    gap: 7px;
    align-items: center;
    padding: 0.25rem 0.5rem;
    margin: 1rem 0.25rem 0 0;
    border-radius: 0.375rem;
    background: var(--gray-800);
    color: var(--white);
    font-size: 0.875rem;
    font-weight: bold;
    text-decoration: none;
    transform: scale(1);
    transition: gap 0.3s linear;
}

html.dark .project-card.active .project-link {
    background: var(--gray-300);
    color: var(--black);
}

.project-card.active .project-link:hover {
    gap: 10px;
}

.project-card.active .project-link img {
    width: 1.5rem;
    filter: brightness(0) invert(1);
}

html.dark .project-card.active .project-link img {
    filter: unset;
}

/* project modal animation */
.overlay {
    display: contents;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(43, 43, 43, 0.1);
    backdrop-filter: blur(6px);
    opacity: 0;
    z-index: 1;
    transition: opacity 2s ease, display 0.6s ease;
}

.project-card.active .overlay {
    display: block;
    opacity: 1;
    z-index: 1001;
}

html body .aos-init.aos-animate.project-card.active {
    z-index: 1000;
}

.project-card.active .project-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    max-width: 800px;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1002;
}
.project-card.active ::-webkit-scrollbar {
    width: 5px;
}

/* Track */
.project-card.active ::-webkit-scrollbar-track {
    background: #00000000;
}

/* Handle */
.project-card.active ::-webkit-scrollbar-thumb {
    background: #242424;
    border-radius: 2.5px;
    width: 5px;
}

/* Handle on hover */
.project-card.active ::-webkit-scrollbar-thumb:hover {
    background: #3f3f3f;
}

@media screen and (max-width: 768px) {
    .project-card.active .project-modal {
        width: 90vw;
    }
}

.project-card.active .project-img {
    height: unset;
}

/* Close button inside expanded container */
.project-close {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    z-index: 103;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.6rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50%;
    cursor: pointer;

}

html.dark .project-close {
    background: rgba(34, 34, 34, 0.9);
    color: var(--gray-200);
}

.project-card.active .project-close {
    display: block;
}

/* Responsive tweaks */
@media (max-width: 880px) {
    .project-card.active .project-container {
        width: 92vw;
        height: auto;
        left: 50%;
        top: 50%;
    }

    .project-card.active .project-img {
        width: 100%;
        display: block;
    }

    .project-card.active .project-content {
        width: 100%;
    }
}