:root {
  --bg: #070b14;
  --bg-2: #0b1120;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e6edf7;
  --muted: #8d99b0;
  --c1: #22d3ee;
  --c2: #8b5cf6;
  --c3: #34d399;
  --grad: linear-gradient(120deg, var(--c1), var(--c2));
  --on-accent: #06101f;
  --err: #fb7185;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 18px;
  --node: 34, 211, 238;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f7fc;
  --bg-2: #eaf0f8;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-2: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #586379;
  --c1: #0891b2;
  --c2: #7c3aed;
  --c3: #059669;
  --on-accent: #ffffff;
  --err: #e11d48;
  --shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.35);
  --node: 8, 145, 178;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f7fc;
    --bg-2: #eaf0f8;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-2: #ffffff;
    --border: rgba(15, 23, 42, 0.1);
    --text: #0f172a;
    --muted: #586379;
    --c1: #0891b2;
    --c2: #7c3aed;
    --c3: #059669;
    --on-accent: #ffffff;
    --err: #e11d48;
    --shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.35);
    --node: 8, 145, 178;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 Inter, system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; line-height: 1.15; margin: 0; }
a { color: var(--c1); }
.muted { color: var(--muted); }
.hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Background ambience */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% 10%, color-mix(in srgb, var(--c2) 18%, transparent), transparent 70%),
    radial-gradient(500px 400px at 5% 40%, color-mix(in srgb, var(--c1) 12%, transparent), transparent 70%),
    radial-gradient(700px 500px at 60% 100%, color-mix(in srgb, var(--c2) 10%, transparent), transparent 70%);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 500 15px/1 Inter, sans-serif; text-decoration: none; cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform .2s, box-shadow .2s, border-color .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--c1); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); font-weight: 600; box-shadow: 0 10px 30px -10px var(--c2); }
.btn.primary:hover { box-shadow: 0 14px 34px -8px var(--c2); }
.btn.sm { padding: 9px 16px; font-size: 14px; }
.btn:disabled { opacity: .65; cursor: wait; transform: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--c1); color: var(--c1); }

/* Nav */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; transition: background .3s, border-color .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); border-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo {
  font: 700 18px "Space Grotesk", sans-serif; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 10px;
}
.logo b { width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.logo-mark { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 6px 14px rgba(139, 92, 246, .3)); transition: transform .3s; }
.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.05); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-actions { display: flex; gap: 10px; align-items: center; }

/* Hero */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 110px 0 80px; overflow: hidden; }
#network { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 160px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center; width: 100%; }
.status {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 14px; color: var(--muted); backdrop-filter: blur(8px);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c3); box-shadow: 0 0 0 0 var(--c3); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c3) 70%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 700; margin-top: 22px; letter-spacing: -0.02em; }
.hero h1 .hi { display: block; font-size: .42em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-bottom: 6px; }
.typed { font: 500 clamp(1.05rem, 2.2vw, 1.35rem) "JetBrains Mono", monospace; margin: 18px 0 0; color: var(--text); min-height: 1.6em; }
.typed .prompt { color: var(--c1); }
.caret { display: inline-block; width: .55em; height: 1.1em; background: var(--c1); vertical-align: -0.15em; margin-left: 3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 540px; margin: 18px 0 0; display: flex; gap: 8px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.quick-links { display: flex; gap: 10px; margin-top: 26px; }
.quick-links a {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); backdrop-filter: blur(8px);
  transition: color .2s, border-color .2s, transform .2s;
}
.quick-links a:hover { color: var(--c1); border-color: var(--c1); transform: translateY(-3px); }

.hero-photo { position: relative; justify-self: center; width: min(360px, 78vw); aspect-ratio: 1; }
.ring {
  position: absolute; inset: -14px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--c1), var(--c2), transparent 55%, var(--c1));
  animation: spin 8s linear infinite; filter: blur(.5px);
}
.ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; filter: blur(28px); opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; z-index: 1;
  border: 6px solid var(--bg); background: var(--grad); display: grid; place-items: center;
  font: 700 5rem "Space Grotesk", sans-serif; color: var(--on-accent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; z-index: 2; padding: 8px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--border); backdrop-filter: blur(10px);
  font: 600 13px "JetBrains Mono", monospace; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap;
  box-shadow: var(--shadow); animation: float 6s ease-in-out infinite;
}
.badge .icon { color: var(--c1); }
.badge:nth-child(1) { top: 4%; left: -12%; }
.badge:nth-child(2) { top: 22%; right: -16%; animation-delay: -1.5s; }
.badge:nth-child(3) { bottom: 18%; left: -16%; animation-delay: -3s; }
.badge:nth-child(4) { bottom: 2%; right: -6%; animation-delay: -4.5s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.scroll-hint { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 2; width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 14px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--c1); animation: scroll 1.8s infinite; }
@keyframes scroll { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* Cards */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
  transition: transform .25s, border-color .25s;
}
.card.hover:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c1) 55%, var(--border)); }
.icon-tile {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 22%, transparent), color-mix(in srgb, var(--c2) 22%, transparent));
  border: 1px solid color-mix(in srgb, var(--c1) 30%, transparent); color: var(--c1);
}
.icon-tile .icon { width: 22px; height: 22px; }

/* Stats */
.stats { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: -40px; }
.stat { padding: 24px; }
.stat strong { display: block; font: 700 clamp(2rem, 4vw, 2.8rem) "Space Grotesk", sans-serif; }
.stat span { color: var(--muted); font-size: 14px; }

