/* Page-level content for all 5 routes */

const { useState: usePageS } = React;

// ─── Hub / homepage ──────────────────────────────────────────────────────
function PageHub({ onNavigate, mobile }) {
  return (
    <main>
      <div className="container">
        <section className="hero">
          <div className="hero-eyebrow">Free · No signup · Static</div>
          <h1 className="t-display">TDEE Calculator</h1>
          <p className="hero-sub">
            From a number to a plan. Get your maintenance calories, then pick a goal — cut, recomp, maintain, or reverse — and we'll do the rest.
          </p>
        </section>
        <TDEECalculator variant="hub" mobile={mobile} />
      </div>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>What you get</div>
            <h2 className="t-h2">Three things every TDEE calculator should give you. Most don't.</h2>
          </div>
        </div>
        <div className="feature-grid">
          <div className="feature-card">
            <div className="feature-num">01</div>
            <h3>Goal-based plan</h3>
            <p>Not just a number. Pick cut, maintain, recomp, or reverse — see daily calories, weekly milestones, and a realistic goal date.</p>
          </div>
          <div className="feature-card">
            <div className="feature-num">02</div>
            <h3>All three formulas</h3>
            <p>Mifflin-St Jeor by default. Switch to Katch-McArdle if you know your body fat %, or Cunningham if you're a serious lifter.</p>
          </div>
          <div className="feature-card">
            <div className="feature-num">03</div>
            <h3>Privacy-first</h3>
            <p>No signup. No email. Calculations stay in your browser. Your last 50 plans saved locally — clear them anytime.</p>
          </div>
        </div>
      </section>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>How to calculate TDEE</div>
            <h2 className="t-h2">Calculate TDEE in four steps</h2>
            <p className="t-body-lg" style={{ marginTop: 12 }}>
              TDEE (Total Daily Energy Expenditure) is the total calories your body burns in 24 hours. To calculate TDEE, estimate your BMR with the Mifflin-St Jeor equation, then multiply by an activity factor between 1.2 and 1.9.
            </p>
          </div>
        </div>
        <ol className="howto-steps">
          <li>
            <div className="howto-num mono">01</div>
            <div>
              <h3 className="t-h3" style={{ margin: 0, marginBottom: 6 }}>Measure your inputs</h3>
              <p className="t-body" style={{ margin: 0, color: "var(--text-muted)" }}>
                You need four numbers: sex, age in years, height in centimeters, and weight in kilograms. If you have a recent body fat % from DEXA or a caliper test, write it down too.
              </p>
            </div>
          </li>
          <li>
            <div className="howto-num mono">02</div>
            <div>
              <h3 className="t-h3" style={{ margin: 0, marginBottom: 6 }}>Calculate your BMR</h3>
              <p className="t-body" style={{ margin: 0, color: "var(--text-muted)" }}>
                Use Mifflin-St Jeor: <span className="mono">10 × weight + 6.25 × height − 5 × age + 5</span> for men, and the same formula minus 161 for women. Example: a 30-year-old man at 80 kg and 178 cm has a BMR of 1,768 calories.
              </p>
            </div>
          </li>
          <li>
            <div className="howto-num mono">03</div>
            <div>
              <h3 className="t-h3" style={{ margin: 0, marginBottom: 6 }}>Pick an activity multiplier</h3>
              <p className="t-body" style={{ margin: 0, color: "var(--text-muted)" }}>
                Multiply BMR by 1.2 (sedentary, desk job), 1.375 (light, 1–3 workouts/week), 1.55 (moderate, 3–5 workouts), 1.725 (active, 6–7 workouts), or 1.9 (athlete, physical job plus training).
              </p>
            </div>
          </li>
          <li>
            <div className="howto-num mono">04</div>
            <div>
              <h3 className="t-h3" style={{ margin: 0, marginBottom: 6 }}>Adjust for your goal</h3>
              <p className="t-body" style={{ margin: 0, color: "var(--text-muted)" }}>
                Eat at TDEE to maintain weight. Subtract 10–20% to lose fat (a 500-calorie deficit ≈ 1 lb/week). Add 5–10% to gain muscle. Recalculate every 5–10 lb of body weight change.
              </p>
            </div>
          </li>
        </ol>
      </section>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Compare formulas</div>
            <h2 className="t-h2">Mifflin-St Jeor vs Katch-McArdle vs Cunningham</h2>
          </div>
        </div>
        <table className="cmp-table">
          <thead><tr>
            <th>Formula</th><th>Best for</th><th>Inputs</th><th>Accuracy</th>
          </tr></thead>
          <tbody>
            <tr>
              <td><strong>Mifflin-St Jeor</strong> <Chip>default</Chip></td>
              <td>General population</td>
              <td className="mono">sex · age · ht · wt</td>
              <td>±10%</td>
            </tr>
            <tr>
              <td><strong>Katch-McArdle</strong></td>
              <td>Lifters with known BF%</td>
              <td className="mono">wt · bf%</td>
              <td>Better for muscular bodies</td>
            </tr>
            <tr>
              <td><strong>Cunningham</strong></td>
              <td>Athletes, very lean</td>
              <td className="mono">wt · bf%</td>
              <td>Best for high-LBM</td>
            </tr>
          </tbody>
        </table>

        <div className="formula-explainer">
          <h3 className="t-h3" style={{ margin: 0, marginBottom: 8 }}>How is this calculated?</h3>
          <p className="t-body" style={{ margin: 0, color: "var(--text-muted)" }}>
            We use Mifflin-St Jeor by default — the most accurate generic formula:
          </p>
          <div className="formula-block">
            Men: &nbsp;&nbsp;BMR = 10W + 6.25H − 5A + 5<br/>
            Women: BMR = 10W + 6.25H − 5A − 161
          </div>
          <p className="t-caption" style={{ margin: 0 }}>
            W = weight (kg), H = height (cm), A = age (years). Then TDEE = BMR × activity multiplier (1.2 sedentary → 1.9 athlete).
          </p>
        </div>
      </section>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Pick your audience</div>
            <h2 className="t-h2">Goal-specific calculators</h2>
          </div>
        </div>
        <div className="aud-grid">
          {[
            { url: "/weight-loss/", icon: "↘", title: "Calorie deficit", desc: "Cutting calories with a goal date" },
            { url: "/macros/", icon: "%", title: "Macro split", desc: "Protein, carbs, and fat in grams" },
            { url: "/women/", icon: "♀", title: "Women's TDEE", desc: "Cycle, pregnancy, perimenopause" },
            { url: "/body-fat/", icon: "Σ", title: "Body fat %", desc: "Katch-McArdle for lifters" },
          ].map((a) => (
            <button key={a.url} className="aud-card" onClick={() => onNavigate(a.url)}>
              <div className="aud-card-icon">{a.icon}</div>
              <h3>{a.title}</h3>
              <p>{a.desc}</p>
              <div className="aud-card-arrow">{a.url} →</div>
            </button>
          ))}
        </div>
      </section>

      <FAQSection items={HUB_FAQ} />
    </main>
  );
}

