/* Сброс и типографика */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--line) transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text);
  caret-color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--marker);
  color: var(--marker-ink);
}

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

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
h3, h4 {
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }

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

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

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* Иностранный текст: шрифтовой стек по письменности */
:lang(zh), :lang(ja), :lang(ko) {
  font-family: var(--font-cjk), var(--font-sans);
}
:lang(ar), :lang(fa), :lang(ur), :lang(he) {
  font-family: var(--font-arabic), var(--font-sans);
}
ruby { ruby-position: over; }
ruby rt {
  font-family: var(--font-sans);
  font-size: 0.42em;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

[dir="rtl"] {
  direction: rtl;
  text-align: start;
  unicode-bidi: isolate;
  font-family: var(--font-arabic), var(--font-sans);
}
[dir="rtl"] input,
[dir="rtl"] textarea {
  text-align: start;
}

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