/* Base: reset, document, typography, a few utilities. Colours and sizes come from tokens.css only. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-fa);
  font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 500;
  color: var(--text);
  background: var(--bg) linear-gradient(160deg, var(--bg-from), var(--bg-to)) fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color var(--t-theme) var(--ease), color var(--t-theme) var(--ease);
}
html[lang="en"] body { font-family: var(--font-en); letter-spacing: -0.1px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 700; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
svg.ico { width: 1.25em; height: 1.25em; flex: none; }
html[dir="rtl"] svg.ico.dir { transform: scaleX(-1); }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

/* Technical values (versions, ids, sizes, percentages) stay Latin and left-to-right in both languages. */
/* The page's alignment is physical (inherited), so a block .num/.mono, which is LTR inside, still lines up with the
   Persian text around it; `start` would resolve against its own LTR direction (and Chrome ignores match-parent). */
html[dir="rtl"] body { text-align: right; }
html[dir="ltr"] body { text-align: left; }
.num, .mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.mono { font-size: var(--fs-mono); font-weight: 600; letter-spacing: 0; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: var(--fs-small); line-height: var(--lh-small); }
.micro { font-size: var(--fs-micro); line-height: var(--lh-micro); font-weight: 600; }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack.tight { gap: var(--sp-2); }
/* a badge or button directly in a column keeps its own width instead of stretching across it */
.stack > .badge, .stack > .btn { align-self: flex-start; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
