@font-face {
    font-family: Vazirmatn;
    src: url("fonts/Vazirmatn[wght].woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --page: #0d1b28;
    --surface: #122435;
    --surface-strong: #1b3141;
    --ink: #f1f3f1;
    --muted: #b2bec4;
    --line: #354a59;
    --accent: #d8c8aa;
    --accent-ink: #1c2a33;
    --nav: rgba(13, 27, 40, .92);
    --contact: #172d3c;
    --footer: #122331;
    --focus: #e5c797;
}

[data-theme="light"] {
    color-scheme: light;
    --page: #f2f4f4;
    --surface: #ffffff;
    --surface-strong: #e3e9e9;
    --ink: #142c3b;
    --muted: #4d6270;
    --line: #c8d1d3;
    --accent: #263f52;
    --accent-ink: #ffffff;
    --nav: rgba(242, 244, 244, .94);
    --contact: #e2e9e9;
    --footer: #e7eded;
    --focus: #195fd1;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Vazirmatn, Tahoma, sans-serif;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
.skip-link {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 500;
    padding: 10px 16px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 8px;
    transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 78px;
    padding: 10px max(24px, calc((100% - 1280px) / 2));
    border-bottom: 1px solid var(--line);
    background: var(--nav);
    backdrop-filter: blur(18px);
}
.nav-brand, .nav-actions, .nav-links { display: flex; align-items: center; }
.nav-brand { gap: 11px; flex-shrink: 0; font-weight: 800; }
.nav-logo, .hero-logotype, .footer-mark {
    display: grid;
    place-content: center;
    grid-auto-flow: column;
    direction: ltr;
    font-family: "Segoe UI", sans-serif;
    font-weight: 800;
    letter-spacing: -.08em;
}
.nav-logo {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--accent);
    font-size: 15px;
}
.nav-identity { display: flex; flex-direction: column; line-height: 1.55; }
.nav-title { font-size: 15px; }
.nav-role { color: var(--muted); font-size: 11px; font-weight: 500; }
.nav-links { gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.nav-link { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 15px; color: var(--muted); border-radius: 3px; font-size: 14px; font-weight: 600; transition: color .2s, background .2s; }
.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--surface-strong); }
.nav-link.active::after { content: ""; position: absolute; right: 15px; left: 15px; bottom: 0; height: 2px; background: var(--accent); }
.nav-actions { gap: 8px; }
.nav-contact-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); border-radius: 5px; font-size: 13px; font-weight: 750; transition: opacity .2s; }
.nav-contact-cta:hover { opacity: .85; }
.nav-btn, .mobile-menu-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    transition: background .2s, border-color .2s;
}
.nav-btn:hover, .mobile-menu-close:hover { background: var(--surface-strong); border-color: var(--muted); }
.nav-hamburger { display: none; }
.theme-icon-sun, .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun, [data-theme="light"] .theme-icon-moon { display: block; }

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    background: rgba(4, 13, 19, .7);
}
.mobile-menu.open { display: block; }
.mobile-menu-panel {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(340px, 88vw);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--page);
    border-left: 1px solid var(--line);
}
.mobile-menu-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.mobile-menu-identity { display: flex; flex-direction: column; }
.mobile-menu-title { font-size: 18px; font-weight: 800; }
.mobile-menu-subtitle { color: var(--muted); font-size: 12px; }
.mobile-nav-link { display: flex; align-items: center; gap: 14px; flex-shrink: 0; min-height: 60px; border-bottom: 1px solid var(--line); font-weight: 650; transition: color .2s; }
.mobile-nav-link:hover { color: var(--accent); }
.mobile-nav-link svg { color: var(--muted); }
.mobile-menu-contact { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-top: auto; padding: 32px 0 8px; color: var(--muted); font-size: 12px; }
.mobile-menu-contact a { color: var(--ink); font-family: "Segoe UI", sans-serif; font-size: 14px; }