// ─── Weight loss page ────────────────────────────────────────────────────
function PageWeightLoss({ mobile }) {
  return (
    <main>
      <div className="container">
        <section className="hero">
          <div className="hero-eyebrow">Cluster · Weight loss</div>
          <h1 className="t-display">TDEE Calculator for Weight Loss</h1>
          <p className="hero-sub">Find your cutting calories and a realistic goal date — without guesswork.</p>
        </section>
        <TDEECalculator variant="weight-loss" mobile={mobile} />
      </div>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Deficit science</div>
            <h2 className="t-h2">How calorie deficits actually work</h2>
            <p className="t-body-lg" style={{ marginTop: 12 }}>
              Fat loss happens when you eat fewer calories than your body burns. 1 kg of body fat ≈ 7,700 cal. A 500 cal/day deficit gives ~0.5 kg/week.
            </p>
          </div>
        </div>
        <table className="cmp-table">
          <thead><tr>
            <th>Deficit</th><th>Daily (TDEE 2,500)</th><th>Weekly loss</th><th>Sustainability</th>
          </tr></thead>
          <tbody>
            <tr><td className="mono">10%</td><td className="mono">−250 cal</td><td className="mono">~0.45 lb</td><td><Chip tone="accent">Very high</Chip></td></tr>
            <tr><td className="mono">15%</td><td className="mono">−375 cal</td><td className="mono">~0.7 lb</td><td><Chip tone="accent">High</Chip></td></tr>
            <tr><td className="mono">20%</td><td className="mono">−500 cal</td><td className="mono">~0.9 lb</td><td><Chip>Moderate</Chip></td></tr>
            <tr><td className="mono">25%+</td><td className="mono">−625+ cal</td><td className="mono">1.1+ lb</td><td><Chip tone="warning">Risk muscle loss</Chip></td></tr>
          </tbody>
        </table>
      </section>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Why most cuts fail</div>
            <h2 className="t-h2">Week 6 is where it breaks.</h2>
          </div>
        </div>
        <div className="feature-grid" style={{ gridTemplateColumns: "1fr 1fr" }}>
          <div className="feature-card">
            <div className="feature-num">01 — Metabolic adaptation</div>
            <h3>NEAT drops 100–300 cal/day</h3>
            <p>Your body responds to a deficit by lowering non-exercise activity. You fidget less, walk less, take stairs less. After 4–6 weeks your starting deficit shrinks itself.</p>
          </div>
          <div className="feature-card">
            <div className="feature-num">02 — Adherence drift</div>
            <h3>Tracking gets sloppy</h3>
            <p>Weekend overshoots add up. The 500 cal deficit you planned becomes 200 after honest accounting. Weigh weekly with a rolling average, recalculate every 5–10 lb of loss.</p>
          </div>
        </div>
      </section>

      <FAQSection items={WL_FAQ} />
    </main>
  );
}