/* Sections */
.section { padding: 110px 24px 0; }
.section-head { margin-bottom: 40px; }
.eyebrow { font: 500 13px "JetBrains Mono", monospace; color: var(--c1); letter-spacing: .06em; text-transform: uppercase; }
.section-head h2, .contact-info h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin-top: 10px; letter-spacing: -0.02em; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: start; }
.about-text p { font-size: 1.1rem; margin: 0; }
.about-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.mini { display: flex; gap: 14px; align-items: center; padding: 16px; }
.mini small { display: block; color: var(--muted); font-size: 13px; }
.mini b { font-weight: 600; font-size: 15px; }
.terminal { border-radius: var(--radius); overflow: hidden; background: #0a0f1c; border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow); }
.terminal-bar { display: flex; gap: 7px; align-items: center; padding: 12px 16px; background: rgba(255, 255, 255, .04); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal-bar em { margin-left: 10px; font: normal 12px "JetBrains Mono", monospace; color: #7d8aa3; }
.terminal pre { margin: 0; padding: 20px; font: 13.5px/1.75 "JetBrains Mono", monospace; color: #c9d4e6; white-space: pre-wrap; min-height: 300px; }
.terminal .p { color: #34d399; }
.terminal .c { color: #22d3ee; }
.terminal .k { color: #a78bfa; }

/* Experience */
.job { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0; overflow: hidden; }
.job + .job { margin-top: 20px; }
.job-main { padding: 30px; }
.job-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.job-head h3 { font-size: 1.35rem; }
.job-head p { margin: 2px 0 0; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font: 500 12.5px "JetBrains Mono", monospace; background: color-mix(in srgb, var(--c1) 12%, transparent); color: var(--c1); border: 1px solid color-mix(in srgb, var(--c1) 30%, transparent); white-space: nowrap; }
.pill.green { background: color-mix(in srgb, var(--c3) 12%, transparent); color: var(--c3); border-color: color-mix(in srgb, var(--c3) 30%, transparent); }
.job-head .pill { margin-inline-start: auto; }
.points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.points li { display: flex; gap: 12px; color: var(--text); }
.points li .icon { color: var(--c3); margin-top: 4px; width: 17px; height: 17px; }
.job-chart { padding: 30px; background: color-mix(in srgb, var(--c2) 6%, transparent); border-inline-start: 1px solid var(--border); }
.job-chart h4 { margin: 0 0 20px; font: 500 13px "JetBrains Mono", monospace; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bar { margin-bottom: 15px; }
.bar-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.bar-label b { font: 600 13px "JetBrains Mono", monospace; color: var(--c1); }
.bar-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.in .bar-fill { width: var(--w); }

/* Education & languages */
.edu-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.edu-grid > *, .edu > div { min-width: 0; }
.edu-list { display: grid; gap: 20px; }
.edu { padding: 30px; display: flex; gap: 18px; align-items: flex-start; }
.edu h3 { font-size: 1.3rem; overflow-wrap: anywhere; }
.edu p { margin: 4px 0 14px; color: var(--muted); }
.edu .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.lang { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.gauge { width: 110px; height: 110px; position: relative; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 9; }
.gauge .track { stroke: var(--surface-2); }
.gauge .val { stroke: url(#gauge-grad); stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: 289; transition: stroke-dashoffset 1.4s cubic-bezier(.2, .8, .2, 1); }
.in .gauge .val { stroke-dashoffset: var(--off); }
.gauge span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.4rem "Space Grotesk", sans-serif; }
.lang h3 { font-size: 1.1rem; }
.lang p { margin: 0; color: var(--muted); font-size: 14px; }

/* Certificates */
.cert-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cert-body { padding: 16px 18px 18px; }
.cert.has-thumb .icon-tile { display: none; }
.cert { display: flex; flex-direction: column; color: var(--text); overflow: hidden; cursor: default; }
.cert.has-thumb { cursor: zoom-in; }
.cert::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: 0; transition: opacity .25s; z-index: 2; }
.cert:hover::before { opacity: 1; }
.cert-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 1.414; padding: 0; border: 0; cursor: zoom-in;
  background: #f4f4f2; overflow: hidden; border-bottom: 1px solid var(--border);
}
.cert-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.cert:hover .cert-thumb img { transform: scale(1.04); }
.cert-zoom {
  position: absolute; inset-block-end: 10px; inset-inline-end: 10px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(7, 11, 20, .65); color: #fff; backdrop-filter: blur(6px); opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.cert:hover .cert-zoom, .cert-thumb:focus-visible .cert-zoom { opacity: 1; transform: none; }
.cert-body { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.cert-top { display: flex; gap: 14px; align-items: flex-start; }
.cert h3 { font-size: 1.05rem; }
.cert p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.cert .cert-issuer { font-size: 13px; opacity: .85; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: auto; font-size: 14px; }
.cert-foot .open { color: var(--c1); display: inline-flex; gap: 4px; align-items: center; font-weight: 600; text-decoration: none; padding: 4px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c1) 35%, transparent); }
.cert-foot .open:hover { background: color-mix(in srgb, var(--c1) 12%, transparent); }
.cert-foot .open .icon { transition: transform .2s; width: 15px; height: 15px; }
.cert-foot .open:hover .icon { transform: translate(2px, -2px); }
[dir="rtl"] .cert-foot .open:hover .icon { transform: scaleX(-1) translate(2px, -2px); }

/* Certificate viewer */
.no-scroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 24px; background: rgba(4, 7, 14, .88); backdrop-filter: blur(10px); animation: ai-in .25s ease-out; }
.viewer[hidden] { display: none; }
.viewer figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-height: 100%; min-width: 0; grid-column: 2; }
.viewer img { max-width: min(1100px, 100%); max-height: calc(100vh - 150px); object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); background: #fff; }
.viewer figcaption { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 100%; color: #e6edf7; flex-wrap: wrap; }
.viewer figcaption b { display: block; font: 600 1.05rem "Space Grotesk", Vazirmatn, sans-serif; }
:root[lang="fa"] .viewer figcaption b { font-family: Vazirmatn, sans-serif; }
.viewer figcaption span { color: #9aa6bd; font-size: 14px; }
.viewer-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .2s; }
.viewer-btn:hover { background: rgba(255, 255, 255, .18); }
.viewer-btn .icon { width: 22px; height: 22px; }
.viewer-close { position: absolute; top: 18px; inset-inline-end: 18px; }
.viewer-prev { grid-column: 1; }
.viewer-next { grid-column: 3; }
.viewer-next .icon { transform: scaleX(-1); }
[dir="rtl"] .viewer-prev .icon { transform: scaleX(-1); }
[dir="rtl"] .viewer-next .icon { transform: none; }
.viewer-nav[hidden] { visibility: hidden; display: grid; }
@media (max-width: 640px) {
  .viewer { grid-template-columns: 1fr; padding: 64px 12px 16px; }
  .viewer figure { grid-column: 1; }
  .viewer-nav { position: absolute; bottom: 18px; }
  .viewer-prev { inset-inline-start: 18px; }
  .viewer-next { inset-inline-end: 18px; }
  .viewer figcaption { padding-bottom: 60px; }
  .viewer img { max-height: calc(100vh - 220px); }
}

/* Skills */
.skill-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.skill { padding: 26px; }
.skill-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.skill-head h3 { font-size: 1.15rem; }
.skill-head span { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li { padding: 7px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; transition: border-color .2s, color .2s; }
.chips li:hover { border-color: var(--c1); color: var(--c1); }

/* Projects */
.section-intro { max-width: 680px; margin: 14px 0 0; font-size: 1.05rem; }
.port-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.port-filters button {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font: 500 14px Inter, Vazirmatn, sans-serif; color: var(--muted); background: var(--surface); border: 1px solid var(--border); transition: color .2s, border-color .2s, background .2s;
}
:root[lang="fa"] .port-filters button { font-family: Vazirmatn, sans-serif; }
.port-filters button span { font: 500 12px "JetBrains Mono", Vazirmatn, monospace; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); }
.port-filters button:hover { color: var(--text); border-color: var(--c1); }
.port-filters button.on { color: var(--on-accent); background: var(--grad); border-color: transparent; }
.port-filters button.on span { background: rgba(255, 255, 255, .25); color: inherit; }
.port-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.port { display: flex; flex-direction: column; overflow: hidden; }
.port.is-detailed { cursor: pointer; }
.port[hidden] { display: none; }
.port-thumb {
  height: 170px; overflow: hidden; position: relative; border-bottom: 1px solid var(--border);
  background: radial-gradient(300px 200px at 70% 20%, color-mix(in srgb, var(--c2) 18%, transparent), transparent 70%),
              radial-gradient(260px 200px at 20% 90%, color-mix(in srgb, var(--c1) 14%, transparent), transparent 70%), var(--bg-2);
}
.port-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.port:hover .port-thumb img { transform: scale(1.04); }
.port-thumb .terminal { border-radius: 0; border: 0; box-shadow: none; height: 100%; }
.port-thumb .terminal pre { font-size: 10.5px; line-height: 1.55; padding: 12px 14px; min-height: 0; white-space: pre; overflow: hidden; }
.port-thumb:not(.is-img)::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40px; background: linear-gradient(transparent, #0a0f1c); pointer-events: none; }
.port-art { height: 100%; display: grid; place-items: center; color: var(--c1); }
.port-art .icon { width: 54px; height: 54px; stroke-width: 1.5; opacity: .85; }
.port-thumb:has(.port-art)::after { display: none; }
.port-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.port-head .pill { padding: 3px 10px; font-size: 11.5px; }
.port-body h3 { font-size: 1.12rem; }
.port-body p { margin: 0; color: var(--muted); font-size: 14.5px; }
.port-tech { margin-top: 2px; }
.port .chips li, .pmodal .chips li { font: 500 12px "JetBrains Mono", Vazirmatn, monospace; padding: 5px 10px; }
.port-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; }
.port-code { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; text-decoration: none; }
.port-code:hover { color: var(--c1); }
.port-code .icon { width: 17px; height: 17px; }

/* Project details window */
.pmodal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(4, 7, 14, .82); backdrop-filter: blur(10px); animation: ai-in .25s ease-out; }
.pmodal[hidden] { display: none; }
.pmodal-panel { width: min(860px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); overflow: hidden; }
.pmodal-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.pmodal-head > div { flex: 1; min-width: 0; }
.pmodal-head .pill { padding: 3px 10px; font-size: 11.5px; }
.pmodal-head h3 { font-size: 1.35rem; margin-top: 6px; }
.pmodal-head .viewer-btn { color: var(--text); background: var(--surface-2); border-color: var(--border); width: 40px; height: 40px; }
.pmodal-body { padding: 22px; overflow-y: auto; }
.pmodal .port-tagline { margin: 0; font-size: 1.08rem; font-weight: 500; }
.pmodal-preview { margin-top: 18px; }
.pmodal-preview img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.pmodal-preview .terminal pre { font-size: 12px; line-height: 1.65; white-space: pre; overflow-x: auto; min-height: 0; }
.port-ps { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.port-ps p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.pmodal h4 { font: 500 12.5px "JetBrains Mono", Vazirmatn, monospace; color: var(--c1); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 0; }
:root[lang="fa"] .pmodal h4 { letter-spacing: 0; font-family: Vazirmatn, sans-serif; font-weight: 600; }
.pmodal .port-ps h4 { margin: 0; }
.pmodal h4 + .points { margin-top: 12px; gap: 8px; font-size: 15px; }
.pmodal h4 + .chips { margin-top: 12px; }
.port-actions { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 18px; }
.lib-card { display: flex; gap: 26px; align-items: center; padding: 22px; text-decoration: none; color: var(--text); overflow: hidden; }
.lib-card::after { content: ""; position: absolute; width: 260px; height: 260px; inset-inline-end: -90px; top: -90px; border-radius: 50%; background: var(--grad); opacity: .1; filter: blur(40px); pointer-events: none; }
.lib-cover { flex: none; width: 150px; aspect-ratio: 700 / 991; border-radius: 4px 10px 10px 4px; overflow: hidden; position: relative; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06); transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
[dir="rtl"] .lib-cover { border-radius: 10px 4px 4px 10px; }
.lib-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 255, 255, .16), transparent 7%, transparent 93%, rgba(0, 0, 0, .25)); pointer-events: none; }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-card:hover .lib-cover { transform: translateY(-4px) rotate(-1.5deg); }
.lib-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lib-info .pill { align-self: flex-start; }
.lib-info h3 { font-size: 1.45rem; }
.lib-info p { margin: 0; color: var(--muted); }
.lib-meta { font-size: 13.5px; color: var(--muted); }
.lib-cta { display: inline-flex; align-items: center; gap: 6px; color: var(--c1); font-weight: 600; margin-top: 4px; }
.lib-cta .icon { width: 16px; height: 16px; transition: transform .2s; }
.lib-card:hover .lib-cta .icon { transform: translate(2px, -2px); }
[dir="rtl"] .lib-cta .icon { transform: scaleX(-1); }
[dir="rtl"] .lib-card:hover .lib-cta .icon { transform: scaleX(-1) translate(2px, -2px); }

/* Book page */
.book { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: var(--bg); animation: ai-in .25s ease-out; }
.book[hidden] { display: none; }
.book::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(700px 500px at 85% 0%, color-mix(in srgb, var(--c2) 16%, transparent), transparent 70%), radial-gradient(600px 400px at 0% 100%, color-mix(in srgb, var(--c1) 10%, transparent), transparent 70%); }
.book-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 16px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); flex: none; }
.book-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 40px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font: 500 14px Inter, Vazirmatn, sans-serif; cursor: pointer; }
:root[lang="fa"] .book-btn { font-family: Vazirmatn, sans-serif; }
.book-btn:hover { border-color: var(--c1); color: var(--c1); }
.book-btn .icon { width: 18px; height: 18px; }
[dir="rtl"] .book-btn .icon { transform: scaleX(-1); }
[dir="rtl"] [data-zoom] .icon, [dir="rtl"] [data-toc] .icon, [dir="rtl"] .reader-tools a .icon { transform: none; }
.book-scroll { position: relative; flex: 1; overflow-y: auto; }
.book-intro { display: grid; grid-template-columns: 300px 1fr; gap: 56px; padding-top: 48px; padding-bottom: 80px; align-items: start; }
.book-cover-lg { position: sticky; top: 24px; border-radius: 6px 14px 14px 6px; overflow: hidden; box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .06); }
[dir="rtl"] .book-cover-lg { border-radius: 14px 6px 6px 14px; }
.book-cover-lg img { display: block; width: 100%; }
.book-about h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin-top: 14px; }
.book-sub { font-size: 1.12rem; color: var(--text); margin: 12px 0 0; }
.book-author { color: var(--muted); margin: 10px 0 0; }
.book-author b { color: var(--text); font-weight: 600; }
.book-facts { margin-top: 18px; }
.book-facts li { font-size: 13.5px; }
.book-facts li.free { color: var(--c3); border-color: color-mix(in srgb, var(--c3) 40%, var(--border)); }
.book-desc { margin: 20px 0 0; line-height: 1.9; color: var(--muted); max-width: 640px; }
.book-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.book-toc-title { font-size: 1.2rem; margin-top: 44px; }
.book-toc { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; max-width: 640px; }
.book-toc a { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 12px; text-decoration: none; color: var(--text); border: 1px solid transparent; transition: background .2s, border-color .2s; }
.book-toc a:hover { background: var(--surface); border-color: var(--border); }
.ch-num { font: 500 13px "JetBrains Mono", Vazirmatn, monospace; color: var(--c1); }
.ch-page { font-size: 13px; color: var(--muted); }

