/* @import ДОЛЖЕН идти первым правилом файла (CSS-требование). ----------
   Реальные vendor-шрифты Outfit / Geist / JetBrains Mono тянутся с
   Google Fonts, когда сеть доступна. ОФФЛАЙН (локальный прототип): импорт
   молча падает, и в силу вступает system-fallback-стек из tokens.css
   (--font-display/-body/-mono). Это осознанный fallback для прототипа —
   раскладка/ритм не зависят от загрузки шрифта (font-display: swap).      */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Geist:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* ============================================================
   CareHaven — base.css  ·  reset · типографика · фокус · контейнеры
   Всё через переменные tokens.css. Light-only.
   ============================================================ */

/* -- Reset (современный, минимальный) -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  font-size: 100%;                 /* honors browser zoom / rem-масштаб  */
  -webkit-text-size-adjust: 100%;  /* без авто-inflate на мобиле         */
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-block-size: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: var(--weight-body) var(--fs-300)/var(--lh-body) var(--font-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, picture, video, canvas, svg { display: block; max-inline-size: 100%; }
img, video { block-size: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
:where(p, li) { text-wrap: pretty; }               /* красивый перенос     */
:where(h1, h2, h3, h4) { text-wrap: balance; }     /* сбалансированный     */
hr { border: 0; border-block-start: 1px solid var(--border); }

/* -- Типографика: роли (шкала из tokens.css, БЕЗ vw) ----------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--lh-heading);
  color: var(--text);
}
h1 { font-size: var(--fs-700); letter-spacing: var(--tracking-h); }
h2 { font-size: var(--fs-600); letter-spacing: var(--tracking-h); }
h3 { font-size: var(--fs-500); line-height: var(--lh-snug); letter-spacing: 0; }
h4 { font-size: var(--fs-400); line-height: var(--lh-snug); letter-spacing: 0; }
.display {                        /* 56/58 — ТОЛЬКО лендинг/маркетинг-хиро */
  font-family: var(--font-display); font-weight: var(--weight-display);
  font-size: var(--fs-800); line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display); text-wrap: balance;
}
.lead     { font-size: var(--fs-400); line-height: var(--lh-snug); color: var(--text); }
.text-secondary { color: var(--text-secondary); }
/* B5: --text-tertiary допустим ТОЛЬКО ≥24px обычный / ≥19px bold.        */
.text-tertiary  { color: var(--text-tertiary); font-size: var(--fs-500); }
.text-tertiary-strong { color: var(--text-tertiary); font-size: var(--fs-400); font-weight: 600; }
.caption  { font-size: var(--fs-100); line-height: var(--lh-snug); color: var(--text-secondary); }
.overline {                       /* eyebrow / надзаголовок секции         */
  font-size: var(--fs-100); line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  font-weight: var(--weight-label); color: var(--text-secondary);
}
.mono {                           /* цены/№лицензий/телефоны/дистанции/даты */
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1; letter-spacing: 0;
}

/* -- Мера строки (жёсткий предохранитель против 180-знаковых строк) --- */
.prose  { max-inline-size: var(--measure-prose);  }
.prose  :where(p, ul, ol) + :where(p, ul, ol, h2, h3) { margin-block-start: var(--s-5); }
.narrow { max-inline-size: var(--measure-narrow); }
.measure-wide { max-inline-size: var(--measure-wide); }

/* -- Фокус: focus-visible = двойное кольцо (B3), не голый outline ----- */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-sm);
}
/* элементы со своим радиусом сохраняют его при фокусе (переопределят ниже
   в components.css); мышиный :focus без клавиатуры кольца не даёт.       */
:focus:not(:focus-visible) { outline: none; }

/* -- Skip-link (доступность) ----------------------------------------- */
.skip-link {
  position: absolute; inset-inline-start: var(--s-4); inset-block-start: -100%;
  z-index: var(--z-max); padding: var(--s-3) var(--s-4);
  background: var(--surface); color: var(--accent-text);
  border-radius: var(--r-input); box-shadow: var(--shadow-2);
  transition: inset-block-start var(--dur-micro) var(--ease-standard);
}
.skip-link:focus { inset-block-start: var(--s-4); text-decoration: none; }

/* -- Контейнеры: «документный» 1120 / «рабочий» до 1680 -------------- */
.container {                      /* документные экраны (лендинг/гиды/юр)   */
  inline-size: min(100% - var(--gutter) * 2, var(--container-doc));
  margin-inline: auto;
}
.container--work {                /* рабочие экраны (search/owner/admin)    */
  inline-size: min(100% - var(--gutter) * 2, var(--container-work));
  margin-inline: auto;
}
.container--full { inline-size: 100%; }   /* карта = 100vw                  */

/* -- Секционный вертикальный ритм ------------------------------------ */
.section    { padding-block: var(--s-7); }
.section--lg{ padding-block: var(--s-8); }
.section--hero { padding-block: var(--s-9); }

/* -- Утилиты: раскладка ---------------------------------------------- */
.stack > * + * { margin-block-start: var(--stack-gap, var(--s-4)); }
.stack-sm > * + * { margin-block-start: var(--s-2); }
.stack-lg > * + * { margin-block-start: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--s-3)); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: var(--gutter); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.center { margin-inline: auto; }
.flex-1 { flex: 1 1 auto; min-inline-size: 0; }   /* против overflow в flex */

/* -- Утилиты: сервис -------------------------------------------------- */
.sr-only {
  position: absolute; inline-size: 1px; block-size: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  border: 0;
}
.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