// ─── Macros ──────────────────────────────────────────────────────────────
function PageMacros({ mobile }) {
  const [preset, setPreset] = usePageS("standard");
  const tdee = 2400; // demo for the sample chart below
  const split = window.TDEE.MACRO_PRESETS[preset];
  const macros = window.TDEE.calculateMacros({ dailyCalories: tdee, split });

  return (
    <main>
      <div className="container">
        <section className="hero">
          <div className="hero-eyebrow">Cluster · Macros</div>
          <h1 className="t-display">TDEE Macro Calculator</h1>
          <p className="hero-sub">Protein, carbs, and fat — split for your goal, in grams you can actually hit.</p>
        </section>
        <TDEECalculator variant="macros" mobile={mobile} />
      </div>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Macro split</div>
            <h2 className="t-h2">Pick a preset, see grams.</h2>
            <p className="t-body-lg" style={{ marginTop: 12 }}>
              For most people, fix protein first (1.6–2.2 g/kg), then split the remainder. Below: live preview at a 2,400 cal target.
            </p>
          </div>
        </div>
        <div className="macro-presets" style={{ marginBottom: 16 }}>
          {Object.entries(window.TDEE.MACRO_PRESETS).map(([k, v]) => (
            <button key={k} className={"macro-preset" + (preset === k ? " is-active" : "")} onClick={() => setPreset(k)}>
              {v.label}
            </button>
          ))}
        </div>
        <div style={{ padding: 24, background: "var(--bg-elevated)", border: "1px solid var(--border)", borderRadius: 12 }}>
          <MacroChart macros={macros} dailyCalories={tdee} />
          <p className="t-caption" style={{ marginTop: 16, color: "var(--text-subtle)" }}>
            Calories per gram: protein 4 · carbs 4 · fat 9. Totals may differ ±1 cal due to rounding.
          </p>
        </div>
      </section>

      <FAQSection items={MACRO_FAQ} />
    </main>
  );
}