/* Reader */
.reader-bar { gap: 10px; }
.reader-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.reader-page { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.reader-page input { width: 58px; height: 34px; text-align: center; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 14px Inter, Vazirmatn, sans-serif; -moz-appearance: textfield; }
.reader-page input::-webkit-inner-spin-button { -webkit-appearance: none; }
.reader-page em { font-style: normal; }
.reader-tools { display: inline-flex; gap: 6px; }
.reader-tools .book-btn { padding: 0; width: 38px; min-width: 38px; height: 38px; }
.reader-body { position: relative; flex: 1; display: flex; min-height: 0; }
.reader-toc { width: 280px; flex: none; overflow-y: auto; padding: 18px 12px; border-inline-end: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 70%, transparent); }
.reader-toc h2 { font-size: 1rem; padding: 0 10px; margin-bottom: 10px; }
.reader-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.reader-toc button { width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: start; padding: 9px 10px; border-radius: 10px; border: 0; background: none; color: var(--text); font: 14px Inter, Vazirmatn, sans-serif; cursor: pointer; }
:root[lang="fa"] .reader-toc button { font-family: Vazirmatn, sans-serif; }
.reader-toc button:hover { background: var(--surface-2); color: var(--c1); }
.reader-toc em { font-style: normal; color: var(--muted); font-size: 12.5px; }
.flip-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flip-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 18px 12px 8px; perspective: 2600px; overflow: hidden; }
.flip-stage.zoomed { overflow: auto; place-items: start; perspective: none; }
.flip-stage.zoomed .flip-book { margin-inline: auto; }
.flip-stage.zoomed .flip-hit { display: none; }
.reader-tools .book-btn.on { color: var(--on-accent); background: var(--grad); border-color: transparent; }
.flip-book { position: relative; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.45, .05, .25, 1); }
/* Closed book (only the front or back cover showing): keep it centred */
.flip-book.spread.closed-right { transform: translateX(25%); }
.flip-book.spread.closed-left { transform: translateX(-25%); }
.flip-page { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; overflow: hidden; background: #0a1420; box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .75); }
.flip-book.spread .flip-page { width: 50%; }
.flip-book.spread .flip-left { border-radius: 6px 0 0 6px; }
.flip-book.spread .flip-right-page { left: 50%; border-radius: 0 6px 6px 0; }
.flip-book:not(.spread) .flip-page { border-radius: 6px; }
.flip-page.blank { visibility: hidden; }
.flip-page canvas, .flip-face canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.flip-spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 70px; transform: translateX(-50%); pointer-events: none; z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .38) 44%, rgba(255, 255, 255, .07) 50%, rgba(0, 0, 0, .38) 56%, transparent); }
.flip-book.closed-left .flip-spine, .flip-book.closed-right .flip-spine { display: none; }
.flip-hit { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 6; border: 0; padding: 0; background: transparent; cursor: pointer; }
.flip-hit.hit-left { left: 0; }
.flip-hit.hit-right { right: 0; }
.flip-hit::after { content: ""; position: absolute; top: 0; bottom: 0; width: 46px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.flip-hit.hit-left::after { left: 0; background: linear-gradient(90deg, rgba(255, 255, 255, .12), transparent); border-radius: 6px 0 0 6px; }
.flip-hit.hit-right::after { right: 0; background: linear-gradient(270deg, rgba(255, 255, 255, .12), transparent); border-radius: 0 6px 6px 0; }
.flip-hit:hover::after { opacity: 1; }
/* The turning leaf */
.flip-leaf { position: absolute; top: 0; height: 100%; width: 50%; z-index: 8; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.45, .05, .25, 1); will-change: transform; }
.flip-leaf.from-left { left: 0; transform-origin: right center; }
.flip-leaf.from-left.go { transform: rotateY(180deg); }
.flip-leaf.from-right { left: 50%; transform-origin: left center; }
.flip-leaf.from-right.go { transform: rotateY(-180deg); }
.flip-leaf.single { left: 0; width: 100%; }
.flip-leaf.pivot-right { transform-origin: right center; }
.flip-leaf.pivot-left { transform-origin: left center; }
.flip-leaf.pivot-right.go { transform: rotateY(180deg); }
.flip-leaf.pivot-left.go { transform: rotateY(-180deg); }
.flip-leaf.pivot-right.incoming { transform: rotateY(180deg); }
.flip-leaf.pivot-left.incoming { transform: rotateY(-180deg); }
.flip-leaf.incoming.go { transform: rotateY(0deg); }
.flip-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #0a1420; }
.flip-face.back { transform: rotateY(180deg); }
.flip-face.blank { background: linear-gradient(90deg, #0b1424, #0e1a2e); }
.flip-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .75s; }
.from-left .front::after, .pivot-right .front::after { background: linear-gradient(270deg, rgba(0, 0, 0, .55), transparent 60%); }
.from-right .front::after, .pivot-left .front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .55), transparent 60%); }
.flip-leaf.go:not(.incoming) .front::after { opacity: 1; }
.flip-face.back::after { background: linear-gradient(90deg, rgba(255, 255, 255, .08), transparent 40%); opacity: 1; }
/* Page-turning mode: finger (no arrow buttons) or buttons (no tap zones) */
.book[data-nav="swipe"] .flip-btn { display: none; }
.book[data-nav="buttons"] .flip-hit { display: none; }
.book[data-nav="buttons"] .flip-btn { width: 54px; min-width: 54px; height: 54px; border-radius: 16px; }
.nav-ask { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(4, 7, 14, .72); backdrop-filter: blur(6px); animation: ai-in .25s ease-out; }
.nav-ask-card { width: min(520px, 100%); padding: 26px; border-radius: 22px; background: var(--bg-2); border: 1px solid var(--border); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); text-align: center; }
.nav-ask-card h2 { font-size: 1.25rem; }
.nav-ask-card p { margin: 16px 0 0; color: var(--muted); font-size: 13.5px; }
.nav-ask-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.nav-ask-options button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: 14px Inter, Vazirmatn, sans-serif; transition: border-color .2s, transform .2s; }
:root[lang="fa"] .nav-ask-options button { font-family: Vazirmatn, sans-serif; }
.nav-ask-options button:hover, .nav-ask-options button:focus-visible { border-color: var(--c1); transform: translateY(-2px); outline: none; }
.nav-ask-options b { font-size: 15.5px; }
.nav-ask-options small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.nav-ask-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: var(--on-accent); }
.nav-ask-icon .icon { width: 26px; height: 26px; transform: none !important; }
.flip-controls { flex: none; display: flex; align-items: center; gap: 14px; justify-content: center; padding: 8px 16px 16px; }
.flip-range { width: min(520px, 60vw); accent-color: var(--c1); }
.flip-controls .book-btn .icon { transform: none !important; }
.flip-controls .flip-right .icon { transform: scaleX(-1) !important; }
.reader-num { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font: 500 14px "JetBrains Mono", Vazirmatn, monospace; }
.reader-status, .reader-fail { text-align: center; color: var(--muted); padding: 60px 16px; }
.reader-fail .btn { margin: 14px 4px 0; }
@media (max-width: 960px) {
  .reader-toc { position: absolute; z-index: 3; inset-block: 0; inset-inline-start: 0; width: min(320px, 86vw); background: var(--bg-2); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .25s; }
  [dir="rtl"] .reader-toc { transform: translateX(105%); }
  .book.toc-open .reader-toc { transform: none; }
  .book-intro { grid-template-columns: 220px 1fr; gap: 32px; }
}
@media (min-width: 961px) { .book.toc-hidden .reader-toc { display: none; } }
@media (max-width: 640px) {
  .lib-card { gap: 16px; padding: 16px; }
  .lib-cover { width: 104px; }
  .lib-info h3 { font-size: 1.15rem; }
  .lib-info p { font-size: 14px; }
  .book-intro { grid-template-columns: 1fr; padding-top: 24px; gap: 24px; }
  .book-cover-lg { position: static; width: 190px; margin: 0 auto; }
  .book-about { text-align: start; }
  .book-btn span { display: none; }
  .reader-title { display: none; }
  .reader-page { margin-inline-end: auto; }
  .reader-page > span:first-child { display: none; }
  .flip-stage { padding: 10px 6px 4px; }
  .flip-controls { gap: 8px; padding: 6px 10px 12px; }
}

