/* ============================================================
   База: reset, типографика, layout-утилиты
   ============================================================ */

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

* { margin: 0; }

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

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

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

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

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

/* ---------- Заголовки ---------- */

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: var(--w-display);
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
  /* у Cormorant по умолчанию минускульные цифры — «0» читается как «о» */
  font-variant-numeric: lining-nums;
  font-feature-settings: 'lnum' 1;
}

.display { font-size: var(--text-display); max-width: none; }
h1, .h1 { font-size: var(--text-h1); }
h2, .h2 { font-size: var(--text-h2); line-height: 1.12; }
h3, .h3 { font-size: var(--text-h3); font-weight: var(--w-display-strong); line-height: 1.22; }

h4, .h4 {
  font-family: var(--font-text);
  font-size: var(--text-h4);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
}

.serif-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
}

em { font-style: italic; }

/* акцентное слово внутри серифного заголовка */
.accent-word { color: var(--accent); }

/* ---------- Текст ---------- */

p { max-width: 38.75rem; /* 620px — комфортная мера */ }

.lead {
  font-size: var(--text-lead);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 42rem;
}

.small { font-size: var(--text-small); line-height: 1.6; }
.caption { font-size: var(--text-caption); line-height: 1.55; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }

.overline {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: var(--text-caption);
  font-weight: 560;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* точка-маркер перед overline */
.overline::before {
  content: '';
  inline-size: 0.375rem;
  block-size: 0.375rem;
  border-radius: 50%;
  background: var(--metal);
  flex: none;
}

.overline--plain::before { display: none; }

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-deep) 36%, transparent);
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

a:hover { text-decoration-color: currentColor; }

strong { font-weight: 600; }

/* ---------- Layout ---------- */

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-pad); }
.section--soft { background: var(--bg-soft); }
.section--dark {
  background: var(--ink-deep);
  color: var(--on-dark);
}

.section--dark .muted,
.section--dark .lead,
.section--dark .caption { color: var(--on-dark-soft); }
.section--dark .overline { color: var(--tint-mist); }
.section--dark .overline::before { background: var(--metal); }

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

/* ---------- Утилиты ---------- */

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 48rem) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