// ─── Women ───────────────────────────────────────────────────────────────
function PageWomen({ mobile }) {
  return (
    <main>
      <div className="container">
        <section className="hero">
          <div className="hero-eyebrow">Cluster · Women</div>
          <h1 className="t-display">TDEE Calculator for Women</h1>
          <p className="hero-sub">Calories that account for your cycle, life stage, and physiology — not just sex.</p>
        </section>
        <TDEECalculator variant="women" mobile={mobile} />
      </div>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Why generic TDEE underestimates women</div>
            <h2 className="t-h2">Most formulas were validated on majority-male populations.</h2>
          </div>
        </div>
        <div className="feature-grid">
          <div className="feature-card"><div className="feature-num">Cycle phase</div><h3>+5–10% in luteal</h3><p>BMR is roughly 5–10% higher in the luteal phase compared to follicular. A 50–100 cal/day swing.</p></div>
          <div className="feature-card"><div className="feature-num">Pregnancy</div><h3>+340 / +450 cal</h3><p>WHO guidelines: T2 +340, T3 +450. Always work with your healthcare provider on specifics.</p></div>
          <div className="feature-card"><div className="feature-num">Breastfeeding</div><h3>+500 cal exclusive</h3><p>Exclusive breastfeeding adds ~500 cal/day (0–6mo). Partial breastfeeding ~400 cal (6–12mo).</p></div>
          <div className="feature-card"><div className="feature-num">Perimenopause</div><h3>−50–100 cal</h3><p>Shifting estrogen and progesterone levels lower BMR. Common cause of unexplained weight gain in late 30s–early 50s.</p></div>
          <div className="feature-card"><div className="feature-num">Post-menopause</div><h3>Stable but lower</h3><p>BMR settles 100–200 cal lower than pre-perimenopause baseline. Recalculate; don't crash diet.</p></div>
          <div className="feature-card"><div className="feature-num">Endocrine conditions</div><h3>PCOS · hypothyroid</h3><p>Significantly affect energy expenditure. Always check with your healthcare team — calculator estimates are starting points only.</p></div>
        </div>
      </section>

      <FAQSection items={WOMEN_FAQ} />
    </main>
  );
}

// ─── Body fat ────────────────────────────────────────────────────────────
function PageBodyFat({ mobile }) {
  return (
    <main>
      <div className="container">
        <section className="hero">
          <div className="hero-eyebrow">Cluster · Body fat</div>
          <h1 className="t-display">TDEE Calculator with Body Fat %</h1>
          <p className="hero-sub">Katch-McArdle formula — for serious lifters who know their body composition.</p>
        </section>
        <TDEECalculator variant="body-fat" mobile={mobile} />
      </div>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Why body fat % matters</div>
            <h2 className="t-h2">Two people, same weight, very different metabolism.</h2>
            <p className="t-body-lg" style={{ marginTop: 12 }}>
              Standard formulas use total body weight. Lean mass burns more at rest than fat. If you have a recent reliable BF% measurement, Katch-McArdle is more accurate for you.
            </p>
          </div>
        </div>
        <div className="bf-compare">
          <div className="bf-card">
            <div className="bf-card-label">
              <span className="t-label">Person A · 25% BF</span>
              <Chip>60 kg LBM</Chip>
            </div>
            <div className="bf-card-val">2,160</div>
            <div className="bf-delta">Mifflin and Katch-McArdle agree closely</div>
          </div>
          <div className="bf-card is-recommended">
            <div className="bf-card-label">
              <span className="t-label">Person B · 12% BF</span>
              <Chip tone="accent">70 kg LBM</Chip>
            </div>
            <div className="bf-card-val">2,408</div>
            <div className="bf-delta"><span className="bf-delta-up">+248</span> calories — Mifflin underestimates</div>
          </div>
        </div>
      </section>

      <section className="section container">
        <div className="section-head">
          <div className="section-head-text">
            <div className="t-label" style={{ marginBottom: 8 }}>Body fat measurement accuracy</div>
            <h2 className="t-h2">If your number's wrong, the formula's wrong.</h2>
          </div>
        </div>
        <table className="cmp-table">
          <thead><tr>
            <th>Method</th><th>Accuracy</th><th>Cost</th><th>Notes</th>
          </tr></thead>
          <tbody>
            <tr><td><strong>DEXA scan</strong></td><td className="mono">±1–3%</td><td className="mono">$50–150</td><td>Gold standard</td></tr>
            <tr><td>Hydrostatic</td><td className="mono">±2–3%</td><td className="mono">$50–100</td><td>Old gold standard, hard to find</td></tr>
            <tr><td>Bod Pod</td><td className="mono">±2–3%</td><td className="mono">$50–100</td><td>Air displacement</td></tr>
            <tr><td>Skinfold (trained)</td><td className="mono">±3–5%</td><td className="mono">&lt;$20</td><td>Tester-dependent</td></tr>
            <tr><td>InBody / quality BIA</td><td className="mono">±3–5%</td><td className="mono">Variable</td><td>Hydration matters</td></tr>
            <tr><td>Smart scale BIA</td><td className="mono">±5–10%</td><td className="mono">$30–200</td><td><Chip tone="warning">Noisy</Chip></td></tr>
          </tbody>
        </table>
      </section>

      <FAQSection items={BF_FAQ} />
    </main>
  );
}

