// fc-coach-tips.jsx — the Coach Insight Card matrix (from Figma).
// Sport × cut-aggressiveness tier → a coaching tip {headline, body}. This is the
// sport-specific plan summary surfaced on the reveal. Tiers map to the cut-rate
// the athlete is on: 'ideal' (<1%/wk, the safe recommendation), 'fast', 'veryfast'.
// Transcribed verbatim from the Figma cards; BJJ (no-gi) reuses BJJ; Judo &
// Wrestling extend the set in the same voice (not in the original Figma).

const COACH_TIPS = {
  Boxing: {
    ideal: { headline: 'This cut gives you time to preserve your punch power.', body: "Boxing is about endurance and sharpness over the rounds. A steady cut like this protects your punch power and keeps your gas tank full. You'll step into the ring light, strong, and ready to outlast your opponent." },
    fast: { headline: 'This quick cut means staying sharp under pressure.', body: "You'll make the weight in time, but it can test your stamina and sharpness in later rounds. Staying disciplined will help you keep your combinations crisp and your reactions sharp." },
    veryfast: { headline: 'This aggressive cut can bring range, but it costs endurance.', body: "This is an aggressive cut, common when time is short. It may leave you feeling flat, but with proper recovery you can still show up lighter and rangier in the ring. Expect some trade-offs in endurance." },
  },
  BJJ: {
    ideal: { headline: 'This steady cut helps you roll with stamina and control.', body: "BJJ demands grip strength, flexibility, and stamina. A gradual cut helps preserve your conditioning so you can push the pace in scrambles and maintain control deep into matches." },
    fast: { headline: "You'll make the division, but scrambles may feel heavier.", body: "Cutting faster means the weight will come off, but it can take the edge off your stamina. Expect rolls to feel heavier at times, so staying efficient with energy will be key on the mat." },
    veryfast: { headline: 'This aggressive cut can risk your strength and guard work.', body: "A steep cut can get you into your division but often at the cost of strength and endurance. Expect some drop in power and guard work to feel tougher — your focus will be on holding sharp positions." },
  },
  MMA: {
    ideal: { headline: 'This balanced cut keeps you ready in every phase of the fight.', body: "MMA requires balance across striking, grappling, and cardio. A steady cut protects your strength and explosiveness in every phase of the fight, letting you perform at your best everywhere." },
    fast: { headline: 'A fast cut trades comfort for competitiveness.', body: "This faster cut will get you into your division, but it can come at the cost of recovery between sessions. You may feel training intensity dip, but you'll still be ready to compete across all phases." },
    veryfast: { headline: "This steep cut gives size, but you'll feel the drain.", body: "This is a steep cut and comes with trade-offs. It often leaves fighters feeling drained, but it can provide the size advantage needed in the cage if rehydration goes well." },
  },
  'Muay Thai': {
    ideal: { headline: 'This steady cut keeps your kicks and clinch power sharp.', body: "Muay Thai relies on snap, balance, and late-round toughness. A steady cut lets you hold clinch power and keep your kicks and knees sharp through all rounds." },
    fast: { headline: 'This fast cut can test your conditioning and rhythm.', body: "This faster cut can test your conditioning and fluidity. Expect some tightness, but it will still get you light for competition with enough to keep your rhythm intact." },
    veryfast: { headline: 'This aggressive cut can sap explosiveness and timing.', body: "A steep cut often affects explosiveness and timing. You'll make the weight, but strikes and balance may feel heavier than usual. Fight-week recovery will matter most." },
  },
  Taekwondo: {
    ideal: { headline: 'This steady cut protects your kicking speed.', body: "Taekwondo is about speed, flexibility, and reaction time. A steady cut helps preserve fast kicks and sharp reflexes so you stay quick on your feet." },
    fast: { headline: 'This fast cut may tighten your flexibility.', body: "Cutting faster will get you to weight but can tighten up flexibility. You may feel some heaviness in kicks, so conserving energy in matches will help." },
    veryfast: { headline: 'This steep cut risks slowing your reactions.', body: "A steep cut risks slowing down your reaction time and kicks. You'll make weight, but explosiveness may be harder to maintain through the fight." },
  },
  Judo: {
    ideal: { headline: 'This steady cut keeps your grip and throwing power intact.', body: "Judo lives on grip strength, explosive throws, and ne-waza endurance. A gradual cut protects that power and your gas tank so you can keep attacking deep into a match." },
    fast: { headline: 'This fast cut may take the edge off your grip.', body: "You'll make the category, but a quicker cut can sap grip endurance and throwing snap. Stay efficient on the mat and lean on the day-before re-weigh window to recover." },
    veryfast: { headline: 'This aggressive cut can blunt your throws.', body: "A steep cut will get you to your category but often costs explosive power and grip stamina. Expect some heaviness — recovery before the comp-day control check will be critical." },
  },
  Wrestling: {
    ideal: { headline: 'This steady cut keeps your scramble power and engine.', body: "Wrestling demands relentless scrambling and a deep gas tank. A gradual, real-weight cut protects your power and conditioning so you can keep the pace and ride out matches." },
    fast: { headline: 'This fast cut can test your engine on the mat.', body: "You'll make weight, but a quicker cut can dull your scramble power and stamina. With same-day weigh-ins there's little time to rebuild, so disciplined fueling matters most." },
    veryfast: { headline: 'This aggressive cut risks your power and gas tank.', body: "A steep cut gets you to weight fast but can leave you flat — and same-day weigh-ins give almost no rehydration window. Expect trade-offs in scramble power and endurance." },
  },
  Other: {
    ideal: { headline: 'This steady cut protects your strength and stamina.', body: "A steady cut is the safest approach for most combat sports. It helps you make weight while protecting strength and stamina so you can compete at your best." },
    fast: { headline: 'This fast cut will get you lighter, but it tests endurance.', body: "A faster cut will make the weight but may reduce endurance and power. Expect to feel some fatigue, but you'll still carry a lighter frame into competition." },
    veryfast: { headline: 'This steep cut gets you down, but performance may dip.', body: "A steep cut gets you into your division quickly but often at the cost of performance. You may feel drained — recovery after weigh-in will be critical." },
  },
};

// pace tier from %/wk (the safe ceiling is 1%/wk). Mirrors the cut-rate flow.
function paceTierFromRate(ratePct) {
  if (ratePct == null) return 'ideal';
  if (ratePct < 1.0) return 'ideal';
  if (ratePct < 1.4) return 'fast';
  return 'veryfast';
}

// resolve a tip for a sport + tier, with sensible fallbacks.
function coachTip(sport, tier = 'ideal') {
  const map = { 'BJJ (no-gi)': 'BJJ' };
  const key = COACH_TIPS[sport] ? sport : (COACH_TIPS[map[sport]] ? map[sport] : 'Other');
  const row = COACH_TIPS[key] || COACH_TIPS.Other;
  return row[tier] || row.ideal;
}

Object.assign(window, { COACH_TIPS, coachTip, paceTierFromRate });
