/* База: сброс, типографика, сетка, служебные классы */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Атрибут hidden должен побеждать любые display из компонентов */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-offset);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 350;
  line-height: 1.6;
  color: var(--color-ink-soft);
  background: linear-gradient(180deg, var(--color-page-deep) 0, var(--color-page) 38rem) no-repeat var(--color-page);
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
fieldset {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

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

img {
  height: auto;
}

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

a {
  color: var(--color-brand-600);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) ease;
}

a:hover {
  color: var(--color-brand-700);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Цель ссылки «К содержанию»: фокус принимает, рамку не показывает */
main:focus {
  outline: none;
}

::selection {
  background: var(--color-brand-500);
  color: var(--color-white);
}

h1,
h2,
h3 {
  color: var(--color-ink);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: 1.08;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
  line-height: 1.2;
}

p {
  text-wrap: pretty;
}

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

.section {
  position: relative;
  padding-block: var(--space-section);
  scroll-margin-top: var(--header-offset);
}

.section__head {
  display: grid;
  gap: var(--space-md);
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
}

.section__lead {
  font-size: var(--text-lead);
  font-weight: 300;
  line-height: 1.5;
  color: var(--color-ink-soft);
}

.text-gradient {
  background: var(--gradient-headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Нижние выносные («у», «р») не должны обрезаться фоном-клипом */
  padding-bottom: 0.08em;
}

/* Подпись с линиями — приём из образцов визуала */
.caption-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: var(--tracking-caption);
  text-transform: uppercase;
  color: var(--color-muted);
}

.caption-line::before {
  content: '';
  flex: none;
  width: 2.5rem;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
}

.caption-line--center {
  justify-content: center;
  text-align: center;
}

.caption-line--center::before,
.caption-line--center::after {
  content: '';
  flex: 1 1 2.5rem;
  max-width: 5rem;
  width: auto;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

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

.skip-link {
  position: fixed;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 100;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-white);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration-fast) ease;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-white);
}

.icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 2;
}

/* Появление при прокрутке — только CSS, без JS: контент виден и там, где view() не поддерживается */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}

@keyframes reveal-rise {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