// ─── FAQ ─────────────────────────────────────────────────────────────────
function FAQSection({ items }) {
  const [open, setOpen] = usePageS(0);
  return (
    <section className="section container">
      <div className="section-head">
        <div className="section-head-text">
          <div className="t-label" style={{ marginBottom: 8 }}>FAQ</div>
          <h2 className="t-h2">Common questions</h2>
        </div>
      </div>
      <div className="faq-list">
        {items.map((item, i) => (
          <div key={i} className="faq-item">
            <button className="faq-q" onClick={() => setOpen(open === i ? -1 : i)}>
              <span>{item.q}</span>
              <span className="faq-q-glyph">{open === i ? "−" : "+"}</span>
            </button>
            {open === i && <div className="faq-a">{item.a}</div>}
          </div>
        ))}
      </div>
    </section>
  );
}

const HUB_FAQ = [
  { q: "How accurate is a TDEE calculator?", a: "Most TDEE formulas estimate within ±10% for typical adults. Your real TDEE depends on factors no formula captures: NEAT, hormones, sleep, stress, body composition. Use the number as a starting point — adjust based on weekly weight change over 2–3 weeks." },
  { q: "What's the most accurate TDEE calculator?", a: "For most people, Mifflin-St Jeor is the most accurate generic formula. If you have a recent, reliable body fat measurement, Katch-McArdle becomes more accurate because it accounts for lean mass instead of total weight." },
  { q: "Should I eat my BMR or my TDEE?", a: "Eat your TDEE if you want to maintain weight. BMR is what you'd burn lying in bed all day — eating only your BMR creates a steep deficit and isn't sustainable for most people." },
  { q: "How many calories should I cut to lose 1 lb a week?", a: "Roughly 500 calories per day below your TDEE. Since 1 lb of fat ≈ 3,500 cal, a 500-cal/day deficit over 7 days = 3,500 cal = 1 lb. Plan for 0.5–1 lb/week for sustainable cuts." },
  { q: "Can I recalculate TDEE every week?", a: "Yes — and you should. As you lose or gain weight, your TDEE changes. We recommend recalculating every 2–4 kg (5–10 lb) of weight change." },
  { q: "Why is my TDEE different on different calculators?", a: "Calculators use different formulas (Mifflin, Harris-Benedict, Katch-McArdle) and different activity multipliers. Pick one calculator and stick with it for consistency." },
  { q: "Is this calculator free?", a: "Yes — completely free, no signup, no email. Funded by ads." },
];
const WL_FAQ = [
  { q: "How much weight can I lose safely per week?", a: "0.5–1% of body weight per week is the sustainable range. For most adults, that's 0.5–2 lb/week. Faster losses cost muscle, willpower, and rebound risk." },
  { q: "Should I eat back exercise calories?", a: "If your activity multiplier already includes exercise, no. If you used 'sedentary' but went to the gym, eat back roughly half the exercise burn — fitness trackers overestimate." },
  { q: "What if I stop losing weight after 6 weeks?", a: "First check the math: weigh weekly, take a 7-day rolling average. If you're truly stalled, recalculate TDEE at your new weight, take a 1–2 week diet break at maintenance, then resume." },
  { q: "What's the difference between a calorie deficit and TDEE calculator?", a: "TDEE is your maintenance number. A deficit calculator subtracts a fixed % or amount to give you a daily target. Same input, two outputs." },
];
const MACRO_FAQ = [
  { q: "How much protein do I need to build muscle?", a: "1.6–2.2 g/kg of bodyweight (0.7–1 g/lb) covers nearly everyone. Going above 2.2 g/kg shows diminishing returns in research." },
  { q: "Are carb and fat ratios that important?", a: "Less than protein. After hitting your protein target, the carb/fat split is mostly preference. Active people generally feel better with more carbs; some prefer high-fat." },
  { q: "Can I do keto with this calculator?", a: "Yes. Pick the keto preset (25P/5C/70F). Keto isn't magical for fat loss — it just changes fuel sources — but works well for some." },
  { q: "What's IIFYM?", a: "If It Fits Your Macros — flexible dieting where you hit total protein/carb/fat targets without restricting food choices. Same math, different mindset." },
];
const WOMEN_FAQ = [
  { q: "Should women eat less during their period?", a: "No — if anything, BMR is slightly higher in the luteal phase before menstruation. Cravings often increase too. Stay consistent with weekly averages." },
  { q: "How accurate is TDEE during pregnancy?", a: "Use it as a baseline only. WHO adds +340/+450 cal in T2/T3 but individual variation is huge. Always work with your provider." },
  { q: "I'm in perimenopause and gaining weight — what should I do?", a: "Recalculate TDEE — your maintenance has likely dropped 50–100 cal/day. Don't crash diet. Adjust intake by 100–150 cal/day, prioritize protein and resistance training." },
  { q: "Can I use this calculator while breastfeeding?", a: "Yes, with the breastfeeding life-phase selected. Don't aggressively diet while exclusively breastfeeding — milk supply often suffers." },
];
const BF_FAQ = [
  { q: "Which formula should I use if I'm not sure of my body fat?", a: "Mifflin-St Jeor. Don't feed garbage data into Katch-McArdle — a wrong BF% makes it less accurate than the simpler formula." },
  { q: "Is Cunningham more accurate than Katch-McArdle?", a: "Only for elite athletes and very lean individuals (<12% male / <18% female). For everyone else, Katch-McArdle is the better default." },
  { q: "How often should I remeasure body fat?", a: "Every 8–12 weeks if you're cutting or bulking. BF% changes more slowly than weight; weekly measurements are noise." },
  { q: "Why does my smart scale give a different number than DEXA?", a: "Smart scales use bioelectrical impedance — sensitive to hydration, time of day, recent meals. DEXA measures actual tissue. Treat smart scale BF% as ±5–10% noise." },
];