/* Contact */
.contact-panel {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; padding: 44px; border-radius: 28px;
  background:
    radial-gradient(400px 300px at 0% 0%, color-mix(in srgb, var(--c1) 16%, transparent), transparent 70%),
    radial-gradient(400px 300px at 100% 100%, color-mix(in srgb, var(--c2) 18%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.contact-info p { margin: 14px 0 0; }
.contact-links { display: grid; gap: 10px; margin-top: 26px; }
.contact-link {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .2s, transform .2s;
}
.contact-link:hover { border-color: var(--c1); transform: translateX(4px); }
.contact-link .icon-tile { width: 40px; height: 40px; border-radius: 11px; }
.contact-link .icon-tile .icon { width: 19px; height: 19px; }
.contact-link small { display: block; color: var(--muted); font-size: 12.5px; }
.contact-link b { font-weight: 500; font-size: 15px; word-break: break-all; }
.contact-link > .icon { margin-inline-start: auto; color: var(--muted); }

.contact-form { display: grid; gap: 16px; align-content: start; }
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { position: relative; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--border); border-radius: 14px; padding: 24px 16px 10px; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.field label { position: absolute; inset-inline-start: 17px; top: 17px; color: var(--muted); pointer-events: none; transition: all .18s; font-size: 15px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 18%, transparent); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label { top: 7px; font-size: 12px; color: var(--c1); }
.field.invalid input, .field.invalid textarea { border-color: var(--err); }
.contact-form .btn { justify-self: start; padding: 14px 26px; }
.form-status { margin: 0; min-height: 1.4em; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.form-status.ok { color: var(--c3); }
.form-status.err { color: var(--err); }

/* ── Site footer ──────────────────────────────────────────── */
.site-footer { margin-top: 110px; padding: 64px 0 100px; border-top: 1px solid var(--border); background: linear-gradient(180deg, var(--surface), transparent 70%); }
.site-footer .wrap { display: grid; grid-template-columns: minmax(250px, 1fr) 2.7fr; gap: 40px 56px; align-items: start; }
.foot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 24px; }
.foot-col h4 { margin: 0 0 16px; font-size: 15px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.foot-col a { color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.5; display: inline-block; overflow-wrap: anywhere; transition: color .2s, transform .2s; }
.foot-col a:hover { color: var(--text); transform: translateX(3px); }
[dir="rtl"] .foot-col a:hover { transform: translateX(-3px); }
.foot-card { order: -1; padding: 24px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); position: relative; overflow: hidden; }
.foot-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--grad); }
.foot-id { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.foot-badge { flex: none; width: 64px; height: 64px; padding: 3px; border-radius: 50%; background: var(--grad); box-shadow: 0 10px 28px -10px var(--c2); }
.foot-badge img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 2px solid var(--bg); }
.foot-name { display: grid; gap: 2px; min-width: 0; }
.foot-name b { font: 700 19px "Space Grotesk", Vazirmatn, sans-serif; }
.foot-name small { color: var(--muted); font-size: 13px; }
.foot-tag { margin: 16px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.foot-social { display: flex; flex-wrap: wrap; gap: 8px; }
.foot-social a { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--text); background: var(--surface); border: 1px solid var(--border); transition: transform .2s, border-color .2s, color .2s; }
.foot-social a:hover { transform: translateY(-2px); border-color: var(--c1); color: var(--c1); }
.foot-social svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.foot-bottom { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }
.foot-bottom a { color: var(--text); text-decoration: none; }
.foot-bottom a:hover { color: var(--c1); }

/* Language button */
.lang-btn { font: 700 13px Vazirmatn, Inter, sans-serif; }
:root[lang="en"] .lang-btn { font-family: Vazirmatn, sans-serif; }
:root[lang="fa"] .lang-btn { font-family: Inter, sans-serif; }

/* Persian (right-to-left) */
:root[lang="fa"] body,
:root[lang="fa"] h1, :root[lang="fa"] h2, :root[lang="fa"] h3,
:root[lang="fa"] .btn, :root[lang="fa"] .logo, :root[lang="fa"] .avatar,
:root[lang="fa"] .stat strong, :root[lang="fa"] .gauge span { font-family: Vazirmatn, Inter, sans-serif; }
:root[lang="fa"] body { line-height: 1.9; }
:root[lang="fa"] h1, :root[lang="fa"] h2, :root[lang="fa"] h3,
:root[lang="fa"] .eyebrow, :root[lang="fa"] .job-chart h4 { letter-spacing: 0; text-transform: none; line-height: 1.4; }
:root[lang="fa"] .port-filters button span { letter-spacing: 0; }
:root[lang="fa"] .eyebrow, :root[lang="fa"] .job-chart h4, :root[lang="fa"] .port-filters button span, :root[lang="fa"] .pill, :root[lang="fa"] .typed { font-family: Vazirmatn, "JetBrains Mono", sans-serif; }
:root[lang="fa"] .eyebrow { font-size: 14px; font-weight: 600; }
:root[lang="fa"] .typed { font-weight: 600; }
:root[lang="fa"] .hero h1 .hi { font-size: .4em; }
:root[lang="fa"] .badge, :root[lang="fa"] .terminal pre { font-family: "JetBrains Mono", Vazirmatn, monospace; }
[dir="rtl"] .flip { transform: scaleX(-1); }
[dir="rtl"] .cert:hover .open .icon { transform: scaleX(-1) translate(2px, -2px); }
[dir="rtl"] .contact-link:hover { transform: translateX(-4px); }
[dir="rtl"] .terminal, [dir="ltr"] .terminal { text-align: left; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.2, .8, .2, 1), transform .8s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

.nav-cross { display: inline-flex; align-items: center; gap: 6px; }
.nav-cross .icon { width: 16px; height: 16px; flex: none; }
[dir="rtl"] .nav-cross .icon { transform: scaleX(-1); }

@media (max-width: 960px) {
  .nav-links { display: none; }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .foot-card { order: 0; }
  .nav-inner { gap: 10px; }
  .hero-inner, .about-grid, .job, .edu-grid, .contact-panel { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 120px; }
  .hero-photo { order: -1; width: min(260px, 64vw); margin-bottom: 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
  .job-chart { border-inline-start: 0; border-top: 1px solid var(--border); }
  .port-list, .cert-grid { grid-template-columns: 1fr 1fr; }
  .scroll-hint { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .section { padding: 80px 16px 0; }
  /* Keep the top bar from overflowing on narrow phones */
  .logo span { display: none; }
  .nav-inner { gap: 8px; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn.sm { padding: 8px 12px; font-size: 13px; }
  .nav-actions .nav-cross { padding: 8px 12px; }
  .nav-cross .icon { display: none; }
  .icon-btn { width: 36px; height: 36px; }
  /* Let the page end clear the floating chat button */
  .site-footer { margin-top: 80px; padding: 44px 0 100px; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .foot-card { padding: 20px; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }
  .author-strip { padding: 24px; }
  .author-strip .btn { align-self: stretch; text-align: center; }
  .badge { font-size: 11.5px; padding: 6px 10px; }
  .badge:nth-child(1) { left: -8%; }
  .badge:nth-child(2) { right: -10%; }
  .badge:nth-child(3) { left: -10%; }
  .badge:nth-child(4) { right: -4%; }
  .stat { padding: 18px; }
  .about-cards, .skill-grid, .contact-form .row, .port-ps { grid-template-columns: 1fr; }
  /* Certificates and projects scroll sideways on phones instead of one long column */
  .cert-grid, .port-list {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; gap: 12px;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin-inline: -16px; padding: 4px 16px 14px; scroll-padding-inline: 16px; scrollbar-width: none;
  }
  .cert-grid::-webkit-scrollbar, .port-list::-webkit-scrollbar { display: none; }
  .cert-grid > *, .port-list > * { scroll-snap-align: start; }
  .pmodal { padding: 10px; }
  .pmodal-panel { max-height: calc(100vh - 20px); }
  .lang-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .job-main, .job-chart, .edu, .skill { padding: 22px; }
  .job-head .pill { margin-inline-start: 0; }
  .contact-panel { padding: 24px; border-radius: 22px; }
  .terminal pre { font-size: 12.5px; min-height: 0; }
  .port-ps { grid-template-columns: 1fr; }
  .port-term pre { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .bar-fill { width: var(--w); }
  .gauge .val { stroke-dashoffset: var(--off); }
}

@media print {
  .nav, #network, .bg-glow, .scroll-hint, #contact, .actions, .ring, #badges { display: none !important; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1; transform: none; }
  .card { box-shadow: none; }
}

/* ── AI assistant ─────────────────────────────────────────── */
.ai { position: fixed; z-index: 60; inset-block-end: 22px; inset-inline-end: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.ai svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[lang="fa"] .ai, :root[lang="fa"] .ai button, :root[lang="fa"] .ai textarea { font-family: Vazirmatn, sans-serif; }
.ai-launcher {
  order: 3; display: inline-flex; align-items: center; gap: 10px; height: 56px; padding-block: 0; padding-inline: 8px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--grad); color: var(--on-accent); font: 600 15px Inter, Vazirmatn, sans-serif; box-shadow: 0 16px 40px -12px var(--c2);
  transition: transform .2s, box-shadow .2s;
}
.ai-launcher:hover { transform: translateY(-3px); box-shadow: 0 20px 44px -10px var(--c2); }
.ai-launcher-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .22); position: relative; }
.ai-launcher-icon::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); animation: ai-ping 2.4s infinite; }
@keyframes ai-ping { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.ai.open .ai-launcher-label { display: none; }
.ai.open .ai-launcher { padding-inline: 8px; }
.ai.open .ai-launcher-icon::after { display: none; }

.ai-nudge {
  order: 2; position: relative; max-width: 260px; padding: 12px 34px 12px 14px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(var(--surface-2), var(--surface-2)), var(--bg); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; line-height: 1.6;
  animation: ai-in .35s cubic-bezier(.2, .8, .2, 1);
}
[dir="rtl"] .ai-nudge { padding: 12px 14px 12px 34px; }
.ai-nudge[hidden] { display: none; }
.ai-nudge-x { position: absolute; top: 6px; inset-inline-end: 8px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }

.ai-panel {
  order: 1; width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
  animation: ai-in .25s cubic-bezier(.2, .8, .2, 1);
}
.ai-panel[hidden] { display: none; }
@keyframes ai-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.ai-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px 16px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(120deg, color-mix(in srgb, var(--c1) 14%, transparent), color-mix(in srgb, var(--c2) 14%, transparent)); }
.ai-head > div { flex: 1; min-width: 0; }
.ai-head b { display: block; font: 600 15px "Space Grotesk", Vazirmatn, sans-serif; }
:root[lang="fa"] .ai-head b { font-family: Vazirmatn, sans-serif; }
.ai-head small { color: var(--muted); font-size: 12.5px; }
.ai-avatar { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: var(--on-accent); font-weight: 700; }
.ai-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ai-avatar i { position: absolute; inset-block-end: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--c3); border: 2px solid var(--bg); }
.ai-icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ai-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.ai-icon-btn svg { width: 18px; height: 18px; }
.ai-progress { position: absolute; inset-inline: 0; bottom: -1px; height: 3px; background: transparent; }
.ai-progress i { display: block; height: 100%; width: 0; background: var(--grad); border-start-end-radius: 3px; border-end-end-radius: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.ai-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 9px; overscroll-behavior: contain; }
.ai-body > * { flex-shrink: 0; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; animation: ai-pop .22s ease-out; }
.ai-msg .ai-gap { height: .55em; }
@keyframes ai-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ai-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-start-start-radius: 4px; }
.ai-msg.user { align-self: flex-end; background: var(--grad); color: var(--on-accent); border-start-end-radius: 4px; }
.ai-typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: ai-dot 1.1s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }

