/* База: сброс, бумага с зерном, типографика, режимы секций, появление по скроллу. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 124px; -webkit-tap-highlight-color: rgba(21, 24, 22, .08); }
a, button, input, select, label, summary { touch-action: manipulation; }
@media (max-width: 899px) { html { scroll-padding-top: 84px; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--font-body);
  font-feature-settings: 'kern', 'liga';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Фактура бумаги: SVG-шум ~3 %, поверх всего, не ловит клики */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Типографика */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: inherit;
  margin: 0;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -.012em; }
h2 { font-size: var(--fs-h2); line-height: 1.08; letter-spacing: -.01em; }
h3 { font-size: var(--fs-h3); line-height: 1.2; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: .9em; }
.nw { white-space: nowrap; }
.line { display: block; }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-soft); max-width: 36em; }
.prose { max-width: 62ch; }
.muted { color: var(--ink-mut); }
.mono { font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kicker {
  font: 500 var(--fs-kicker)/1.3 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mut);
  margin: 0 0 14px;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--cinnabar); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.section--dark :focus-visible { outline-color: var(--on-dark); }

.skip-link { position: absolute; left: -9999px; top: 12px; z-index: 200; background: var(--ink); color: var(--paper); padding: 10px 16px; }
.skip-link:focus { left: 16px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Контейнер и секции */
.wrap { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { position: relative; padding-block: var(--section-py); overflow: clip; }
.section--alt { background: var(--paper-2); }
.section--dark { background: var(--ink-bg); color: var(--on-dark); }
.section--dark .kicker, .section--dark .muted { color: var(--on-dark-mut); }
.section--dark .lead { color: var(--on-dark-mut); }
.section--dark a:hover { text-decoration-color: var(--jade-light); }
.section__head { max-width: 44rem; margin-bottom: clamp(40px, 3rem + 2vw, 80px); }
.section__head .lead { margin-top: 20px; }

/* Появление по скроллу: только с JS (.js на <html>), иначе контент виден сразу */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
