:root {
  --canvas: #f3f7f5;
  --surface: #ffffff;
  --surface-soft: #edf6f2;
  --ink: #172622;
  --muted: #52635f;
  --line: #d7e3de;
  --line-strong: #b9d4cb;
  --deep: #0f2e2a;
  --deep-soft: #1a3d36;
  --deep-card: #17332f;
  --teal: #087f6b;
  --teal-dark: #056554;
  --teal-soft: #d9eee7;
  --teal-glow: rgba(8, 127, 107, .18);
  --coral: #bd5141;
  --coral-soft: #fae7e2;
  --success: #2d9b68;
  --font-fa: "Vazirmatn", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  --font-en: "Inter", "Noto Sans", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--font-en); font-size: 15px; line-height: 1.65; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
html[lang="fa"] body { font-family: var(--font-fa); line-height: 1.9; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(8, 127, 107, .35); outline-offset: 3px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

.container { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 1000; top: 10px; inset-inline-start: 10px; padding: 8px 12px; color: var(--deep); background: #fff; border: 1px solid var(--line); border-radius: 6px; transform: translateY(-160%); text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

/* ===== Topbar ===== */
.topbar { position: sticky; z-index: 100; top: 0; min-height: 68px; display: flex; align-items: center; gap: 20px; padding: 8px max(20px, calc((100vw - 1180px) / 2)); background: rgba(255,255,255,.88); border-bottom: 1px solid rgba(215,227,222,.9); backdrop-filter: blur(14px) saturate(1.2); }
.brand { min-width: 220px; display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { position: relative; width: 40px; height: 40px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 8px; color: #fff; background: var(--deep); font: 800 11px/1 var(--font-mono); overflow: hidden; isolation: isolate; }
.brand-mark-glow { position: absolute; inset: -12px; background: radial-gradient(closest-side, rgba(8,127,107,.55), transparent 70%); opacity: .7; }
.brand-copy { display: grid; line-height: 1.35; }
.brand-copy strong { font-size: 13px; letter-spacing: -.01em; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.desktop-nav { display: flex; align-items: center; gap: 2px; margin-inline: auto; }
.desktop-nav a { position: relative; padding: 8px 10px; color: #465955; font-size: 12px; font-weight: 700; text-decoration: none; transition: color .18s ease; }
.desktop-nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 1px; background: var(--coral); transform: scaleX(0); transform-origin: center; transition: transform .18s ease; }
.desktop-nav a:hover, .desktop-nav a.is-active { color: var(--deep); }
.desktop-nav a.is-active::after { transform: scaleX(1); }
.toolbar { display: flex; align-items: center; gap: 8px; }
.language-switch { display: flex; align-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf8; direction: ltr; }
.language-switch button { width: 36px; height: 30px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: 700 11px var(--font-mono); cursor: pointer; transition: background .15s ease, color .15s ease; }
.language-switch button.is-active { color: #fff; background: var(--deep); box-shadow: 0 1px 6px rgba(15,46,42,.18); }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 800; text-decoration: none; cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .72; transform: none; }
.button svg { width: 16px; height: 16px; flex: 0 0 auto; fill: currentColor; }
.button-primary { width: 40px; padding-inline: 0; color: #fff; background: var(--deep); border-color: var(--deep); }
.button-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.button-light { color: var(--deep); background: #fff; border-color: #fff; box-shadow: 0 4px 18px rgba(15,46,42,.12); }
.button-light:hover { color: var(--teal-dark); background: var(--teal-soft); border-color: var(--teal-soft); }
.button-ghost { color: #e8f4ef; border-color: rgba(232,244,239,.42); background: rgba(255,255,255,.04); }
.button-ghost:hover { color: #fff; border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); }
.nav-toggle { display: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.nav-toggle span { display: block; width: 18px; height: 2px; border-radius: 1px; background: var(--deep); transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

[hidden] { display: none !important; }
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; background: linear-gradient(90deg, var(--teal), var(--coral)); transform-origin: left; transform: scaleX(0); pointer-events: none; }

.mobile-nav { display: none; }
.mobile-drawer { position: fixed; z-index: 90; top: 68px; left: 0; right: 0; display: grid; gap: 2px; padding: 12px 16px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.98); backdrop-filter: blur(12px); box-shadow: 0 12px 32px rgba(15,46,42,.12); animation: drawerIn .22s ease; }
.mobile-drawer[hidden] { display: none !important; animation: none; }
.mobile-drawer a { padding: 10px 12px; border-radius: 8px; color: var(--deep); font-size: 13px; font-weight: 700; text-decoration: none; }
.mobile-drawer a:hover { background: var(--teal-soft); }
.drawer-backdrop { position: fixed; inset: 68px 0 0; z-index: 89; background: rgba(15,46,42,.18); backdrop-filter: blur(2px); }
.drawer-backdrop[hidden] { display: none !important; }
@keyframes drawerIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ===== Hero ===== */
.hero { position: relative; color: #fff; background: var(--deep); border-bottom: 1px solid rgba(255,255,255,.06); overflow: hidden; isolation: isolate; }
.hero-spotlight { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s ease; background: radial-gradient(420px circle at var(--mx, 30%) var(--my, 40%), rgba(143,224,205,.14), transparent 65%); }
.hero:hover .hero-spotlight { opacity: 1; }
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.hero-grid { position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(ellipse 90% 70% at 28% 30%, #000 35%, transparent 72%); }
.hero-orb { position: absolute; border-radius: 50%; filter: blur(42px); opacity: .45; will-change: transform; }
.hero-orb-a { width: 520px; height: 520px; left: -80px; top: -140px; background: radial-gradient(circle at 50% 50%, rgba(8,127,107,.9), transparent 68%); animation: driftA 18s ease-in-out infinite alternate; }
.hero-orb-b { width: 620px; height: 620px; right: -160px; top: 10%; background: radial-gradient(circle at 50% 50%, rgba(189,81,65,.42), transparent 68%); animation: driftB 22s ease-in-out infinite alternate; }
.hero-orb-c { width: 420px; height: 420px; left: 42%; bottom: -120px; background: radial-gradient(circle at 50% 50%, rgba(45,155,104,.28), transparent 70%); animation: driftA 26s ease-in-out infinite alternate-reverse; }
@keyframes driftA { from { transform: translate(0,0) scale(1); } to { transform: translate(18px, -14px) scale(1.04); } }
@keyframes driftB { from { transform: translate(0,0) scale(1); } to { transform: translate(-14px, 12px) scale(1.05); } }

.hero-layout { position: relative; z-index: 1; min-height: 520px; display: grid; grid-template-columns: minmax(0, 1fr) 296px; align-items: center; gap: 56px; padding-block: 72px 64px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hero-kicker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 6px rgba(8,127,107,.18), 0 0 14px rgba(8,127,107,.45); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .85; } }
.eyebrow { margin: 0; color: #8fe0cd; font: 700 11px/1.3 var(--font-mono); letter-spacing: .08em; }
.hero h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.05; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
.hero h1::after { content: ""; display: block; width: 72px; height: 3px; margin-top: 14px; border-radius: 2px; background: linear-gradient(90deg, var(--teal), var(--coral)); opacity: .95; }
.hero-role { margin: 18px 0 0; color: #dff1ea; font-size: clamp(16px, 2.2vw, 22px); font-weight: 700; letter-spacing: -.01em; }
.hero-role-typed { color: #8fe0cd; font-weight: 800; }
.hero-role-cursor { display: inline-block; width: 2px; height: 1em; margin-inline-start: 2px; background: #8fe0cd; vertical-align: -1px; animation: blink 1s steps(2,end) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }
.hero-techline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.hero-techline span { display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #cfe8df; background: rgba(255,255,255,.06); font: 600 11px var(--font-mono); letter-spacing: .01em; backdrop-filter: blur(6px); }
.hero-summary { max-width: 700px; margin: 20px 0 0; color: #b9d3cb; font-size: 15px; line-height: 1.9; }
html[lang="en"] .hero-summary { color: #c2d7d0; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-actions-primary { margin-top: 28px; }
.hero-actions-secondary { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.hero-link-secondary { display: inline-flex; align-items: center; gap: 6px; color: #b9d3cb; font: 600 11px var(--font-mono); text-decoration: none; opacity: .9; transition: color .15s ease, opacity .15s ease; }
.hero-link-secondary svg { width: 13px; height: 13px; fill: currentColor; opacity: .85; }
.hero-link-secondary:hover { color: #fff; opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.hero-link-tertiary { color: #8fbdb0; font: 500 10px var(--font-mono); text-decoration: none; opacity: .75; transition: color .15s ease, opacity .15s ease; }
.hero-link-tertiary:hover { color: #cfe8df; opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.quick-facts { max-width: 700px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 30px 0 0; padding: 16px 0 0; border-top: 1px solid rgba(255,255,255,.12); }
.quick-facts div { min-width: 0; padding-inline: 16px; }
.quick-facts div:first-child { padding-inline-start: 0; }
.quick-facts div + div { border-inline-start: 1px solid rgba(255,255,255,.1); }
.quick-facts dt { color: #8fbdb0; font: 700 10px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.quick-facts dd { margin: 4px 0 0; color: #f0faf7; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }

.identity-card { position: relative; width: 100%; padding: 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04)); backdrop-filter: blur(12px); box-shadow: 0 20px 50px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.1); overflow: hidden; }
.identity-card-glow { position: absolute; inset: -40% -20% auto -20%; height: 220px; background: radial-gradient(ellipse at 50% 0%, rgba(143,224,205,.22), transparent 62%); pointer-events: none; }
.profile-photo-wrap { position: relative; padding: 4px; background: linear-gradient(180deg, #fff, #e8f1ec); border-radius: 10px; }
.profile-photo-wrap img { width: 100%; aspect-ratio: 1 / 1; border-radius: 8px; object-fit: cover; object-position: center; }
.availability-dot { position: absolute; inset-inline-start: 12px; bottom: 12px; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(45,155,104,.18); }
.availability-label { position: absolute; inset-inline-start: 30px; bottom: 10px; padding: 2px 7px; border-radius: 999px; color: #0f2e2a; background: #fff; font: 700 9px var(--font-mono); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.identity-contact { position: relative; display: grid; gap: 4px; margin: 12px 2px 0; color: #cfe6de; font-style: normal; text-align: center; }
.identity-contact strong { color: #fff; font-size: 12px; letter-spacing: .02em; }
.identity-contact a { color: #cfe6de; font: 500 11px var(--font-mono); text-decoration: none; direction: ltr; }
.identity-contact a:hover { color: #fff; text-decoration: underline; }
.identity-meta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); color: #9ec8ba; font: 600 10px var(--font-mono); }
.mono-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(45,155,104,.6); }

/* ===== Reveal ===== */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
  .reveal.is-visible { opacity: 1; transform: none; }
  .reveal.is-visible .strength-grid article { animation: cardIn .5s ease both; }
  .reveal.is-visible .strength-grid article:nth-child(2) { animation-delay: .06s; }
  .reveal.is-visible .strength-grid article:nth-child(3) { animation-delay: .12s; }
  .reveal.is-visible .strength-grid article:nth-child(4) { animation-delay: .18s; }
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== Resume shell ===== */
.resume-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 56px; padding-block: 56px 72px; }
.main-column { min-width: 0; }
.resume-section + .resume-section { margin-top: 56px; padding-top: 52px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.section-index { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid #a6d8ca; border-radius: 8px; color: var(--teal-dark); background: var(--teal-soft); font: 800 10px var(--font-mono); }
.section-heading p { margin: 0 0 1px; color: var(--coral); font-size: 10px; font-weight: 800; }
.section-heading h2, .side-heading h2 { margin: 0; color: var(--deep); line-height: 1.3; letter-spacing: -.01em; }
.section-heading h2 { font-size: 24px; }
.lead { max-width: 860px; margin: 0; color: #3d514c; font-size: 15px; line-height: 2; }
html[lang="en"] .lead { line-height: 1.75; }

/* ===== Strength grid ===== */
.strength-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.strength-grid article { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.strength-grid article:hover { border-color: #bfe0d4; box-shadow: 0 8px 24px rgba(15,46,42,.06); transform: translateY(-2px); }
.mini-icon { width: max-content; min-width: 36px; height: 24px; display: grid; place-items: center; padding-inline: 7px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 6px; font: 800 8px var(--font-mono); letter-spacing: .04em; }
.strength-grid h3 { margin: 11px 0 4px; color: var(--deep); font-size: 12px; }
.strength-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }

/* ===== Experience timeline ===== */
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 6px; bottom: 8px; inset-inline-start: 6px; width: 1px; background: #d0e2db; }
.timeline-progress { position: absolute; top: 6px; left: 6px; width: 1px; background: linear-gradient(180deg, var(--teal), var(--coral)); transform-origin: top; transform: scaleY(0); transition: transform .15s linear; }
html[dir="rtl"] .timeline-progress { left: auto; right: 6px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 22px; padding-inline-start: 30px; padding-bottom: 28px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker { position: absolute; top: 5px; inset-inline-start: 0; width: 13px; height: 13px; border: 3px solid var(--canvas); border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 1px #83b9a9; transition: transform .2s ease, box-shadow .2s ease; }
.timeline-item:hover .timeline-marker { transform: scale(1.15); box-shadow: 0 0 0 1px #83b9a9, 0 0 10px rgba(8,127,107,.25); }
.timeline-meta { display: grid; align-content: start; gap: 2px; color: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.timeline-meta time { color: #314942; font-weight: 800; font-family: var(--font-mono); }
.timeline-body { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .18s ease, box-shadow .18s ease; }
.timeline-body:hover { border-color: #c5ddd5; box-shadow: 0 6px 20px rgba(15,46,42,.05); }
.timeline-body h3 { margin: 0; color: var(--deep); font-size: 14px; line-height: 1.5; }
.timeline-body .company { margin: 2px 0 6px; color: var(--teal-dark); font-size: 11px; font-weight: 800; }
.timeline-body .company a { color: inherit; text-decoration: none; }
.timeline-body .company a:hover { text-decoration: underline; }
.timeline-body > p:not(.company) { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.achievement-list, .project-points { display: grid; gap: 3px; margin: 10px 0 10px; padding: 0; list-style: none; }
.achievement-list li, .project-points li { position: relative; padding-inline-start: 14px; color: #455854; font-size: 11px; line-height: 1.75; }
.achievement-list li::before, .project-points li::before { content: ""; position: absolute; top: .72em; inset-inline-start: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tags span { min-height: 22px; display: inline-flex; align-items: center; padding: 2px 7px; border: 1px solid #d5e4de; border-radius: 999px; color: #466158; background: #f7fbf9; font: 700 9px var(--font-mono); direction: ltr; transition: border-color .15s ease, background .15s ease; }
.tags span:hover { border-color: #bfe0d4; background: var(--teal-soft); }

/* ===== Earlier experience ===== */
.earlier-experience { margin-top: 28px; }
.earlier-heading { margin: 0 0 12px; color: var(--muted); font: 700 12px var(--font-mono); letter-spacing: .02em; }
.earlier-grid { display: grid; gap: 8px; }
.earlier-card { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s ease; }
.earlier-card:hover { border-color: #c5ddd5; }
.earlier-meta { color: var(--muted); font: 600 10px var(--font-mono); }
.earlier-meta time { font-weight: 800; color: #314942; }
.earlier-card h3 { margin: 2px 0 2px; color: var(--deep); font-size: 12px; line-height: 1.5; }
.earlier-card p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.7; }

/* ===== Projects ===== */
.featured-projects { display: grid; gap: 14px; }
.project-card { position: relative; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.project-card::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 2px; background: linear-gradient(90deg, var(--teal), transparent 70%); opacity: .7; }
.project-card:hover { border-color: #bfe0d4; box-shadow: 0 10px 30px rgba(15,46,42,.07); transform: translateY(-2px); }
.project-card-featured { border-inline-start: 3px solid var(--teal); }
.project-card-featured:hover { border-inline-start-color: var(--teal-dark); }
.project-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.project-type { display: inline-flex; align-items: center; gap: 6px; color: var(--teal-dark); font: 700 10px var(--font-mono); letter-spacing: .04em; }
.project-type::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.project-year { color: #71807b; font: 700 10px var(--font-mono); }
.project-card h3 { margin: 0; color: var(--deep); font-size: 16px; letter-spacing: -.01em; }
.project-card p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.85; }
.project-card-secondary { border-inline-start-color: var(--line); padding: 16px 18px; }
.project-card-secondary h3 { font-size: 13px; }
.secondary-grid { display: grid; gap: 12px; margin-top: 14px; }
.secondary-title { margin: 28px 0 10px; color: var(--deep); font-size: 14px; }

/* Agent flow diagram */
.agent-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, #f8fcf9, #f3f7f5); }
.flow-step { display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid #c5ddd5; border-radius: 6px; color: var(--teal-dark); background: var(--teal-soft); font: 700 9px var(--font-mono); direction: ltr; white-space: nowrap; transition: transform .15s ease; }
.project-card:hover .flow-step { transform: translateY(-1px); }
.flow-arrow { color: #8fb0a5; font: 600 13px var(--font-mono); animation: nudge 2s ease-in-out infinite; }
.flow-arrow:nth-child(2) { animation-delay: 0s; }
.flow-arrow:nth-child(4) { animation-delay: .15s; }
.flow-arrow:nth-child(6) { animation-delay: .3s; }
@keyframes nudge { 0%,100% { transform: translateX(0); opacity: .9; } 50% { transform: translateX(2px); opacity: 1; } }
html[dir="rtl"] .flow-arrow { transform: scaleX(-1); }
html[dir="rtl"] .flow-arrow { animation-name: nudgeRtl; }
@keyframes nudgeRtl { 0%,100% { transform: scaleX(-1) translateX(0); } 50% { transform: scaleX(-1) translateX(2px); } }

/* Case study */
.case-study { margin: 14px 0 4px; }
.case-study summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--teal-dark); background: #f8fcf9; font: 700 11px var(--font-mono); cursor: pointer; list-style: none; transition: background .15s ease, border-color .15s ease; }
.case-study summary::-webkit-details-marker { display: none; }
.case-study summary::before { content: "▸"; font-size: 10px; transition: transform .15s ease; display: inline-block; }
.case-study[open] summary::before { transform: rotate(90deg); }
.case-study summary:hover { background: var(--teal-soft); border-color: #bfe0d4; }
.case-body { display: grid; gap: 10px; margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #f8fcf9; }
.case-row strong { display: block; margin-bottom: 2px; color: var(--deep); font: 700 10px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.case-row p { margin: 0; color: #455c55; font-size: 11px; line-height: 1.8; }
.case-row p[dir="ltr"] { font-family: var(--font-mono); font-size: 10px; }

/* Open source */
.open-source-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 32px; }
.subsection-title { margin: 0; color: var(--deep); font-size: 16px; letter-spacing: -.01em; }
.github-link { color: var(--teal-dark); font: 800 11px var(--font-en); text-decoration: none; }
html[lang="fa"] .github-link { font-family: var(--font-fa); }
.github-link:hover { text-decoration: underline; }
.repo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.repo-card { min-width: 0; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease; }
.repo-card:hover { border-color: #8fcab9; background: #f8fcfa; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,46,42,.06); }
.repo-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--deep); font: 800 8px var(--font-mono); }
.repo-card strong { display: block; overflow-wrap: anywhere; color: var(--deep); font: 700 11px var(--font-mono); direction: ltr; text-align: left; }
.repo-card p { margin: 4px 0 6px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.repo-body { min-width: 0; display: grid; }
.repo-body > span:last-child { color: var(--teal-dark); font: 700 8.5px var(--font-mono); direction: ltr; }

/* ===== Side column ===== */
.side-column { min-width: 0; padding-inline-start: 28px; border-inline-start: 1px solid var(--line); }
.side-section { padding-bottom: 26px; }
.side-section + .side-section { padding-top: 24px; border-top: 1px solid var(--line); }
.side-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.side-heading span { color: var(--coral); font: 800 10px var(--font-mono); }
.side-heading h2 { font-size: 16px; }
.skill-group + .skill-group { margin-top: 18px; }
.skill-group h3 { margin: 0 0 6px; color: #40534e; font-size: 11px; }
.skill-note { margin: -1px 0 8px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.skill-note-soft { margin: 0; }
.skill-group-soft { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.skill-list { display: flex; flex-wrap: wrap; gap: 5px; }
.skill-list span { min-height: 26px; display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid #dce8e3; border-radius: 999px; color: #4b615b; background: #f7faf8; font: 700 9px var(--font-mono); direction: ltr; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.skill-list span:hover { border-color: #bfe0d4; background: var(--teal-soft); transform: translateY(-1px); }
.education-item h3, .certificate-card h3 { margin: 0; color: var(--deep); font-size: 12px; line-height: 1.55; }
.education-item p, .certificate-card p { margin: 3px 0; color: var(--muted); font-size: 10.5px; }
.education-item time { color: var(--teal-dark); font: 700 10px var(--font-mono); }
.certificate-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s ease; }
.certificate-card:hover { border-color: #c5ddd5; }
.certificate-card + .certificate-card { margin-top: 8px; }
.certificate-card dl { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 8px 0 0; }
.certificate-card dl div { display: flex; gap: 4px; font-size: 9px; font-family: var(--font-mono); }
.certificate-card dt { color: #778781; }
.certificate-card dd { margin: 0; color: #3b514a; font-weight: 700; }
.text-button { width: max-content; padding: 0; border: 0; color: var(--teal-dark); background: transparent; font: 700 10px var(--font-mono); cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.language-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.language-item + .language-item { margin-top: 8px; }
.language-item > div:first-child { display: grid; }
.language-item strong { font-size: 11px; }
.language-item span { color: var(--muted); font-size: 10px; }

/* ===== Certificate dialog ===== */
.certificate-dialog { width: min(1080px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: hidden; border: 0; border-radius: 10px; box-shadow: 0 24px 70px rgba(12, 28, 24, .35); }
.certificate-dialog::backdrop { background: rgba(12, 28, 24, .75); }
.dialog-toolbar { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-toolbar h2 { margin: 0; font: 700 13px var(--font-mono); }
.dialog-toolbar button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; color: var(--deep); background: #f7faf8; font-size: 21px; line-height: 1; cursor: pointer; }
.certificate-dialog img { width: 100%; height: auto; background: #eef2f0; }
.noscript { position: fixed; z-index: 9999; right: 10px; bottom: 10px; left: 10px; padding: 12px; border-radius: 8px; color: #fff; background: #a53e32; text-align: center; }

/* ===== Footer ===== */
.site-footer { padding: 36px 0 44px; border-top: 1px solid var(--line); }
.site-footer-inner { text-align: center; }
.footer-terminal { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font: 600 11px var(--font-mono); }
.footer-terminal .mono { color: var(--teal-dark); }
.site-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.site-footer a { color: var(--teal-dark); text-decoration: none; font-weight: 700; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .footer-copy { margin-top: 6px; font-size: 10px; color: #8a9a95; }

/* ===== Print (hidden on screen) ===== */
.print-resume { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1040px) {
  .desktop-nav { display: none; }
  .nav-toggle { display: flex; }
  .brand { margin-inline-end: auto; }
  .mobile-nav { position: sticky; z-index: 90; top: 68px; display: flex; gap: 2px; overflow-x: auto; padding: 7px 16px; border-bottom: 1px solid var(--line); background: #fff; scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a { flex: 0 0 auto; padding: 5px 10px; color: #4c605a; border-radius: 6px; font: 700 11px var(--font-mono); text-decoration: none; }
  .mobile-nav a:hover { color: var(--teal-dark); background: var(--teal-soft); }
  .hero-layout { gap: 40px; }
  .resume-shell { grid-template-columns: minmax(0, 1fr) 264px; gap: 40px; }
  .strength-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repo-grid { grid-template-columns: 1fr; }
}

@media (max-width: 790px) {
  .container { width: min(100% - 30px, 680px); }
  .hero-layout { grid-template-columns: 1fr; gap: 28px; padding-block: 48px 40px; }
  .hero h1 { font-size: 40px; }
  .hero-role { font-size: 18px; }
  .identity-card { max-width: 320px; justify-self: stretch; }
  .resume-shell { grid-template-columns: 1fr; gap: 40px; padding-block: 40px 52px; }
  .side-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; padding: 0; border: 0; }
  .side-section { min-width: 0; }
  .side-section + .side-section { padding-top: 0; border-top: 0; }
  .side-section:nth-child(n + 3) { padding-top: 24px; border-top: 1px solid var(--line); }
}

@media (max-width: 590px) {
  html { scroll-padding-top: 104px; }
  body { font-size: 14px; }
  .topbar { min-height: 60px; gap: 8px; padding-inline: 12px; }
  .brand { min-width: 0; }
  .brand-copy { display: none; }
  .brand-mark { width: 36px; height: 36px; font-size: 10px; }
  .toolbar { gap: 6px; }
  .language-switch button { width: 32px; height: 28px; }
  .button { min-width: 38px; min-height: 36px; padding: 8px 10px; }
  .mobile-nav { top: 60px; padding-inline: 12px; }
  .hero-layout { padding-block: 36px 32px; }
  .hero h1 { font-size: 32px; }
  .hero h1::after { width: 56px; }
  .hero-role { font-size: 16px; }
  .hero-techline { gap: 5px; }
  .hero-techline span { font-size: 10px; padding: 3px 7px; }
  .hero-summary { margin-top: 16px; font-size: 13px; }
  .hero-actions { margin-top: 20px; }
  .button-light { max-width: 100%; overflow-wrap: anywhere; }
  .quick-facts { grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
  .quick-facts div, .quick-facts div:first-child { padding: 0; }
  .quick-facts div + div { border: 0; }
  .identity-card { max-width: none; }
  .resume-section + .resume-section { margin-top: 40px; padding-top: 36px; }
  .section-heading { margin-bottom: 16px; }
  .section-heading h2 { font-size: 20px; }
  .lead { font-size: 14px; }
  .strength-grid { grid-template-columns: 1fr; margin-top: 18px; }
  .timeline-item { grid-template-columns: 1fr; gap: 6px; padding-inline-start: 26px; padding-bottom: 24px; }
  .timeline-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; }
  .timeline-body { padding: 12px 14px; }
  .timeline-body h3 { font-size: 13px; }
  .project-card { padding: 16px; }
  .open-source-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .agent-flow { gap: 4px; padding: 8px 10px; }
  .flow-step { font-size: 8px; padding: 3px 6px; }
  .side-column { grid-template-columns: 1fr; }
  .side-section + .side-section, .side-section:nth-child(n + 3) { padding-top: 20px; border-top: 1px solid var(--line); }
  .site-footer p { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

@page { size: A4; margin: 9mm 0 9mm; }

@media print {
  html { background: #fff; }
  body { margin: 0; color: #172622; background: #fff; font-size: 9.2pt; line-height: 1.55; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body > :not(.print-resume) { display: none !important; }
  .print-resume { display: block !important; width: 210mm; min-height: 0; padding: 0 11mm; color: #172622; background: #fff; }
  .print-header { display: flex; align-items: center; justify-content: space-between; gap: 6mm; padding-bottom: 4mm; border-bottom: .45mm solid #087f6b; break-inside: avoid; page-break-inside: avoid; }
  .print-identity { min-width: 0; }
  .print-header h1 { margin: 0; color: #17332f; font-size: 20pt; line-height: 1.15; }
  .print-role { margin: 1mm 0 0; color: #3b554d; font-size: 9.5pt; font-weight: 700; }
  .print-techline { margin: .8mm 0 0; color: #6a8a80; font-family: var(--font-mono); font-size: 7.2pt; }
  .print-contact { margin: 2mm 0 0; color: #455c55; font-family: var(--font-mono); font-size: 7.4pt; line-height: 1.6; overflow-wrap: anywhere; }
  .print-contact a { color: inherit; text-decoration: none; }
  .print-messenger { white-space: nowrap; }
  .print-photo { width: 24mm; height: 24mm; flex: 0 0 24mm; border: .45mm solid #bfd9d0; border-radius: 2.5mm; object-fit: cover; object-position: center; }
  .print-section { padding-top: 4mm; }
  .print-section h2 { margin: 0 0 2mm; padding-bottom: 1.2mm; border-bottom: .25mm solid #d7e3de; color: #17332f; font-size: 10pt; line-height: 1.4; }
  .print-section > p { margin: 0; color: #3b514a; line-height: 1.65; }
  .print-skills p + p { margin-top: 1.2mm; }
  .print-skills strong, .print-github strong { color: #17332f; }
  .print-about p { font-size: 8.6pt; line-height: 1.6; }
  .print-item { margin: 0 0 2.8mm; break-inside: avoid; page-break-inside: avoid; }
  .print-item-compact { margin-bottom: 2mm; }
  .print-item-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 4mm; }
  .print-item-heading h3 { margin: 0; color: #17332f; font-size: 9pt; line-height: 1.4; }
  .print-item-heading span { color: #52675f; font-size: 7.2pt; line-height: 1.4; text-align: end; font-family: var(--font-mono); }
  .print-item-heading b { color: #087f6b; }
  .print-item-heading a { color: inherit; text-decoration: none; }
  .print-item p { margin: 1mm 0 0; color: #3d514b; line-height: 1.6; font-size: 8.2pt; }
  .print-item ul { margin: 1.2mm 0 0; padding-inline-start: 3.5mm; color: #3d514b; line-height: 1.55; font-size: 8.2pt; }
  .print-item li { padding-inline-start: .5mm; }
  .print-item li + li { margin-top: .6mm; }
  .print-flow { margin: 1.2mm 0 0; color: #087f6b; font-family: var(--font-mono); font-size: 7pt; font-weight: 600; }
  .print-github { margin: 1.2mm 0 0; color: #3d514b; line-height: 1.6; font-size: 8.4pt; }
  .print-github a { color: #087f6b; font-family: var(--font-mono); text-decoration: none; }
  .print-repo-list { margin: .8mm 0 0; padding: 0; list-style: none; }
  .print-repo-list li { display: flex; align-items: baseline; gap: 2.5mm; color: #3d514b; line-height: 1.45; font-size: 7.4pt; break-inside: avoid; page-break-inside: avoid; }
  .print-repo-list li + li { margin-top: .6mm; }
  .print-repo-list a { flex: 0 0 44mm; color: #087f6b; font-family: var(--font-mono); font-size: 7pt; font-weight: 700; overflow-wrap: anywhere; text-decoration: none; }
  .print-repo-list span { min-width: 0; font-size: 7pt; }
  .print-more { color: #52675f; font-family: var(--font-mono); font-size: 7pt; }
  .print-final-section { }
  .print-final-section > div { min-width: 0; }
  .print-final-section > div + div { margin-top: 2.2mm; }
  .print-final-section h2 { font-size: 8.8pt; }
  .print-final-section p { margin: 0; color: #3d514b; font-size: 7.6pt; line-height: 1.5; }
  html[lang="en"] .print-resume { font-family: var(--font-en); line-height: 1.5; }
  html[lang="en"] .print-header h1 { font-size: 19pt; }
}