.ai-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; animation: ai-pop .25s ease-out; }
.ai-chips button {
  padding: 8px 13px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c1) 45%, var(--border)); background: transparent;
  color: var(--c1); font: 500 13.5px Inter, Vazirmatn, sans-serif; cursor: pointer; transition: background .2s, transform .15s;
}
.ai-chips button:hover { background: color-mix(in srgb, var(--c1) 12%, transparent); transform: translateY(-1px); }
.ai-chips button.ghost { border-style: dashed; color: var(--muted); border-color: var(--border); }
.ai-chips a.link { padding: 8px 14px; border-radius: 999px; background: var(--grad); color: var(--on-accent); font: 600 13.5px Inter, Vazirmatn, sans-serif; text-decoration: none; box-shadow: 0 8px 20px -10px var(--c2); }
.ai-chips a.link:hover { transform: translateY(-1px); }
.form-status:has(.form-fallback) { flex-wrap: wrap; }
.form-fallback { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; flex-basis: 100%; }
.form-fallback a { padding: 9px 14px; border-radius: 999px; background: var(--grad); color: var(--on-accent); font-weight: 600; font-size: 14px; text-decoration: none; }

.ai-card { align-self: stretch; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; animation: ai-pop .25s ease-out; }
.ai-card dl { margin: 0; padding: 6px 0; }
.ai-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; gap: 10px; align-items: start; padding: 8px 14px; font-size: 13.5px; }
.ai-row + .ai-row { border-top: 1px dashed var(--border); }
.ai-row dt { color: var(--muted); }
.ai-row dd { margin: 0; overflow-wrap: anywhere; }
.ai-row-edit { width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ai-row-edit:hover { color: var(--c1); background: var(--surface-2); }
.ai-row-edit svg { width: 14px; height: 14px; }
.ai-card-actions { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--c2) 6%, transparent); }
.ai-card-actions button { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 14px Inter, Vazirmatn, sans-serif; cursor: pointer; }
.ai-card-actions button.primary { background: var(--grad); color: var(--on-accent); border-color: transparent; }
.ai-card-actions button:hover { filter: brightness(1.06); }

