@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Variable.woff2") format("woff2-variations"), url("fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #08080a;
  --bg-raise: #0e0e11;
  --text: #f5f5f7;
  --text-dim: #99999f;
  --text-faint: #5c5c63;
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.06);
  --accent: #d4af37;
  --accent-soft: #f6e8b8;
  --accent-dim: rgba(212, 175, 55, 0.4);
  --accent-wash: rgba(212, 175, 55, 0.12);
  --accent-grad: linear-gradient(135deg, #8a6a1f 0%, #d4af37 42%, #f6e8b8 58%, #d4af37 78%, #8a6a1f 100%);
  --on-accent: #171103;
  --mono: "Courier New", ui-monospace, Consolas, monospace;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --container: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y proximity; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  direction: rtl;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }

p { text-align: justify; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container-wide {
  max-width: 1760px;
  padding: 0 48px;
}

/* ---------- hero layout ---------- */
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 64px;
}
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero-logo {
  flex: 0 0 auto;
  width: 320px;
}
.hero-logo img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 30px 60px rgba(212, 175, 55, 0.18));
}
@media (max-width: 1100px) {
  .hero-row { flex-direction: column-reverse; gap: 36px; text-align: center; }
  .hero-logo { width: 220px; }
  .hero-text .hero-cta { justify-content: center; }
  .hero-text .hero-stats { justify-content: center; }
  .container-wide { padding: 0 24px; }
}

/* ---------- background ambience ---------- */
.bg-ambience {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-ambience::before {
  content: "";
  position: absolute;
  top: -10%;
  right: -16%;
  width: 54vw;
  height: 54vw;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.08;
  filter: blur(140px);
}
.bg-ambience::after { content: none; }
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.65;
  pointer-events: none;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 50;
  padding: 18px 0;
  transition: background 0.3s ease, border-color 0.3s ease, padding 0.3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(8, 8, 10, 0.86);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  padding: 13px 0;
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 30px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.nav-links a { transition: color 0.2s ease; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  right: 0; left: 0;
  bottom: -8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-cta { display: inline-flex; }
.nav-toggle {
  display: flex;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  color: var(--text);
  align-items: center;
  justify-content: center;
}
.mobile-panel {
  display: none;
  position: fixed;
  top: 68px;
  inset-inline: 16px;
  z-index: 49;
  background: rgba(14, 14, 17, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  backdrop-filter: blur(20px);
}
.mobile-panel.open { display: block; }
.mobile-panel a {
  display: block;
  padding: 14px 16px;
  font-size: 0.98rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}
.mobile-panel a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 18px 40px -16px rgba(212, 175, 55, 0.45);
}
.btn-primary:hover { box-shadow: 0 22px 48px -14px rgba(212, 175, 55, 0.6); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 9px 18px; font-size: 0.82rem; }

/* ---------- hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 110px;
  padding-bottom: 60px;
  position: relative;
  scroll-snap-align: start;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 26px;
  font-family: var(--mono);
}
.eyebrow::before { content: none; }
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.12;
  font-weight: 800;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero h1 span.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.role-switch {
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 30px;
  height: 1.8em;
  position: relative;
  overflow: hidden;
}
.role-switch .roles { position: relative; height: 100%; }
.role-switch .role {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.role-switch .role.active { opacity: 1; transform: translateY(0); }
.role-switch .role b { color: var(--accent); font-weight: 700; margin-left: 10px; }
.hero p.lead {
  max-width: 620px;
  font-size: 1.06rem;
  color: var(--text-dim);
  margin: 0 0 40px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }
.hero-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  max-width: 700px;
}
.hero-stats .stat { min-width: 110px; }
.hero-stats .stat b {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
}
.hero-stats .stat span { font-size: 0.8rem; color: var(--text-faint); }

/* ---------- section scaffolding ---------- */
section {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 110px 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
}
.section-head { margin-bottom: 48px; max-width: 680px; }
.section-num {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 18px;
  font-family: var(--mono);
}
.section-num::after {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent-dim);
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-head p { color: var(--text-dim); font-size: 1rem; margin: 0; }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 48px;
  align-items: start;
  padding-top: 40px;
  border-top: 1px solid var(--border-soft);
}
.about-card p { color: var(--text-dim); font-size: 1.02rem; margin: 0 0 20px; }
.about-card p:last-child { margin-bottom: 0; }
.facet-list { display: grid; gap: 0; }
.facet {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.facet:first-child { padding-top: 0; }
.facet .n {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent);
  width: 26px;
  font-family: var(--mono);
}
.facet .t { font-weight: 600; color: var(--text); }

/* ---------- services ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.service-card, .glass-card {
  background: var(--bg);
  padding: 32px 28px;
  transition: background 0.3s ease;
}
.service-card:hover, .glass-card:hover { background: var(--bg-raise); }
.service-card .icon {
  color: var(--accent);
  margin-bottom: 20px;
}
.service-card h3 { margin: 0 0 8px; font-size: 1.06rem; font-weight: 700; color: var(--text); }
.service-card p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }

/* ---------- work ---------- */
.project-grid { display: flex; flex-direction: column; }
.project-card {
  padding: 40px 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
}
.project-card:first-child { padding-top: 0; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.project-title-row { display: flex; align-items: center; gap: 14px; }
.project-top h3 { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--text); }
.project-num { font-size: 0.78rem; color: var(--text-faint); font-weight: 700; font-family: var(--mono); }
.project-link-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.project-link-icon:hover { border-color: var(--accent); color: var(--accent); transform: translate(2px, -2px); }
.project-card .tagline { color: var(--accent); font-weight: 600; font-size: 0.95rem; margin: 0 0 14px; }
.project-card .summary { color: var(--text-dim); font-size: 0.95rem; margin: 0 0 18px; max-width: 680px; }
.tech-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.76rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.project-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: none;
}

