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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--body);
  font-weight: 400;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Лёгкое зерно: добавляет бумажную глубину, не мешая чтению. */
body::after {
  position: fixed;
  inset: 0;
  z-index: 150;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  content: "";
  opacity: 0.05;
  pointer-events: none;
}

body.is-locked {
  overflow: hidden;
}

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

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
}

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

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.container {
  width: min(var(--container), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}

.container--narrow {
  width: min(880px, 100% - (var(--gutter) * 2));
  margin-inline: auto;
}

[id] {
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: clamp(44px, 6vw, 80px);
}

.section--plain {
  padding-top: clamp(32px, 4vw, 56px);
}

.section--line {
  border-top: 1px solid var(--line);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: translateY(-180%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
}

h1,
.h1 {
  font-family: var(--font-display);
  font-size: var(--h1);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

h2,
.h2 {
  font-family: var(--font-display);
  font-size: var(--h2);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

h3,
.h3 {
  font-size: var(--h3);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

p {
  max-width: 62ch;
}

.lead {
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.muted {
  color: var(--ink-label);
}

.accent {
  color: var(--accent);
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-label);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow__num {
  order: -2;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  order: -1;
  width: 18px;
  height: 1px;
  background: var(--accent);
  content: "";
}

.eyebrow--dark {
  color: var(--accent-on-dark);
}

.eyebrow--dark::before {
  background: var(--accent-on-dark);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.section-head__title {
  max-width: 22ch;
  margin-top: 14px;
}

.section-head__aside {
  max-width: 40ch;
  padding-bottom: 4px;
  color: var(--ink-label);
  font-size: 0.96rem;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
}

[data-reveal] {
  will-change: opacity, transform;
}

@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition:
      opacity 700ms var(--ease-out) var(--reveal-delay, 0ms),
      transform 700ms var(--ease-out) var(--reveal-delay, 0ms);
  }

  html.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
    will-change: auto;
  }

  /* Заголовки: мягкая маска вместо простого подъёма. */
  html.js [data-reveal="mask"] {
    opacity: 1;
    transform: none;
    clip-path: inset(0 0 110% 0);
    transition: clip-path 900ms var(--ease-out) var(--reveal-delay, 0ms);
  }

  html.js [data-reveal="mask"].is-visible {
    clip-path: inset(-10% 0 -10% 0);
  }
}

/* Линия прогресса чтения. */
.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 120;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  will-change: transform;
}

@media (max-width: 860px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .section-head__aside {
    max-width: 52ch;
  }
}

@media (max-width: 640px) {
  :root {
    --body: 1rem;
  }

  .lead {
    font-size: 1.02rem;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-header,
  .mobile-menu,
  .sticky-cta {
    display: none !important;
  }
}
