/* Layout concept: a night-blue "control room" where Persian khatam geometry meets a live neural network.
   Turquoise (firouzeh) and saffron gold are drawn from Isfahan tilework. Dark by default, light on toggle. */
:root {
  --bg: #081016;
  --bg-2: #0c161e;
  --surface: #101c26;
  --surface-2: #142330;
  --line: rgba(173, 214, 224, .10);
  --line-strong: rgba(173, 214, 224, .2);
  --text: #e7eef1;
  --muted: #8ea3ad;
  --turq: #2ec4b6;
  --gold: #e9b949;
  --turq-soft: rgba(46, 196, 182, .14);
  --gold-soft: rgba(233, 185, 73, .14);
  --on-accent: #041014;
  --grid: rgba(173, 214, 224, .05);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);

  --radius: 20px;
  --maxw: 1180px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font-body: "Vazirmatn", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Vazirmatn", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}
:root[lang="en"] {
  --font-body: "Plus Jakarta Sans", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Vazirmatn", system-ui, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f4f7f6;
  --bg-2: #eaf0ef;
  --surface: #ffffff;
  --surface-2: #f5f9f8;
  --line: rgba(10, 40, 50, .10);
  --line-strong: rgba(10, 40, 50, .18);
  --text: #0b1c24;
  --muted: #51656e;
  --turq: #0e8c81;
  --gold: #b27a12;
  --turq-soft: rgba(14, 140, 129, .10);
  --gold-soft: rgba(178, 122, 18, .10);
  --on-accent: #ffffff;
  --grid: rgba(10, 40, 50, .05);
  --shadow: 0 30px 60px -32px rgba(10, 40, 50, .35);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 17px; line-height: 1.85;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
:root[lang="en"] body { line-height: 1.7; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0 0 1em; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--turq); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--turq); outline-offset: 3px; border-radius: 8px; }
.mono { font-family: var(--font-mono); letter-spacing: .02em; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 16px; position: relative; }
@media (min-width: 640px) { .wrap { padding-inline: 32px; } }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--turq); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 200; text-decoration: none; }
.skip:focus { top: 12px; }

/* Scroll progress */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; transform: scaleX(var(--p, 0)); transform-origin: left; background: linear-gradient(90deg, var(--turq), var(--gold)); }
:root[dir="rtl"] .progress span { transform-origin: right; background: linear-gradient(270deg, var(--turq), var(--gold)); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 100;
  transition: background .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.topbar.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom-color: var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 16px; height: 70px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-family: var(--font-display); }