// ─── Static pages ────────────────────────────────────────────────────────
const SUPPORT_EMAIL = "geniusgames.support@gmail.com";

function StaticPage({ eyebrow, title, children }) {
  return (
    <main>
      <div className="container container-narrow">
        <section className="hero" style={{ paddingBottom: 24 }}>
          <div className="hero-eyebrow">{eyebrow}</div>
          <h1 className="t-h1">{title}</h1>
        </section>
        <section className="static-prose">{children}</section>
      </div>
    </main>
  );
}

function PageAbout() {
  return (
    <StaticPage eyebrow="About" title="About tdeegoal.com">
      <p>tdeegoal.com is a free TDEE calculator built around one idea: a number alone is useless — you need a plan. Plug in your stats, pick a goal, and get daily calories, macros, and a realistic timeline.</p>
      <h2>Who it's for</h2>
      <p>Lifters, runners, and anyone who tracks calories seriously. We use validated research formulas (Mifflin-St Jeor, Katch-McArdle, Cunningham) and explain the math instead of hiding it behind a black box.</p>
      <h2>What we don't do</h2>
      <ul>
        <li>No signup, no email capture, no dark patterns.</li>
        <li>No tracking pixels, no analytics that follow you off-site.</li>
        <li>No medical advice — see the <a href="/disclaimer/" onClick={(e) => { e.preventDefault(); window.history.pushState({}, "", "/disclaimer/"); dispatchEvent(new PopStateEvent("popstate")); }}>disclaimer</a>.</li>
      </ul>
      <h2>Contact</h2>
      <p>Questions, feedback, bug reports, partnership inquiries — email <a href={"mailto:" + SUPPORT_EMAIL}>{SUPPORT_EMAIL}</a>. We read everything.</p>
    </StaticPage>
  );
}

