/* ==========================================================================
   Сброс, типографика, ссылки, состояния
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--ls-display); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-tight); letter-spacing: var(--ls-display); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { text-wrap: pretty; }

/* --- Ссылки --------------------------------------------------------- */

a { color: inherit; text-decoration: none; }

/* Ссылка внутри текста всегда подчёркнута — это единственный надёжный
   признак кликабельности для тех, кто не различает цвет. */
a:where(:not([class])) {
  color: var(--c-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  text-decoration-color: var(--c-accent-line);
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}
a:where(:not([class])):hover {
  color: var(--c-link-hover);
  text-decoration-color: currentColor;
}
.section--dark a:where(:not([class])),
.footer a:where(:not([class])) {
  color: var(--c-link-ink);
  text-decoration-color: rgba(94, 200, 221, .45);
}
.section--dark a:where(:not([class])):hover,
.footer a:where(:not([class])):hover { color: var(--c-white); }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

/* --- Фокус ---------------------------------------------------------- */

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 4px;
}
.section--dark :focus-visible, .footer :focus-visible, .header :focus-visible {
  outline-color: var(--c-accent-bright);
}

::selection { background: var(--c-selection); color: var(--c-text); }

/* --- Числа и подписи в стиле чековой печати -------------------------- */

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

/* Выделение ключевого факта в тексте */
mark, .mark {
  background: linear-gradient(transparent 62%, var(--c-selection) 62%);
  color: inherit;
  padding-inline: .1em;
}

/* --- Утилиты -------------------------------------------------------- */

/* display у компонента сильнее браузерного правила для [hidden]: без этой
   строки скрытый атрибутом блок остаётся на экране. Калькулятор свою кнопку
   прячет иначе (visibility), поэтому исключаем его явно. */
[hidden]:not(.calc__back) { display: none !important; }

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: 200;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-white);
  color: var(--c-ink);
  font-weight: 600;
  border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--sp-3); }

.nowrap { white-space: nowrap; }
.accent { color: var(--c-accent-ink); }
.measure { max-width: var(--measure); }
