/* ==========================================================================
   BASE — техническая основа. Правится только через :root токены ниже.
   Уникальный дизайн живёт в sections.css.
   ========================================================================== */

:root {
  /* --- ЦВЕТА: переопределяются под каждую компанию --- */
  --bg: #ffffff;
  --bg-alt: #f5f4f1;
  --bg-deep: #14161a;
  --ink: #16181d;
  --ink-soft: #5a6070;
  --ink-invert: #f7f7f5;
  --accent: #1f5f4b;
  --accent-soft: #e4efe9;
  --line: #e2e1dd;

  /* --- ТИПОГРАФИКА --- */
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --tracking-display: -0.02em;

  /* Плавная шкала: размер тянется от мобильного к десктопу без брейкпоинтов */
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0: clamp(1rem, 0.95rem + 0.24vw, 1.13rem);
  --step-1: clamp(1.2rem, 1.11rem + 0.44vw, 1.5rem);
  --step-2: clamp(1.44rem, 1.29rem + 0.75vw, 2rem);
  --step-3: clamp(1.73rem, 1.48rem + 1.24vw, 2.66rem);
  --step-4: clamp(2.07rem, 1.68rem + 1.97vw, 3.55rem);
  --step-5: clamp(2.49rem, 1.87rem + 3.08vw, 4.73rem);

  /* --- РИТМ И ФОРМА --- */
  --gap: clamp(1rem, 0.7rem + 1.5vw, 2rem);
  --section-y: clamp(3.5rem, 2rem + 7vw, 8rem);
  --container: 1200px;
  --container-narrow: 780px;
  --radius: 4px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.04), 0 8px 30px rgba(16, 18, 22, 0.07);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* --- ТИПОГРАФИКА --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { text-wrap: pretty; }
p + p { margin-top: 1em; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { font-size: var(--step-1); color: var(--ink-soft); line-height: 1.5; }
.muted { color: var(--ink-soft); }

/* --- РАСКЛАДКА --- */
.container {
  width: min(100% - 2 * var(--gap), var(--container));
  margin-inline: auto;
}
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--deep { background: var(--bg-deep); color: var(--ink-invert); }
.section--deep .muted,
.section--deep .lede { color: rgba(247, 247, 245, 0.7); }

.stack > * + * { margin-top: var(--flow, 1.5rem); }

.grid { display: grid; gap: var(--gap); }
@media (min-width: 700px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* --- КНОПКИ --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.9em 1.9em;
  border-radius: var(--radius);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease),
    color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--ghost { border: 1px solid currentColor; }
.btn--ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* --- ФОКУС: обязателен для доступности --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--bg);
}
.skip-link:focus { left: 0; }

/* --- ШАПКА --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  min-height: 72px;
}
.site-header__brand {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.nav { display: none; gap: clamp(1rem, 2vw, 2rem); align-items: center; }
.nav a { font-size: var(--step--1); text-decoration: none; opacity: 0.75; transition: opacity 0.2s; }
.nav a:hover { opacity: 1; }
.nav-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  gap: 5px;
  align-content: center;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Порядок важен: медиазапрос должен идти после базовых правил .nav и .nav-toggle */
@media (min-width: 860px) {
  .nav { display: flex; }
  .nav-toggle { display: none; }
  .mobile-nav { display: none; }
}

.mobile-nav {
  display: grid;
  gap: 0.25rem;
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a { padding: 0.6rem 0; font-size: var(--step-1); text-decoration: none; }

/* --- ФОРМА --- */
.field { display: grid; gap: 0.4rem; }
.field label { font-size: var(--step--1); font-weight: 600; }
.field input, .field textarea {
  padding: 0.85em 1em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.form-status { font-size: var(--step--1); min-height: 1.5em; }
.form-status[data-state='ok'] { color: var(--accent); font-weight: 600; }

/* --- ПОДВАЛ --- */
.site-footer { padding-block: clamp(2.5rem, 5vw, 4rem) 2rem; border-top: 1px solid var(--line); }
.site-footer__bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
}

/* --- ПОЯВЛЕНИЕ ПРИ СКРОЛЛЕ (включает script.js) --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }
