/* ============================================================
   База: сброс, типографика, фокус, утилиты, текст из markdown
   ============================================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  font-feature-settings: "kern" 1;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }

::selection { background: var(--blue-100); color: var(--navy-900); }

:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 300;
  padding: 10px 16px;
  background: var(--navy-900);
  color: #fff;
  border-radius: 0 0 12px 12px;
  transition: transform var(--d-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(60px); }

.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;
}

/* ---------- Типографика ---------- */

.display-1 {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: clamp(38px, 4.6vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.display-2 {
  font-family: var(--font-display);
  font-weight: 720;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.title-lg { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; letter-spacing: -0.015em; }
.title-md { font-family: var(--font-display); font-weight: 680; font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; }
.title-sm { font-weight: 650; font-size: 15.5px; line-height: 1.35; }
.lead { font-size: clamp(17px, 1.5vw, 19.5px); line-height: 1.55; color: var(--ink-soft); max-width: 60ch; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 14px; line-height: 1.5; }
.xsmall { font-size: 12.5px; line-height: 1.45; }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.link { color: var(--blue-700); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link:hover { color: var(--navy-900); }

.container { max-width: var(--content-w); margin: 0 auto; padding: 0 var(--pad-x); }
.section { padding: clamp(64px, 9vw, 128px) 0; }
.section-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 52px); }
.section-head .lead { margin-top: 16px; }

.stack { display: grid; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 10px); }
.spacer { flex: 1; }

/* ---------- Полосы фона (публичные страницы, как на сайте Фонда) ---------- */

.striped-bg { position: relative; isolation: isolate; }
.striped-bg::before {
  content: "";
  position: fixed;
  inset: -10vh 0;
  z-index: -1;
  pointer-events: none;
  transform: translate3d(0, var(--bg-shift, 0px), 0);
  background:
    linear-gradient(90deg,
      transparent 0 8%, rgba(192, 214, 234, .15) 8% 13%, transparent 13% 27%,
      rgba(192, 214, 234, .10) 27% 31%, transparent 31% 52%, rgba(192, 214, 234, .13) 52% 58%,
      transparent 58% 76%, rgba(192, 214, 234, .09) 76% 80%, transparent 80% 100%);
}
@media (max-width: 768px) { .striped-bg::before { opacity: .6; } }

/* ---------- Текст из markdown (уроки, библиотека, ответы помощника) ---------- */

.md { font-size: 16px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.md > * + * { margin-top: .8em; }
.md h1 { font-family: var(--font-display); font-size: 1.6em; line-height: 1.2; letter-spacing: -0.015em; margin-top: 1.2em; }
.md h2 { font-family: var(--font-display); font-size: 1.3em; line-height: 1.25; margin-top: 1.4em; }
.md h3 { font-size: 1.08em; margin-top: 1.2em; }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 1.3em; }
.md ul { list-style: none; }
.md ul > li { position: relative; }
.md ul > li::before { content: ""; position: absolute; left: -1em; top: .72em; width: 6px; height: 6px; border-radius: 2px; background: var(--blue-600); }
.md ol { list-style: decimal; }
.md li + li { margin-top: .3em; }
.md a { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }
.md blockquote { border-left: 3px solid var(--sail-200); padding: 4px 0 4px 16px; color: var(--ink-soft); }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; }
.md pre { background: var(--navy-950); color: #E8EEF7; padding: 14px 16px; border-radius: 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.md table { border-collapse: collapse; width: 100%; font-size: .94em; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md strong { font-weight: 650; }