.brand__mark { width: 34px; height: 34px; transition: transform .8s var(--ease); }
.brand:hover .brand__mark { transform: rotate(90deg); }
.brand__name { font-size: 16px; }
.nav { display: none; gap: 2px; margin-inline-start: auto; }
.nav a {
  position: relative; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; transition: color .25s;
}
.nav a::after {
  content: ""; position: absolute; inset-inline: 14px; bottom: 2px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, var(--turq), var(--gold)); transform: scaleX(0); transition: transform .35s var(--ease);
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }
.tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.nav + .tools { margin-inline-start: 8px; }
@media (min-width: 960px) { .nav { display: flex; } .menu-btn { display: none !important; } }
@media (max-width: 959px) {
  .nav.open {
    display: flex; flex-direction: column; position: absolute; top: 64px; inset-inline: 16px;
    padding: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow); animation: drop .3s var(--ease);
  }
  .nav.open a { padding: 12px 16px; font-size: 16px; }
  .nav.open a::after { display: none; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

.icon-btn, .lang-btn {
  display: inline-grid; place-items: center; height: 40px; min-width: 40px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text); font: 600 14px/1 var(--font-body); cursor: pointer; transition: border-color .25s, background .25s;
  text-decoration: none;
}
.lang-btn { font-family: "Vazirmatn", "Plus Jakarta Sans", sans-serif; }
.icon-btn:hover, .lang-btn:hover { border-color: var(--turq); }
.icon-btn svg { width: 18px; height: 18px; }
.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 26px;
  border-radius: 999px; font: 600 16px/1 var(--font-body); text-decoration: none; overflow: hidden;
  border: 1px solid transparent; will-change: transform;
}
.btn--primary {
  color: var(--on-accent);
  background: linear-gradient(120deg, var(--turq), color-mix(in srgb, var(--turq) 55%, var(--gold)), var(--gold));
  background-size: 200% 100%; animation: sheen 6s linear infinite;
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--turq) 80%, transparent);
}
.btn--primary:hover { box-shadow: 0 18px 40px -12px color-mix(in srgb, var(--turq) 90%, transparent); }
@keyframes sheen { 50% { background-position: 100% 0; } }
.btn--ghost { color: var(--text); border-color: var(--line-strong); background: color-mix(in srgb, var(--surface) 60%, transparent); backdrop-filter: blur(8px); }
.btn--ghost:hover { border-color: var(--turq); }
.btn__arrow { transition: transform .3s var(--ease); }
:root[dir="rtl"] .btn__arrow { transform: scaleX(-1); }
.btn:hover .btn__arrow { transform: translateX(4px); }
:root[dir="rtl"] .btn:hover .btn__arrow { transform: scaleX(-1) translateX(4px); }
.magnetic { transition: transform .35s var(--ease), box-shadow .3s, border-color .3s; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; margin-top: -70px; padding: 110px 0 90px; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero__grid-bg {
  position: absolute; inset: 0; z-index: -2;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; z-index: -2; width: 60vmax; height: 60vmax; top: -25vmax; inset-inline-end: -20vmax;
  background: radial-gradient(closest-side, var(--turq-soft), transparent);
  animation: float 14s ease-in-out infinite;
}
.hero::before {
  content: ""; position: absolute; z-index: -2; width: 40vmax; height: 40vmax; bottom: -20vmax; inset-inline-start: -10vmax;
  background: radial-gradient(closest-side, var(--gold-soft), transparent);
  animation: float 18s ease-in-out infinite reverse;
}
@keyframes float { 50% { transform: translate(3vmax, 4vmax) scale(1.08); } }

.hero__grid { display: grid; gap: 56px; align-items: center; }
@media (min-width: 960px) {
  .hero { padding: 150px 0 130px; }
  .hero__grid { grid-template-columns: 1.1fr .9fr; gap: 56px; }
}
.hero__text { min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px; padding: 7px 14px 7px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; font: 600 13px/1.4 "Plus Jakarta Sans", var(--font-body); letter-spacing: .01em; color: var(--turq);
  background: color-mix(in srgb, var(--surface) 60%, transparent); backdrop-filter: blur(6px); direction: ltr;
}
.eyebrow__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--turq); animation: ping 2.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--turq) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }

.hero__name {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(46px, 9vw, 96px); line-height: 1.12;
  color: var(--text);
}
:root[lang="en"] .hero__name { font-weight: 800; letter-spacing: -.04em; line-height: 1.02; }
.hero__name .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-block: .06em .14em; margin-block: -.06em -.14em; }
.hero__name .w > span {
  display: inline-block;
  background: linear-gradient(100deg, var(--text) 35%, var(--turq) 65%, var(--gold) 95%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: nameflow 9s ease-in-out infinite;
}
@keyframes nameflow { 50% { background-position: 100% 0; } }

.hero__role {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .45em;
  font-size: clamp(19px, 2.6vw, 26px); font-weight: 600; margin: 18px 0 20px; color: var(--muted);
}
.rotator { position: relative; display: inline-grid; color: var(--text); min-height: 1.6em; }
.rotator__item { grid-area: 1 / 1; white-space: nowrap; }
.rotator__item.in { animation: rotIn .7s var(--ease) both; }
.rotator__item.out { animation: rotOut .5s var(--ease) both; }
.rotator__item::after {
  content: ""; display: block; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--turq), var(--gold)); transform-origin: left; animation: underline 3.4s linear both;
}
:root[dir="rtl"] .rotator__item::after { transform-origin: right; }
@keyframes rotIn { from { opacity: 0; transform: translateY(60%); filter: blur(6px); } }
@keyframes rotOut { to { opacity: 0; transform: translateY(-60%); filter: blur(6px); } }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hero__lead { font-size: 18px; color: var(--muted); max-width: 60ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 44px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; max-width: 600px; }
.stats > div {
  position: relative; padding: 16px 16px 14px; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px);
}
.stats > div::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; width: 45%; height: 2px;
  background: linear-gradient(90deg, var(--turq), transparent);
}
:root[dir="rtl"] .stats > div::before { background: linear-gradient(270deg, var(--turq), transparent); }
.stats dt { font: 800 clamp(26px, 4vw, 38px)/1.1 var(--font-display); font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
:root[dir="rtl"] .stats dt { text-align: right; }
.stats .plus { color: var(--gold); }
.stats dd { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* Hero visual */
.hero__visual { position: relative; width: min(100%, 460px); aspect-ratio: 1; justify-self: center; }
.khatam { position: absolute; inset: -8%; width: 116%; height: 116%; overflow: visible; }
.khatam__star, .khatam__ring, .khatam__ring2 { transform-box: view-box; transform-origin: 50% 50%; }
.khatam__star { animation: spin 60s linear infinite; }
.khatam__ring { animation: spin 90s linear infinite reverse; }
.khatam__ring2 { animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.portrait {
  position: absolute; inset: 14%; margin: 0; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 0 10px color-mix(in srgb, var(--bg) 60%, transparent), 0 40px 80px -30px rgba(0, 0, 0, .8), 0 0 100px -10px var(--turq-soft);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.05); transition: transform 1.2s var(--ease); }
.hero__visual:hover .portrait img { transform: scale(1.1); }
.orbit-chip {
  position: absolute; z-index: 2; padding: 8px 14px; border-radius: 999px; font-size: 12.5px; line-height: 1.3; white-space: nowrap; direction: ltr;
  color: var(--text); background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
  animation: bob 6s ease-in-out infinite;
}
.orbit-chip::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--turq); margin-right: 8px; vertical-align: middle; }
.chip-a { top: 8%; left: -2%; }
.chip-b { top: 46%; right: -6%; animation-delay: -2s; }
.chip-b::before { background: var(--gold); }
.chip-c { bottom: 5%; left: 6%; animation-delay: -4s; }
@keyframes bob { 50% { transform: translateY(-12px); } }
@media (max-width: 520px) {
  .chip-a { left: 0; } .chip-b { right: 0; } .orbit-chip { font-size: 11px; padding: 6px 10px; }
}

.scroll-cue { position: absolute; bottom: 26px; left: 50%; translate: -50% 0; width: 26px; height: 42px; border: 1.5px solid var(--line-strong); border-radius: 14px; display: none; }
.scroll-cue span { position: absolute; top: 8px; left: 50%; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--turq); animation: cue 1.8s infinite; }
@keyframes cue { 70%, 100% { transform: translateY(14px); opacity: 0; } }
@media (min-width: 960px) and (min-height: 760px) { .scroll-cue { display: block; } }

