/*
 * base.css — reset, 12-column grid, base typography (brief §17.3, §18.1)
 * Requires tokens.css to be loaded first (uses its custom properties only —
 * no raw hex/px values duplicated here per brief §25.3).
 *
 * Breakpoints used below (brief §18.1, exact pixel values):
 *   320px  — small mobile floor (no horizontal scroll required from here up)
 *   480px  — mobile
 *   768px  — tablet (typography switches from mobile to desktop scale here)
 *   1024px — desktop
 *   1280px — large desktop
 */

/* ---------------------------------------------------------------------- */
/* Reset                                                                   */
/* ---------------------------------------------------------------------- */

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
  margin: 0;
}

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

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

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-weight: var(--fw-body);
  color: var(--text-on-light);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* belt-and-braces against §18.2/§30.2 "no horizontal scroll at 320px" */
}

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

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

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

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

/* Visible focus state everywhere (brief §20 accessibility) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link (brief §20 — "Skip link Skip to content") */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 1000;
  padding: 12px 20px;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: var(--fw-body-medium);
}

.skip-link:focus {
  top: 0;
}

/* ---------------------------------------------------------------------- */
/* Surface helpers — dark (hero, footer) vs light (all other sections)     */
/* brief §17.2: "Hero и footer — dark background. Основные секции — light" */
/* ---------------------------------------------------------------------- */

.surface-dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}

.surface-dark .text-muted {
  color: var(--text-on-dark-muted);
}

.surface-light {
  background: var(--bg-light);
  color: var(--text-on-light);
}

.surface-light .text-muted {
  color: var(--text-on-light-muted);
}

/* ---------------------------------------------------------------------- */
/* Layout — content container + 12-column grid (brief §17.4)               */
/* ---------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--side-padding-mobile);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--side-padding-tablet);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: var(--side-padding-desktop);
  }
}

@media (min-width: 1280px) {
  .container {
    padding-inline: var(--side-padding-desktop-large);
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(var(--grid-columns), 1fr);
  }
}

section {
  padding-block: var(--section-spacing-mobile);
}

@media (min-width: 1024px) {
  section {
    padding-block: var(--section-spacing-desktop);
  }
}

/* Long paragraph max width (brief §17.3: "максимальная ширина длинного абзаца: 720px") */
.text-measure {
  max-width: 720px;
}

/* ---------------------------------------------------------------------- */
/* Typography scale — mobile-first, switches to desktop scale at 768px     */
/* (brief §17.3 defines two tiers only: desktop sizes and mobile sizes)    */
/* ---------------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-display);
}

h1 {
  font-size: var(--fs-h1-mobile);
  font-weight: var(--fw-h1);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--fs-h2-mobile);
  font-weight: var(--fw-h2);
  line-height: 1.14;
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--fs-h3-mobile);
  font-weight: var(--fw-h3);
  line-height: 1.22;
}

.hero-body {
  font-size: var(--fs-hero-body-mobile);
  line-height: var(--lh-hero-body-desktop);
}

.body-large {
  font-size: var(--fs-body-large);
  line-height: var(--lh-body-large);
}

body,
p {
  font-size: var(--fs-body-mobile);
  line-height: var(--lh-body);
}

small,
.text-small {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/* Eyebrow / uppercase labels — old-site style: accent-colored, Inter (no
   monospace), matches the original .label rule exactly (including its
   24px bottom margin — the old site's var(--s-3)). */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------------- */
/* Vertical text rhythm                                                    */
/* The reset above zeroes every margin, which left headings, paragraphs    */
/* and CTA groups visually glued together with no breathing room. These    */
/* rules restore an explicit, consistent rhythm instead of relying on      */
/* per-section one-off margins.                                           */
/* ---------------------------------------------------------------------- */

h1 + p,
h2 + p,
h3 + p {
  margin-top: 20px;
}

p + p {
  margin-top: 16px;
}

/* Paragraph directly after a section heading gets a bit more air, since it
   is usually the section's intro/lede line. */
.section-title + p,
.section-title + .text-measure {
  margin-top: 24px;
}

@media (min-width: 768px) {
  h1 {
    font-size: var(--fs-h1-desktop);
    line-height: var(--lh-h1-desktop);
  }

  h2 {
    font-size: var(--fs-h2-desktop);
    line-height: var(--lh-h2-desktop);
  }

  h3 {
    font-size: var(--fs-h3-desktop);
    line-height: var(--lh-h3-desktop);
  }

  .hero-body {
    font-size: var(--fs-hero-body-desktop);
    line-height: var(--lh-hero-body-desktop);
  }

  body,
  p {
    font-size: var(--fs-body);
  }
}
