:root {
    --bg: #0a0e0c;
    --bg-light: #10150f;
    --forest: #174d35;
    --forest-light: #216847;
    --accent-rgb: var(--accent-rgb);
    --glass-rgb: 17, 23, 19;
    --card-rgb: 255, 255, 255;
    --text: #f1f3f1;
    --muted: #9da69f;
    --border: #27332c;
    --border-soft: rgba(var(--card-rgb), 0.08);
    --radius: 14px;
    --section-pad: 120px;
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg: #eef2f7;
    --bg-light: #ffffff;
    --forest: #2554c7;
    --forest-light: #2f6fed;
    --accent-rgb: 47, 111, 237;
    --glass-rgb: 255, 255, 255;
    --card-rgb: 16, 24, 40;
    --text: #101828;
    --muted: #5b6472;
    --border: #d7dee6;
    color-scheme: light;
}

body {
    transition: background 0.4s ease, color 0.4s ease;
}

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

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

body {
    font-family: "Vazirmatn", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: auto;
}

a {
    color: inherit;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--forest-light);
    outline-offset: 3px;
}

/* ---------- Layout skeleton: canvas behind, content above ---------- */

#particleCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.navbar, main, section, footer {
    position: relative;
    z-index: 1;
}

section[id] {
    scroll-margin-top: 90px;
}

/* ---------- Navbar ---------- */

.navbar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    padding: 22px 0;
    z-index: 50;
    transition: background 0.3s ease, border-color 0.3s ease, padding 0.3s ease;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: rgba(var(--glass-rgb), 0.65);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom-color: var(--border-soft);
    padding: 14px 0;
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 26px;
}

.logo {
    font-size: 19px;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 34px;
}

.nav-links a {
    position: relative;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    padding-bottom: 4px;
}

.nav-links a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--forest-light);
    transition: width 0.25s ease;
}

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

.nav-links a.active {
    color: var(--forest-light);
}

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

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text);
    display: block;
}

.theme-toggle {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(var(--card-rgb), 0.05);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.theme-toggle:hover {
    border-color: var(--forest-light);
    transform: translateY(-2px);
}

.theme-toggle svg {
    position: absolute;
    width: 18px;
    height: 18px;
    transition: opacity 0.35s ease, transform 0.45s ease;
}

.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(60deg) scale(0.5);
}

html[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-60deg) scale(0.5);
}

html[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 13px 28px;
    border: 1px solid var(--forest-light);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.25s ease;
    background: var(--forest);
    cursor: pointer;
    font-size: 15px;
}

.btn:hover {
    background: var(--forest-light);
    transform: translateY(-2px);
}

.btn-download {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: var(--border-soft);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-download:hover {
    background: rgba(var(--accent-rgb), 0.25);
    border-color: var(--forest-light);
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------- Hero ---------- */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 70px;
}

.hero-image {
    width: 320px;
    height: 320px;
    position: relative;
    flex-shrink: 0;
}

.hero-image::before {
    content: "";
    position: absolute;
    inset: -12px;
    border: 2px solid var(--forest-light);
    border-radius: 50%;
    z-index: 0;
}

.hero-image::after {
    content: "";
    position: absolute;
    inset: -24px;
    border: 1px solid var(--forest);
    border-radius: 50%;
    opacity: 0.5;
    z-index: 0;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    filter: contrast(1.05);
    box-shadow: 0 0 45px rgba(var(--accent-rgb), 0.35);
}

.hero-content {
    flex: 1;
    max-width: 640px;
}

.hero-eyebrow {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 14px;
}

.hero h1 {
    font-size: 58px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.hero h2 {
    font-size: 24px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 22px;
}

.hero p {
    font-size: 17px;
    color: var(--muted);
    margin-bottom: 28px;
    max-width: 55ch;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

.hero-tags span {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--muted);
    font-size: 13px;
    transition: 0.25s ease;
}

.hero-tags span:hover {
    background: rgba(var(--accent-rgb), 0.18);
    border-color: var(--forest-light);
    color: var(--text);
}

.scroll-cue {
    position: absolute;
    bottom: 36px;
    right: 50%;
    transform: translateX(50%);
    width: 1px;
    height: 46px;
    background: linear-gradient(to bottom, transparent, var(--forest-light));
}

.scroll-cue::after {
    content: "";
    position: absolute;
    left: -3px;
    bottom: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--forest-light);
}

/* ---------- Section title ---------- */

.section-title {
    margin-bottom: 56px;
}

.section-title h2 {
    font-size: 38px;
    font-weight: 700;
    position: relative;
    display: inline-block;
    padding-bottom: 16px;
}

.section-title h2::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 46px;
    height: 3px;
    background: var(--forest-light);
    border-radius: 3px;
}

/* ---------- About ---------- */

.about {
    padding: var(--section-pad) 0;
    background: rgba(var(--glass-rgb), 0.35);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}

.about::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    top: -160px;
    left: -120px;
    border-radius: 50%;
    background: var(--forest-light);
    filter: blur(150px);
    opacity: 0.28;
    pointer-events: none;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 80px;
}

