/* ===== BMRScope — Metabolic Editorial, wide & light ===== */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400&family=Work+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --ink: #1c2a2e;
  --ink-soft: #526268;
  --muted: #89979b;
  --paper: #fbfcfc;
  --card: #ffffff;
  --line: #e5eae9;
  --primary: #0e5f63;
  --primary-dark: #0a484c;
  --primary-soft: #e6f1ef;
  --flame: #f0744b;
  --flame-soft: #fdeee7;
  --gold: #d29a3a;
  --positive: #0e5f63;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 32px rgba(28,42,46,.06);
  --max-width: 1280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--paper); line-height: 1.7; font-size: 16px;
}

/* Header */
.site-header { background: rgba(255,255,255,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 100; }
.site-header .inner { max-width: var(--max-width); margin: 0 auto; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; }
.site-header .logo { font-family: 'Fraunces', Georgia, serif; font-size: 21px; font-weight: 600; color: var(--primary-dark); text-decoration: none; letter-spacing: -.3px; display: inline-flex; align-items: center; gap: 10px; }
.site-header .logo em, .footer-brand em { font-style: normal; color: var(--flame); }
.site-header .logo-img { width: 36px; height: 36px; border-radius: 9px; display: block; flex-shrink: 0; background: var(--primary-soft); }
.site-header .nav-links { display: flex; gap: 24px; list-style: none; }
.site-header .nav-links a { color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .2s; }
.site-header .nav-links a:hover { color: var(--primary); }

.menu-btn { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.menu-btn .bar { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: all .2s; }
.menu-btn[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Layout */
.container { max-width: var(--max-width); margin: 0 auto; padding: 14px 24px 70px; }

/* Hero — single compact line, tool visible on first screen */
.hero { margin-bottom: 14px; }
.hero h1 { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.3px; color: var(--ink); }
.hero-sub { color: var(--ink-soft); font-size: 15px; margin-top: 8px; max-width: 640px; }

/* Tool — full width, aligned with sections below */
.tool-wrap { margin-top: 4px; }
.inputs { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); margin-bottom: 24px; }
/* Desktop: all five fields in one row, button spans full width below */
@media (min-width: 881px) {
  .inputs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; align-items: start; }
  .inputs .two-col { display: contents; }
  .inputs .input-field { margin-bottom: 0; }
  .inputs .btn, .inputs .error-msg { grid-column: 1 / -1; }
  .inputs .btn { margin-top: 0; }
}
.inputs .input-field { margin-bottom: 18px; }
.inputs label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--ink); letter-spacing: .02em; }
.inputs label .opt { font-weight: 400; color: var(--muted); font-size: 12px; }
.inputs .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-suffix { position: relative; }
.input-suffix input {
  width: 100%; padding: 13px 52px 13px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-size: 16px; color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s;
  font-family: 'Work Sans', sans-serif;
}
.input-suffix input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,95,99,.1); }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; font-weight: 500; pointer-events: none; }

