/* ============================================================
   «Шабыт» 2026 — базовые стили: reset, типографика, сетка
   ============================================================ */

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

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

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-text);
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

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

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

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

::selection { background: var(--violet); color: #fff; }

/* --- Заголовки --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: 1.125rem; font-weight: 600; margin: 0; }

.display { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.numeral { font-family: var(--font-numeral); font-weight: 400; letter-spacing: 0.01em; }

.lead { font-size: var(--fs-lead); line-height: 1.5; }
.small { font-size: var(--fs-small); }
.tiny { font-size: var(--fs-tiny); }
.muted { color: var(--ink-500); }
.section--dark .muted { color: var(--ink-300); }

/* --- Контейнеры --- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--dark { background: var(--ink-900); color: #fff; }
.section--white { background: var(--white); }
.section--flush-top { padding-top: 0; }

/* Заголовок секции: заголовок слева, пояснение справа (на десктопе) */
.section-head {
  display: grid;
  gap: var(--space-4) var(--space-7);
  align-items: end;
  margin-bottom: clamp(32px, 5vw, 64px);
}
@media (min-width: 900px) {
  .section-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .section-head > p { margin: 0 0 0.35em; }
}
.section-head p { color: var(--ink-500); font-size: var(--fs-lead); max-width: 34em; }
.section--dark .section-head p { color: var(--ink-300); }

/* --- Сетка --- */
.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* --- Текстовые блоки (положение, статьи) --- */
.prose { max-width: 70ch; }
.prose h2 { margin: 2em 0 0.6em; font-size: var(--fs-h3); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose h3 { margin: 1.6em 0 0.5em; font-size: 1.125rem; font-family: var(--font-text); font-weight: 600; letter-spacing: 0; }
.prose p { margin-bottom: 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--ink-500); }
.prose strong { font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-300); }
.prose a:hover { text-decoration-color: var(--violet); }

/* --- Утилиты --- */
.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;
}
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--space-4); }
.hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.section--dark .hr { border-color: var(--line-dark); }
.tabular { font-variant-numeric: tabular-nums; }

/* Reveal при скролле: одно состояние, одна анимация. Применяется только к
   ключевым моментам (заголовки секций, лестница призов), не к каждому блоку. */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 90ms; }
.reveal[data-delay="2"] { transition-delay: 180ms; }
.reveal[data-delay="3"] { transition-delay: 270ms; }

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