/* NutriGuru — единая типографика.
 *
 * Один шрифт на всё приложение — Onest (файлы в fonts/, лицензия SIL OFL):
 * текст, кнопки, поля, заголовки и цифры. Насыщенность плавная (100–900),
 * поэтому заголовки одинаково жирные на iPhone, Android и компьютере.
 * Подключается последним и выравнивает разнобой старых стилей.
 * Подмножества latin-ext и cyrillic-ext скачиваются, только если на странице
 * встречаются такие символы.
 */
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/onest-cyrillic-ext-wght-normal.woff2') format('woff2-variations'), url('fonts/onest-cyrillic-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/onest-cyrillic-wght-normal.woff2') format('woff2-variations'), url('fonts/onest-cyrillic-wght-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/onest-latin-ext-wght-normal.woff2') format('woff2-variations'), url('fonts/onest-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/onest-latin-wght-normal.woff2') format('woff2-variations'), url('fonts/onest-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font);
  --display-weight: 800;
  --display-tracking: -0.025em;
}

/* ---------- Основной текст ---------- */
html {
  /* Браузер телефона не увеличивает текст сам: размеры одинаковые везде. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  font-family: var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Поля и кнопки не наследуют шрифт сами по себе. */
button, input, select, textarea, optgroup, .modal-sheet, .ng-btn-primary, .ng-btn-secondary, .ng-btn-accent, .ng-input {
  font-family: var(--font);
}
/* Цифры одинаковой ширины: таблицы, счётчики, графики не «прыгают». */
body { font-variant-numeric: tabular-nums; }

/* ---------- Заголовки экранов и главные цифры: одна насыщенность и трекинг ---------- */
/* :not(#ng-type) поднимает приоритет над старыми правилами без !important. */
:is(
  h1, h2,
  .home-v2-hero-title,
  .nutrition-week-calendar__title,
  .nutrition-hero-big-val,
  .nutrition-ring-pct,
  .home-stat-value,
  .progress-ring-value,
  .progress-stat-big strong,
  .activity-primary-stat strong,
  .habit-hero-stat strong,
  .personal-session-day strong,
  .ng-streak-copy strong,
  .ng-weight-now strong,
  .home-coach-question-field .question-mark
):not(#ng-type):not(i):not([class*="fa-"]) {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  font-variant-numeric: tabular-nums;
}
/* Длинные слова переносятся, а не вылезают за карточку; строки выравниваются. */
:is(h1, h2):not(#ng-type) {
  overflow-wrap: break-word;
  text-wrap: balance;
  line-height: 1.12;
}
/* Небольшие заголовки карточек — чуть легче крупных. */
:is(.activity-widget-heading h2, .ng-reminder-copy strong, .progress-data-title h2, .ng-card-title):not(#ng-type) {
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* ---------- Подзаголовки и текст: одна шкала насыщенности ---------- */
:is(h3, h4, h5, h6):not(#ng-type) { font-family: var(--font); letter-spacing: -0.01em; }
/* Самые узкие телефоны (< 360 px): длинное слово переносим с дефисом, а не за край. */
@media (max-width: 359px) {
  :is(h1, h2):not(#ng-type) { hyphens: auto; overflow-wrap: anywhere; }
}

/* ---------- Единые размеры заголовков ----------
 * Заголовок экрана   — 32 px (Прогресс, NG Coach …)
 * Заголовок раздела  — 28 px (Мои достижения; вложенные экраны с кнопкой «Назад»)
 * Заголовок виджета  — 24 px (все карточки на всех экранах)
 * Элемент в виджете  — 17 px (добавка, челлендж в списке)
 * На экранах от 768 px: 38 / 32 / 28 / 18.
 * Надпись над заголовком (ПЛАН ПИТАНИЯ, ПОКАЗАТЕЛИ) — 12 px капсом. */
:root {
  --fs-screen-title: 32px;
  --fs-section-title: 28px;
  --fs-widget-title: 24px;
  --fs-item-title: 17px;
  --fs-kicker: 12px;
}
@media (min-width: 768px) {
  :root { --fs-screen-title: 38px; --fs-section-title: 32px; --fs-widget-title: 28px; --fs-item-title: 18px; }
}

/* Заголовок экрана */
:is(.progress-header h1, .coach-title-row h1, .more-menu-header h2, .habit-hero-content h1):not(#ng-type) {
  font-size: var(--fs-screen-title) !important;
  line-height: 1.1 !important;
}

/* Заголовок вложенного экрана (рядом кнопка «Назад») */
:is(:has(> .back-btn) > :is(h1, h2), :has(> .back-btn) > div > :is(h1, h2), .rx-head-text h2):not(#ng-type) {
  font-size: var(--fs-section-title) !important;
  line-height: 1.15 !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
}

/* Заголовок раздела */
:is(.nutrition-achievements-header h1, .activity-achievements-heading h2, .meals-screen-header h2):not(#ng-type) {
  font-size: var(--fs-section-title) !important;
  line-height: 1.15 !important;
}

/* Заголовок виджета: главная, питание, активность, прогресс, новые экраны */
:is(
  .home-card h2,
  .fasting-home-widget h2,
  .drinks-widget-title-wrap h2,
  .supplements-diary-section h2,
  .nutrition-plans-widget-title-wrap h2,
  .fasting-meals-widget h3,
  .challenge-widget-head h2,
  .meal-diary-section h3.text-base,
  #screenContent h3.text-base,
  .activity-widget-heading h2,
  .progress-data-card h2,
  .ng-card-title,
  .coach-chat-panel h2,
  .habit-detail-card h2,
  .more-goals-card h3,
  .personal-card-head h3,
  .personal-hero h3,
  .rx-collection h3,
  .rx-section-title,
  .challenge-group > h2,
  .challenge-history > h2,
  .fasting-empty-state h3,
  .fasting-history-card h3
):not(#ng-type) {
  font-size: var(--fs-widget-title) !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  line-height: 1.15 !important;
}

/* Надпись над заголовком виджета */
:is(.home-eyebrow, .progress-eyebrow):not(#ng-type) {
  font-size: var(--fs-kicker) !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  line-height: 1.3 !important;
  text-transform: uppercase;
}

/* Название элемента внутри виджета (добавка, челлендж в списке) */
:is(.supplement-diary-card h3, .challenge-option h3):not(#ng-type) {
  font-size: var(--fs-item-title) !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
}