.gender-toggle { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.gender-toggle .gender-btn { flex: 1; padding: 12px; border: none; background: #fff; color: var(--ink-soft); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; font-family: 'Work Sans', sans-serif; }
.gender-toggle .gender-btn.active { background: var(--primary); color: #fff; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hint.live { color: var(--positive); }

.field.invalid input, .input-field.invalid input { border-color: var(--flame); box-shadow: 0 0 0 3px rgba(240,116,75,.12); }

.buttons { display: flex; gap: 10px; }

.btn {
  width: 100%; padding: 15px; background: var(--primary); color: #fff; border: none;
  border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 6px;
  transition: background .2s, transform .1s; font-family: 'Work Sans', sans-serif; letter-spacing: .01em;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.99); }

.error-msg { color: var(--flame); font-size: 14px; margin-top: 12px; display: none; }
.error-msg.show { display: block; }

/* Results */
.results { display: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.results.show { display: block; animation: fadeUp .45s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.score-hero { text-align: center; background: linear-gradient(135deg, var(--primary-soft), #f2f7f5); border: 1px solid #d4e5e1; border-radius: var(--radius); padding: 26px 20px; margin-bottom: 20px; }
.score-num { font-family: 'Fraunces', Georgia, serif; font-size: 56px; font-weight: 500; line-height: 1; color: var(--primary-dark); }
.score-label { font-size: 15px; font-weight: 600; color: var(--primary); margin-top: 6px; }
.score-note { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }

.formula-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.formula-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; transition: border-color .2s, box-shadow .2s; }
.formula-card.is-rec { border-color: #cfe3df; background: #f7fbfa; }
.formula-card .fc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 10px; }
.formula-card .fc-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.formula-card .fc-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary-dark); letter-spacing: .02em; white-space: nowrap; }
.formula-card[data-f="katch"]:not(.enabled) { opacity: .55; }
.formula-card[data-f="katch"].enabled .fc-badge { background: var(--flame-soft); color: var(--flame); }
.formula-card .fc-value { font-family: 'Fraunces', Georgia, serif; font-size: 34px; font-weight: 500; color: var(--primary-dark); line-height: 1.1; }
.formula-card[data-f="katch"] .fc-value { color: var(--flame); }
.formula-card .fc-desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.tdee-block { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.tdee-label { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.activity-select {
  width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px;
  font-size: 14px; color: var(--ink); background: #fff; font-family: 'Work Sans', sans-serif; cursor: pointer;
}
.activity-select:focus { outline: none; border-color: var(--primary); }
.tdee-result { text-align: center; margin-top: 16px; }
.tdee-num { font-family: 'Fraunces', Georgia, serif; font-size: 44px; font-weight: 500; color: var(--flame); line-height: 1; }
.tdee-cap { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.age-block { }
.age-head { margin-bottom: 12px; }
.age-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.age-sub { font-size: 12px; color: var(--muted); }
.age-chart { width: 100%; height: auto; background: linear-gradient(#f8faf9, #fff); border: 1px solid var(--line); border-radius: 14px; display: block; }
.age-tip { font-size: 13px; color: var(--ink-soft); margin-top: 14px; padding: 12px 16px; background: var(--primary-soft); border-radius: 12px; line-height: 1.6; }

/* Sections */
.section { margin-top: 52px; }
.section h2 { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 500; margin-bottom: 16px; letter-spacing: -.4px; color: var(--ink); }
.section h3 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; color: var(--primary-dark); }
.section p { margin-bottom: 14px; color: var(--ink); }
.section ul { margin: 0 0 16px 22px; }
.section li { margin-bottom: 8px; }

.formula-box { background: #fff; border: 1px dashed var(--line); border-left: 4px solid var(--primary); border-radius: 10px; padding: 14px 18px; margin-bottom: 8px; font-family: 'JetBrains Mono', Menlo, monospace; font-size: 13.5px; line-height: 1.8; color: var(--ink); }

.ref-table { width: 100%; border-collapse: collapse; margin: 14px 0 20px; font-size: 14px; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.ref-table th, .ref-table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--line); }
.ref-table thead th { background: var(--paper); font-weight: 600; color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.ref-table tr:last-child td { border-bottom: none; }
.ref-table td.cell-strong { font-weight: 600; color: var(--primary-dark); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-item summary { font-weight: 600; font-size: 16px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 22px; color: var(--primary); font-weight: 400; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { margin-top: 12px; color: var(--ink-soft); font-size: 15px; }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); padding: 38px 20px; }
.site-footer .inner { max-width: var(--max-width); margin: 0 auto; }
.site-footer .footer-brand { font-family: 'Fraunces', Georgia, serif; font-size: 18px; font-weight: 600; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.footer-logo { border-radius: 6px; background: var(--primary-soft); }
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 16px; }
.site-footer .footer-links a { color: var(--ink-soft); text-decoration: none; font-size: 14px; transition: color .2s; }
.site-footer .footer-links a:hover { color: var(--primary); }
.site-footer .copyright { font-size: 13px; color: #a6b0b3; }

/* Cookie banner */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); color: #fff; padding: 18px 20px; z-index: 9999; display: none; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.cookie-banner.show { display: flex; }
.cookie-banner p { font-size: 14px; max-width: 600px; }
.cookie-banner p a { color: #9fd0cc; }
.cookie-banner .cookie-btns { display: flex; gap: 10px; }
.cookie-banner .btn-cookie { padding: 9px 22px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; }
.cookie-banner .btn-accept { background: var(--primary); color: #fff; }
.cookie-banner .btn-decline { background: transparent; color: #fff; border: 1px solid #64748b; }

/* Responsive */
@media (max-width: 880px) {
  .formula-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .site-header .inner { position: relative; }
  .menu-btn { display: flex; }
  nav { display: contents; }
  .site-header .nav-links { position: absolute; top: calc(100% + 8px); left: 0; right: 0; flex-direction: column; gap: 2px; padding: 8px; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(28,42,46,.14); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .2s, transform .2s, visibility .2s; }
  .site-header .nav-links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .site-header .nav-links a { display: block; padding: 11px 14px; }
  .hero h1 { font-size: 24px; }
  .score-num { font-size: 44px; }
  .section h2 { font-size: 23px; }
  /* wide tables scroll within their own box instead of stretching the page */
  .ref-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cookie-banner { flex-direction: column; text-align: center; }
}

/* Compliance pages */
.page-content { max-width: 820px; margin: 0 auto; padding: 46px 20px 70px; }
.page-content h1 { font-family: 'Fraunces', Georgia, serif; font-size: 34px; font-weight: 500; margin-bottom: 24px; letter-spacing: -.4px; }
.page-content h2 { font-size: 20px; font-weight: 600; margin: 30px 0 12px; color: var(--primary-dark); }
.page-content p { margin-bottom: 14px; color: var(--ink); }
.page-content ul { margin: 0 0 16px 22px; }
.page-content li { margin-bottom: 8px; }
.page-content a { color: var(--primary); }
.contact-form { margin-top: 20px; }
.contact-form .field { margin-bottom: 18px; }
.contact-form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.contact-form input, .contact-form textarea { width: 100%; padding: 13px 16px; border: 2px solid var(--line); border-radius: 10px; font-size: 15px; font-family: 'Work Sans', sans-serif; background: #fff; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--primary); }
.contact-form .btn { width: auto; padding: 13px 30px; margin-top: 0; }
#contact-status { margin-top: 14px; font-weight: 600; }

/* Article list / article pages */
.content-section h2 { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 500; margin-bottom: 20px; letter-spacing: -.4px; }
.article-list { display: flex; flex-direction: column; gap: 12px; }
.article-list a { display: block; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.article-list a:hover { border-color: var(--primary); box-shadow: 0 4px 18px rgba(14,95,99,.1); transform: translateY(-2px); }
.article-list .article-title { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; line-height: 1.4; }
.article-list a:hover .article-title { color: var(--primary); }
.article-list .article-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.article-content { padding: 46px 0; }
.article-content .inner { max-width: 780px; margin: 0 auto; padding: 0 20px; }
.article-content article { background: #fff; border-radius: 16px; padding: 46px 54px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.article-content h1 { font-family: 'Fraunces', Georgia, serif; font-size: 2rem; font-weight: 500; color: var(--ink); margin-bottom: 12px; line-height: 1.25; letter-spacing: -.5px; }
.article-content .article-meta { font-size: .85rem; color: var(--muted); margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.article-content h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.4rem; font-weight: 500; color: var(--ink); margin: 38px 0 14px; letter-spacing: -.3px; }
.article-content h3 { font-size: 1.08rem; font-weight: 600; color: var(--primary-dark); margin: 26px 0 10px; }
.article-content p { margin-bottom: 18px; color: var(--ink); line-height: 1.85; }
.article-content ul, .article-content ol { margin: 0 0 20px 24px; }
.article-content li { margin-bottom: 10px; line-height: 1.8; }
.article-content a { color: var(--primary); text-decoration: none; font-weight: 500; }
.article-content a:hover { text-decoration: underline; }
.article-content blockquote { border-left: 4px solid var(--primary); padding: 16px 22px; margin: 24px 0; background: var(--primary-soft); border-radius: 0 8px 8px 0; color: var(--ink); }
.article-content code { font-family: 'JetBrains Mono', monospace; background: var(--primary-soft); color: var(--primary-dark); padding: 2px 7px; border-radius: 4px; font-size: .88em; }
.article-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 24px; font-size: .88rem; color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.article-back:hover { color: var(--primary); }
.article-back::before { content: '\2190'; font-size: 1.1rem; }
.faq-section { margin-top: 46px; padding-top: 30px; border-top: 2px solid var(--line); }
.faq-section .faq details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: var(--paper); overflow: hidden; }
.faq-section .faq details[open] { border-color: var(--primary); }
.faq-section .faq summary { padding: 15px 20px; font-weight: 600; font-size: .95rem; cursor: pointer; list-style: none; color: var(--ink); }
.faq-section .faq summary::-webkit-details-marker { display: none; }
.faq-section .faq details p { padding: 0 20px 18px 20px; margin: 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.75; }
.related-articles { margin-top: 46px; padding-top: 30px; border-top: 2px solid var(--line); }
.related-articles ul { list-style: none; display: grid; gap: 10px; }
.related-articles a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 15px 19px; color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 500; }
.related-articles a:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 600px) {
  .article-content article { padding: 28px 22px; border-radius: 12px; }
  .article-content h1 { font-size: 1.5rem; }
  .article-content h2 { font-size: 1.2rem; }
  .site-header .inner:not(:has(.menu-btn)) nav { display: block; }
  .site-header .inner:not(:has(.menu-btn)) .nav-links { position: static; opacity: 1; visibility: visible; transform: none; flex-direction: row; flex-wrap: wrap; gap: 6px; background: none; border: none; box-shadow: none; padding: 0; }
  .site-header .inner:not(:has(.menu-btn)) .nav-links a { padding: 6px 9px; font-size: .8rem; }
}