function PagePrivacy() {
  return (
    <StaticPage eyebrow="Privacy" title="Privacy policy">
      <p className="t-caption">Last updated: 2026-05-05</p>
      <h2>Short version</h2>
      <p>We don't collect personal data. The calculator runs entirely in your browser. Your inputs and saved plans live in your device's localStorage and never leave it.</p>
      <h2>What we store</h2>
      <ul>
        <li><strong>localStorage (your device only):</strong> theme preference, units (kg/lb), and your last 50 saved plans. Clear it any time via your browser settings.</li>
        <li><strong>Server logs:</strong> our hosting provider (Cloudflare) records standard request metadata — IP, user agent, timestamp — for abuse prevention. We do not access or analyze these logs.</li>
      </ul>
      <h2>Cookies and tracking</h2>
      <p>No tracking cookies. No analytics scripts. No third-party pixels.</p>
      <h2>Advertising</h2>
      <p>We may display ads via Google AdSense to fund the site. AdSense uses cookies for ad personalization, governed by Google's privacy policy. You can opt out at <a href="https://adssettings.google.com/" target="_blank" rel="noopener noreferrer">adssettings.google.com</a>.</p>
      <h2>Your rights</h2>
      <p>Because we don't collect personal data on our servers, there is nothing to request, export, or delete from us. Clearing your browser's site data removes everything we hold about you.</p>
      <h2>Contact</h2>
      <p>Privacy questions: <a href={"mailto:" + SUPPORT_EMAIL}>{SUPPORT_EMAIL}</a>.</p>
    </StaticPage>
  );
}

function PageDisclaimer() {
  return (
    <StaticPage eyebrow="Disclaimer" title="Medical disclaimer">
      <p className="t-caption">Last updated: 2026-05-05</p>
      <p><strong>tdeegoal.com is for educational and informational purposes only. It is not medical advice.</strong></p>
      <h2>Estimates, not prescriptions</h2>
      <p>The calculators on this site use validated formulas (Mifflin-St Jeor, Katch-McArdle, Cunningham) that estimate energy expenditure within roughly ±10% for a typical adult. Real metabolism varies with hormones, sleep, stress, body composition, medications, and conditions no formula can capture.</p>
      <h2>Talk to a professional before</h2>
      <ul>
        <li>Significantly changing your calorie intake.</li>
        <li>Starting an aggressive cut or bulk.</li>
        <li>Following any plan if you are pregnant, breastfeeding, recovering from an eating disorder, or managing a medical condition (diabetes, thyroid disorders, kidney or liver disease, etc.).</li>
        <li>Working with a child or adolescent — these formulas are validated for adults only.</li>
      </ul>
      <p>Consult a registered dietitian, your physician, or a qualified healthcare provider for personalized guidance.</p>
      <h2>No liability</h2>
      <p>We provide this tool "as is" without warranties of any kind. Use it at your own risk. We are not responsible for outcomes resulting from decisions made based on the calculator's output.</p>
      <h2>Contact</h2>
      <p>Questions about a calculation: <a href={"mailto:" + SUPPORT_EMAIL}>{SUPPORT_EMAIL}</a>.</p>
    </StaticPage>
  );
}

Object.assign(window, {
  PageHub, PageWeightLoss, PageMacros, PageWomen, PageBodyFat, FAQSection,
  PageAbout, PagePrivacy, PageDisclaimer,
});