/* Hero intro sequence (only when motion is allowed) */
.anim [data-anim] { animation: rise .9s var(--ease) both; animation-delay: var(--d, 0s); }
.anim [data-anim="scale"] { animation-name: pop; animation-duration: 1.2s; }
.anim .hero__name .w > span { animation: wordUp 1s var(--ease) both, nameflow 9s ease-in-out infinite; animation-delay: calc(.12s + var(--i) * .1s), 1.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes pop { from { opacity: 0; transform: scale(.9) rotate(-4deg); } }
@keyframes wordUp { from { transform: translateY(110%); } }

/* ---------- Marquee ---------- */
.marquee { position: relative; z-index: 2; padding: 26px 0 30px; border-block: 1px solid var(--line); background: var(--bg-2); }
.marquee__label { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .12em; margin: 0 0 14px; padding-inline: 16px; }
.marquee__viewport {
  overflow: hidden; direction: ltr;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track { display: flex; width: max-content; margin: 0; padding: 0; list-style: none; animation: marquee 60s linear infinite; }
.marquee__viewport:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: inline-flex; align-items: center; gap: 22px; padding-inline: 22px 0; white-space: nowrap;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 2vw, 22px); color: var(--muted);
  transition: color .3s;
}
.marquee__item:hover { color: var(--text); }
.marquee__item::after { content: "✦"; color: var(--gold); font-size: 13px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { position: relative; padding: 88px 0; }
@media (min-width: 960px) { .section { padding: 128px 0; } }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line); overflow: hidden; }
.section__head { margin-bottom: 48px; max-width: 780px; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 16px;
  font: 700 12.5px/1.4 var(--font-body); color: var(--turq); letter-spacing: .12em; text-transform: uppercase;
}
:root[lang="fa"] .kicker { font-family: var(--font-body); letter-spacing: 0; font-size: 14px; font-weight: 600; }
.kicker__icon { width: 12px; height: 12px; position: relative; flex: none; }
.kicker__icon::before, .kicker__icon::after { content: ""; position: absolute; inset: 1px; border: 1.5px solid var(--gold); }
.kicker__icon::after { transform: rotate(45deg); }
.h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 4.6vw, 52px); line-height: 1.25; }
:root[lang="en"] .h2 { letter-spacing: -.03em; line-height: 1.12; }
.lead { color: var(--muted); font-size: 18px; max-width: 64ch; margin-top: 18px; }

/* Scroll reveal */
.anim [data-reveal] { opacity: 0; transform: translateY(32px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.anim [data-reveal].in { opacity: 1; transform: none; }

/* ---------- Approach ---------- */
.approach { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .approach { grid-template-columns: .85fr 1.15fr; gap: 80px; } }
.approach__body { min-width: 0; }
.frame { position: relative; border-radius: 28px; padding: 10px; background: linear-gradient(140deg, var(--turq-soft), transparent 40%, var(--gold-soft)); border: 1px solid var(--line); }
.frame img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 20px; }
@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.frame::after {
  content: ""; position: absolute; inset: -1px; border-radius: 28px; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--a), transparent 0 65%, var(--turq), var(--gold), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: rotateBorder 6s linear infinite;
}
@keyframes rotateBorder { to { --a: 360deg; } }

.skills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 28px 0 0; }
.skills li {
  padding: 7px 14px; border-radius: 999px; font: 500 13px/1.3 var(--font-mono); direction: ltr;
  border: 1px solid var(--line-strong); color: var(--text); background: var(--surface);
  transition: border-color .25s, color .25s, transform .25s;
}
.skills li:hover { border-color: var(--turq); color: var(--turq); transform: translateY(-2px); }

.steps__label { margin: 96px 0 22px; color: var(--muted); font-size: 14px; font-weight: 500; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step {
  position: relative; padding: 26px 22px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  counter-increment: step; overflow: hidden; transition: border-color .3s, transform .5s var(--ease), opacity .9s var(--ease);
}
.step:hover { border-color: color-mix(in srgb, var(--turq) 50%, var(--line)); transform: translateY(-4px); }
.step::before { content: "0" counter(step); display: block; font: 700 13px/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--gold); margin-bottom: 38px; }
.step::after {
  content: ""; position: absolute; top: 32px; inset-inline-start: 58px; inset-inline-end: 22px; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
:root[dir="rtl"] .step::after { background: linear-gradient(270deg, var(--line-strong), transparent); }
.step h3 { position: relative; font-family: var(--font-display); font-size: 21px; margin-bottom: 8px; }
.step p { position: relative; color: var(--muted); font-size: 15px; line-height: 1.75; margin: 0; }
.step__glow {
  position: absolute; bottom: -90px; inset-inline-end: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--turq-soft), transparent); transition: transform .6s var(--ease);
}
.step:hover .step__glow { transform: scale(1.6); }

/* ---------- Projects ---------- */
.glow {
  position: absolute; width: 50vmax; height: 50vmax; top: -10vmax; inset-inline-start: -15vmax; pointer-events: none;
  background: radial-gradient(closest-side, var(--turq-soft), transparent);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -16px 0 30px; }