.main { width: min(100% - 48px, 1280px); margin-inline: auto; }
.hero { padding: clamp(56px, 7vw, 98px) 0 55px; border-bottom: 1px solid var(--line); }
.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    grid-template-areas: "avatar visual" "content visual" "actions visual";
    align-items: start;
    column-gap: clamp(48px, 7vw, 108px);
}
.hero-avatar { grid-area: avatar; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.hero-logotype { width: 38px; height: 38px; color: var(--accent); border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }
.hero-content { grid-area: content; padding-top: 25px; }
.hero-name { margin: 0 0 8px; font-size: clamp(64px, 7vw, 102px); line-height: 1.22; letter-spacing: -.035em; font-weight: 850; }
.hero-subtitle { display: flex; align-items: center; gap: 10px; margin: 0; font-size: clamp(17px, 1.65vw, 21px); font-weight: 750; }
.hero-dot { width: 24px; height: 2px; flex: none; background: var(--accent); }
.hero-description { max-width: 42ch; margin: 22px 0 0; color: var(--muted); font-size: 16px; line-height: 2.1; }
.hero-location { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.hero-actions { grid-area: actions; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 10px 21px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; font-weight: 750; transition: transform .2s, background .2s, border-color .2s; }
.hero-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.hero-btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.hero-btn-secondary { color: var(--ink); background: transparent; }
.hero-btn-secondary span { font-size: 19px; line-height: 1; }

/* A compact diagram makes the technical focus tangible without a stock portrait. */
.system-visual {
    position: relative;
    grid-area: visual;
    display: flex;
    flex-direction: column;
    min-height: 460px;
    padding: 27px;
    overflow: hidden;
    color: #e7edec;
    background-color: #1b3141;
    background-image: linear-gradient(rgba(226, 234, 233, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(226, 234, 233, .035) 1px, transparent 1px);
    background-size: 32px 32px;
    border: 1px solid #425766;
    border-radius: 6px;
}
.system-visual::before { content: "TD"; position: absolute; left: -10px; bottom: 50px; direction: ltr; color: rgba(235, 241, 238, .045); font: 800 210px/.8 "Segoe UI", sans-serif; letter-spacing: -.1em; }
.visual-heading, .visual-caption { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 750; }
.visual-mark { direction: ltr; font-family: "Segoe UI", sans-serif; font-size: 10px; letter-spacing: .06em; opacity: .7; }
.visual-diagram { position: relative; width: min(100%, 345px); margin: auto; padding: 32px 0; text-align: left; font-family: "Segoe UI", sans-serif; }
.visual-node { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 16px; border: 1px solid #526a78; border-radius: 4px; background: rgba(20, 38, 51, .9); }
.visual-node span { font-size: 9px; font-weight: 700; letter-spacing: .09em; opacity: .68; }
.visual-node strong { font-size: 20px; line-height: 1.25; letter-spacing: -.03em; }
.visual-node small { font-size: 11px; opacity: .72; }
.visual-node-main { width: 76%; margin: auto; padding: 18px 20px; background: #ddd0b6; color: #182a34; border-color: #ddd0b6; }
.visual-node-main strong { font-size: 27px; }
.visual-connector { width: 1px; height: 27px; margin: auto; background: #82939b; }
.visual-branches { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 14px; }
.visual-branches::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 14px; border: 1px solid #82939b; border-bottom: 0; }
.visual-caption { justify-content: flex-start; gap: 0; padding-top: 18px; border-top: 1px solid #526a78; }
.visual-caption span + span::before { content: "/"; margin: 0 12px; opacity: .4; }

.bento { display: block; }
.bento-card { padding: 100px 0; border-bottom: 1px solid var(--line); }
.card-header { margin-bottom: 35px; }
.card-title { margin: 0; font-size: clamp(29px, 3.1vw, 42px); line-height: 1.45; letter-spacing: -.035em; font-weight: 850; }
#about { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); padding: clamp(48px, 5vw, 68px) 0; }
#about .card-header { margin: 0; }
.about-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 3vw, 40px); }
.about-text { margin: 0; color: var(--muted); font-size: 16px; line-height: 2.1; }
.about-text strong { color: var(--ink); font-weight: 750; }

#services { padding: 68px 0; }
#services .card-header { margin-bottom: 24px; }
.services-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; }
.service-item { padding: 24px 0 0; border-top: 1px solid var(--line); }
.service-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent); background: var(--surface); }
.service-item h3 { margin: 0 0 10px; font-size: 17px; line-height: 1.6; }
.service-item p { margin: 0; color: var(--muted); font-size: 14px; line-height: 2; }
.term { display: inline-block; white-space: nowrap; }

#skills { margin-top: 100px; padding: clamp(28px, 5vw, 60px); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.skill-bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 42px; }
.skill-bar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.skill-bar-name { direction: ltr; font-family: "Segoe UI", sans-serif; font-size: 14px; font-weight: 700; }
.skill-bar-percent { color: var(--muted); font-size: 13px; }
.skill-bar-track { height: 4px; overflow: hidden; background: var(--line); border-radius: 4px; direction: ltr; }
.skill-bar-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.skill-bar-fill[data-width="95"] { width: 95%; }
.skill-bar-fill[data-width="85"] { width: 85%; }
.skill-bar-fill[data-width="90"] { width: 90%; }
.skill-bar-fill[data-width="92"] { width: 92%; }
.skill-bar-fill[data-width="75"] { width: 75%; }
.skill-bar-fill[data-width="70"] { width: 70%; }
.skill-bar-fill[data-width="88"] { width: 88%; }
.skill-bar-fill[data-width="80"] { width: 80%; }
.skill-bar-fill[data-width="78"] { width: 78%; }

#contact { margin-top: 100px; padding: clamp(28px, 5vw, 60px); border: 1px solid var(--line); border-radius: 6px; background: var(--contact); }
#contact .card-header { margin-bottom: 8px; }
.contact-intro { max-width: 55ch; margin: 0 0 32px; color: var(--muted); font-size: 15px; }
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 5px; }
.contact-item { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 90px; padding: 18px; background: var(--contact); transition: background .2s; }
.contact-item:hover { background: var(--surface-strong); }
.contact-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; color: var(--accent); border: 1px solid var(--line); border-radius: 5px; }
.contact-icon svg { width: 19px; height: 19px; }
.contact-info { display: flex; flex-direction: column; min-width: 0; }
.contact-label { font-size: 14px; font-weight: 750; }
.contact-value { overflow-wrap: anywhere; color: var(--muted); font-family: "Segoe UI", Vazirmatn, sans-serif; font-size: 12px; text-align: right; }
.site-footer { margin-top: 72px; border-top: 1px solid var(--line); background: var(--footer); }
.footer-shell { width: min(100% - 48px, 1100px); margin-inline: auto; }
.footer-main { display: grid; grid-template-columns: minmax(250px, 1.1fr) minmax(150px, .65fr) minmax(190px, .9fr); gap: clamp(24px, 4vw, 52px); padding: 44px 0 32px; }
.footer-brand { display: inline-flex; align-items: center; gap: 13px; }
.footer-mark { width: 48px; height: 48px; color: var(--accent); border: 1px solid var(--line); border-radius: 5px; font-size: 17px; }
.footer-identity { display: flex; flex-direction: column; line-height: 1.6; }
.footer-identity strong { color: var(--ink); font-size: 16px; }
.footer-identity span { color: var(--muted); font-size: 12px; }
.footer-about p { max-width: 38ch; margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 2; }
.footer-column h2 { margin: 0 0 10px; color: var(--ink); font-size: 14px; font-weight: 750; }
.footer-links { display: grid; grid-template-columns: repeat(2, max-content); gap: 0 26px; }
.footer-contact { display: flex; flex-direction: column; align-items: flex-start; }
.footer-links a, .footer-contact a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; transition: color .2s; }
.footer-links a:hover, .footer-contact a:hover, .footer-top:hover { color: var(--ink); }
.footer-contact a { direction: ltr; font-family: "Segoe UI", sans-serif; overflow-wrap: anywhere; }
.footer-contact span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.footer-top { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-left: 60px; color: var(--muted); white-space: nowrap; transition: color .2s; }
.footer-top span { color: var(--accent); font-size: 18px; line-height: 1; }

