/* ==========================================================================
   base.css — переменные, сброс, типографика, служебные классы
   Тема переключается атрибутом data-theme="dark" на <html>.
   ========================================================================== */

:root {
  /* Палитра */
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eceefa;
  --ink: #14172e;
  --muted: #565b7a;
  --link: #3340ff;
  --line: #14172e;
  --shade: #14172e;

  /* Фирменные цвета: не меняются между темами */
  --cobalt: #3340ff;
  --canary: #ffdd33;
  --mint: #bff3dc;
  --coral: #ff5a6e;
  --night: #14172e;
  --on-night: #f1f2ff;
  --on-color: #14172e;
  --on-cobalt: #ffffff;

  /* Шрифты. Onest стоит вторым в заголовках — из него берётся знак ₽ */
  --font-display: "Unbounded", "Onest", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-text: "Onest", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Размеры текста */
  --fs-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --fs-small: 0.875rem;
  --fs-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-h1: clamp(1.75rem, 1.05rem + 3.3vw, 3.9rem);
  --fs-h2: clamp(1.5rem, 1.1rem + 1.8vw, 2.6rem);
  --fs-h3: clamp(1.1rem, 1rem + 0.55vw, 1.45rem);

  /* Геометрия */
  --r-s: 10px;
  --r-m: 18px;
  --r-l: 30px;
  --bw: 2px;
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-y: clamp(56px, 9vw, 112px);
  --header-h: 68px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1126;
  --surface: #171b38;
  --surface-2: #20254a;
  --ink: #f1f2ff;
  --muted: #a6abcf;
  --link: #a5acff;
  --line: #f1f2ff;
  --shade: #3340ff;
  --night: #080a1a;
  color-scheme: dark;
}

/* Системная тема, если посетитель ничего не выбирал */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1126;
    --surface: #171b38;
    --surface-2: #20254a;
    --ink: #f1f2ff;
    --muted: #a6abcf;
    --link: #a5acff;
    --line: #f1f2ff;
    --shade: #3340ff;
    --night: #080a1a;
    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Сброс
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: 1.06; letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.2; }
h4 { font-size: 1.05rem; font-weight: 600; }

p,
ul,
ol,
dl,
figure,
blockquote,
table {
  margin: 0;
}

p {
  max-width: 68ch;
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.25em;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

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

button {
  cursor: pointer;
}

hr {
  border: 0;
  border-top: var(--bw) solid var(--line);
  margin: 0;
}

::selection {
  background: var(--canary);
  color: var(--on-color);
}

/* --------------------------------------------------------------------------
   Доступность
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 4px;
}

:root[data-theme="dark"] :focus-visible {
  outline-color: var(--canary);
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--canary);
  color: var(--on-color);
  font-weight: 700;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-s);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

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

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

.container--narrow {
  max-width: calc(780px + var(--gutter) * 2);
}

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: clamp(36px, 6vw, 72px);
}

.section--night {
  background: var(--night);
  color: var(--on-night);
}

.section--surface {
  background: var(--surface);
  border-block: var(--bw) solid var(--line);
}

.section__head {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(28px, 5vw, 56px);
}

.section__head p {
  color: var(--muted);
  font-size: var(--fs-lead);
}

.section--night .section__head p {
  color: #b9bde6;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--muted);
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}
