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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + var(--space-4));
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  font-synthesis: none;
  font-kerning: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure {
  margin: 0;
}

h1, h2, h3, h4 {
  font-weight: var(--weight-bold);
  line-height: var(--lh-tight);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }

ul[role="list"], ol[role="list"] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease);
}
a:hover {
  text-decoration-thickness: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

img, svg {
  display: block;
  max-width: 100%;
}

code {
  font-family: var(--font-code);
  font-size: 0.9em;
  background: var(--neutral-bg);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
}

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

[hidden] {
  display: none !important;
}

::selection {
  background: var(--primary);
  color: var(--on-primary);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: var(--z-dialog);
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-md);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
}

/* Isolates user-entered names so Persian and English never reorder each other. */
.bidi {
  unicode-bidi: plaintext;
}
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
}
[dir="rtl"] .ltr {
  text-align: right;
}

.num {
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}

.muted {
  color: var(--text-muted);
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 1rem; height: 1rem; }
.icon--lg { width: 1.5rem; height: 1.5rem; }

[dir="rtl"] .icon--dir {
  transform: scaleX(-1);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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