:root {
  --white: #ffffff;
  --ink: #000000;
  --text: #18181b;
  --muted: #52525b;
  --line: #e4e4e7;
  --soft: #f5f7fb;
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --danger: #b91c1c;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --maxw: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  background: var(--white);
}

h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--blue); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.container { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.muted { color: var(--muted); font-weight: 400; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { width: 14px; height: 14px; background: var(--blue); border-radius: 3px; }
.nav { display: none; gap: 1.5rem; margin-inline-end: auto; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--blue); }
.cart-link {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.cart-link:hover { background: var(--ink); color: var(--white); }
.badge {
  min-width: 1.5rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-size: .85rem;
  line-height: 1.5rem;
  text-align: center;
}
@media (min-width: 640px) {
  .nav { display: flex; }
  .cart-link { margin-inline-start: 0; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .55rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--white); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.is-added { background: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 3rem 0 3.5rem; }
.hero-grid { display: grid; gap: 2.5rem; }
.hero h1 {
  font-size: clamp(1.9rem, 5.2vw, 3.1rem);
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
}
.lead { margin: 1.25rem 0 2rem; max-width: 36rem; font-size: 1.1rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.code {
  margin: 0;
  padding: 1.25rem 1.4rem;
  background: var(--ink);
  color: #e4e4e7;
  border-radius: var(--r-lg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
  line-height: 1.95;
  text-align: left;
  overflow-x: auto;
}
.code .dim { color: #a1a1aa; }
.code .k { color: #60a5fa; }

@media (min-width: 900px) {
  .hero { padding: 5rem 0 5.5rem; }
  .hero-grid { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 3.5rem; }
}

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; scroll-margin-top: 64px; }
.section-soft { background: var(--soft); border-block: 1px solid var(--line); }
.section h2 { font-size: 1.75rem; font-weight: 800; line-height: 1.5; color: var(--ink); }
.section-note { margin-top: .25rem; color: var(--muted); }
@media (min-width: 900px) { .section { padding: 5rem 0; } }

/* ---------- Service cards ---------- */
.cards {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.6; color: var(--ink); }
.card-text { color: var(--muted); }
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.price-num { font-size: 1.35rem; font-weight: 800; color: var(--blue); }
.price-unit { color: var(--muted); font-size: .95rem; }

/* ---------- Checkout ---------- */
.checkout-grid { display: grid; gap: 1.25rem; margin-top: 2rem; align-items: start; }
@media (min-width: 900px) { .checkout-grid { grid-template-columns: 1.1fr 1fr; } }

.panel {
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel h3 { margin-bottom: 1rem; font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.empty { color: var(--muted); }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "info remove" "qty total";
  align-items: center;
  gap: .6rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.cart-item:first-child { padding-top: 0; }
.cart-info { grid-area: info; display: flex; flex-direction: column; line-height: 1.6; }
.cart-info strong { color: var(--ink); }
.cart-item .link-btn { grid-area: remove; }
.qty { grid-area: qty; display: inline-flex; align-items: center; gap: .25rem; }
.qty button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.qty button:hover:not(:disabled) { background: var(--ink); color: var(--white); }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty-num { min-width: 2.25rem; text-align: center; font-weight: 700; }
.line-total { grid-area: total; text-align: end; font-weight: 700; color: var(--ink); }
.link-btn {
  padding: .25rem .5rem;
  border: 0;
  background: none;
  font: inherit;
  color: var(--danger);
  text-decoration: underline;
  cursor: pointer;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
  font-weight: 700;
}
.total-row strong { font-size: 1.4rem; font-weight: 800; color: var(--blue); }

/* ---------- Form ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 500; }
.field input,
.field textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid #a1a1aa;
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus,
.field textarea:focus { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 0; }
.field input.ltr { direction: ltr; text-align: right; }
.field input.ltr::placeholder { text-align: right; }
.form-error {
  margin-bottom: 1rem;
  padding: .65rem .9rem;
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  background: #fef2f2;
  color: var(--danger);
}
.hint { margin-top: .9rem; font-size: .92rem; color: var(--muted); }

/* ---------- Result pages ---------- */
.result { padding: 3rem 1.25rem 4rem; }
.result-card {
  max-width: 560px;
  margin-inline: auto;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.result-card h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.5; color: var(--ink); }
.result-card .lead { margin: .75rem auto 1.5rem; font-size: 1rem; }
.result-card .hero-actions { justify-content: center; margin-top: 1.5rem; }
.result-icon { margin-bottom: 1rem; }
.result-icon.ok { color: var(--blue); }
.result-icon.bad { color: var(--danger); }
.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .5rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--soft);
  border-radius: var(--r-md);
  text-align: start;
}
.details dt { color: var(--muted); }
.details dd { font-weight: 700; color: var(--ink); }
.ltr-text { direction: ltr; text-align: right; unicode-bidi: plaintext; }
.result-sub { margin-bottom: .5rem; font-size: 1rem; font-weight: 700; color: var(--ink); text-align: start; }
.result-items { margin-bottom: 1.75rem; text-align: start; }
.result-items li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}

/* ---------- Footer ---------- */
.site-footer { padding: 1.75rem 0; background: var(--ink); color: #d4d4d8; font-size: .95rem; }