.ai-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px 12px 6px; border-top: 1px solid var(--border); }
.ai-input textarea {
  flex: 1; resize: none; max-height: 120px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--text); font: 14.5px/1.5 Inter, Vazirmatn, sans-serif;
}
.ai-input textarea:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 18%, transparent); }
.ai-send { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0; background: var(--grad); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; }
.ai-send:disabled { opacity: .5; cursor: default; }
[dir="rtl"] .ai-send svg { transform: scaleX(-1); }
.ai-note { margin: 0; padding: 4px 14px 12px; font-size: 11.5px; color: var(--muted); text-align: center; }

@media (max-width: 640px) {
  .ai { inset-block-end: 14px; inset-inline-end: 14px; }
  .ai-launcher-label { display: none; }
  .ai-launcher { padding-inline: 8px; }
  .ai-nudge { max-width: calc(100vw - 100px); }
  .ai.open { inset: 0; padding: 10px; justify-content: flex-end; align-items: stretch; background: rgba(0, 0, 0, .35); }
  .ai.open .ai-panel { width: 100%; height: calc(100% - 70px); }
  .ai.open .ai-launcher { align-self: flex-end; }
}
@media print { .ai { display: none !important; } }

/* ── Learning hub ─────────────────────────────────────────── */
.hero.hero-learn { min-height: auto; padding: 150px 0 90px; }
.hero-learn .hero-inner { grid-template-columns: 1fr; max-width: 820px; }
.hero-learn .kicker { display: inline-flex; align-items: center; gap: 8px; align-self: start; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font: 500 13.5px "JetBrains Mono", Vazirmatn, monospace; color: var(--c1); }
:root[lang="fa"] .hero-learn .kicker { font-family: Vazirmatn, sans-serif; }
.hero-learn h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-top: 20px; letter-spacing: -0.02em; }
.hero-learn .lead { font-size: 1.15rem; max-width: 620px; display: block; }
.track-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.track { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px; text-align: start; cursor: pointer; border: 1px solid var(--border); }
.track h3 { font-size: 1.2rem; }
.track p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.track-count { font: 500 12.5px "JetBrains Mono", Vazirmatn, monospace; color: var(--c1); }
:root[lang="fa"] .track-count { font-family: Vazirmatn, sans-serif; }

