// src/pages/BlogPostPage.jsx
import React from 'react';
import { useParams, Link, useNavigate, Navigate } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import { motion } from 'framer-motion';
import { ArrowLeft } from 'lucide-react';

// === FULL BLOG CONTENT: 28 CATEGORIES × 5 POSTS EACH ===
const BLOG_CONTENT = {
  'fart-science': {
    'why-farts-smell': {
      title: "Why Do Farts Smell?",
      teaser: "The stinky science behind your toots.",
      content: `
        <p>Ever wondered why some farts smell like <strong>rotten eggs</strong> and others like <em>pure evil</em>? It’s all about <strong>hydrogen sulfide (H₂S)</strong> — the same gas that makes volcanoes reek!</p>
        <p>Foods high in sulfur — like <strong>beans, broccoli, eggs, and onions</strong> — get broken down by gut bacteria. These microbes release H₂S as a byproduct. The more sulfur, the worse the stench.</p>
        <h3>Pro Tip:</h3>
        <p>Take <strong>Beano</strong> before eating beans. It contains enzymes that break down complex sugars <em>before</em> bacteria can turn them into gas.</p>
        <p><strong>Fun Fact:</strong> The average person farts <strong>14 times a day</strong> — that’s over <strong>5,110 toots per year</strong>!</p>
      `
    },
    'fart-volume': {
      title: "How Loud Can a Fart Be?",
      teaser: "Decibels of doom measured.",
      content: `
        <p>The loudest recorded fart hit <strong>107 decibels</strong> — louder than a <em>rock concert</em> or a <strong>chainsaw</strong>!</p>
        <p>Volume depends on:</p>
        <ul>
          <li><strong>Butt cheek tension</strong> — tighter = louder</li>
          <li><strong>Gas pressure</strong> — more buildup = bigger blast</li>
          <li><strong>Clothing</strong> — jeans amplify, underwear muffles</li>
        </ul>
        <p><strong>World Record:</strong> In 1972, a man in a soundproof chamber hit <strong>112 dB</strong>. The microphone nearly broke.</p>
      `
    },
    'fart-fuel': {
      title: "Can Farts Power a Car?",
      teaser: "Methane dreams and green energy.",
      content: `
        <p>Yes! Farts are <strong>60% methane (CH₄)</strong> — the same gas used in natural gas vehicles.</p>
        <p>One person’s daily farts produce enough methane to power a <strong>small LED bulb for 6 hours</strong>.</p>
        <p>Sweden already runs <strong>buses on biogas from human waste</strong>. Fart-powered cars? It’s not science fiction — it’s <em>science flatulence</em>.</p>
      `
    },
    'fart-physics': {
      title: "Fart Physics: Newton’s Third Law",
      teaser: "Every toot has an equal push.",
      content: `
        <p>Newton’s Third Law: <em>For every action, there is an equal and opposite reaction.</em></p>
        <p>When you fart, gas shoots out → your body gets a tiny forward push.</p>
        <p>Astronauts in space use this! A well-timed toot can help adjust position in zero gravity.</p>
        <p><strong>Fun Experiment:</strong> Sit on a swivel chair. Fart hard. Spin slightly. Science!</p>
      `
    },
    'fart-lightning': {
      title: "Fart Lightning: Static Spark Myth",
      teaser: "Can friction ignite gas?",
      content: `
        <p>Myth: <em>Farting in dry pants can create a spark and ignite methane.</em></p>
        <p>Reality: Methane needs <strong>5–15% concentration in air</strong> to ignite. Your fart is too diluted.</p>
        <p>But in a sealed room with 100 people eating beans? <strong>Theoretical risk</strong>.</p>
        <p>Never fart near an open flame. Just don’t.</p>
      `
    }
  },

  'fart-myths': {
    'pharaoh-curse': {
      title: "Pharaoh’s Fart Curse",
      teaser: "Gas that doomed Egypt.",
      content: `
        <p>Legend says King Tut’s tomb was cursed with a <strong>fart so toxic</strong> it killed archaeologists.</p>
        <p>Truth: Mold and bacteria in the sealed tomb released gases. But the <em>idea</em> of a deadly toot? Pure gold.</p>
        <p>Ancient Egyptians believed farts carried souls. Letting one rip = bad omen.</p>
      `
    },
    'dragon-breath': {
      title: "Dragon Farts: Origin of Fire",
      teaser: "Mythical methane breath.",
      content: `
        <p>Dragons don’t breathe fire — they <strong>fart methane</strong> and ignite it with a spark from their teeth.</p>
        <p>Medieval scholars believed dragons ate sulfur-rich rocks. Gut bacteria = endless gas. Spark = fire.</p>
        <p>Explains why knights carried Beano.</p>
      `
    },
    'roman-omen': {
      title: "Farts as Omens in Rome",
      teaser: "Senators feared toots.",
      content: `
        <p>In Ancient Rome, a fart during a speech was a <strong>sign from Jupiter</strong>.</p>
        <p>Julius Caesar once farted mid-senate. Everyone cheered. He won the vote.</p>
        <p>Bad smell? War. Loud blast? Victory. Silent? Betrayal.</p>
      `
    },
    'petomanus-god': {
      title: "Petomanus: God of Farts",
      teaser: "Greek deity of flatulence.",
      content: `
        <p>Petomanus was the forgotten Greek god of wind, stench, and comedy.</p>
        <p>Temples had whoopee cushions. Priests trained in controlled release.</p>
        <p>His symbol: a golden butt trumpet.</p>
      `
    },
    'nostradamus-toot': {
      title: "Nostradamus Fart Prophecies",
      teaser: "Toots foretold the future.",
      content: `
        <p>Nostradamus wrote: <em>“From the rear shall come a wind, and the world shall know change.”</em></p>
        <p>Historians now believe he predicted the <strong>Great Bean Famine of 1789</strong>.</p>
      `
    }
  },

  'food-farts': {
    'bean-apocalypse': {
      title: "The Great Bean Apocalypse",
      teaser: "12-hour gas storm.",
      content: `
        <p>One can of refried beans = <strong>12 hours of continuous flatulence</strong>.</p>
        <p>Symptoms: Bloating, cramps, and a smell that lingers like regret.</p>
        <p>Pro tip: Pair with rice. It reduces gas by 50%.</p>
      `
    },
    'broccoli-bomb': {
      title: "Broccoli Fart Bomb",
      teaser: "Green cloud of doom.",
      content: `
        <p>Broccoli contains <strong>raffinose</strong> — a sugar humans can’t digest. Gut bacteria feast → sulfur gas.</p>
        <p>One cup = <strong>3–5 farts</strong> within 2 hours.</p>
        <p>Steaming reduces gas. Roasting makes it worse.</p>
      `
    },
    'curry-revenge': {
      title: "Curry’s 48-Hour Revenge",
      teaser: "Spicy aftermath.",
      content: `
        <p>Spicy curry accelerates digestion → food ferments faster → <strong>long-lasting, spicy farts</strong>.</p>
        <p>Smell lingers in clothes for days.</p>
        <p>Yogurt helps. Water makes it worse.</p>
      `
    },
    'egg-sulfur': {
      title: "Egg Sulfur Hell",
      teaser: "Breakfast betrayal.",
      content: `
        <p>Boiled eggs = <strong>pure sulfur</strong>. One egg = one rotten egg fart.</p>
        <p>Hard-boiled = worse than scrambled.</p>
        <p>Eat with toast. Fiber binds the smell.</p>
      `
    },
    'milk-rebellion': {
      title: "Lactose Rebellion",
      teaser: "Dairy strikes back.",
      content: `
        <p>70% of adults are lactose intolerant. Milk = <strong>bloating, cramps, explosive diarrhea</strong>.</p>
        <p>Lactaid pills work. Almond milk = safe zone.</p>
      `
    }
  },

  'space-farts': {
    'zero-g': {
      title: "Farts in Zero Gravity",
      teaser: "NASA’s floating clouds.",
      content: `
        <p>In space, farts don’t rise. They <strong>float in place</strong>.</p>
        <p>Astronauts report <em>gas bubbles</em> drifting through the cabin.</p>
        <p>One ISS crew had to evacuate a module due to a <strong>bean burrito incident</strong>.</p>
      `
    },
    'alien-fart': {
      title: "Do Aliens Fart?",
      teaser: "SETI listens for gas.",
      content: `
        <p>If aliens have digestion, they fart. Methane is a <strong>biomarker</strong> for life.</p>
        <p>Scientists scan exoplanets for methane spikes. Could be cows… or aliens.</p>
        <p>Imagine first contact: “Take me to your leader… and your bathroom.”</p>
      `
    },
    'mars-methane': {
      title: "Terraforming Mars with Farts",
      teaser: "Methane for atmosphere.",
      content: `
        <p>Mars has methane. Could be <strong>ancient farts</strong> from microbes.</p>
        <p>Future colonists could use human gas to thicken the atmosphere.</p>
        <p><strong>Project FartForm:</strong> 1 million people eating beans on Mars.</p>
      `
    },
    'black-hole': {
      title: "Black Hole Farts",
      teaser: "Event horizon gas.",
      content: `
        <p>Black holes burp X-rays when they eat. Scientists call it <strong>feedback</strong>.</p>
        <p>Imagine a black hole with indigestion. Cosmic toot = galaxy-sized blast.</p>
      `
    },
    'beano-orbit': {
      title: "Beano in Orbit",
      teaser: "Anti-fart diet for space.",
      content: `
        <p>NASA tests low-gas diets. Beans are banned. Broccoli is enemy #1.</p>
        <p>Astronauts take <strong>Beano pills</strong> before launch.</p>
        <p>One fart in a spacesuit = <strong>12-hour stink prison</strong>.</p>
      `
    }
  },

  'animal-farts-extreme': {
    'whale-fart': {
      title: "Blue Whale 1000-Gallon Fart",
      teaser: "Ocean-wide stench.",
      content: `
        <p>A blue whale’s fart is <strong>larger than a car</strong>.</p>
        <p>It creates a <em>visible cloud</em> in the water.</p>
        <p>Divers have reported <strong>green bubbles</strong> the size of beach balls.</p>
      `
    },
    'sloth-fart': {
      title: "Sloth Farts Once Every 3 Weeks",
      teaser: "Slow-motion stink.",
      content: `
        <p>Sloths digest so slowly, gas builds for weeks.</p>
        <p>One fart = <strong>earthquake in the canopy</strong>.</p>
        <p>Monkeys flee. Birds fall from trees.</p>
      `
    },
    'manatee-mist': {
      title: "Manatee Fart Clouds",
      teaser: "Mermaid myth origins.",
      content: `
        <p>Manatees fart to float. Bubbles rise like mist.</p>
        <p>Sailors saw bubbles <em>mermaids in the fog</em>. It was manatee gas.</p>
        <p>Disney lied to us.</p>
      `
    },
    'komodo-gas': {
      title: "Komodo Dragon Toxic Farts",
      teaser: "Lizard chemical weapon.",
      content: `
        <p>Komodo breath is deadly. But their farts? <strong>Worse</strong>.</p>
        <p>Contains bacteria that causes sepsis in minutes.</p>
        <p>Prey dies from bite <em>or</em> smell.</p>
      `
    },
    'penguin-boost': {
      title: "Penguin Fart Swim Boost",
      teaser: "Underwater toot power.",
      content: `
        <p>Penguins use farts to propel through water.</p>
        <p>One toot = <strong>5-meter dash</strong>.</p>
        <p>Olympic swimmers take notes.</p>
      `
    }
  },

  'fart-tech': {
    'filter-3000': {
      title: "FartFilter 3000 Underwear",
      teaser: "Carbon tech neutralizer.",
      content: `
        <p>Activated carbon layer traps odor molecules.</p>
        <p>Works for <strong>100+ farts</strong> before washing.</p>
        <p>Used by astronauts, soldiers, and dates.</p>
      `
    },
    'fart-app': {
      title: "FartTrackr AI App",
      teaser: "Predicts your next blast.",
      content: `
        <p>Uses diet, stress, and sleep to predict fart timing.</p>
        <p>Alerts: <em>“Silent but deadly in 12 minutes.”</em></p>
        <p>Privacy mode: Auto-mutes in meetings.</p>
      `
    },
    'fart-drone': {
      title: "FartBomb Delivery Drone",
      teaser: "Prank from the sky.",
      content: `
        <p>Drone drops stink bombs on command.</p>
        <p>Range: 500 meters. Payload: 3 farts.</p>
        <p>Amazon Prime for pranks.</p>
      `
    },
    'fart-laser': {
      title: "Laser Fart Zapper",
      teaser: "Star Wars for stink.",
      content: `
        <p>Uses infrared to break down odor molecules mid-air.</p>
        <p>One zap = <strong>odor gone in 0.3 seconds</strong>.</p>
        <p>Coming to a bathroom near you.</p>
      `
    },
    'fart-nft': {
      title: "Fart NFTs",
      teaser: "Own a digital toot.",
      content: `
        <p>Each NFT is a unique fart waveform.</p>
        <p>Top sale: <strong>$69,420</strong> for “The Silent Scream.”</p>
        <p>Owners get bragging rights and a whoopee cushion.</p>
      `
    }
  },

  'celebrity-farts': {
    'beyonce-stage': {
      title: "Beyoncé Fart on Stage",
      teaser: "Mic caught it live.",
      content: `
        <p>During a 2013 concert, a <strong>low rumble</strong> was caught on mic.</p>
        <p>Fans call it the <em>Formation Fart</em>.</p>
        <p>Beyoncé laughed. The crowd cheered.</p>
      `
    },
    'tom-hanks': {
      title: "Tom Hanks Fart in Cast Away",
      teaser: "Wilson smelled it.",
      content: `
        <p>During filming, Tom let one rip. Wilson floated away in disgust.</p>
        <p>Director kept it in. Oscar-worthy.</p>
      `
    },
    'oprah-toot': {
      title: "Oprah’s On-Air Fart",
      teaser: "You get a smell!",
      content: `
        <p>Live show. Oprah: “You get a car!” <em>*toot*</em> “And you get a smell!”</p>
        <p>Audience laughed for 5 minutes.</p>
      `
    },
    'elon-tesla': {
      title: "Elon Musk Fart in Tesla",
      teaser: "Autopilot blamed.",
      content: `
        <p>Elon tweeted: “Tesla now has fart mode. You’re welcome.”</p>
        <p>Cars play fart sounds on turn signals.</p>
        <p>Regulators confused.</p>
      `
    },
    'taylor-studio': {
      title: "Taylor Swift Fart = Hit Song",
      teaser: "1989 (Fart Edition).",
      content: `
        <p>During recording, Taylor farted. Engineer kept it.</p>
        <p>Became the bass drop in “Shake It Off.”</p>
        <p>Grammy for Best Fart in a Lead Role.</p>
      `
    }
  },

  'fart-horror': {
    'ghost-fart': {
      title: "Ghost Farts in Haunted Houses",
      teaser: "Spirits with gas.",
      content: `
        <p>Ghosts don’t eat. So why the smell?</p>
        <p>Theory: They’re <strong>trapped farts from the living</strong>.</p>
        <p>Exorcism = Beano + holy water.</p>
      `
    },
    'zombie-fart': {
      title: "Zombie Farts: Rotting Gut Gas",
      teaser: "Undead digestion.",
      content: `
        <p>Zombies don’t digest. Food rots inside.</p>
        <p>One bite = <strong>eternal fart</strong>.</p>
        <p>Smell is how you know they’re near.</p>
      `
    },
    'fart-curse-12': {
      title: "Fart That Killed 12 People",
      teaser: "Victorian tragedy.",
      content: `
        <p>1850 London. 12 men in a sealed room. One bean dinner.</p>
        <p>Gas built up. Spark from pipe. <strong>Boom</strong>.</p>
        <p>History’s deadliest toot.</p>
      `
    },
    'demon-portal': {
      title: "Demonic Fart Portal",
      teaser: "Exorcism by Beano.",
      content: `
        <p>Demons enter through farts. Sulfur = gateway.</p>
        <p>Priest uses <strong>Beano + crucifix</strong>.</p>
        <p>Hell smells like eggs.</p>
      `
    },
    'fart-slasher': {
      title: "The Fart Slasher",
      teaser: "Silent but deadly killer.",
      content: `
        <p>Urban legend: Killer farts in elevators. Victims pass out.</p>
        <p>Wakes up with <em>“Silent But Deadly”</em> carved on chest.</p>
        <p>Never trust a quiet lift.</p>
      `
    }
  },

  'fart-sports': {
    'fart-lifting': {
      title: "Fart-Powered Weightlifting",
      teaser: "PR via toot.",
      content: `
        <p>Powerlifters time farts with lifts.</p>
        <p>Extra abdominal pressure = <strong>10kg boost</strong>.</p>
        <p>Judges allow it. It’s natural.</p>
      `
    },
    'fart-yoga': {
      title: "Fart Yoga: The Forbidden Pose",
      teaser: "Downward dog disaster.",
      content: `
        <p>In downward dog, gas escapes. Loudly.</p>
        <p>Yoga studios ban beans. Namaste = <em>“No toots”</em>.</p>
      `
    },
    'fart-marathon': {
      title: "Marathon Fart Strategy",
      teaser: "Pace your gas.",
      content: `
        <p>Runners save farts for the final mile.</p>
        <p>Gas release = <strong>speed boost</strong>.</p>
        <p>World record holder: 2:01:39 + 1 fart.</p>
      `
    },
    'fart-boxing': {
      title: "Fart Distraction in Boxing",
      teaser: "Knockout via smell.",
      content: `
        <p>Fighter farts in clinch. Opponent gags.</p>
        <p>Ref calls it <em>“biological warfare.”</em></p>
        <p>Banned in 12 countries.</p>
      `
    },
    'fart-olympics': {
      title: "Fart Events at Olympics",
      teaser: "New sport proposal.",
      content: `
        <p>Proposed events: Volume, Duration, Odor, Distance.</p>
        <p>Judges wear gas masks.</p>
        <p>Gold medal = lifetime Beano supply.</p>
      `
    }
  },

  'fart-music': {
    'fart-beat': {
      title: "Fart Beats in Hip-Hop",
      teaser: "808s and toots.",
      content: `
        <p>Dr. Dre uses farts as bass drops.</p>
        <p>“Still D.R.E.” has 3 hidden toots.</p>
        <p>Fans remix with their own.</p>
      `
    },
    'fart-opera': {
      title: "Fart in Opera: The High Note",
      teaser: "Aria interruption.",
      content: `
        <p>Tenor hits high C. Farts. Audience applauds.</p>
        <p>Critics call it <em>“avant-garde.”</em></p>
        <p>Encore = encore toot.</p>
      `
    },
    'fart-dj': {
      title: "DJ FartDrop: Club Remix",
      teaser: "Bass + gas.",
      content: `
        <p>DJ drops beat. Then drops a fart.</p>
        <p>Crowd goes wild. Smell included.</p>
        <p>Headphones come with nose plugs.</p>
      `
    },
    'fartophone': {
      title: "The Fartophone",
      teaser: "Wind section.",
      content: `
        <p>Brass instrument powered by farts.</p>
        <p>Plays in C minor (for “crap”).</p>
        <p>Orchestras hire professional farters.</p>
      `
    },
    'fart-symphony': {
      title: "Fart Symphony Orchestra",
      teaser: "Beethoven’s 9th Toot.",
      content: `
        <p>Entire orchestra farts in harmony.</p>
        <p>Conductor waves baton. Then waves hand in front of nose.</p>
        <p>Standing ovation. And evacuation.</p>
      `
    }
  },

  'fart-gaming': {
    'fart-minecraft': {
      title: "Fart Mod in Minecraft",
      teaser: "Creeper gas.",
      content: `
        <p>Creepers explode with farts. Smell radius: 10 blocks.</p>
        <p>Players craft <strong>Beano Armor</strong>.</p>
        <p>Nether smells worse.</p>
      `
    },
    'fart-fortnite': {
      title: "Fart Emote in Fortnite",
      teaser: "Victory toot.",
      content: `
        <p>Victory Royale = fart dance.</p>
        <p>Top players banned for <em>“toxic behavior.”</em></p>
        <p>Skins include whoopee cushion backpack.</p>
      `
    },
    'fart-gta': {
      title: "Fart Radio in GTA",
      teaser: "Drive-by stink.",
      content: `
        <p>Radio station plays fart remixes of classics.</p>
        <p>“Fart It Off” by Taylor Fart.</p>
        <p>Cops chase you for noise pollution.</p>
      `
    },
    'fart-zelda': {
      title: "Link’s Fart Ocarina",
      teaser: "Song of Stink.",
      content: `
        <p>Play song → summon fart cloud.</p>
        <p>Stuns enemies. Heals Ganondorf (he likes it).</p>
        <p>Zelda rolls her eyes.</p>
      `
    },
    'fart-esports': {
      title: "Fart Distraction in eSports",
      teaser: "Pro gamer banned.",
      content: `
        <p>Player farts into mic during tournament.</p>
        <p>Opponent disconnects from smell.</p>
        <p>Banned for <em>“biological DDoS.”</em></p>
      `
    }
  },

  'fart-nature': {
    'volcano-fart': {
      title: "Volcano Farts: Earth’s Gas",
      teaser: "Magma methane.",
      content: `
        <p>Volcanoes release <strong>methane and sulfur</strong>.</p>
        <p>One eruption = <strong>1 billion human farts</strong>.</p>
        <p>Earth’s biggest toot.</p>
      `
    },
    'ocean-fart': {
      title: "Deep Sea Fart Bubbles",
      teaser: "Abyssal toots.",
      content: `
        <p>Fish fart. Bubbles rise 1,000 meters.</p>
        <p>Whales add to the mix. Ocean = giant fart jacuzzi.</p>
      `
    },
    'forest-fart': {
      title: "Forest Fart Ecosystem",
      teaser: "Trees love gas.",
      content: `
        <p>Trees absorb methane. Farts fertilize forests.</p>
        <p>Amazon rainforest = <strong>world’s largest fart filter</strong>.</p>
      `
    },
    'desert-fart': {
      title: "Mirage Farts in Desert",
      teaser: "Heat wave stink.",
      content: `
        <p>Hot air rises. Farts create <em>smell mirages</em>.</p>
        <p>Travelers see oasis. Smell death.</p>
      `
    },
    'arctic-fart': {
      title: "Polar Bear Fart Snow",
      teaser: "Frozen toot crystals.",
      content: `
        <p>Polar bears fart. Gas freezes into <strong>yellow snow</strong>.</p>
        <p>Don’t eat it. Ever.</p>
      `
    }
  },

  'fart-pets': {
    'dog-fart': {
      title: "Dog Farts: Breed Rankings",
      teaser: "Pug vs. Lab.",
      content: `
        <p>Top 3: Pug, Bulldog, Boxer.</p>
        <p>Labradors = silent but deadly.</p>
        <p>Golden Retrievers = polite toots.</p>
      `
    },
    'cat-fart': {
      title: "Cat Farts: Silent & Deadly",
      teaser: "Kitty revenge.",
      content: `
        <p>Cats fart when angry. Or happy. Or asleep.</p>
        <p>Smell lingers in litter box for days.</p>
        <p>They judge you for yours.</p>
      `
    },
    'fish-fart': {
      title: "Fish Farts: Bubble Trouble",
      teaser: "Aquarium gas.",
      content: `
        <p>Goldfish fart bubbles. Clownfish fart jokes.</p>
        <p>Tank smells like low tide.</p>
        <p>Filter can’t keep up.</p>
      `
    },
    'bird-fart': {
      title: "Parrot Fart Mimicry",
      teaser: "Says your toot.",
      content: `
        <p>Parrots learn fart sounds. Repeat at 3 AM.</p>
        <p>Neighbors call exorcist.</p>
      `
    },
    'hamster-fart': {
      title: "Hamster Fart Wheel Power",
      teaser: "Tiny turbine.",
      content: `
        <p>Hamster farts while running. Wheel spins faster.</p>
        <p>Could power LED light.</p>
        <p>Green energy for rodents.</p>
      `
    }
  },

  'fart-dreams': {
    'fart-nightmare': {
      title: "Fart Nightmare: Trapped in Elevator",
      teaser: "No escape.",
      content: `
        <p>You’re stuck. Someone farts. No air. No mercy.</p>
        <p>Wake up gasping. Check pants.</p>
      `
    },
    'fart-lucid': {
      title: "Lucid Fart Dreaming",
      teaser: "Control your toots.",
      content: `
        <p>In lucid dreams, you can fart on command.</p>
        <p>Fly with gas propulsion. Impress dream crush.</p>
      `
    },
    'fart-astral': {
      title: "Astral Fart Projection",
      teaser: "Toot out of body.",
      content: `
        <p>Leave body. Fart travels to other dimensions.</p>
        <p>Aliens smell Earth for first time.</p>
      `
    },
    'fart-prophetic': {
      title: "Fart Dreams Predict Future",
      teaser: "Gas visions.",
      content: `
        <p>Fart in dream = stock market crash.</p>
        <p>Smell eggs = meet soulmate.</p>
        <p>Trust the toot.</p>
      `
    },
    'fart-sleep': {
      title: "Fart During REM Sleep",
      teaser: "Dream toots.",
      content: `
        <p>Brain paralyzes body. But not butt.</p>
        <p>Fart in sleep = <strong>wet dream for gas</strong>.</p>
      `
    }
  },

  'fart-art': {
    'fart-painting': {
      title: "Fart Painting: Gas on Canvas",
      teaser: "Abstract stink.",
      content: `
        <p>Artist farts on canvas. Paint reacts to methane.</p>
        <p>Sold for $1.2M. Buyer: “I smell genius.”</p>
      `
    },
    'fart-sculpture': {
      title: "Fart Cloud Sculptures",
      teaser: "Ephemeral art.",
      content: `
        <p>Sculptor captures fart in glass dome.</p>
        <p>Lasts 3 minutes. Then dissipates.</p>
        <p>Art critics cry.</p>
      `
    },
    'fart-poetry': {
      title: "Fart Haiku Collection",
      teaser: "5-7-5 toots.",
      content: `
        <p><em>Silent wind escapes / Judgment in your lover’s eyes / Love smells like eggs</em></p>
        <p>Published in <strong>Fart Quarterly</strong>.</p>
      `
    },
    'fart-film': {
      title: "Fart Film Festival",
      teaser: "Silent but deadly.",
      content: `
        <p>Short films with no dialogue. Only farts.</p>
        <p>Best Sound Design = loudest toot.</p>
        <p>Red carpet smells like beans.</p>
      `
    },
    'fart-museum': {
      title: "Museum of Fart Art",
      teaser: "Curated gas.",
      content: `
        <p>Exhibits: Fart in a Jar (1923), Whoopee Cushion (Ancient Rome).</p>
        <p>Tours include gas masks.</p>
      `
    }
  },

  'fart-coffee': {
    'espresso-fart': {
      title: "Espresso Fart: Instant Blast",
      teaser: "Caffeine + gas.",
      content: `
        <p>One shot = <strong>one toot</strong> in 10 minutes.</p>
        <p>Baristas warn: “Decaf or disaster.”</p>
      `
    },
    'decaf-fart': {
      title: "Decaf Farts: Still Deadly",
      teaser: "No buzz, all stink.",
      content: `
        <p>Decaf doesn’t reduce gas. Just sadness.</p>
        <p>Still farts. Still smells.</p>
      `
    },
    'latte-fart': {
      title: "Latte Fart Foam",
      teaser: "Milky cloud.",
      content: `
        <p>Milk + espresso = <strong>creamy toot</strong>.</p>
        <p>Foam rises. So does smell.</p>
      `
    },
    'cold-brew-fart': {
      title: "Cold Brew Fart: Slow Release",
      teaser: "12-hour toot.",
      content: `
        <p>Slow extraction = slow gas release.</p>
        <p>One sip = all-day aroma.</p>
      `
    },
    'fart-brew': {
      title: "FartBrew: Coffee for Tooters",
      teaser: "Gas-infused roast.",
      content: `
        <p>Coffee beans aged in fart jars.</p>
        <p>Taste: Earthy. Smell: Familiar.</p>
        <p>Hipsters love it.</p>
      `
    }
  },

  'fart-skulls': {
    'skull-fart': {
      title: "Skull Farts: Bone Gas",
      teaser: "Death smells.",
      content: `
        <p>Skulls don’t fart. But graves do.</p>
        <p>Decomposing bodies release gas for years.</p>
        <p>Ghost farts = real.</p>
      `
    },
    'pirate-fart': {
      title: "Pirate Fart Treasure",
      teaser: "Gas map.",
      content: `
        <p>Pirates marked treasure with farts.</p>
        <p>Smell led to gold. Or doom.</p>
      `
    },
    'viking-fart': {
      title: "Viking Fart Battle Cry",
      teaser: "Toot before raid.",
      content: `
        <p>Vikings farted before battle. Intimidation.</p>
        <p>Enemies fled from smell.</p>
      `
    },
    'phrenology-fart': {
      title: "Phrenology of Farts",
      teaser: "Bump = big toot.",
      content: `
        <p>Skull bumps predict fart power.</p>
        <p>Big “gas lobe” = loud toots.</p>
        <p>Science or pseudoscience? Yes.</p>
      `
    },
    'fart-reaper': {
      title: "Grim Reaper Farts",
      teaser: "Death by stink.",
      content: `
        <p>Reaper collects souls. And gas.</p>
        <p>One whiff = instant death.</p>
        <p>Hell smells like sulfur.</p>
      `
    }
  },

  'fart-ocean': {
    'shark-fart': {
      title: "Shark Farts: Blood in Water",
      teaser: "Chum gas.",
      content: `
        <p>Sharks fart to attract mates. Or prey.</p>
        <p>Smell travels miles.</p>
        <p>Swimmers panic.</p>
      `
    },
    'kraken-fart': {
      title: "Kraken Fart Storm",
      teaser: "Tentacle toot.",
      content: `
        <p>Kraken farts create whirlpools.</p>
        <p>Ships sucked in by smell.</p>
      `
    },
    'mermaid-fart': {
      title: "Mermaid Fart Bubbles",
      teaser: "Underwater perfume.",
      content: `
        <p>Mermaids fart pearls. Or so sailors say.</p>
        <p>Bubbles rise. Smell follows.</p>
      `
    },
    'submarine-fart': {
      title: "Submarine Fart Leak",
      teaser: "Crew panic.",
      content: `
        <p>One fart in sub = <strong>red alert</strong>.</p>
        <p>Crew dons gas masks.</p>
        <p>Captain: “Surface for air!”</p>
      `
    },
    'titanic-fart': {
      title: "Titanic Fart Sinking",
      teaser: "Iceberg toot.",
      content: `
        <p>Iceberg was frozen fart from glacier.</p>
        <p>Smell cracked the hull.</p>
        <p>History rewritten.</p>
      `
    }
  },

  'fart-bugs': {
    'beetle-fart': {
      title: "Beetle Fart Defense",
      teaser: "Stink spray.",
      content: `
        <p>Bombardier beetle farts hot chemicals.</p>
        <p>100°C blast. Kills predators.</p>
      `
    },
    'fly-fart': {
      title: "Fly Fart Buzz",
      teaser: "Annoying toot.",
      content: `
        <p>Flies fart while flying. Buzz + smell.</p>
        <p>Picnic ruined.</p>
      `
    },
    'ant-fart': {
      title: "Ant Fart Colony",
      teaser: "Gas tunnels.",
      content: `
        <p>Ants fart to communicate. Pheromone + methane.</p>
        <p>Colony smells like teamwork.</p>
      `
    },
    'spider-fart': {
      title: "Spider Fart Web",
      teaser: "Sticky stink.",
      content: `
        <p>Spiders fart silk. And gas.</p>
        <p>Web traps flies. Smell traps souls.</p>
      `
    },
    'fart-moth': {
      title: "Moth Fart to Flame",
      teaser: "Attracted to gas.",
      content: `
        <p>Moths love fart smell. Fly into butts.</p>
        <p>Evolution failed.</p>
      `
    }
  },

  'fart-cats': {
    'cat-silent': {
      title: "Cat Silent But Deadly",
      teaser: "Kitty revenge.",
      content: `
        <p>Cat farts on your pillow. You wake up dead inside.</p>
        <p>They stare. You suffer.</p>
      `
    },
    'cat-litter': {
      title: "Cat Litter Fart Mask",
      teaser: "Still smells.",
      content: `
        <p>Litter hides poop. Not farts.</p>
        <p>Room still smells like regret.</p>
      `
    },
    'cat-yawn': {
      title: "Cat Yawn Fart",
      teaser: "Morning breath.",
      content: `
        <p>Cat yawns. Farts. You inhale both.</p>
        <p>Breakfast ruined.</p>
      `
    },
    'cat-zoomies': {
      title: "Fart Zoomies",
      teaser: "Gas-powered sprint.",
      content: `
        <p>Cat farts. Runs at 40 mph.</p>
        <p>Furniture destroyed.</p>
      `
    },
    'cat-judgment': {
      title: "Cat Judges Your Fart",
      teaser: "Stares in disgust.",
      content: `
        <p>You fart. Cat slow-blinks. Leaves room.</p>
        <p>You are dead to them.</p>
      `
    }
  },

  'fart-fish': {
    'goldfish-fart': {
      title: "Goldfish Fart Bubbles",
      teaser: "Tiny toots.",
      content: `
        <p>Goldfish fart every 10 seconds.</p>
        <p>Bowl = bubble machine.</p>
      `
    },
    'puffer-fart': {
      title: "Puffer Fish Fart Inflate",
      teaser: "Gas defense.",
      content: `
        <p>Puffer fills with air. And farts.</p>
        <p>Double defense.</p>
      `
    },
    'clownfish-fart': {
      title: "Clownfish Fart Joke",
      teaser: "Nemo laughs.",
      content: `
        <p>Clownfish fart to make bubbles. For fun.</p>
        <p>Anemone doesn’t mind.</p>
      `
    },
    'shark-fart-2': {
      title: "Shark Fart Chum",
      teaser: "Attracts mates.",
      content: `
        <p>Sharks fart blood + gas. Mating call.</p>
        <p>Romantic.</p>
      `
    },
    'fart-sushi': {
      title: "Fart Sushi Roll",
      teaser: "Wasabi + gas.",
      content: `
        <p>Chef farts into rice. Flavor enhancer.</p>
        <p>5-star Yelp review: “Explosive!”</p>
      `
    }
  },

  'fart-birds': {
    'parrot-fart': {
      title: "Parrot Fart Mimicry",
      teaser: "Repeats your toot.",
      content: `
        <p>Parrot learns fart sound. Says it at dinner.</p>
        <p>Guests leave. Bird promoted.</p>
      `
    },
    'owl-fart': {
      title: "Owl Fart Wisdom",
      teaser: "Hoot + toot.",
      content: `
        <p>Owl farts when wise. Or hungry.</p>
        <p>Forest smells like knowledge.</p>
      `
    },
    'penguin-fart-2': {
      title: "Penguin Fart Slide",
      teaser: "Ice toot.",
      content: `
        <p>Penguin farts on belly. Slides faster.</p>
        <p>Olympic training.</p>
      `
    },
    'eagle-fart': {
      title: "Eagle Fart Dive",
      teaser: "Soaring stink.",
      content: `
        <p>Eagle farts mid-dive. Speed boost.</p>
        <p>Prey never sees it coming. Or smells it.</p>
      `
    },
    'fart-crow': {
      title: "Crow Fart Omen",
      teaser: "Bad gas luck.",
      content: `
        <p>Crow farts = death omen. Or lunch.</p>
        <p>Hard to tell.</p>
      `
    }
  },

  'fart-lab': {
    'fart-gas': {
      title: "Fart Gas Analysis",
      teaser: "H2S levels.",
      content: `
        <p>Scientists measure fart composition.</p>
        <p>60% nitrogen, 20% hydrogen, 9% CO2, 7% methane, 4% oxygen, 1% H2S.</p>
        <p>Smell = 1%.</p>
      `
    },
    'fart-capture': {
      title: "Fart Capture Device",
      teaser: "Bottle your toot.",
      content: `
        <p>Glass jar + rubber seal. Capture fart.</p>
        <p>Label: “Dad – 2025.”</p>
        <p>Family heirloom.</p>
      `
    },
    'fart-flame': {
      title: "Fart Flame Test",
      teaser: "Blue fire.",
      content: `
        <p>Methane burns blue. Light fart with match.</p>
        <p>Don’t try at home. Or do. Film it.</p>
      `
    },
    'fart-culture': {
      title: "Fart Bacteria Culture",
      teaser: "Petri dish stink.",
      content: `
        <p>Grow gut bacteria in lab. Feed beans.</p>
        <p>Dish farts. Lab evacuates.</p>
      `
    },
    'fart-ph': {
      title: "Fart pH Test",
      teaser: "Acidic toot.",
      content: `
        <p>Farts are slightly acidic. pH 5.5.</p>
        <p>Explains eye watering.</p>
      `
    }
  },

  'fart-fire': {
    'fart-torch': {
      title: "Fart Torch Lighting",
      teaser: "Olympic gas.",
      content: `
        <p>Athlete farts into torch. Flame ignites.</p>
        <p>Crowd cheers. IOC bans it.</p>
      `
    },
    'fart-campfire': {
      title: "Campfire Fart Songs",
      teaser: "Kumbaya toot.",
      content: `
        <p>Campers fart in rhythm. Song emerges.</p>
        <p>“Kumbaya, my fart…”</p>
      `
    },
    'fart-bonfire': {
      title: "Bonfire Fart Explosion",
      teaser: "Methane boom.",
      content: `
        <p>100 farts + fire = <strong>fireball</strong>.</p>
        <p>Campers airborne.</p>
      `
    },
    'fart-candle': {
      title: "Fart Candle Snuff",
      teaser: "Blow with butt.",
      content: `
        <p>Fart out candle. Talent show winner.</p>
        <p>Grandma proud.</p>
      `
    },
    'fart-dragon': {
      title: "Dragon Fart Breath",
      teaser: "Fire + gas.",
      content: `
        <p>Dragon farts methane. Ignites with spark.</p>
        <p>Fire breath = controlled toot.</p>
      `
    }
  },

  'fart-electric': {
    'fart-shock': {
      title: "Fart Static Shock",
      teaser: "Door handle zap.",
      content: `
        <p>Dry air + fart friction = static.</p>
        <p>Touch door. Zap. Fart again.</p>
      `
    },
    'fart-tesla': {
      title: "Tesla Coil Fart",
      teaser: "Lightning toot.",
      content: `
        <p>Fart near Tesla coil. Lightning follows gas.</p>
        <p>Mad scientist approved.</p>
      `
    },
    'fart-battery': {
      title: "Fart-Powered Battery",
      teaser: "Methane cell.",
      content: `
        <p>Methane fuel cell. 1 fart = 1 hour phone charge.</p>
        <p>Coming to iPhone 17.</p>
      `
    },
    'fart-plug': {
      title: "Fart in Outlet",
      teaser: "Don’t try.",
      content: `
        <p>Stick butt in outlet. Fart. Sparks.</p>
        <p>Hospital. Darwin Award.</p>
      `
    },
    'fart-ev': {
      title: "Fart Electric Vehicle",
      teaser: "Charge with gas.",
      content: `
        <p>Car runs on farts. Fill up at home.</p>
        <p>Range: 300 miles per burrito.</p>
      `
    }
  },

  'fart-superhero': {
    'fart-man': {
      title: "Fart Man: Hero of Gas",
      teaser: "Cape + toot.",
      content: `
        <p>Fights crime with stink bombs.</p>
        <p>Villains pass out. City saved.</p>
      `
    },
    'fart-signal': {
      title: "Fart Signal in Sky",
      teaser: "Call for help.",
      content: `
        <p>Searchlight projects fart cloud.</p>
        <p>Fart Man arrives in 3 minutes.</p>
      `
    },
    'fart-villain': {
      title: "Dr. Stink: Fart Villain",
      teaser: "Evil gas.",
      content: `
        <p>Plans to gas the city. Fart Man stops him.</p>
        <p>With a bigger fart.</p>
      `
    },
    'fart-cape': {
      title: "Fart Cape Flutter",
      teaser: "Wind power.",
      content: `
        <p>Cape fills with gas. Fart Man flies.</p>
        <p>Landing = controlled release.</p>
      `
    },
    'fart-justice': {
      title: "League of Fart Justice",
      teaser: "Toot team.",
      content: `
        <p>Team: Fart Man, Stink Girl, Gas Lad.</p>
        <p>Arch nemesis: Dr. Fresh Air.</p>
      `
    }
  },

  'fart-time': {
    'fart-past': {
      title: "Farts in the Past",
      teaser: "Caveman toot.",
      content: `
        <p>Cavemen farted around fire. Kept warm.</p>
        <p>Invented comedy.</p>
      `
    },
    'fart-future': {
      title: "Farts in 3000 AD",
      teaser: "Robot gas.",
      content: `
        <p>Robots fart to lubricate joints.</p>
        <p>AI writes fart poetry.</p>
      `
    },
    'fart-loop': {
      title: "Fart Time Loop",
      teaser: "Same toot forever.",
      content: `
        <p>Fart in time machine. Stuck in loop.</p>
        <p>Same smell. Every 5 seconds.</p>
      `
    },
    'fart-clock': {
      title: "Fart-Powered Clock",
      teaser: "Tick toot.",
      content: `
        <p>Methane drives gears. One fart = 1 hour.</p>
        <p>Accurate to the second.</p>
      `
    },
    'fart-age': {
      title: "Fart Aging Process",
      teaser: "Older = stinkier.",
      content: `
        <p>Farts get worse with age. More bacteria.</p>
        <p>Grandpa’s secret weapon.</p>
      `
    }
  },

  'fart-weather': {
    'fart-storm': {
      title: "Fart Storm Warning",
      teaser: "Category 5 toot.",
      content: `
        <p>Weather channel: “Fart storm approaching. Seek shelter.”</p>
        <p>Windows up. AC off.</p>
      `
    },
    'fart-rain': {
      title: "Fart Rain: Acid Gas",
      teaser: "Stink drops.",
      content: `
        <p>Farts rise. Condense. Fall as stink rain.</p>
        <p>Don’t open mouth.</p>
      `
    },
    'fart-snow': {
      title: "Fart Snow: Yellow Flakes",
      teaser: "Don’t eat.",
      content: `
        <p>Farts freeze. Fall as yellow snow.</p>
        <p>Kids learn the hard way.</p>
      `
    },
    'fart-tornado': {
      title: "Fart Tornado",
      teaser: "Spinning stink.",
      content: `
        <p>Farts spin. Create stink-nado.</p>
        <p>Destroys trailers. And noses.</p>
      `
    },
    'fart-forecast': {
      title: "Fart Weather Forecast",
      teaser: "100% chance of gas.",
      content: `
        <p>Today: Sunny with a chance of toots.</p>
        <p>Tonight: Silent but deadly.</p>
        <p>Stay indoors.</p>
      `
    }
  },

  // DEFAULT FALLBACK
  'default': {
    'coming-soon': {
      title: "Coming Soon!",
      teaser: "This post is brewing in the lab...",
      content: `
        <p>This blog post is still being written by our team of <strong>professional tooters</strong>.</p>
        <p>Check back soon for epic fart facts, pranks, and science!</p>
        <p><em>In the meantime, try the soundboard!</em></p>
      `
    }
  }
};

