@font-face {
  font-family: Vazirmatn;
  src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0d10;
  --surface: #12151a;
  --surface-2: #181c22;
  --border: #232830;
  --text: #f2f5f7;
  --muted: #9aa4af;
  --primary: #00e676;
  --primary-ink: #04140b;
  --glow: rgba(0, 230, 118, 0.14);
  --danger: #ff5c6c;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme='light'] {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --border: #dfe5e2;
  --text: #0e1412;
  --muted: #58645e;
  --primary: #008a45;
  --primary-ink: #ffffff;
  --glow: rgba(0, 160, 80, 0.12);
  --danger: #d6293b;
  --shadow: 0 12px 32px rgba(20, 40, 30, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.container {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.nav {
  display: flex;
  gap: 1.75rem;
  margin-inline-end: auto;
  margin-inline-start: 2rem;
}
.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav a:hover {
  color: var(--primary);
}
.bar-actions {
  display: flex;
  gap: 0.5rem;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--muted);
  transition: 0.2s;
}
.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.menu-btn {
  display: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s, background 0.2s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 8px 24px var(--glow);
}
.btn-primary:hover {
  opacity: 0.92;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 9px;
}
.btn-block {
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4rem, 12vw, 8rem) 0 clamp(3rem, 8vw, 5rem);
  text-align: center;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto auto;
  width: 70%;
  height: 90%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 30%, #000, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.badge {
  display: inline-block;
  padding: 4px 18px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--glow);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.35;
  font-weight: 900;
  margin-bottom: 1.25rem;
}
.grad {
  background: linear-gradient(90deg, var(--primary), #4da3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lead {
  color: var(--muted);
  max-width: 720px;
  font-size: 1.1rem;
}
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-top: 2.25rem;
}
.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  list-style: none;
  margin-top: 2.5rem;
}
.stack li {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.8rem;
  direction: ltr;
  padding: 2px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}
.section.alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}
.section-title h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.section-title p {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}
.card {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.section.alt .card {
  background: var(--bg);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0.9rem 0 0.4rem;
  font-size: 1.15rem;
}
.card p {
  color: var(--muted);
  font-size: 0.95rem;
}
.ico {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--glow);
  color: var(--primary);
  font-weight: 900;
  font-family: ui-monospace, Menlo, monospace;
}

/* ---------- Portfolio ---------- */
.works {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.work {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.work:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.work-media {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.work:hover .work-media img {
  transform: scale(1.04);
}
.work-ph {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--primary);
  background: linear-gradient(135deg, var(--glow), transparent);
}
.work-body {
  padding: 1.25rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.work-body h3 {
  font-size: 1.1rem;
}
.work-body p {
  color: var(--muted);
  font-size: 0.92rem;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}
.tags li {
  font-size: 0.75rem;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.work-link {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92rem;
}
.work-link:hover {
  text-decoration: underline;
}
.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
}

/* ---------- Process ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
  list-style: none;
  counter-reset: s;
}
.steps li {
  position: relative;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.steps b {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-ink);
  margin-bottom: 0.6rem;
}
.steps h3 {
  font-size: 1.05rem;
}
.steps p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Forms ---------- */
.consult {
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  box-shadow: var(--shadow);
}
.field {
  margin-bottom: 1.25rem;
}
.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--glow);
}
.field textarea {
  resize: vertical;
}
.hp {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-msg {
  margin-bottom: 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
.form-msg[hidden] {
  display: none;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 3rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.site-footer .accent {
  color: var(--primary);
  margin-top: 0.3rem;
}
.enamad-box {
  display: inline-block;
  margin-top: 1.5rem;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
}

/* ---------- Status page ---------- */
.status {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
}
.status .tick {
  display: inline-grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--glow);
  color: var(--primary);
  font-size: 2.6rem;
  margin-bottom: 1.25rem;
}
.status p {
  color: var(--muted);
  margin: 0.75rem 0 1.75rem;
}

/* ---------- Motion ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s, transform 0.6s;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (max-width: 760px) {
  .menu-btn {
    display: inline-block;
  }
  .nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    margin: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav a {
    padding: 0.8rem 1.25rem;
    border-top: 1px solid var(--border);
  }
  .site-header.open .nav {
    display: flex;
  }
}

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