.chip {
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--muted); font: 500 14px/1.2 var(--font-body); cursor: pointer; transition: all .25s;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--turq); color: var(--on-accent); border-color: var(--turq); }
.projects { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card {
  --mx: 50%; --my: 50%;
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease), border-color .3s, box-shadow .3s, opacity .9s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(360px circle at var(--mx) var(--my), var(--turq-soft), transparent 60%);
}
.card:hover { border-color: color-mix(in srgb, var(--turq) 45%, var(--line)); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card__hit { position: absolute; inset: 0; z-index: 3; background: none; border: 0; cursor: pointer; border-radius: var(--radius); }
.card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card__media img { transform: scale(1.06); }
.card__media canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__media--soon::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--text) 6%, transparent) 50%, transparent 70%);
  background-size: 250% 100%; animation: shimmer 3.2s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.card__play {
  position: absolute; z-index: 2; inset-inline-end: 14px; bottom: 14px; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; background: rgba(4, 16, 20, .7); color: #fff; backdrop-filter: blur(6px);
}
.card__play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.card__body { position: relative; z-index: 2; padding: 22px; display: flex; flex-direction: column; flex: 1; }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.card__tag { padding: 4px 10px; border-radius: 999px; font: 500 12px/1.3 var(--font-mono); background: var(--turq-soft); color: var(--turq); }
.card__tag--soon { background: var(--gold-soft); color: var(--gold); font-family: var(--font-body); }
.card__year { color: var(--muted); font: 500 12px/1 var(--font-mono); margin-inline-start: auto; }
.card h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; line-height: 1.75; margin: 0; }
.card__more { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 18px; color: var(--turq); font-weight: 600; font-size: 14px; }
.card__more svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
:root[dir="rtl"] .card__more svg { transform: scaleX(-1); }
.card:hover .card__more svg { transform: translateX(4px); }
:root[dir="rtl"] .card:hover .card__more svg { transform: scaleX(-1) translateX(4px); }
.skeleton { display: block; height: 18px; width: 62%; border-radius: 6px; background: var(--line-strong); margin-bottom: 12px; }