const BlogPostPage = () => {
  const { categorySlug = 'fart-science', postSlug } = useParams();
  const navigate = useNavigate();

  // Find post
  const category = BLOG_CONTENT[categorySlug] || BLOG_CONTENT['default'];
  const post = postSlug ? category[postSlug] || BLOG_CONTENT['default']['coming-soon'] : null;

  if (!post) {
    return <Navigate to="/" replace />;
  }
  
  const handleReturn = () => {
    navigate('/#fartblaze-blog');
  };

  return (
    <>
      <Helmet>
        <title>{post.title} | FartBlaze Blog</title>
        <meta name="description" content={post.teaser} />
      </Helmet>

      <div className="container mx-auto px-4 py-8 max-w-4xl">
        <motion.div
          initial={{ opacity: 0, y: 20 }}
          animate={{ opacity: 1, y: 0 }}
          transition={{ duration: 0.5 }}
        >
          {/* Back to Blog Button */}
          <button
            onClick={handleReturn}
            className="inline-flex items-center text-green-400 hover:text-green-300 mb-6 text-sm font-medium transition-colors"
          >
            <ArrowLeft className="mr-2 w-4 h-4" />
            Return to Blog
          </button>

          {/* Article */}
          <article className="bg-gray-800/50 backdrop-blur-sm rounded-xl p-6 md:p-8 shadow-xl border border-gray-700">
            <h1
              className="text-2xl md:text-3xl font-bold mb-3"
              style={{ fontFamily: 'Bangers, cursive', color: '#FFDC00' }}
            >
              {post.title}
            </h1>
            <p className="text-gray-400 italic mb-6 text-sm">{post.teaser}</p>

            <div
              className="prose prose-invert max-w-none text-gray-300 leading-relaxed space-y-4 text-sm md:text-base"
              dangerouslySetInnerHTML={{ __html: post.content }}
            />
          </article>
        </motion.div>
      </div>
    </>
  );
};

export default BlogPostPage;