.about-text h3 {
    font-size: 24px;
    margin-bottom: 22px;
}

.about-text p {
    color: var(--muted);
    font-size: 16px;
    margin-bottom: 18px;
}

.about-info {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.about-info div {
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(var(--card-rgb), 0.015);
}

.about-info strong,
.about-info span {
    display: block;
}

.about-info strong {
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.about-info span {
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
}

/* ---------- Experience ---------- */

.experience {
    padding: var(--section-pad) 0;
}

.timeline {
    position: relative;
    border-right: 1px solid var(--border);
    padding-right: 40px;
}

.job {
    position: relative;
    margin-bottom: 56px;
}

.job:last-child {
    margin-bottom: 0;
}

.job::before {
    content: "";
    position: absolute;
    right: -47px;
    top: 5px;
    width: 13px;
    height: 13px;
    background: var(--forest-light);
    border: 3px solid var(--bg);
    border-radius: 50%;
}

.job-date {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.job-content h3 {
    font-size: 23px;
    margin-bottom: 5px;
}

.job-content h4 {
    color: var(--muted);
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 14px;
}

.job-content p {
    color: var(--muted);
    max-width: 640px;
    font-size: 15px;
}

/* ---------- Skills ---------- */

.skills {
    padding: var(--section-pad) 0;
    background: rgba(var(--glass-rgb), 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}

.skills::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    bottom: -180px;
    right: -120px;
    border-radius: 50%;
    background: var(--forest-light);
    filter: blur(150px);
    opacity: 0.28;
    pointer-events: none;
}

.skills-group + .skills-group {
    margin-top: 48px;
}

.skills-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.skills-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0;
}

.group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.16);
    border: 1px solid rgba(var(--accent-rgb), 0.45);
    color: var(--forest-light);
    transform: scale(0.35);
    opacity: 0;
    transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.group-icon.popped {
    transform: scale(1);
    opacity: 1;
}

.group-icon svg {
    width: 21px;
    height: 21px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.skill-card {
    padding: 24px 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(var(--card-rgb), 0.015);
    transition: border-color 0.25s ease, background 0.25s ease;
}

.skill-card:hover {
    border-color: var(--forest-light);
    background: rgba(var(--accent-rgb), 0.06);
}

.skill-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.skill-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.12);
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    color: var(--forest-light);
}

.skill-icon svg {
    width: 18px;
    height: 18px;
}

.skill-card-head h4 {
    font-size: 17px;
    font-weight: 600;
}

.skill-card-head small {
    color: var(--muted);
    font-size: 13px;
}

.skill-card p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.skill-level {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.skill-level span {
    display: block;
    height: 100%;
    background: var(--forest-light);
    border-radius: 10px;
}

/* ---------- Contact ---------- */

.contact {
    padding: var(--section-pad) 0;
    position: relative;
    overflow: hidden;
}

.contact::before {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--forest);
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    top: 30%;
    left: 10%;
    pointer-events: none;
}

.contact-intro {
    color: var(--muted);
    font-size: 17px;
    margin-bottom: 40px;
    max-width: 60ch;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 26px;
    background: rgba(var(--card-rgb), 0.05);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: var(--text);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: 0.3s ease;
}

.contact-card:hover {
    background: rgba(var(--accent-rgb), 0.14);
    border-color: rgba(var(--accent-rgb), 0.55);
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35), 0 0 25px rgba(var(--accent-rgb), 0.12);
}

.contact-icon {
    font-size: 26px;
}

.contact-card h3 {
    font-size: 17px;
    margin-bottom: 5px;
}

.contact-card p {
    color: var(--muted);
    font-size: 14px;
}

/* ---------- Footer ---------- */

.footer {
    padding: 44px 0 30px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

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

.footer h3 {
    font-size: 19px;
    margin-bottom: 5px;
}

.footer p {
    color: var(--muted);
    font-size: 14px;
}

.back-to-top {
    text-decoration: none;
    font-size: 14px;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 999px;
    transition: 0.25s ease;
}

.back-to-top:hover {
    color: var(--text);
    border-color: var(--forest-light);
}

.footer-copy {
    text-align: left;
}

/* ---------- Mobile ---------- */

@media (max-width: 900px) {
    :root { --section-pad: 90px; }

    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: 64px;
        right: 0;
        left: 0;
        background: rgba(var(--glass-rgb), 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        gap: 22px;
        padding: 28px 0;
        border-bottom: 1px solid var(--border-soft);
        transform: translateY(-12px);
        opacity: 0;
        pointer-events: none;
        transition: 0.25s ease;
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .hero .container {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }

    .hero-image {
        width: 220px;
        height: 220px;
        margin-top: 70px;
    }

    .hero h1 { font-size: 40px; }
    .hero h2 { font-size: 20px; }
    .hero p { margin-inline: auto; }
    .hero-tags { justify-content: center; }
    .hero-actions { justify-content: center; }

    .about-content {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .contact-card { padding: 20px; }

    .section-title h2 { font-size: 30px; }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-copy { text-align: center; }
}