/* ---------- skills ---------- */
.skill-grid { display: flex; flex-direction: column; }
.skill-card { padding: 22px 0; border-bottom: 1px solid var(--border-soft); }
.skill-card:first-child { padding-top: 0; }
.skill-card h3 {
  margin: 0 0 16px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-family: var(--mono);
  text-transform: uppercase;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tags span {
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ---------- journey ---------- */
.timeline { position: relative; padding-inline-end: 24px; border-top: 1px solid var(--border-soft); padding-top: 8px; }
.timeline::before {
  content: "";
  position: absolute;
  inset-inline-end: 3px;
  top: 8px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; padding-inline-end: 32px; padding-top: 32px; padding-bottom: 8px; }
.timeline-item::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 38px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.timeline-date {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  font-family: var(--mono);
}
.timeline-item h3 { margin: 0 0 2px; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.timeline-item .company { color: var(--text-dim); font-size: 0.92rem; font-weight: 500; margin-bottom: 4px; }
.timeline-item .tag-line { color: var(--text-faint); font-size: 0.8rem; margin-bottom: 10px; }
.timeline-item p.desc { color: var(--text-dim); font-size: 0.92rem; margin: 0; max-width: 620px; }

/* ---------- writing ---------- */
.article-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; }
.article-card {
  background: var(--bg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}
.article-card:hover { background: var(--bg-raise); }
.article-date { font-size: 0.76rem; color: var(--accent); margin-bottom: 12px; font-weight: 600; font-family: var(--mono); }
.article-card h3 { margin: 0 0 12px; font-size: 1.08rem; font-weight: 700; line-height: 1.5; color: var(--text); }
.article-card p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 18px; flex-grow: 1; }
.article-card .project-link { font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); width: fit-content; }
.article-card .project-link svg { transition: transform 0.2s ease; }
.article-card .project-link:hover svg { transform: translate(3px, -3px); }
.article-note { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }

/* ---------- contact ---------- */
.contact-card {
  padding: 0;
  text-align: right;
  border-top: 1px solid var(--border-soft);
  padding-top: 48px;
}
.contact-card h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 800; margin: 0 0 16px; color: var(--text); }
.contact-card p { color: var(--text-dim); max-width: 520px; margin: 0 0 36px; font-size: 1rem; }

.contact-form { max-width: 560px; margin: 0 0 40px; display: flex; flex-direction: column; gap: 14px; }
.hp-field { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.form-row { display: flex; gap: 14px; }
.form-row input { flex: 1 1 0; min-width: 0; }
.contact-form input,
.contact-form textarea {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--text-faint); }
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); }
.form-foot { display: flex; align-items: center; gap: 16px; }
.form-status { font-size: 0.86rem; color: var(--text-dim); }
.form-status.ok { color: #7dbb6b; }
.form-status.err { color: #e05a5a; }
.form-divider { color: var(--text-faint); font-size: 0.82rem; margin: 0 0 16px; }

.social-row { display: grid; grid-template-columns: repeat(2, auto); gap: 14px 48px; justify-content: start; }
.social-pill {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}
.social-pill:hover { color: var(--accent); }

/* ---------- footer ---------- */
footer {
  padding: 36px 0;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-faint);
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .nav-links, .nav-cta { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }
  section { padding: 76px 0; }
  .hero { padding-top: 120px; }
  .hero-stats { gap: 24px; }
  .social-row { grid-template-columns: 1fr; gap: 14px; }
  .form-row { flex-direction: column; }
  p { text-align: right; }
}

/* ---------- article page ---------- */
.article-page { padding-top: 150px; padding-bottom: 100px; min-height: 100vh; }
.article-back { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 36px; }
.article-back:hover { color: var(--accent); }
.article-head { max-width: 760px; margin-bottom: 48px; }
.article-head .article-date { display: block; margin-bottom: 16px; }
.article-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.4; margin: 0 0 16px; color: var(--text); }
.article-head .excerpt { color: var(--text-dim); font-size: 1.05rem; margin: 0; }
.article-body { max-width: 760px; color: var(--text-dim); font-size: 1.02rem; line-height: 2; }
.article-body h2 { color: var(--text); font-size: 1.4rem; font-weight: 800; margin: 48px 0 18px; }
.article-body h3 { color: var(--text); font-size: 1.15rem; font-weight: 700; margin: 36px 0 14px; }
.article-body p { margin: 0 0 20px; text-align: justify; }
.article-body strong { color: var(--text); font-weight: 700; }
.article-body ul, .article-body ol { margin: 0 0 20px; padding-inline-start: 24px; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote {
  margin: 0 0 24px;
  padding: 16px 20px;
  border-inline-start: 3px solid var(--accent);
  background: var(--bg-raise);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-style: normal;
}
.article-body table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 0.92rem; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 10px 12px; text-align: right; }
.article-body th { color: var(--text); background: var(--bg-raise); font-weight: 700; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-footer { max-width: 760px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border-soft); }
.article-footer a { color: var(--accent); font-weight: 600; }
@media (max-width: 560px) {
  .article-page { padding-top: 120px; }
  .article-body p { text-align: right; }
}
