/* ==========================================================================
   БАЗА: сброс, типографика, служебные классы
   ========================================================================== */

*, *::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;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  text-wrap: pretty;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Заголовки --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-head);
  letter-spacing: var(--ls-head);
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--fs-h1-sub); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-head); letter-spacing: -0.01em; }
h4 { font-size: 17px; }
h5 { font-size: 15px; }
h6 { font-size: var(--fs-xs); letter-spacing: var(--ls-wide); text-transform: uppercase; }

/* Оптическая компенсация левого выноса у крупных заголовков */
.h-optical { margin-left: -0.04em; }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-accent-ink);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { color: var(--color-accent); }

strong, b { font-weight: var(--fw-bold); }

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

figure { margin: 0; }
figcaption {
  margin-top: var(--space-2);
  font-size: var(--fs-xxs);
  color: var(--color-text-faint);
}

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; }
li { margin-bottom: var(--space-2); }
li:last-child { margin-bottom: 0; }

hr, .hr {
  height: var(--rule);
  border: 0;
  margin: 0;
  background: var(--color-divider);
}

/* --- Фокус: обязателен для доступности --- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
::selection {
  background: color-mix(in srgb, var(--color-accent) 25%, transparent);
}

/* --- Ссылка «пропустить к содержимому» --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--color-accent);
  color: #fff;
  font-weight: var(--fw-bold);
}
.skip-link:focus {
  left: 0;
  color: #fff;
}

/* ==========================================================================
   СЛУЖЕБНЫЕ КЛАССЫ
   ========================================================================== */

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

/* Надзаголовок капсом над h1/h2 */
.kicker {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
  margin-bottom: var(--space-5);
}
.kicker--muted { color: var(--color-text-faint); }
.kicker--on-dark { color: var(--brand-teal); }

/* Мелкая подпись капсом (метки в таблицах, метаданные) */
.label {
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-base);
  color: var(--color-text-muted);
}

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-accent { color: var(--color-accent); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

.measure    { max-width: 62ch; }
.measure-sm { max-width: 52ch; }
.measure-lg { max-width: 72ch; }

.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-auto { margin-top: auto; }

/*.grayscale { filter: grayscale(1) contrast(1.08); }*/

/* Ссылка-стрелка «Все материалы →» */
.link-arrow {
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: var(--fw-semi);
  white-space: nowrap;
}
.link-arrow::after { content: " →"; }
/* На узких экранах длинная подпись должна переноситься, а не вылезать за край */
@media (max-width: 700px) {
  .link-arrow { white-space: normal; }
}
