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

:root {
  --bg: #fbfaf8;
  --fg: #1a1b26;
  --muted: #5b5d6b;
  --accent: #6d5cff;
  --line: #e7e5ef;
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #1a1b26; --fg: #f2f1f6; --muted: #b3b2c2; --accent: #a78bfa; --line: #2c2d3c; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.9 "Vazirmatn", Tahoma, sans-serif;
  text-rendering: optimizeLegibility;
}

.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; color: var(--fg); text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 16px; flex: 1 1 100%; order: 3; }
@media (min-width: 900px) { .top nav { flex: 1; order: 0; } }
.top nav a { color: var(--muted); text-decoration: none; }
.cta {
  padding: 6px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.4; margin: 0 0 24px; }
h2 { font-size: 24px; line-height: 1.5; margin: 40px 0 12px; }
h3 { font-size: 19px; margin: 28px 0 8px; }
a { color: var(--accent); }
ol, ul { padding-inline-start: 24px; }
ol { list-style-type: persian; }
li { margin-block: 6px; }
table { border-collapse: collapse; width: 100%; }
@media (max-width: 720px) { main table:not(.tool-table) { display: block; overflow-x: auto; } }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: start; }

footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.stamp { color: var(--muted); font-size: 14px; margin: -12px 0 24px; }
.lead { font-size: 19px; border-inline-start: 4px solid var(--accent); padding-inline-start: 14px; }

.tool { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 20px 0; }
.tool label { display: block; margin: 10px 0 4px; }
.tool input[type=text] { width: 100%; max-width: 280px; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; }
.tool button { margin-top: 14px; padding: 8px 18px; font: inherit; font-weight: 600; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.tool .tool-row { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.tool .tool-out { margin: 14px 0 0; font-weight: 600; }
.tool fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; padding: 12px; }
.tool legend { padding-inline: 6px; font-weight: 600; }
.tool input:focus-visible, .tool button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tool-scroll { overflow-x: auto; }
.tool-table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .95em; }
.tool-table td:first-child { min-width: 9em; }
.tool-table th, .tool-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: start; vertical-align: middle; }
.tool-table select, .tool-table input[type=text] { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; max-width: 160px; }
.download { display: inline-block; padding: 8px 16px; border: 1px solid var(--accent); border-radius: 8px; text-decoration: none; font-weight: 600; }