.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.art { display: flex; flex-direction: column; gap: 12px; padding: 22px; text-decoration: none; color: var(--text); }
.art[hidden] { display: none; }
.art-top { display: flex; gap: 14px; align-items: flex-start; }
.art-badges { display: flex; flex-direction: column; gap: 5px; }
.art-badges .pill { align-self: flex-start; }
.art-meta { font-size: 12.5px; color: var(--muted); }
.art h3 { font-size: 1.12rem; }
.art p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.art-read { display: inline-flex; align-items: center; gap: 6px; color: var(--c1); font-weight: 600; font-size: 14px; }
.art-read .icon { width: 15px; height: 15px; transition: transform .2s; }
.art:hover .art-read .icon { transform: translate(2px, -2px); }
[dir="rtl"] .art-read .icon { transform: scaleX(-1); }
[dir="rtl"] .art:hover .art-read .icon { transform: scaleX(-1) translate(2px, -2px); }

.author-strip { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: space-between; padding: 30px 34px; border-radius: 22px;
  background: radial-gradient(400px 220px at 100% 0%, color-mix(in srgb, var(--c2) 16%, transparent), transparent 70%), var(--surface); border: 1px solid var(--border); }
.author-strip h3 { font-size: 1.3rem; }
.author-strip p { margin: 8px 0 0; color: var(--muted); max-width: 560px; }

/* ── Article reader ───────────────────────────────────────── */
.adoc { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; background: var(--bg); animation: ai-in .25s ease-out; }
.adoc[hidden] { display: none; }
.adoc::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 420px; pointer-events: none; background: radial-gradient(600px 300px at 80% 0%, color-mix(in srgb, var(--c2) 14%, transparent), transparent 70%), radial-gradient(500px 300px at 0% 0%, color-mix(in srgb, var(--c1) 10%, transparent), transparent 70%); }
.adoc-track { margin-inline-start: auto; }
.adoc-scroll { position: relative; flex: 1; overflow-y: auto; }
.adoc-body { max-width: 760px; padding-top: 44px; padding-bottom: 90px; }
.adoc-kick { font: 500 13px "JetBrains Mono", Vazirmatn, monospace; color: var(--c1); margin: 0; }
:root[lang="fa"] .adoc-kick { font-family: Vazirmatn, sans-serif; }
.adoc-body h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); margin: 14px 0 0; letter-spacing: -0.02em; }
.adoc-summary { font-size: 1.18rem; color: var(--muted); margin: 16px 0 0; line-height: 1.8; }
.adoc-content { margin-top: 30px; font-size: 1.06rem; line-height: 1.95; }
.adoc-content h2 { font-size: 1.5rem; margin: 40px 0 0; }
.adoc-content p { margin: 16px 0 0; }
.adoc-content > *:first-child { margin-top: 0; }
.doc-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 11px; }
.doc-list li { display: flex; gap: 12px; align-items: flex-start; }
.doc-list li .icon { color: var(--c3); margin-top: 6px; width: 17px; height: 17px; flex: none; }
.doc-note { display: flex; gap: 14px; margin: 24px 0 0; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.doc-note .icon { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.doc-note.tip { border-color: color-mix(in srgb, var(--c1) 35%, var(--border)); }
.doc-note.tip .icon { color: var(--c1); }
.doc-note.warn { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.doc-note.warn .icon { color: var(--err); }
.doc-note div { line-height: 1.75; }
.doc-code, .doc-term, .doc-img { margin: 26px 0 0; }
.doc-code { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #0a0f1c; }
.doc-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.08); }
.doc-lang { font: 500 12px "JetBrains Mono", monospace; color: #7d8aa3; text-transform: uppercase; letter-spacing: .05em; }
.doc-copy { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: #9aa6bd; font: 500 12.5px Inter, Vazirmatn, sans-serif; cursor: pointer; }
:root[lang="fa"] .doc-copy { font-family: Vazirmatn, sans-serif; }
.doc-copy:hover { color: #fff; }
.doc-copy .icon { width: 15px; height: 15px; }
.doc-code pre { margin: 0; padding: 18px; overflow-x: auto; line-height: 1.65; font-size: 14px; }
.doc-code code { font: 13.5px/1.75 "JetBrains Mono", monospace; color: #c9d4e6; white-space: pre; }
.doc-term .terminal { margin: 0; }
.doc-term pre { min-height: 0; white-space: pre; overflow-x: auto; line-height: 1.65; }
.doc-term .o { color: #9fb0c9; }
.doc-img { text-align: center; }
.doc-img img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.doc-code figcaption, .doc-term figcaption, .doc-img figcaption { margin-top: 10px; font-size: 13.5px; color: var(--muted); text-align: center; padding: 0 14px 14px; }
.doc-code figcaption, .doc-term figcaption { padding-bottom: 0; }
.adoc-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.adoc-navbtn { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); }
.adoc-navbtn:hover { border-color: var(--c1); }
.adoc-navbtn .icon { flex: none; color: var(--muted); }
.adoc-navbtn.next { text-align: end; flex-direction: row-reverse; }
.adoc-navbtn small { display: block; color: var(--muted); font-size: 12px; }
.adoc-navbtn b { font-weight: 600; font-size: 14.5px; }
[dir="rtl"] .adoc-navbtn.prev .icon, [dir="ltr"] .adoc-navbtn.next .icon { transform: scaleX(-1); }

@media (max-width: 960px) {
  .track-grid { grid-template-columns: 1fr 1fr; }
  .article-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hero.hero-learn { padding-top: 120px; }
  .track-grid, .article-grid { grid-template-columns: 1fr; }
  .adoc-nav { grid-template-columns: 1fr; }
  .adoc-navbtn.next { flex-direction: row; text-align: start; }
}

/* ── Static article pages (fa/<id>/, en/<id>/) ───────────────── */
.article-main { position: relative; padding-top: 84px; }
.adoc-page { padding-bottom: 40px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--c1); }
.crumbs span[aria-hidden] { opacity: .5; }
.adoc-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; }
.adoc-back .icon { width: 18px; height: 18px; }
[dir="rtl"] .adoc-back .icon { transform: scaleX(-1); }
@media (max-width: 640px) { .article-main { padding-top: 72px; } .adoc-nav { grid-template-columns: 1fr; } }

/* ── Lab card on the hub ─────────────────────────────────────── */
.lab-card { display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center; padding: 34px; text-decoration: none; color: var(--text); overflow: hidden; position: relative; }
.lab-card::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c2) 22%, transparent), transparent 65%); pointer-events: none; }
.lab-art { display: grid; grid-template-columns: repeat(2, 64px); gap: 12px; }
.lab-art .icon-tile { width: 64px; height: 64px; border-radius: 18px; }
.lab-art .icon-tile .icon { width: 28px; height: 28px; }
.lab-text h3 { font-size: 1.6rem; margin: 12px 0 8px; }
.lab-text p { color: var(--muted); margin: 0 0 20px; line-height: 1.8; max-width: 640px; }
.lab-cta { display: inline-flex; align-items: center; gap: 8px; }
.lab-cta .icon { width: 18px; height: 18px; }
@media (max-width: 640px) { .lab-card { grid-template-columns: 1fr; padding: 24px; gap: 22px; } .lab-art { grid-template-columns: repeat(4, 56px); } .lab-art .icon-tile { width: 56px; height: 56px; } }

