/* Общие стили страниц-калькуляторов питания (/calculator, /deficit, …).
   Меняя файл, поднимите ?v= во всех страницах, которые его подключают. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --dark: #0f172a;
  --dark2: #1e293b;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --white: #ffffff;
  --green: #6ee7b7;
  --amber: #fbbf24;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.6;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: #0f172a;
  border-bottom: 1px solid rgba(99,102,241,.15);
}
.logo {
  font-size: 19px; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── SHARED ── */
section { padding: 72px 20px; }
.container { max-width: 1060px; margin: 0 auto; }
.section-label {
  text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 2px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 14px;
}
h2 {
  text-align: center; font-size: clamp(24px, 4vw, 40px);
  font-weight: 800; letter-spacing: -1px; margin-bottom: 14px;
}
.section-sub {
  text-align: center; color: var(--muted); font-size: 17px;
  max-width: 600px; margin: 0 auto 44px; line-height: 1.7;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; text-decoration: none; padding: 16px 32px;
  border-radius: 12px; font-size: 16px; font-weight: 700;
  display: inline-block; border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(99,102,241,.35);
}

/* ── HERO + CALC ── */
.hero {
  padding: 82px 16px 40px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
h1 {
  font-size: clamp(27px, 5.4vw, 46px);
  font-weight: 900; line-height: 1.15; letter-spacing: -1.2px;
  margin-bottom: 10px; max-width: 760px;
}
h1 span {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #ec4899 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 15px; color: var(--muted);
  max-width: 460px; margin-bottom: 20px; line-height: 1.55;
}

.calc {
  width: 100%; max-width: 460px; text-align: left;
  background: var(--card);
  border: 1px solid rgba(99,102,241,.22);
  border-radius: 16px; padding: 18px 16px;
}

.gender-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.gender-btn {
  font: inherit; font-size: 15px; font-weight: 600;
  padding: 13px 8px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
}
.gender-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(99,102,241,.35), rgba(139,92,246,.35));
  border-color: var(--accent);
  color: var(--white);
}

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.field { display: flex; flex-direction: column; }
.field label {
  font-size: 12px; color: var(--muted); font-weight: 600;
  margin-bottom: 5px; letter-spacing: .2px;
}
.field input {
  font: inherit; font-size: 17px; font-weight: 700;
  width: 100%; padding: 12px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; color: var(--white);
  text-align: center;
}
.field input:focus { outline: none; border-color: var(--accent); background: rgba(99,102,241,.1); }
.field input.invalid { border-color: #f87171; }
.field input::placeholder { color: #475569; font-weight: 500; }

.err {
  display: none;
  font-size: 13px; color: #fca5a5; margin-top: 8px; line-height: 1.45;
}
.err.show { display: block; }

/* ── RESULT ── */
.result { width: 100%; max-width: 460px; margin-top: 14px; text-align: left; }

.result-card {
  background: linear-gradient(135deg, rgba(99,102,241,.16), rgba(139,92,246,.16));
  border: 1px solid rgba(99,102,241,.35);
  border-radius: 16px; padding: 20px 18px;
}
.big-label { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.big-value {
  font-size: 44px; font-weight: 900; letter-spacing: -1.5px; line-height: 1.1;
  color: var(--white); margin: 2px 0 2px;
}
.big-value small { font-size: 18px; font-weight: 700; color: var(--muted); letter-spacing: 0; }

.res-rows { margin-top: 14px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.res-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 15px; padding: 4px 0;
}
.res-row span:first-child { color: var(--muted); }
.res-row span:last-child { font-weight: 700; color: var(--text); text-align: right; }

.note {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 12px; padding: 11px 13px;
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3);
  border-radius: 10px; font-size: 13.5px; line-height: 1.5; color: #fde68a;
}

/* target weight step */
.goal-step {
  margin-top: 12px; padding: 14px 16px;
  background: var(--card); border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
}
.goal-step p { font-size: 14.5px; color: var(--muted); margin-bottom: 10px; }
.goal-input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.goal-input-row input {
  font: inherit; font-size: 17px; font-weight: 700;
  padding: 12px 14px; width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; color: var(--white); text-align: center;
}
.goal-input-row input:focus { outline: none; border-color: var(--accent); background: rgba(99,102,241,.1); }
.goal-input-row input.invalid { border-color: #f87171; }
.goal-unit { font-size: 15px; color: var(--muted); font-weight: 600; }

/* CTA under result */
.result-cta { margin-top: 14px; text-align: center; }
.result-cta p { font-size: 14.5px; color: var(--muted); margin-bottom: 12px; line-height: 1.55; }
.result-cta .btn-primary { width: 100%; padding: 16px 20px; }
.result-cta .hint { font-size: 13px; color: #64748b; margin: 10px 0 0; }

/* ── HOW IT WORKS ── */
.how { background: var(--dark2); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.step { text-align: center; padding: 20px 18px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 16px;
}
.step h3 { font-size: 17px; font-weight: 700; color: var(--white); margin-bottom: 8px; }
.step p { font-size: 15px; color: var(--muted); line-height: 1.6; }

/* ── FEATURES ── */
.features-inner { max-width: 600px; margin: 0 auto; }
.features-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.features-list li {
  display: flex; align-items: center; gap: 14px;
  font-size: 16px; color: var(--text); padding: 14px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,.06), rgba(139,92,246,.06));
  border: 1px solid rgba(99,102,241,.15);
  border-radius: 12px;
}
.features-list .feat-icon { font-size: 20px; flex-shrink: 0; }

/* ── CTA ── */
.cta-block {
  background: linear-gradient(135deg, rgba(99,102,241,.15) 0%, rgba(139,92,246,.15) 100%);
  border: 1px solid rgba(99,102,241,.25); border-radius: 24px;
  padding: 56px 24px; text-align: center;
}
.cta-block h2 { margin-bottom: 14px; font-size: clamp(24px, 4vw, 40px); }
.cta-block .cta-sub { color: var(--muted); font-size: 17px; margin-bottom: 28px; line-height: 1.7; }
.cta-block .cta-note { color: #64748b; font-size: 13px; margin-top: 14px; }

/* ── FOOTER ── */
footer { background: var(--dark2); border-top: 1px solid rgba(255,255,255,.06); padding: 36px 20px; }
.footer-inner {
  max-width: 1060px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.footer-logo { font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-copy { color: var(--muted); font-size: 13px; }

@media (max-width: 640px) {
  section { padding: 56px 16px; }
  .cta-block { padding: 40px 18px; }
  .hero { padding-top: 74px; }
}
@media (max-width: 360px) {
  .grid3 { gap: 7px; }
  .field input { font-size: 16px; padding: 11px 6px; }
}

/* ── ARTICLE (SEO-текст под инструментом) ── */
.article { max-width: 720px; margin: 0 auto; }
.article h2 { text-align: left; font-size: clamp(22px, 3.4vw, 30px); margin: 40px 0 14px; letter-spacing: -.5px; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 18px; font-weight: 700; color: var(--white); margin: 24px 0 8px; }
.article p, .article li { font-size: 16.5px; color: var(--text); line-height: 1.75; }
.article p { margin-bottom: 14px; }
.article ul, .article ol { padding-left: 22px; margin-bottom: 14px; }
.article li { margin-bottom: 6px; }
.article a { color: #a5b4fc; }
.article strong { color: var(--white); }
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 14px; overflow-x: auto; color: var(--white);
}
.example {
  background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.22);
  border-radius: 14px; padding: 16px 18px; margin: 0 0 16px;
}
.example p:last-child { margin-bottom: 0; }
.example .res-row { font-size: 15.5px; }

/* FAQ */
.faq { max-width: 720px; margin: 0 auto; }
.faq details {
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 10px; background: rgba(255,255,255,.02);
}
.faq summary { cursor: pointer; font-size: 16.5px; font-weight: 700; color: var(--white); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-weight: 800; }
.faq details[open] summary::after { content: '−'; }
.faq details p { font-size: 15.5px; color: var(--text); line-height: 1.7; margin-top: 10px; }

/* Другие калькуляторы */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; max-width: 720px; margin: 0 auto; }
.tools a {
  display: block; padding: 16px 18px; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 1px solid rgba(99,102,241,.22); color: var(--white); font-weight: 700;
}
.tools a span { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.tools a[aria-current="page"] { display: none; }

nav .logo { text-decoration: none; }

/* Таблицы норм в тексте */
.norms { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15.5px; }
.norms th, .norms td { padding: 9px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
.norms th { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.norms td b { color: var(--white); }
@media (max-width: 420px) { .norms { font-size: 14px; } .norms th, .norms td { padding: 8px 6px; } }
