/* ==========================================================================
   Калорика AI — прототип сайта kalorica.ru
   Общие бренд-стили. Без внешних зависимостей (открывается офлайн).
   ========================================================================== */

:root {
  /* --- Бренд: синие --- */
  --brand-900: #172c74;
  --brand-800: #1E3A8A;
  --brand-700: #1E40AF;
  --brand-600: #2563EB;
  --brand-ink: #023c69;
  --accent: #3B82F6;
  --accent-400: #60A5FA;
  --accent-300: #93C5FD;

  /* --- Макро-цвета (система приложения — КБЖУ ВЕЗДЕ) --- */
  --macro-protein: #3B82F6;   /* Белки — синий */
  --macro-fat: #F59E0B;       /* Жиры — янтарный */
  --macro-carb: #8B5CF6;      /* Углеводы — фиолетовый (никогда не красный) */
  --macro-goal: #34D399;      /* Цель / успех — зелёный */
  --macro-protein-bg: #DBEAFE;
  --macro-fat-bg: #FEF3C7;
  --macro-carb-bg: #EDE9FE;
  --macro-goal-bg: #E2F8F0;

  /* --- Поверхности / текст --- */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #5B6B82;
  --line: #E7ECF3;
  --line-2: #EEF2F7;

  /* --- Размеры --- */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .07);
  --shadow-brand: 0 8px 20px rgba(37, 99, 235, .22);
  --container: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", "PT Sans", sans-serif;
}

* { box-sizing: border-box; }