/* ── Vision tool page ────────────────────────────────────────── */
.vis-main { position: relative; padding-top: 110px; }
.vis-head { max-width: 860px; }
.vis-head h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 12px 0 10px; letter-spacing: -0.02em; }
.vis-head .lead { color: var(--muted); font-size: 1.12rem; line-height: 1.8; margin: 0; }
.vis-privacy { display: inline-flex; align-items: center; gap: 10px; margin: 18px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; color: var(--text); background: color-mix(in srgb, var(--c3) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c3) 35%, transparent); }
.vis-privacy .icon { width: 18px; height: 18px; color: var(--c3); flex: none; }
.vis-app { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 22px; margin-top: 34px; align-items: start; }
.vis-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.vis-toolbar .btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.vis-toolbar .btn .icon { width: 18px; height: 18px; }
.vis-toggles { display: flex; gap: 6px; margin-inline-start: auto; }
.vis-chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 8px 14px; border-radius: 999px; font: 500 13.5px Inter, Vazirmatn, sans-serif; cursor: pointer; transition: all .2s; }
.vis-chip.on { color: var(--on-accent); background: var(--grad); border-color: transparent; }
.vis-view { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: #05080f; border: 1px solid var(--border); }
.vis-view video, .vis-view img, .vis-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.vis-view.mirror video, .vis-view.mirror canvas { transform: scaleX(-1); }
.vis-view video[hidden], .vis-view img[hidden] { display: none; }
.vis-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 24px; color: #c9d3e3; background: radial-gradient(500px 300px at 50% 40%, rgba(139, 92, 246, .16), transparent 70%); }
.vis-empty .icon { width: 54px; height: 54px; color: #22d3ee; margin-bottom: 6px; }
.vis-empty b { font-size: 1.1rem; }
.vis-empty span { color: #8d99b0; font-size: 14px; }
.vis-empty[hidden] { display: none; }
.vis-status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 24px; background: rgba(5, 8, 15, .9); color: #e6edf7; z-index: 2; }
.vis-status[hidden] { display: none; }
.vis-status small { color: #8d99b0; }
.vis-err { color: #fda4af; max-width: 420px; line-height: 1.7; }
.vis-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #22d3ee; animation: vis-spin 0.9s linear infinite; }
@keyframes vis-spin { to { transform: rotate(360deg); } }
.vis-fps { position: absolute; top: 10px; left: 10px; direction: ltr; z-index: 1; font: 500 12px "JetBrains Mono", monospace; padding: 4px 8px; border-radius: 8px; background: rgba(5, 8, 15, .7); color: #34d399; }
.vis-fps[hidden] { display: none; }
.vis-panel { display: grid; gap: 12px; }
.vis-card { padding: 18px 20px; }
.vis-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 1.02rem; margin: 0 0 10px; }
.vis-card h3 small { font: 500 13px Inter, Vazirmatn, sans-serif; color: var(--c1); }
.vis-card p { margin: 0; font-size: 14px; }
.vis-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; border-top: 1px dashed var(--border); }
.vis-row:first-of-type { border-top: 0; }
.vis-row span { color: var(--muted); }
.vis-sub { margin-top: 10px !important; color: var(--muted); font-size: 12.5px !important; }
.vis-eye { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.vis-eye > span { color: var(--muted); min-width: 74px; }
.vis-eye i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25); flex: none; }
.vis-eye em { font-style: normal; font-size: 13px; }
.vis-bar { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; padding: 3px 0; }
.vis-bar span { color: var(--muted); }
.vis-bar i { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.vis-bar i b { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .2s; }
.vis-bar em { font: 500 12px "JetBrains Mono", monospace; color: var(--muted); font-style: normal; text-align: end; }
.vis-hand { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; font-size: 14px; border-top: 1px dashed var(--border); }
.vis-hand:first-of-type { border-top: 0; }
.vis-hand span { color: var(--muted); }
.vis-hand em { font-style: normal; margin-inline-start: auto; font-weight: 600; }
.vis-how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.vis-how-grid .card { padding: 24px; }
.vis-how-grid h3 { margin: 0 0 8px; font-size: 1.1rem; }
.vis-how-grid p { margin: 0; color: var(--muted); line-height: 1.8; font-size: 14.5px; }
.vis-credit { margin-top: 18px; font-size: 13px; }
@media (max-width: 960px) { .vis-app { grid-template-columns: 1fr; } .vis-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vis-how-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .vis-main { padding-top: 88px; }
  .vis-panel { grid-template-columns: 1fr; }
  .vis-toggles { margin-inline-start: 0; width: 100%; }
  .vis-toggles .vis-chip { flex: 1; }
  .vis-toolbar .btn { flex: 1; justify-content: center; white-space: nowrap; padding-inline: 12px; font-size: 14.5px; }
}