.back-to-top { position: fixed; z-index: 90; left: 24px; bottom: 24px; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 50%; opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s, transform .2s, visibility .2s; }
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.toast { position: fixed; z-index: 300; left: 50%; bottom: 24px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 11px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); opacity: 0; visibility: hidden; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s, visibility .2s; }
.toast.visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
    .nav-role, .nav-contact-cta { display: none; }
}
@media (max-width: 980px) {
    .hero-card { column-gap: 40px; }
    .system-visual { min-height: 420px; }
    .about-content { grid-template-columns: 1fr; gap: 12px; }
    .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
    .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .navbar { min-height: 70px; padding-inline: 20px; }
    .nav-links { display: none; }
    .nav-hamburger { display: grid; }
    .main { width: min(100% - 40px, 1280px); }
    .hero { padding: 48px 0 38px; }
    .hero-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "avatar" "content" "actions" "visual"; }
    .hero-name { font-size: clamp(57px, 12vw, 82px); }
    .hero-actions { margin-top: 26px; }
    .system-visual { min-height: 380px; margin-top: 38px; }
    .bento-card { padding: 70px 0; }
    #about { grid-template-columns: 1fr; gap: 14px; }
    #services { padding: 52px 0; }
    .skill-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #skills, #contact { margin-top: 70px; padding: 30px 24px; }
    .site-footer { margin-top: 56px; }
    .footer-shell { width: min(100% - 40px, 1100px); }
    .footer-main { grid-template-columns: 1fr 1fr; gap: 28px; padding: 38px 0 28px; }
    .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .navbar { gap: 8px; }
    .nav-brand { gap: 8px; }
    .nav-title { font-size: 14px; }
    .nav-actions { gap: 4px; }
    .nav-btn { width: 44px; height: 44px; }
    .hero-avatar { font-size: 12px; }
    .hero-name { font-size: clamp(52px, 13vw, 64px); }
    .hero-subtitle { align-items: flex-start; font-size: 16px; }
    .hero-dot { margin-top: 11px; }
    .hero-description { font-size: 15px; }
    .hero-btn { flex: 1 1 auto; padding-inline: 14px; }
    .system-visual { min-height: 360px; padding: 20px; }
    .visual-diagram { padding: 25px 0; }
    .visual-node { padding: 11px; }
    .visual-node-main { padding: 14px; }
    .visual-caption { font-size: 11px; }
    .visual-caption span + span::before { margin: 0 8px; }
    .about-text { font-size: 15px; }
    .services-grid, .skill-bars, .contact-grid { grid-template-columns: 1fr; }
    .services-grid { gap: 28px; }
    .service-item { display: grid; grid-template-columns: 46px 1fr; column-gap: 15px; }
    .service-icon { grid-row: span 2; margin-bottom: 0; }
    .service-item h3 { margin: 0 0 5px; }
    .skill-bars { gap: 24px; }
    .contact-item { min-height: 74px; }
    .footer-main { grid-template-columns: 1fr; gap: 24px; }
    .footer-about { grid-column: auto; }
    .footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-self: stretch; gap: 2px 20px; }
    .footer-bottom { align-items: flex-start; flex-direction: column; gap: 10px; }
    .footer-top { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
