:root {
  --bmr-accent: var(--nf-green, #00a86b);
  --bmr-accent-dark: var(--nf-green-dark, #008f5c);
  --bmr-page: var(--nf-bg, #f7faf9);
  --bmr-surface: var(--nf-card, #ffffff);
  --bmr-text: var(--nf-text, #081a34);
  --bmr-muted: var(--nf-muted, #66758f);
  --bmr-border: rgba(8, 26, 52, 0.10);
  --bmr-soft: var(--nf-green-soft, #dff7ef);
  --bmr-shadow: 0 18px 50px rgba(8, 26, 52, 0.08);
}

/* Works with NovaFitHub's existing theme variables plus common dark-mode selectors. */
body.dark-mode .bmr-tdee-page,
body.dark .bmr-tdee-page,
html.dark .bmr-tdee-page,
html[data-theme="dark"] .bmr-tdee-page,
body[data-theme="dark"] .bmr-tdee-page {
  --bmr-page: #0b1220;
  --bmr-surface: #111a2b;
  --bmr-text: #eaf2f8;
  --bmr-muted: #a8b4c6;
  --bmr-border: rgba(234, 242, 248, 0.12);
  --bmr-soft: rgba(0, 168, 107, 0.14);
  --bmr-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.bmr-tdee-page {
  width: 100%;
  background: var(--bmr-page);
  color: var(--bmr-text);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.bmr-tdee-article {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 56px 0 72px;
}

.bmr-tdee-hero {
  margin-bottom: 34px;
  padding: 44px clamp(24px, 4vw, 54px);
  border: 1px solid var(--bmr-border);
  border-radius: 24px;
  background: var(--bmr-surface);
  box-shadow: var(--bmr-shadow);
}

.bmr-tdee-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--bmr-soft);
  color: var(--bmr-accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bmr-tdee-hero h1 {
  max-width: 840px;
  margin: 0;
  color: var(--bmr-text);
  font-size: clamp(2rem, 5vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.bmr-tdee-lead {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--bmr-muted);
  font-size: 1.06rem;
  line-height: 1.75;
}

.bmr-tdee-content {
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid var(--bmr-border);
  border-radius: 24px;
  background: var(--bmr-surface);
  box-shadow: var(--bmr-shadow);
}

.bmr-tdee-content section + section {
  margin-top: 48px;
}

.bmr-tdee-content h2,
.bmr-tdee-content h3 {
  color: var(--bmr-text);
  text-align: left;
}

.bmr-tdee-content h2 {
  margin: 0 0 18px;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.bmr-tdee-content h3 {
  margin: 30px 0 12px;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.35;
}

.bmr-tdee-content p,
.bmr-tdee-content li {
  color: var(--bmr-text);
  font-size: 1rem;
  line-height: 1.82;
}

.bmr-tdee-content p {
  margin: 0 0 16px;
}

.bmr-tdee-content ul,
.bmr-tdee-content ol {
  margin: 14px 0 18px;
  padding-left: 24px;
}

.bmr-tdee-content li + li {
  margin-top: 8px;
}

.bmr-tdee-content a {
  color: var(--bmr-accent-dark);
  font-weight: 700;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.bmr-tdee-content a:hover {
  color: var(--bmr-accent);
}

.tool-callout {
  margin-top: 22px !important;
  padding: 18px 20px;
  border-left: 4px solid var(--bmr-accent);
  border-radius: 12px;
  background: var(--bmr-soft);
}

.formula-box {
  margin: 18px 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--bmr-border);
  border-radius: 14px;
  background: var(--bmr-page);
}

.formula-box p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  width: 100%;
  margin: 22px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--bmr-border);
  border-radius: 14px;
  background: var(--bmr-surface);
}

.table-wrap table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bmr-border);
  text-align: left;
  vertical-align: top;
  color: var(--bmr-text);
  line-height: 1.55;
}

.table-wrap thead th {
  background: var(--bmr-soft);
  font-weight: 800;
}

.table-wrap tbody tr:last-child th,
.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.secondary-table {
  margin-top: -24px;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-list details {
  border: 1px solid var(--bmr-border);
  border-radius: 14px;
  background: var(--bmr-page);
  overflow: hidden;
}

.faq-list summary {
  position: relative;
  cursor: pointer;
  padding: 17px 48px 17px 18px;
  list-style: none;
  color: var(--bmr-text);
  font-weight: 750;
  line-height: 1.5;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: '+';
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: var(--bmr-accent);
  font-size: 1.4rem;
  font-weight: 500;
}

.faq-list details[open] summary::after {
  content: '−';
}

.faq-list details p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--bmr-muted);
}

.references-section {
  padding-top: 36px;
  border-top: 1px solid var(--bmr-border);
}

.references-section ol {
  margin-bottom: 10px;
}

.reference-note {
  color: var(--bmr-muted) !important;
  font-size: 0.92rem !important;
}

@media (max-width: 700px) {
  .bmr-tdee-article {
    width: min(100% - 20px, 920px);
    padding: 28px 0 44px;
  }

  .bmr-tdee-hero,
  .bmr-tdee-content {
    border-radius: 18px;
  }

  .bmr-tdee-hero {
    padding: 28px 20px;
    margin-bottom: 18px;
  }

  .bmr-tdee-content {
    padding: 24px 18px 30px;
  }

  .bmr-tdee-content section + section {
    margin-top: 38px;
  }

  .bmr-tdee-content p,
  .bmr-tdee-content li {
    font-size: 0.97rem;
    line-height: 1.75;
  }

  .table-wrap {
    border-radius: 12px;
  }

  .table-wrap th,
  .table-wrap td {
    padding: 12px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bmr-tdee-page {
    transition: none;
  }
}