/* overflow-x: clip не создаёт scroll-контейнер → безопасно для position: sticky,
   но подстраховывает от горизонтального скролла на узких экранах (≤375px). */
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Инлайновая кнопка-действие (JS-триггер, не переход по ссылке) — визуально как текстовая ссылка */
.link-btn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.08; margin: 0 0 .5em; letter-spacing: -.025em; }
h1 { font-size: clamp(2.4rem, 5.2vw, 3.9rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.24rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.section { padding: 92px 0; }
.section-tight { padding: 56px 0; }
.eyebrow {
  display: inline-block;
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}
.section-head { max-width: 660px; margin-bottom: 44px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head p { color: var(--ink-2); font-size: 1.06rem; margin: 0; }
.lead { font-size: 1.14rem; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1;
  padding: 15px 24px; border-radius: 10px; border: 1.5px solid transparent;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand-600);
  color: #fff; box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background:#1D4ED8; box-shadow: 0 12px 26px rgba(37, 99, 235, .30); transform: translateY(-1px); color:#fff; }
.btn-secondary { background: #fff; color: var(--brand-800); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--accent-300); color: var(--brand-800); }
.btn-ghost-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost-light:hover { background: rgba(255,255,255,.2); color:#fff; }
.btn-sm { padding: 10px 18px; font-size: .9rem; }
.btn-block { width: 100%; white-space: normal; line-height: 1.3; }
/* Шеринг: на тач-устройствах (мобильных) прячем явные сети — их заменяет системное «Поделиться» */
@media (pointer: coarse) { .share-widget .sw-net { display: none; } }
.btn .store { font-size: .72rem; font-weight: 600; opacity: .82; display:block; line-height:1.1; }
.btn .store-main { font-size: 1.02rem; font-weight: 800; display:block; line-height:1.15; }
.btn-store { padding: 11px 24px; text-align: left; }

/* ---------- Хедер ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 22px; height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; color: var(--ink); font-size: 1.14rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow-sm); }
.brand .ai { color: var(--accent); }
.nav { display: flex; gap: 24px; margin-left: 12px; }
.nav a { color: var(--ink-2); font-weight: 600; font-size: .96rem; }
.nav a:hover { color: var(--brand-800); text-decoration: none; }
.header-cta { margin-left: auto; }
/* Главный CTA шапки — «Скачать в RuStore» В ОДНУ СТРОКУ = длинная широкая кнопка (больший клик-таргет). Единый источник для всех страниц. */
.header-cta .btn-store { padding: 12px 32px; font-size: 1rem; }
.header-cta .btn-store .store { display: inline; font-size: 1rem; font-weight: 600; opacity: .95; line-height: 1.2; }
.header-cta .btn-store .store-main { display: inline; font-size: 1rem; font-weight: 800; margin-left: .35em; line-height: 1.2; }
@media (max-width: 780px) { .nav { display: none; } .header-cta .store { display:none; } }

/* ---------- Макро-чипы и бары (КБЖУ) ---------- */
.kcal-badge {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-weight: 800; color: var(--brand-800);
}
.kcal-badge b { font-size: 1.05em; }
.kcal-badge .u { font-weight: 600; color: var(--ink-3); font-size: .82em; }

.macro-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 700; padding: 5px 11px 5px 9px; border-radius: var(--radius-pill);
  color: var(--ink);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip small { font-weight: 600; color: var(--ink-2); }
.chip.p { background: var(--macro-protein-bg); }
.chip.p .dot { background: var(--macro-protein); }
.chip.f { background: var(--macro-fat-bg); }
.chip.f .dot { background: var(--macro-fat); }
.chip.c { background: var(--macro-carb-bg); }
.chip.c .dot { background: var(--macro-carb); }
.chip.g { background: var(--macro-goal-bg); }
.chip.g .dot { background: var(--macro-goal); }

/* Стековый бар распределения КБЖУ по калориям */
.macro-bar { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; background: var(--line-2); }
.macro-bar > span { display: block; height: 100%; }
.macro-bar .mb-p { background: var(--macro-protein); }
.macro-bar .mb-f { background: var(--macro-fat); }
.macro-bar .mb-c { background: var(--macro-carb); }
.macro-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.macro-legend .li { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.macro-legend .li b { color: var(--ink); }
.macro-legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Футер ---------- */
.site-footer { background: #0B1220; color: #C6D0DF; padding: 54px 0 30px; margin-top: 20px; }
.site-footer a { color: #AFC0D6; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.footer-grid .brand { color: #fff; margin-bottom: 12px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 34px; padding-top: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .84rem; color: #7E8DA3; }
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Прочее ---------- */
.pill-note {
  display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 700;
  color: #92600A; background: #FEF6DC; border: 1px solid #FBE7A6; padding: 4px 11px; border-radius: var(--radius-pill);
}
.rating-stars { color: #FBBF24; letter-spacing: 1px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 40px 0; }

.breadcrumbs { font-size: .86rem; color: var(--ink-3); padding: 16px 0 4px; }
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { margin: 0 7px; }

/* ---------- Share-виджет (share.js) — единый на всех шаро-страницах ---------- */
.share-widget { display: flex; flex-direction: column; gap: 8px; }
.share-widget .sw-label { font-weight: 700; font-size: .84rem; color: var(--ink-2); }
.sw-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw-btn { gap: 7px; }
.sw-btn svg { flex: none; }
.sw-flash { min-height: 1.2em; color: #0E7C5A; font-weight: 600; }

/* ---------- Onboard-CTA (onboard-cta.js) — компактный второй вход в онбординг
   на контент-страницах (SEO-посадки). НЕ заменяет основной app-CTA «Сфоткай
   блюдо» — более мягкий путь для тех, кто ещё не знает свою норму. ---------- */
.onboard-cta { margin: 30px 0; }
.onboard-cta .oc-inner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--macro-protein-bg) 0%, #fff 70%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 22px; box-shadow: var(--shadow-sm);
}
.onboard-cta .oc-icon {
  width: 42px; height: 42px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm);
  color: var(--accent); display: grid; place-items: center; flex: none;
}
.onboard-cta .oc-text { flex: 1; min-width: 200px; }
.onboard-cta .oc-text h3 { margin: 0; font-size: 1rem; }
.onboard-cta .oc-cta { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.onboard-cta .oc-note { color: var(--ink-3); }
@media (max-width: 620px) {
  .onboard-cta .oc-inner { flex-direction: column; text-align: center; padding: 18px 20px; }
  .onboard-cta .oc-cta { align-items: center; }
}

/* ==========================================================================
   Общие контент-компоненты (карточки рационов и статей)
   Используются на index.html, rations.html, articles.html — единый источник.
   Перенесены из inline-стилей index.html без изменения визуала.
   ========================================================================== */

/* ---------- Карточка рациона (фото, без эмодзи) ---------- */
.ration-card { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .2s ease; height: 100%; }
.ration-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.ration-card .rc-cover { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.ration-card .rc-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.ration-card:hover .rc-cover img { transform: scale(1.05); }
.ration-card .rc-cover .ration-tag { position: absolute; top: 12px; left: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.ration-card .rc-cover .kcal-over { position: absolute; top: 12px; right: 12px; background: rgba(11,18,32,.78); color: #fff; padding: 5px 11px; border-radius: 8px; backdrop-filter: blur(4px); font-weight: 800; font-size: .84rem; }
.ration-card .rc-cover .kcal-over .u { color: #C9D8F0; font-weight: 600; }

/* ---------- Нейтральный category-плейсхолдер для продуктов без реального фото ----------
   Реальное фото есть не для каждого из ~13 000 продуктов и не будет. Вместо чужого/
   несовпадающего фото — нейтральная иконка-заглушка по категории продукта. */
.rc-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.rc-placeholder svg { width: 42%; height: 42%; max-width: 72px; max-height: 72px; }
.rc-placeholder--meat  { background: #FBEAE2; } .rc-placeholder--meat svg  { color: #B14A22; }
.rc-placeholder--fish  { background: #E2F1FA; } .rc-placeholder--fish svg  { color: #0F6E96; }
.rc-placeholder--dairy { background: #FBF3DC; } .rc-placeholder--dairy svg { color: #8A6417; }
.rc-placeholder--grain { background: #F1E7D6; } .rc-placeholder--grain svg { color: #8A5A25; }
.rc-placeholder--veg   { background: #E3F5E9; } .rc-placeholder--veg svg   { color: #227A4A; }
.ration-tag { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 6px; }
.rt-loss { color:#0E7C5A; } .rt-health { color:#1E40AF; } .rt-keto { color:#92600A; } .rt-student { color:#6D28D9; } .rt-fasting { color:#0E7C5A; } .rt-veg { color:#6D28D9; }
.ration-card .rc-body { padding: 16px 18px 0; flex: 1; }
.ration-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.ration-card .rc-desc { font-size: .9rem; color: var(--ink-2); margin: 0; }
.ration-card .rc-foot { padding: 14px 18px 18px; margin-top: 12px; }
.ration-card .rc-meta { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--ink-3); margin-bottom: 12px; }
.ration-card .rc-meta b { color: var(--ink-2); }
.author-label { font-weight: 700; color: var(--ink-2); }
.arrow-link { display:inline-flex; align-items:center; gap:6px; font-weight:700; color: var(--accent); font-size:.92rem; }

/* ---------- Карточка статьи (фото-обложка, без эмодзи) ---------- */
.article-card { overflow:hidden; text-decoration:none; color:inherit; transition: transform .15s ease, box-shadow .2s; display:flex; flex-direction:column; }
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration:none; }
.article-card .ac-img { aspect-ratio: 16/9; overflow:hidden; }
.article-card .ac-img img { width:100%; height:100%; object-fit:cover; transition: transform .45s ease; }
.article-card:hover .ac-img img { transform: scale(1.05); }
.article-card .ac-body { padding: 18px; flex:1; display:flex; flex-direction:column; }
.article-card .ac-cat { font-size:.74rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color: var(--accent); margin-bottom:8px; }
.article-card h3 { font-size:1.06rem; margin-bottom:8px; }
.article-card p { font-size:.9rem; color: var(--ink-2); margin:0 0 14px; }
.article-card .ac-foot { margin-top:auto; font-size:.82rem; color: var(--ink-3); }

/* ---------- Видео-эмбед (стиль RuTube / VK-плеера, плейсхолдер) ---------- */
.video-embed { position:relative; aspect-ratio:16/9; border-radius:var(--radius); overflow:hidden; background:linear-gradient(135deg,#0B1220,#1E3A8A); display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow); }
.video-embed .play { width:74px; height:74px; border-radius:50%; background:rgba(255,255,255,.16); border:2px solid rgba(255,255,255,.6); display:flex; align-items:center; justify-content:center; }
.video-embed .play::after { content:""; border-style:solid; border-width:13px 0 13px 22px; border-color:transparent transparent transparent #fff; margin-left:5px; }
.video-embed .vlabel { position:absolute; bottom:12px; left:14px; color:#fff; font-weight:700; font-size:.85rem; background:rgba(0,0,0,.4); padding:5px 12px; border-radius:var(--radius-pill); }
.video-embed .vsrc { position:absolute; top:12px; right:14px; color:#fff; font-weight:800; font-size:.78rem; background:rgba(0,0,0,.35); padding:5px 11px; border-radius:6px; letter-spacing:.02em; }
.video-caption { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:10px; }

/* ---------- Видео-галерея: карусель Cover Flow, центральная карточка = сам плеер (iframe) ---------- */
.video-gallery { display:flex; flex-direction:column; align-items:center; }
.video-stat, .video-tag {
  display:inline-flex; align-items:center; gap:6px; font-size:.76rem; font-weight:700;
  padding:4px 11px; border-radius: var(--radius-pill); white-space:nowrap;
}
.video-stat { color: var(--brand-800); background: var(--macro-protein-bg); }
.video-tag { color:#7A5209; background: var(--macro-fat-bg); }

/* Карусель клипов — эффект Cover Flow (как обложки в старом iTunes / лента TikTok):
   ЦЕНТРАЛЬНАЯ карточка — прямо и крупно, и она же ПЛЕЕР: в неё вставлен единственный на
   странице <iframe> (.vg-frame, absolute inset:0, поверх обложки). Боковые карточки уходят
   в перспективу (rotateY), мельче и тусклее к краям — это просто обложки img.
   Геометрия (сдвиг/поворот/масштаб/глубина по индексу карточки относительно активной)
   считается в JS и пишется как inline transform на .vg-card — так клик, стрелки ‹ ›, свайп/
   drag и клавиши остаются одной согласованной моделью навигации, без параллельных CSS-веток.
   Карточка — <div role="button" tabindex="0"> (не <button>), чтобы внутрь можно было вложить
   iframe (iframe в button невалиден); Enter/Space обрабатываются в JS. */
.vg-coverflow { display:flex; align-items:center; gap:6px; width:100%; max-width:980px; margin:28px auto 0; }
.vg-viewport {
  flex:1 1 auto; min-width:0; height:400px; overflow:hidden;
  perspective:1700px; perspective-origin:50% 50%;
}
.vg-track {
  position:relative; width:100%; height:100%;
  transform-style:preserve-3d; touch-action:pan-y; cursor:grab;
}
.vg-track:active { cursor:grabbing; }
.vg-card {
  position:absolute; top:50%; left:50%; width:210px; aspect-ratio:9/16;
  padding:0; border:1.5px solid var(--line); border-radius:var(--radius);
  overflow:hidden; background:var(--line-2); cursor:pointer; font-family:inherit;
  box-shadow: 0 10px 22px -12px rgba(15,23,42,.4);
  user-select:none; -webkit-tap-highlight-color:transparent;
  /* базовый transform — центрирует карточку на своей точке привязки (left/top:50%);
     JS сразу перезаписывает inline-стилем с полной геометрией Cover Flow (см. скрипт) */
  transform: translate(-50%,-50%);
  transition: transform .45s cubic-bezier(.22,.9,.32,1), opacity .45s ease, border-color .15s, box-shadow .25s;
}
.vg-card img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
/* .vg-frame — сам плеер: единственный iframe, живёт внутри активной карточки, поверх обложки */
.vg-card .vg-frame { position:absolute; inset:0; width:100%; height:100%; border:0; z-index:4; background:#000; }
/* play-кружок поверх обложки (чистый CSS, без текстовых символов/эмодзи); на активной прячем */
.vg-card .vg-play { position:absolute; top:8px; right:8px; width:22px; height:22px; border-radius:50%; background:rgba(15,23,42,.5); pointer-events:none; z-index:2; }
.vg-card .vg-play::after {
  content:""; position:absolute; top:50%; left:52%; transform:translate(-50%,-50%);
  border-style:solid; border-width:5px 0 5px 8px; border-color:transparent transparent transparent #fff;
}
.vg-card.active .vg-play { display:none; }
.vg-card .vt-badge {
  position:absolute; left:6px; bottom:6px; z-index:2; max-width:calc(100% - 12px);
  font-size:.66rem; font-weight:700; color:#fff; background:rgba(15,23,42,.64);
  padding:2px 7px; border-radius:var(--radius-pill); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  pointer-events:none;
}
.vg-card.active { border-color:var(--accent); box-shadow: 0 18px 32px -12px rgba(15,23,42,.45), 0 0 0 3px rgba(59,130,246,.18); }
.vg-card:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }

.vg-arrow {
  flex:0 0 auto; width:40px; height:40px; border-radius:50%;
  border:1.5px solid var(--line); background:var(--surface); color:var(--ink-2);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  transition: border-color .15s, color .15s, opacity .15s;
}
.vg-arrow span { display:block; font-size:1.35rem; line-height:1; margin-top:-2px; }
.vg-arrow--prev span::before { content:"\2039"; }
.vg-arrow--next span::before { content:"\203A"; }
.vg-arrow:hover:not(:disabled) { border-color:var(--accent); color:var(--accent); }
.vg-arrow:disabled { opacity:.35; cursor:default; }

/* Подпись + бейдж + ссылка активного клипа — под каруселью, по центру */
.vg-caption { justify-content:center; text-align:center; margin-top:18px; }

/* Десктоп — центр КРУПНЫЙ (плеер ~300px ×533px, 9:16); боковые масштабируются от него
   пропорционально (scale в JS), сдвиг соседей = доля ширины карточки → Cover Flow-вид цел. */
@media (min-width:640px) {
  .vg-viewport { height:560px; }
  .vg-card { width:300px; }
}
/* Узкий экран — уменьшаем пропорционально, чтобы не переполнять страницу по горизонтали
   (viewport overflow:hidden + html overflow-x:clip страхуют от горизонтального скролла). */
@media (max-width:420px) {
  .vg-viewport { height:300px; }
  .vg-card { width:160px; }
  .vg-arrow { width:34px; height:34px; }
}
@media (prefers-reduced-motion: reduce) {
  .vg-card { transition: opacity .2s ease, border-color .15s, box-shadow .2s; }
}

/* ---------- Заголовок каталога (светлый, для rations.html / articles.html) ---------- */
.catalog-head { background:linear-gradient(135deg,#EAF2FE 0%, #F1ECFE 100%); border-bottom:1px solid var(--line); }
.catalog-head .container { padding:34px 20px 30px; }
.catalog-head h1 { max-width:820px; margin:0 0 12px; }
.catalog-head p { max-width:640px; color:var(--ink-2); font-size:1.08rem; margin:0; }

/* ---------- Печать / PDF (window.print, БЕЗ внешних PDF-библиотек) ----------
   Кнопка «Скачать / распечатать PDF» на ration.html, ration-keto.html, plan.html
   вызывает нативный window.print(). Ниже — что скрыть/упростить в печатной
   версии, чтобы остался чистый рацион/план с КБЖУ (без хедера/футера/nav/
   app-CTA/share/интерактивных кнопок). */
@media print {
  .site-header, .site-footer, .share-widget, .sticky-cta, .breadcrumbs,
  .btn, .qty-group, .qty-btn, .pi-remove, .no-print,
  .r-layout > aside { display: none !important; }
  body { padding-bottom: 0 !important; background: #fff !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .r-layout, .plan-layout { display: block !important; }
  .grid, .grid-2, .grid-3 { display: block !important; }
  .plan-card { position: static !important; }
  .card, .day, .info-card, .summary-card { box-shadow: none !important; }
  .section, .section-tight { padding: 8px 0 !important; }
}

/* ---------- Embed-код (ration.html «Вставить на свой сайт») ---------- */
.embed-textarea {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius);
  resize: vertical; color: var(--ink-2); background: var(--bg);
}
.embed-textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- Фильтры каталога (визуально-статичные) ---------- */
.filter-bar { display:flex; flex-wrap:wrap; gap:22px; align-items:flex-start; padding:22px 0 6px; }
.filter-group { display:flex; flex-direction:column; gap:8px; }
.filter-group .fg-label { font-size:.74rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-3); }
.filter-pills { display:flex; flex-wrap:wrap; gap:8px; }
.filter {
  font-family:inherit; font-size:.86rem; font-weight:700; color:var(--ink-2);
  background:#fff; border:1px solid var(--line); padding:8px 15px; border-radius:var(--radius-pill);
  cursor:pointer; transition:border-color .15s, color .15s, background .15s;
}
.filter:hover { border-color:var(--accent-300); color:var(--brand-800); }
.filter.active { background:var(--brand-600); border-color:var(--brand-600); color:#fff; }
.result-count { color:var(--ink-3); font-size:.9rem; margin:6px 0 0; }

/* ==========================================================================
   Калькуляторы (kalkulyator-*.html) — единый layout
   Раньше каждый из 6 калькуляторов дублировал этот CSS в своём <style> и
   использовал 2-колоночную сетку (поля | результат). У калькуляторов с
   малым числом полей (напр. «Идеальный вес» — только пол и рост) левая
   колонка получалась короче правой и оставляла гигантскую пустоту, а CTA
   в узкой правой колонке теснился. Теперь — один центрированный столбец:
   поля → результат → переход в приложение, одинаково на всех 6 страницах.
   ========================================================================== */
.tool-head { max-width: 700px; margin-bottom: 28px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 960px; margin: 0 auto; align-items: start; }
@media (max-width: 820px) { .tool-grid { grid-template-columns: 1fr; max-width: 560px; } }
.tool-panel { padding: 26px; }
.tool-result { padding: 26px; }
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field label { font-weight: 700; font-size: .84rem; display: block; margin-bottom: 7px; color: var(--ink-2); }
input[type=number] {
  width: 100%; font-family: inherit; font-size: 1rem; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type=number]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.field-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr 1fr; } }
.pill-block { margin-bottom: 20px; }
.pill-block:last-child { margin-bottom: 0; }
.pill-block .fg-label { display: block; margin-bottom: 9px; }
.result-kcal { text-align: center; padding: 6px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.result-kcal .big { font-size: 2.5rem; font-weight: 800; color: var(--brand-800); line-height: 1; }
.result-kcal .lbl { color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .74rem; }
.result-lines { display: grid; gap: 3px; margin-bottom: 16px; }
.result-lines > div { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; color: var(--ink-2); padding: 5px 6px; }
.result-lines b { color: var(--ink); font-weight: 800; }
.formula-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: .82rem; color: var(--ink-2); margin-top: 14px; }
.tnum { font-variant-numeric: tabular-nums; }
.warn-note { margin-top: 12px; display: none; }
.warn-note.show { display: inline-flex; }
.related-calcs { margin-top: 28px; font-size: .88rem; color: var(--ink-3); }
.related-calcs a { color: var(--accent); font-weight: 600; margin-right: 2px; }

/* ---------- Пояснялки: всегда видимая строка под подписью (Apple HIG «add an explanation») ---------- */
/* Никаких «?»-всплывашек: пояснение всегда на экране, спокойное, короткое, позитивное. */
.fg-hint { margin: -2px 0 11px; font-size: .82rem; line-height: 1.45; color: var(--ink-3); font-weight: 400; letter-spacing: normal; text-transform: none; max-width: 46ch; }
.result-say { margin: 9px auto 0; max-width: 30ch; font-size: .88rem; line-height: 1.45; color: var(--ink-2); font-weight: 500; text-transform: none; letter-spacing: normal; }
.rl-name { display: flex; flex-direction: column; gap: 1px; }
.rl-name small { font-size: .76rem; font-weight: 400; color: var(--ink-3); line-height: 1.35; }

/* ---------- «Как получилась цифра»: наглядная человеческая раскладка расчёта (не голая формула) ---------- */
.calc-steps { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px; }
.calc-steps h4 { margin: 0 0 8px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.cs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: .9rem; color: var(--ink-2); }
.cs-row b { color: var(--ink); font-weight: 800; white-space: nowrap; }
.cs-sub { display: block; font-size: .74rem; font-weight: 400; color: var(--ink-3); }
.cs-row.final { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
.cs-row.final > span { font-weight: 700; color: var(--ink); }
.cs-row.final b { color: var(--brand-800); }
.cmp-head { font-size: .74rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 2px; padding-left: 6px; }

/* ---------- Поиск по каталогу (search.js) ---------- */
.search-box { position: relative; max-width: 520px; margin: 0 0 18px; }
.search-box input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 1rem; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 44px; transition: border-color .15s; }
.search-box input::placeholder { color: var(--ink-3); }
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box .si-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; display: flex; }
.search-empty { display: none; text-align: center; padding: 40px 16px; color: var(--ink-2); }
.search-empty h3 { margin-bottom: 8px; color: var(--ink); }
.search-empty p { margin: 0 auto 14px; max-width: 42ch; }

/* ---------- CTA «в приложение» внутри результата калькулятора ---------- */
.app-cta-box { background: linear-gradient(135deg,var(--brand-800),var(--brand-900)); color: #fff; border-radius: var(--radius); padding: 18px 20px; text-align: center; margin-top: 10px; }
.app-cta-box b { display: block; margin: 14px 0 2px; font-size: .96rem; }
/* RuStore-кнопка вне шапки (CTA-блок калькуляторов, хаб-страницы) — тоже в одну строку, не жмётся */
.btn-store-line .store, .btn-store-line .store-main { display: inline; line-height: 1.2; }
.btn-store-line .store { font-size: .86rem; opacity: .95; }
.btn-store-line .store-main { font-size: 1.02rem; margin-left: .4em; }