/* ---------- Timeline ---------- */
.timeline-wrap { position: relative; }
.timeline__rail { position: absolute; top: 10px; bottom: 10px; inset-inline-start: 9px; width: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.timeline__fill { position: absolute; inset: 0; transform: scaleY(var(--t, 0)); transform-origin: top; background: linear-gradient(var(--turq), var(--gold)); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { position: relative; padding-inline-start: 44px; padding-bottom: 36px; display: grid; gap: 2px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__node {
  position: absolute; inset-inline-start: 1px; top: 6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line-strong); transition: border-color .4s, box-shadow .4s;
}
.timeline__item.lit .timeline__node { border-color: var(--turq); box-shadow: 0 0 0 5px var(--turq-soft); }
.timeline__item:first-child .timeline__node { background: var(--turq); border-color: var(--turq); }
.timeline__period { color: var(--gold); font: 600 13.5px/1.6 var(--font-body); font-variant-numeric: tabular-nums; }
:root[lang="fa"] .timeline__period { font-family: var(--font-body); font-size: 14px; }
.timeline__card { padding: 14px 18px; border-radius: 16px; border: 1px solid transparent; transition: background .3s, border-color .3s; margin-inline-start: -18px; }
.timeline__card:hover { background: var(--surface); border-color: var(--line); }
.timeline__card h3 { font-family: var(--font-display); font-size: 20px; }
.timeline__org { color: var(--turq); font-weight: 500; margin: 4px 0 6px; }
.timeline__card ul { margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.timeline__card li { margin-bottom: 3px; }
.timeline__card li::marker { color: var(--gold); }
@media (min-width: 960px) {
  .timeline__rail { inset-inline-start: 199px; }
  .timeline__item { grid-template-columns: 160px 1fr; gap: 64px; padding-inline-start: 0; }
  .timeline__node { inset-inline-start: 191px; top: 20px; }
  .timeline__period { text-align: end; padding-top: 14px; }
  .timeline__card { margin-inline-start: 0; }
}

/* ---------- Press ---------- */
.press { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.press__item a {
  position: relative; display: flex; flex-direction: column; height: 100%; padding: 22px 22px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; overflow: hidden;
  transition: border-color .3s, transform .5s var(--ease), box-shadow .3s;
}
.press__item a::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--turq), var(--gold)); transform: scaleY(0); transform-origin: top; transition: transform .45s var(--ease);
}
.press__item a:hover { border-color: color-mix(in srgb, var(--turq) 45%, var(--line)); transform: translateY(-3px); box-shadow: var(--shadow); }
.press__item a:hover::before { transform: scaleY(1); }
.press__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; padding-inline-end: 30px; color: var(--muted); font-size: 13px; }
.press__type { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--turq-soft); color: var(--turq); }
.press__type--interview, .press__type--podcast { background: var(--gold-soft); color: var(--gold); }
.press__outlet { color: var(--text); font-weight: 600; }
.press__meta time { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.press__item h3 { font-family: var(--font-display); font-size: 18px; line-height: 1.55; margin-bottom: 8px; }
.press__item p { color: var(--muted); font-size: 14.5px; line-height: 1.75; margin: 0; }
.press__go { position: absolute; top: 22px; inset-inline-end: 18px; color: var(--muted); transition: color .25s, transform .3s var(--ease); }
.press__go svg { width: 18px; height: 18px; }
:root[dir="rtl"] .press__go { transform: scaleX(-1); }
.press__item a:hover .press__go { color: var(--turq); }

.press.collapsed .press__item:nth-child(n+10) { display: none; }
.press__more { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- Education ---------- */
.edu { display: grid; gap: 48px; }
@media (min-width: 960px) { .edu { grid-template-columns: 1.3fr 1fr; gap: 72px; align-items: start; } }
.edu__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.edu__item { position: relative; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .3s, transform .5s var(--ease), opacity .9s var(--ease); }
.edu__item:hover { border-color: color-mix(in srgb, var(--turq) 45%, var(--line)); transform: translateY(-3px); }
.edu__period { color: var(--gold); font: 600 13.5px/1 var(--font-body); font-variant-numeric: tabular-nums; }
:root[lang="fa"] .edu__period { font-family: var(--font-body); font-size: 14px; }
.edu__item h3 { font-family: var(--font-display); font-size: 19px; margin-top: 10px; }
.edu__org { color: var(--turq); margin: 4px 0 0; }
.edu__note { color: var(--muted); font-size: 14px; margin: 12px 0 0; line-height: 1.75; }
.honors {
  position: relative; overflow: hidden; padding: 30px; border-radius: 24px; border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
.honors__star { position: absolute; width: 220px; height: 220px; inset-inline-end: -60px; top: -60px; stroke: var(--gold); stroke-width: .6; opacity: .4; animation: spin 50s linear infinite; }
.honors h3 { position: relative; font-family: var(--font-display); font-size: 22px; margin-bottom: 18px; }
.honors ul { position: relative; margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.honors li { display: flex; gap: 12px; font-size: 15px; line-height: 1.65; }
.honors li::before { content: "✦"; color: var(--gold); flex: none; }
@media (min-width: 960px) { .honors { position: sticky; top: 100px; margin-top: 130px; } }

/* ---------- Gallery ---------- */
.gallery { padding-bottom: 0; }
.gallery__grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery figure { position: relative; margin: 0; border-radius: 22px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 1.2s var(--ease), filter .6s; filter: saturate(.9); }
.gallery figure:hover img { transform: scale(1.05); filter: saturate(1.05); }
.gallery figcaption {
  position: absolute; bottom: 14px; inset-inline-start: 14px; padding: 6px 12px; border-radius: 999px; font-size: 12px; line-height: 1.3;
  background: rgba(4, 16, 20, .6); color: #fff; backdrop-filter: blur(8px);
}
@media (max-width: 560px) { .gallery__grid { gap: 10px; } .gallery figure { border-radius: 14px; } }

/* ---------- Contact ---------- */
.contact { overflow: hidden; }
.contact__bg {
  position: absolute; inset: 10% 0 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 60% at 50% 60%, var(--turq-soft), transparent 70%),
    radial-gradient(30% 40% at 70% 40%, var(--gold-soft), transparent 70%);
}
.contact__inner { position: relative; z-index: 1; text-align: center; max-width: 880px; }
.contact .kicker { justify-content: center; }
.contact__title {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(32px, 5.4vw, 60px); line-height: 1.25;
  background: linear-gradient(100deg, var(--text) 20%, var(--turq), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[lang="en"] .contact__title { letter-spacing: -.035em; line-height: 1.1; }
.contact .lead { margin-inline: auto; }
.contact__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 34px; }
.copy {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 22px; padding: 6px 6px 6px 16px; border-radius: 999px;
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); font: 500 14px/1.4 "Plus Jakarta Sans", var(--font-body); cursor: pointer; transition: border-color .25s, color .25s;
}
:root[dir="rtl"] .copy { padding: 6px 16px 6px 6px; }
.copy:hover { border-color: var(--turq); color: var(--text); }
.copy__state { padding: 4px 12px; border-radius: 999px; background: var(--turq-soft); color: var(--turq); font-family: var(--font-body); font-size: 12px; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 2; border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer__lang { color: var(--muted); text-decoration: none; transition: color .25s; }
.footer__lang:hover { color: var(--turq); }
.footer__lang:lang(fa) { font-family: var(--font-body); }

/* ---------- Modal ---------- */
.modal {
  width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-strong);
  border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .7);
}
.modal[open] { animation: modalIn .45s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } }
.modal::backdrop { background: rgba(2, 8, 12, .7); backdrop-filter: blur(6px); }
.modal__inner { position: relative; }
.modal__close { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; background: rgba(4, 16, 20, .6); color: #fff; }
.modal__media { aspect-ratio: 16 / 9; background: #000; }
.modal__media img, .modal__media video, .modal__media iframe { width: 100%; height: 100%; object-fit: contain; border: 0; display: block; }
.modal__body { padding: 28px; }
.modal__meta { color: var(--turq); font-size: 13px; margin-bottom: 8px; }
.modal__body h3 { font-family: var(--font-display); font-size: 26px; margin-bottom: 14px; }
.modal__desc p { color: var(--muted); }
.modal__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.modal__facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 18px 0 0; font-size: 14px; }
.modal__facts dt { color: var(--turq); }
.modal__facts dd { margin: 0; color: var(--muted); }
.modal__shots { display: flex; gap: 10px; overflow-x: auto; padding: 18px 0 6px; scroll-snap-type: x mandatory; }
.modal__shot { flex: 0 0 auto; height: 120px; padding: 0; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; overflow: hidden; background: #000; cursor: zoom-in; scroll-snap-align: start; }
.modal__shot img { height: 100%; width: auto; display: block; }
.modal__shot:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; }
.card__status { padding: 4px 10px; border-radius: 999px; font-size: 12px; line-height: 1.3; background: var(--gold-soft); color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Persian script must not be letter-spaced or set in the monospace face. */
:root[lang="fa"] .marquee__label,
:root[lang="fa"] .steps__label,
:root[lang="fa"] .gallery figcaption { font-family: var(--font-body); letter-spacing: 0; font-size: 14px; }
/* Numerals on the Persian page: JetBrains Mono has no Persian digits (they would fall back to a system font), and
   Vazirmatn's tabular Persian digits are padded to a fixed width, which leaves visible gaps (e.g. "۱ ۴"). */
:root[lang="fa"] .stats dt,
:root[lang="fa"] .step::before,
:root[lang="fa"] .timeline__period,
:root[lang="fa"] .edu__period,
:root[lang="fa"] .press__meta time,
:root[lang="fa"] .card__year,
:root[lang="fa"] .card__tag,
:root[lang="fa"] .modal__meta { font-family: var(--font-body); font-variant-numeric: normal; letter-spacing: 0; }
:root[lang="fa"] .stats dt { font-family: var(--font-display); font-weight: 800; line-height: 1.2; }
:root[lang="fa"] .step::before { content: "۰" counter(step, persian); font-weight: 600; font-size: 14px; }
