// friends-data.jsx — friends' shared learning progress.
// Mara's two domains (Geology, Electrical Engineering) are built from the
// two deep-dive reports she shared: topics, takeaways, key concepts, and
// summaries with real source links. Other friends carry progress only.

const FA = { clay:'#C7937D', blue:'#1E8FF0', green:'#2E7A3A', sage:'#9FC09C', lilac:'#D49CEE' };

const GEOLOGY = [
  {
    id:'g-plate', name:'Plate Tectonics', field:'Plate Tectonics', progress:85, notes:11, updated:'2h ago',
    note:'Rigid plates ride the flowing asthenosphere; slab pull, not ridge push, is now seen as the main driver.',
    concepts:[
      {label:'Lithosphere', note:'Rigid outer shell, broken into plates'},
      {label:'Asthenosphere', note:'Hot layer that flows like stiff putty'},
      {label:'Divergent boundary', note:'Ridges pull apart; new crust forms'},
      {label:'Convergent boundary', note:'Plates collide; one may subduct'},
      {label:'Transform boundary', note:'Plates grind past each other'},
      {label:'Subduction', note:'Dense plate sinks back into the mantle'},
      {label:'Slab pull', note:'Sinking slab — the modern main driver'},
    ],
    summary:{
      head:'Why the continents move',
      intro:'Plate tectonics is the single idea that unified geology — mountains, quakes, volcanoes, and the jigsaw fit of the continents all became expressions of one process.',
      secs:[
        { h:'Core idea', b:"Earth's rigid lithosphere is broken into about a dozen plates that float on the hotter, slowly flowing asthenosphere and move a few centimetres a year. They meet at three boundaries: divergent (mid-ocean ridges make new crust), convergent (one plate subducts into the mantle), and transform (plates grind past). New crust at ridges balances old crust lost to subduction, so Earth stays the same size." },
        { h:'Why it matters', b:"It is the key that unlocks the rest of geology, and a model of how science changes its mind: until the 1990s ridge push was thought primary, but most scientists now think the pull of sinking slabs is the stronger force." },
        { h:'Common pitfalls', b:"Plates are not the same as continents — one plate usually carries both continent and ocean floor. And they do not float on liquid magma; the asthenosphere is solid rock that flows very slowly, like extremely stiff putty." },
      ],
      links:[
        { label:'Continental Movement by Plate Tectonics — Univ. of Hawaii', url:'https://manoa.hawaii.edu/exploringourfluidearth/physical/ocean-floor/continental-movement-plate-tectonics' },
        { label:'Seafloor Spreading and Subduction — Britannica', url:'https://www.britannica.com/science/plate-tectonics/Seafloor-spreading' },
        { label:'Some unanswered questions — USGS, This Dynamic Earth', url:'https://pubs.usgs.gov/gip/dynamic/unanswered.html' },
      ],
    },
  },
  {
    id:'g-quake', name:'Earthquakes', field:'Seismology', progress:70, notes:9, updated:'1d ago',
    note:'Stress builds on a locked fault until it slips — elastic rebound — radiating P, S, and surface waves.',
    concepts:[
      {label:'Fault', note:'Fracture where blocks of rock move'},
      {label:'Stress', note:'Force per area pushing on the rock'},
      {label:'Elastic strain', note:'Stored deformation before it breaks'},
      {label:'Elastic rebound', note:'Rock snaps back, releasing energy'},
      {label:'Seismic waves', note:'Fast P, slower S, damaging surface waves'},
      {label:'Seismometer', note:'Records waves to locate the quake'},
    ],
    summary:{
      head:'What actually happens in an earthquake',
      intro:"Earthquakes are the most immediate way Earth's restlessness reaches human life — and proof the plates are still moving right now.",
      secs:[
        { h:'Core idea', b:"Most quakes happen on faults near plate boundaries. As plates push, rock bends and stores elastic strain like a bent stick; when stress beats friction the fault suddenly slips and snaps back, releasing the energy in an instant — Reid's elastic rebound theory, worked out after the 1906 San Francisco quake. The energy radiates as fast P-waves, slower S-waves, and surface waves that do most of the damage." },
        { h:'Why it matters', b:"Seismometers in different places record the waves' arrival times, which is how a quake is located and measured — yet despite a century of work we still cannot predict when a specific quake will strike." },
        { h:'Common pitfalls', b:"The ground does not 'open up and swallow' things — faults slip past, they do not yawn into gaps. 'Earthquake weather' is a myth, and no one can reliably predict the day or hour of a specific quake." },
      ],
      links:[
        { label:'What causes earthquakes? — British Geological Survey', url:'https://www.bgs.ac.uk/discovering-geology/earth-hazards/earthquakes/what-causes-earthquakes/' },
        { label:'Elastic-rebound theory — Wikipedia', url:'https://en.wikipedia.org/wiki/Elastic-rebound_theory' },
        { label:'Earthquake Essentials — Geosciences LibreTexts', url:'https://geo.libretexts.org/Courses/California_State_University_Los_Angeles/Book:_An_Introduction_to_Geology_(Johnson_Affolter_Inkenbrandt_and_Mosher)/09:_Earthquakes/9.01:_Earthquake_Essentials' },
      ],
    },
  },
  {
    id:'g-volc', name:'Volcanic Eruptions', field:'Volcanology', progress:60, notes:8, updated:'2d ago',
    note:"Magma's viscosity and gas content decide it: runny mafic lava oozes; sticky felsic magma traps gas and explodes.",
    concepts:[
      {label:'Magma', note:'Molten rock below; lava once erupted'},
      {label:'Viscosity', note:'How runny or sticky the magma is'},
      {label:'Volatiles', note:'Dissolved gases — water and CO₂'},
      {label:'Exsolution', note:'Gas bubbles out as pressure drops'},
      {label:'Mafic magma', note:'Low-silica, runny, gentle eruptions'},
      {label:'Felsic magma', note:'High-silica, sticky, explosive'},
      {label:'Tephra', note:'Fragments blasted out in an explosion'},
    ],
    summary:{
      head:'Why some volcanoes ooze and others explode',
      intro:"Volcanoes range from Hawaii's gentle lava rivers to the catastrophic blast of Mount St. Helens — and the difference is not random.",
      secs:[
        { h:'Core idea', b:"Magma rises because it is less dense than surrounding rock. As pressure drops, dissolved gases come out of solution as bubbles — exactly like the fizz when you uncork a bottle. Thin, runny (mafic, low-silica) magma lets gas escape and erupts gently; thick, sticky (felsic, high-silica) magma traps gas until pressure shatters it into ash and tephra. High viscosity plus high gas content makes an explosive eruption." },
        { h:'Why it matters', b:"It explains why some volcanoes are tourist attractions and others are deadly, and it rests on a piece of physics you can feel every time you open a fizzy drink." },
        { h:'Common pitfalls', b:"Lava and magma are not the same word for the same thing — it is magma underground and lava once it erupts. And volcanoes do not explode from being 'too hot'; the violence comes from trapped gas escaping, not from temperature." },
      ],
      links:[
        { label:'How Do Volcanoes Erupt? — U.S. Geological Survey', url:'https://www.usgs.gov/faqs/how-do-volcanoes-erupt' },
        { label:'Volcanic Eruptions — U.S. National Park Service', url:'https://www.nps.gov/subjects/volcanoes/volcanic-eruptions.htm' },
        { label:'Magma Composition and Eruption Style — LibreTexts', url:'https://geo.libretexts.org/Courses/Coastline_College/Environmental_Geology_for_CBE/04:_Volcanism/4.02:_Magma_Composition_and_Eruption_Style' },
      ],
    },
  },
  {
    id:'g-rock', name:'The Rock Cycle', field:'Petrology', progress:45, notes:6, updated:'4d ago',
    note:'Igneous, sedimentary, and metamorphic rocks transform into one another in a loop with no fixed order.',
    concepts:[
      {label:'Igneous rock', note:'Magma or lava cools and crystallizes'},
      {label:'Sedimentary rock', note:'Compacted, cemented sediments'},
      {label:'Metamorphic rock', note:'Changed by heat and pressure'},
      {label:'Weathering', note:'Rock broken into fragments at surface'},
      {label:'Lithification', note:'Sediment compacted and cemented'},
      {label:'Foliation', note:'Minerals line up into bands'},
    ],
    summary:{
      head:'How a rock becomes a different rock',
      intro:'The rocks around you are not permanent objects but stages in a cycle that has run for billions of years.',
      secs:[
        { h:'Core idea', b:"Three families, defined by how they form: igneous (magma cools and crystallizes), sedimentary (fragments are deposited, compacted, and cemented, often in visible layers), and metamorphic (heat and pressure change a rock's minerals without melting it — limestone becomes marble, granite becomes gneiss). Melting, weathering, and burial link them, and deeper burial can melt anything back into magma." },
        { h:'Why it matters', b:"It is the framework that makes sense of every rock you will ever pick up, and it ties together weathering, volcanoes, and the plate movements that bury and recycle rock." },
        { h:'Common pitfalls', b:"The rock cycle is not a fixed one-way sequence — rocks can take many paths and skip stages, and any type can become any other. And metamorphism does not mean melting; if a rock fully melts it is on its way to igneous." },
      ],
      links:[
        { label:'The Rock Cycle — National Geographic Education', url:'https://education.nationalgeographic.org/resource/rock-cycle/' },
        { label:'The Rock Cycle — Britannica', url:'https://www.britannica.com/video/Earth-surface-crust-rock-cycle-process/-68369' },
        { label:'The Rock Cycle — Geosciences LibreTexts', url:'https://geo.libretexts.org/Bookshelves/Geology/Introduction_to_Historical_Geology_(Johnson_et_al.)/04:_The_Rock_Cycle/4.02:_The_Rock_Cycle' },
      ],
    },
  },
  {
    id:'g-age', name:'Age of the Earth', field:'Geochronology', progress:30, notes:5, updated:'1w ago',
    note:"Radioactive decay is a clock; meteorites — not Earth's recycled rocks — pin Earth at ~4.54 billion years.",
    concepts:[
      {label:'Radioactive decay', note:'Unstable atoms transform at a fixed rate'},
      {label:'Half-life', note:'Time for half a sample to decay'},
      {label:'Parent / daughter', note:'The decaying atom and what it becomes'},
      {label:'Radiometric dating', note:'Age from the parent-to-daughter ratio'},
      {label:'Zircon', note:'Durable mineral ideal for U–Pb dating'},
      {label:'Deep time', note:'The vast scale, measured in billions of years'},
    ],
    summary:{
      head:'How we know the Earth is 4.5 billion years old',
      intro:"The age of the Earth is one of the great achievements of science: a specific, enormous number pinned down with real precision.",
      secs:[
        { h:'Core idea', b:"Radioactive elements decay into 'daughter' elements at a fixed rate set by a half-life — uranium-238 to lead-206 takes about 4.5 billion years. Measure the parent-to-daughter ratio in a mineral (zircon is ideal) and you read how long the clock has run. Earth's own oldest rocks are recycled by tectonics, so the decisive number came from dating meteorites: in the 1950s Clair Patterson used the Canyon Diablo meteorite to get about 4.55 billion years, later confirmed by Moon rocks." },
        { h:'Why it matters', b:"It makes radioactive decay a natural clock, introduces the concept of deep time, and shows how geology borrows tools from physics and chemistry." },
        { h:'Common pitfalls', b:"Carbon-14 cannot date the Earth — its half-life is far too short, useful only to about 50,000 years. And the 4.54-billion-year figure comes largely from meteorites, not from Earth's own recycled rocks." },
      ],
      links:[
        { label:'How Do You Know the Age of Fossils? — NIST', url:'https://www.nist.gov/how-do-you-measure-it/how-do-you-know-age-fossils-and-other-old-things' },
        { label:"What is the Earth's age and how do we know? — EarthSky", url:'https://earthsky.org/earth/age-of-earth-how-old-is-planet-earth/' },
        { label:'How do we know how old Earth is? — Live Science', url:'https://www.livescience.com/planet-earth/how-do-we-know-how-old-earth-is' },
      ],
    },
  },
  {
    id:'g-mtn', name:'Mountain Building', field:'Geomorphology', progress:20, notes:4, updated:'1w ago',
    note:'Collisions build mountains; isostasy means eroding a range can actually push its peaks higher.',
    concepts:[
      {label:'Orogeny', note:'Mountain building at convergent margins'},
      {label:'Continental collision', note:'Two plates thicken the crust'},
      {label:'Uplift', note:'The raising of crust into high ground'},
      {label:'Isostasy', note:'Crust floats on the denser mantle'},
      {label:'Crustal root', note:'Deep crust supporting a range'},
      {label:'Exhumation', note:'Buried rock brought back to the surface'},
    ],
    summary:{
      head:'Why mountains rise — and why erosion helps',
      intro:"Mountains look permanent, yet they are made and unmade by the same plate motions as everything else — and they hide a genuine surprise.",
      secs:[
        { h:'Core idea', b:"Most ranges are built by orogeny at convergent boundaries: an ocean plate subducts and volcanoes rise (the Andes), or two continents collide and the crust thickens and folds upward (the Himalayas). The twist is isostasy — the crust floats on the denser mantle like an iceberg, so a tall range has a deep root. Strip material off the top by erosion and the lightened range floats upward, the root rising to replace much of what was lost." },
        { h:'Why it matters', b:"It ties the whole story together and explains why old ranges keep rising long after the collision stops, and why deeply buried rocks eventually reach the surface." },
        { h:'Common pitfalls', b:"Mountains are not simply pushed up and then left alone — erosion and uplift keep interacting for tens of millions of years. The surprising part is that eroding a range can make its peaks rise, because the lightened crust floats upward." },
      ],
      links:[
        { label:'Orogeny — Wikipedia', url:'https://en.wikipedia.org/wiki/Orogeny' },
        { label:'Orogenic belt — Wikipedia', url:'https://en.wikipedia.org/wiki/Orogenic_belt' },
        { label:'How Erosion Builds Mountains — Scientific American', url:'https://www.scientificamerican.com/article/how-erosion-builds-mountains-2005-07/' },
      ],
    },
  },
];

const ELECENG = [
  {
    id:'e-ohm', name:"Ohm's Law", field:'Circuit Theory', progress:90, notes:10, updated:'5h ago',
    note:'V = I × R ties voltage, current, and resistance — the workhorse every later circuit idea builds on.',
    concepts:[
      {label:'Charge', note:'The fundamental quantity, carried by electrons'},
      {label:'Current (I)', note:'Rate of charge flow, in amperes'},
      {label:'Voltage (V)', note:'Potential difference that pushes charge'},
      {label:'Resistance (R)', note:'Opposition to current, in ohms'},
      {label:"Ohm's law", note:'V = I × R links the three'},
      {label:'Voltage drop', note:"Voltage 'used up' across a component"},
    ],
    summary:{
      head:'Why voltage, current, and resistance are linked',
      intro:"Ohm's law is the first equation almost every electrical engineer learns — but it only sticks once you can picture the three quantities it links.",
      secs:[
        { h:'Core idea', b:"Current is the flow of charge (amperes); voltage is the potential difference that pushes it (volts); resistance is how strongly a material opposes that flow (ohms). Ohm's law ties them together: V = I × R. For a fixed voltage, more resistance means less current — 12 V across 6 Ω gives 2 A, but across 12 Ω only 1 A — and rearranged it finds any one quantity from the other two." },
        { h:'Why it matters', b:"Nearly every circuit calculation starts here, and technicians use it in reverse: a surprising current points to a change in resistance or voltage. In AC it even generalizes — resistance becomes the broader idea of impedance." },
        { h:'Common pitfalls', b:"Current is not 'used up' by a component — the same current flows around a series loop; what changes is voltage. And Ohm's law is not universal: diodes and many devices are deliberately non-ohmic." },
      ],
      links:[
        { label:"Voltage, Current, Resistance, and Ohm's Law — SparkFun", url:'https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law/all' },
        { label:"What Is Ohm's Law? — Fluke", url:'https://www.fluke.com/en-us/learn/blog/electrical/what-is-ohms-law' },
        { label:"Ohm's law — Britannica", url:'https://www.britannica.com/science/Ohms-law' },
      ],
    },
  },
  {
    id:'e-acdc', name:'AC vs. DC Power', field:'Power Systems', progress:75, notes:8, updated:'1d ago',
    note:'The grid runs on AC because transformers step voltage up for low-loss transmission; devices rectify it back to DC.',
    concepts:[
      {label:'Direct current (DC)', note:'Charge flows steadily one way'},
      {label:'Alternating current (AC)', note:'Flow reverses 50–60×/second'},
      {label:'Frequency', note:'Reversals per second, in hertz'},
      {label:'Transformer', note:'Steps AC voltage up or down'},
      {label:'Transmission loss', note:'Heat in wires; cut by high voltage'},
      {label:'Rectifier', note:'Converts AC into DC'},
    ],
    summary:{
      head:'Why your socket is AC but your phone is DC',
      intro:"Every wall socket delivers alternating current, yet nearly every gadget runs on direct current and needs a converter — and the reason is a window into how power crosses continents.",
      secs:[
        { h:'Core idea', b:"In DC, charge flows steadily in one direction (a battery); in AC it reverses 50 or 60 times a second. The grid runs on AC because transformers easily step AC voltage up — and sending power at high voltage (and so low current) sharply cuts the heat lost in long lines. Plants transmit at hundreds of thousands of volts; transformers step it down for your house; your charger rectifies the AC back to DC." },
        { h:'Why it matters', b:"It is the story of the 1880s 'War of the Currents' — Tesla and Westinghouse's AC beat Edison's DC because it could change voltage easily — and modern high-voltage DC (HVDC) has reopened the question for the longest links." },
        { h:'Common pitfalls', b:"AC is not simply 'more dangerous' or 'more powerful' than DC. And high voltage, not high current, is what makes long-distance transmission efficient, because loss depends on current." },
      ],
      links:[
        { label:'The War of the Currents: AC vs. DC — U.S. Dept. of Energy', url:'https://www.energy.gov/articles/war-currents-ac-vs-dc-power' },
        { label:"What is Faraday's law of induction? — Live Science", url:'https://www.livescience.com/53509-faradays-law-induction.html' },
        { label:'AC vs DC: a modern Battle of the Currents — Watt-Logic', url:'https://watt-logic.com/2025/08/11/ac-vc-dc-who-would-win-a-modern-battle-of-the-currents/' },
      ],
    },
  },
  {
    id:'e-trans', name:'The Transistor', field:'Electronics', progress:55, notes:7, updated:'2d ago',
    note:'A tiny gate voltage steers a much larger current — one device that both switches (digital 1s and 0s) and amplifies.',
    concepts:[
      {label:'Semiconductor', note:'Material whose conductivity is controllable'},
      {label:'Transistor', note:'Small input controls a larger current'},
      {label:'MOSFET', note:'Switched by voltage on an insulated gate'},
      {label:'Gate / source / drain', note:"A MOSFET's three terminals"},
      {label:'Switching', note:'Fully on or off — digital logic'},
      {label:'Amplification', note:'Small signal controls a larger copy'},
    ],
    summary:{
      head:'How a transistor switches and amplifies',
      intro:"The transistor is arguably the most important invention of the twentieth century — there are now more of them on Earth than any other human-made object.",
      secs:[
        { h:'Core idea', b:"A transistor uses a small signal at one terminal to control a much larger current between the other two. In a MOSFET, a voltage on the insulated gate creates an electric field that opens or closes a conducting channel between source and drain. Full on / full off makes it the physical 1s and 0s of digital logic; operated in between, a small signal controls a larger copy of itself — amplification." },
        { h:'Why it matters', b:"One device, two roles, endlessly repeated — it is the gateway to all of digital electronics, from logic gates to the processor running the screen in front of you." },
        { h:'Common pitfalls', b:"A transistor is not a mechanical switch — nothing moves; an electric field changes how well a channel conducts. And it does not 'create' energy when it amplifies; the extra power comes from the supply, with the small signal merely steering it." },
      ],
      links:[
        { label:'How Transistors Work — Build Electronic Circuits', url:'https://www.build-electronic-circuits.com/how-transistors-work/' },
        { label:'The MOSFET Tutorial — Electronics Tutorials', url:'https://www.electronics-tutorials.ws/transistor/tran_6.html' },
        { label:'What is the MOSFET: Basics & Applications — ElProCus', url:'https://www.elprocus.com/mosfet-as-a-switch-circuit-diagram-free-circuits/' },
      ],
    },
  },
  {
    id:'e-cap', name:'The Capacitor', field:'Electronics', progress:50, notes:6, updated:'3d ago',
    note:'Two plates store energy in the electric field between them; Q = C × V, set by area, gap, and dielectric.',
    concepts:[
      {label:'Capacitor', note:'Two plates separated by an insulator'},
      {label:'Dielectric', note:'Insulating material between the plates'},
      {label:'Capacitance (C)', note:'Charge stored per volt, in farads'},
      {label:'Electric field', note:'Where the energy is actually stored'},
      {label:'Permittivity', note:'How much a material boosts capacitance'},
      {label:'Q = C × V', note:'Charge, capacitance, and voltage'},
    ],
    summary:{
      head:'How a capacitor stores energy in empty space',
      intro:"A capacitor stores energy not in a material or a chemical reaction, but in the electric field in the gap between two plates that never touch.",
      secs:[
        { h:'Core idea', b:"Two conducting plates are separated by an insulator (the dielectric). Connect a voltage and electrons pile onto one plate and are pulled off the other; the opposite charges attract across the gap but cannot cross it, so energy is stored in the field between them. Capacitance (farads) is charge held per volt: Q = C × V — larger with more plate area, smaller with a wider gap, and larger when a dielectric is inserted." },
        { h:'Why it matters', b:"It introduces the electric field as a place where energy actually lives, and explains camera flashes, power-supply smoothing, and the touchscreen in your pocket. Unlike a battery, it stores little energy but releases it almost instantly." },
        { h:'Common pitfalls', b:"A capacitor does not store charge the way a bucket stores water — the plates hold equal and opposite charge, so the device stays neutral; what it stores is energy in the field. And current does not really flow 'through' it in steady DC." },
      ],
      links:[
        { label:'Capacitor Theory — SparkFun', url:'https://learn.sparkfun.com/tutorials/capacitors/capacitor-theory' },
        { label:'Introduction to Capacitors — Electronics Tutorials', url:'https://www.electronics-tutorials.ws/capacitor/cap_1.html' },
        { label:'Capacitors and Dielectrics — Lumen Learning', url:'https://courses.lumenlearning.com/suny-physics/chapter/19-5-capacitors-and-dielectrics/' },
      ],
    },
  },
  {
    id:'e-ind', name:'Electromagnetic Induction', field:'Electromagnetism', progress:40, notes:6, updated:'4d ago',
    note:'A changing magnetic field through a coil induces a voltage — the basis of nearly all generators and transformers.',
    concepts:[
      {label:'Magnetic flux', note:'Field passing through a loop'},
      {label:'Induction', note:'Changing flux induces a voltage'},
      {label:"Faraday's law", note:'Induced voltage = rate of change of flux'},
      {label:'EMF', note:'The induced voltage that drives current'},
      {label:"Lenz's law", note:'Induced current opposes the change'},
      {label:'Transformer', note:'Two coils scale AC by their turns ratio'},
    ],
    summary:{
      head:'How a changing magnet makes electricity',
      intro:"Almost all the world's electricity is made by one phenomenon Michael Faraday discovered in 1831: move a magnet near a coil of wire, and a voltage appears.",
      secs:[
        { h:'Core idea', b:"Faraday's law says a changing magnetic flux through a loop induces a voltage, and the faster the flux changes the larger the voltage. Spin a coil in a magnetic field (a generator) and the induced voltage reverses each half-turn — which is exactly why generators make AC. Drive a coil with AC beside another on an iron core (a transformer) and you scale voltage by the turns ratio. Lenz's law adds that the induced current always opposes the change that made it." },
        { h:'Why it matters', b:"It is where electrical energy actually comes from — coal, gas, nuclear, hydro, and wind all use it — and it ties the generator that makes AC to the transformer that moves it." },
        { h:'Common pitfalls', b:"A steady magnetic field induces nothing — only a change in flux matters. And a transformer cannot step up energy, only voltage: raising voltage lowers current in proportion, so power is conserved." },
      ],
      links:[
        { label:"What is Faraday's law of induction? — Live Science", url:'https://www.livescience.com/53509-faradays-law-induction.html' },
        { label:"Faraday's law of induction — Wikipedia", url:'https://en.wikipedia.org/wiki/Faraday%27s_law_of_induction' },
        { label:"Induction and Faraday's Law — Physics Fundamentals", url:'https://physicsfundamentals.org/blog/electromagnetic-induction' },
      ],
    },
  },
  {
    id:'e-loss', name:'Why Signals Fade', field:'Signals & Systems', progress:25, notes:4, updated:'6d ago',
    note:'Resistance wastes power as heat at P = I²R — which is why the grid raises voltage to drop current.',
    concepts:[
      {label:'Resistive loss', note:'Heat dissipated, P = I²R'},
      {label:'Transmission', note:'Moving power over distance in wires'},
      {label:'Step-up / step-down', note:'Raise voltage to cut current, then lower'},
      {label:'Attenuation', note:'A signal weakening as it travels'},
      {label:'Repeater', note:'Boosts a fading signal'},
      {label:'Trade-off', note:'Balancing competing losses and limits'},
    ],
    summary:{
      head:'Why electrical signals fade over distance',
      intro:"Every wire wastes some of what passes through it, and every signal weakens as it travels — a single fact that shapes an enormous amount of electrical engineering.",
      secs:[
        { h:'Core idea', b:"Real wires have resistance, and pushing current through it dissipates energy as heat at P = I²R — note the loss depends on the square of the current. So to deliver power with less loss you raise the voltage so the current drops, then use transformers to step it back down near homes. For signals, resistance plus the wire's capacitance and inductance attenuates and smears them, so long links need amplifiers, repeaters, high voltage, or optical fibre." },
        { h:'Why it matters', b:"It is why power is sent at high voltage, why your charger gets warm, and why long cables need repeaters — the practical problem engineers spend their careers managing." },
        { h:'Common pitfalls', b:"Line loss is set mainly by current, not voltage — because it goes as current squared, which is exactly why engineers raise voltage to lower current. And 'just use thicker wire' is not free; it costs money and weight." },
      ],
      links:[
        { label:'The War of the Currents: AC vs. DC — U.S. Dept. of Energy', url:'https://www.energy.gov/articles/war-currents-ac-vs-dc-power' },
        { label:'AC vs DC: a modern Battle of the Currents — Watt-Logic', url:'https://watt-logic.com/2025/08/11/ac-vc-dc-who-would-win-a-modern-battle-of-the-currents/' },
        { label:"Voltage, Current, Resistance, and Ohm's Law — SparkFun", url:'https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law/all' },
      ],
    },
  },
];

// Lighter friends — progress only, drawn from the shared learning world.
const lite = (name, field, progress, notes) => ({ id:'lt-'+name.toLowerCase().replace(/\W+/g,'')+'-'+progress, name, field, progress, notes });

// Priya's two domains, built from the Civil Engineering & Architecture report.
const CIVIL = [
  {
    id:'c-rebar', name:'Reinforced Concrete', field:'Structural Engineering', progress:88, notes:12, updated:'3h ago',
    note:'Concrete is strong squeezed but weak pulled; steel rebar takes the tension exactly where it appears.',
    concepts:[
      {label:'Compression', note:'A squeezing force — concrete\u2019s strength'},
      {label:'Tension', note:'A pulling force — concrete\u2019s weakness, steel\u2019s strength'},
      {label:'Shear', note:'A sliding force along a plane'},
      {label:'Reinforced concrete', note:'Concrete with embedded steel, strong both ways'},
      {label:'Rebar', note:'Ribbed steel bar placed where tension occurs'},
      {label:'Composite material', note:'Two materials covering each other\u2019s weakness'},
      {label:'Prestressed concrete', note:'Concrete squeezed in advance by tensioned steel'},
    ],
    summary:{
      head:'Why concrete needs steel hidden inside it',
      intro:'Concrete is the most widely used construction material on Earth, and nearly all of it has steel buried inside \u2014 the cleanest possible introduction to the two forces that govern every structure.',
      secs:[
        { h:'Core idea', b:'Materials feel three basic stresses: compression (pushing together), tension (pulling apart), and shear (sliding). Concrete is excellent in compression but weak in tension \u2014 bend it and it cracks. Steel is the mirror image. Reinforced concrete embeds rebar exactly where tension appears: along the bottom of a sagging slab, the top of a cantilevered balcony. The ribbed bar locks into the concrete, and a lucky accident \u2014 the two expand at nearly the same rate with temperature \u2014 keeps the seasons from tearing them apart.' },
        { h:'Why it matters', b:'It introduces the idea of a composite material, where two substances each cover the other\u2019s weakness, and it explains what the cracks in a sidewalk or beam actually mean. For cases where even hairline cracks are unacceptable, the steel is stretched tight before loading \u2014 prestressed concrete \u2014 so tension never reaches the concrete at all.' },
        { h:'Common pitfalls', b:'Cracks are not automatically failure \u2014 ordinary rebar often cannot take up tension until the concrete has cracked slightly, by design; what matters is crack width and whether water reaches the steel. Concrete does not \u201cdry\u201d to harden \u2014 it cures by reacting chemically with water. And steel is not there to help with compression; concrete handles that alone.' },
      ],
      links:[
        { label:'Why Does Concrete Need Reinforcement? \u2014 Practical Engineering', url:'https://practical.engineering/blog/2018/8/1/why-does-concrete-need-reinforcement' },
        { label:'Rebar \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Rebar' },
        { label:'Why Rebar in Concrete: How Steel Reinforces It \u2014 ScienceInsights', url:'https://scienceinsights.org/why-rebar-in-concrete-how-steel-reinforces-it/' },
      ],
    },
  },
  {
    id:'c-bridge', name:'How Bridges Carry Load', field:'Structural Engineering', progress:74, notes:9, updated:'1d ago',
    note:'A bridge redirects weight to the ground; beam, truss, arch, and suspension are four answers in tension and compression.',
    concepts:[
      {label:'Span', note:'The unsupported distance a bridge crosses'},
      {label:'Beam', note:'Bends under load \u2014 top compressed, bottom stretched'},
      {label:'Truss', note:'A framework of triangles resolving pulls and pushes'},
      {label:'Arch', note:'A curve carrying load in pure compression'},
      {label:'Abutment', note:'End support that resists an arch\u2019s outward push'},
      {label:'Suspension cable', note:'A draped cable carrying the deck in tension'},
      {label:'Pier / tower', note:'Vertical support carrying load down in compression'},
    ],
    summary:{
      head:'How a bridge carries its load',
      intro:'A bridge is the purest structure there is \u2014 no walls, no rooms, just the problem of getting a load across a gap \u2014 which makes it the ideal place to train your eye to see tension and compression in the wild.',
      secs:[
        { h:'Core idea', b:'A bridge does not absorb the weight on it; it redirects that weight into its supports and the ground. A beam bridge bends \u2014 top in compression, bottom in tension. A truss is a beam reinforced with triangles, the one shape that cannot change its angles without changing its sides, so loads split into clean pulls and pushes. An arch carries load almost purely in compression, pushing down and outward into abutments. A suspension bridge is the arch inverted: the deck hangs from cables in pure tension between towers that carry load down in compression.' },
        { h:'Why it matters', b:'Span is the prize \u2014 the better a design manages the two forces, the farther it can reach. Once you can read where the tension and compression go in a bridge, you can read almost any structure.' },
        { h:'Common pitfalls', b:'A bridge does not \u201chold\u201d weight the way a shelf holds books \u2014 it is a path that redirects loads to the ground. Bigger and more massive is not stronger: a truss carries large loads with thin members because triangles use material efficiently. And the deadliest enemy is often not weight but motion \u2014 wind-induced twisting and resonance, as in the 1940 Tacoma Narrows collapse.' },
      ],
      links:[
        { label:'How bridges work \u2014 Explain That Stuff', url:'https://www.explainthatstuff.com/bridges.html' },
        { label:'Tension and Compression: Two Forces Every Bridge Knows Well \u2014 HowStuffWorks', url:'https://science.howstuffworks.com/engineering/civil/bridge2.htm' },
        { label:'Bridge \u2014 Truss, Arch, Suspension design \u2014 Britannica', url:'https://www.britannica.com/technology/bridge-engineering/Truss' },
      ],
    },
  },
  {
    id:'c-quake', name:'Earthquake-Resistant Buildings', field:'Earthquake Engineering', progress:58, notes:8, updated:'2d ago',
    note:'Survival comes from flexibility and energy absorption \u2014 bending, not raw strength; base isolation lets the ground slide by underneath.',
    concepts:[
      {label:'Inertia', note:'The mass\u2019s tendency to resist the ground\u2019s motion'},
      {label:'Lateral force', note:'The sideways wrench a quake puts on a structure'},
      {label:'Ductility', note:'Deforming substantially without fracturing'},
      {label:'Brittleness', note:'Failing suddenly with little deformation \u2014 the enemy'},
      {label:'Base isolation', note:'Bearings that decouple a building from ground motion'},
      {label:'Lead-rubber bearing', note:'Layered rubber and steel with a damping lead core'},
      {label:'Damper', note:'Dissipates vibration energy, like a shock absorber'},
    ],
    summary:{
      head:'How buildings survive earthquakes',
      intro:'An earthquake does not push on a building the way wind does; it yanks the ground out from under it, back and forth, several times a second \u2014 and the engineering answer is one of the field\u2019s great inversions.',
      secs:[
        { h:'Core idea', b:'When the ground accelerates sideways, a building\u2019s own mass resists moving (inertia), wrenching the structure between foundation and upper floors. A brittle building cracks; the goal is ductility \u2014 deforming substantially without breaking \u2014 and flexibility, which spreads the energy through the frame. The most elegant strategy is base isolation: the building sits on bearings, stiff vertically but soft sideways, so the ground shudders beneath while the building above sways slowly. Isolation can cut forces on a mid-rise by a factor of five to ten.' },
        { h:'Why it matters', b:'It is a field whose textbook is rewritten after every major quake. The aim of code design is life-safety \u2014 buildings that do not collapse, even if they must be repaired \u2014 and the same ductility that saves a building is the property that lets rebar do its quiet work.' },
        { h:'Common pitfalls', b:'There is no fully \u201cearthquake-proof\u201d building \u2014 engineers say earthquake-resistant, and most codes aim to prevent collapse, not leave the building undamaged. Stronger and stiffer is not automatically safer; brittle strength fails suddenly. And it is usually not the shaking that kills but collapsing structures \u2014 why the same magnitude quake can be a catastrophe in one country and an inconvenience in another.' },
      ],
      links:[
        { label:'How Earthquake-Proof Buildings Are Designed \u2014 BigRentz', url:'https://www.bigrentz.com/blog/earthquake-proof-buildings' },
        { label:'Insights from earthquakes on seismic-resistant structural design \u2014 GDI Engineering', url:'https://gdiengdesign.com/building-for-the-future-insights-from-earthquakes-on-seismic-resistant-structural-design/' },
        { label:'How Base Isolation Can Protect Buildings \u2014 RINGFEDER', url:'https://blog.ringfeder.com/earthquake-resistant-construction-how-base-isolation-can-protect-buildings' },
      ],
    },
  },
  {
    id:'c-soil', name:'Foundations & Settling Ground', field:'Geotechnical Engineering', progress:42, notes:6, updated:'5d ago',
    note:'Every structure stands on dirt, which compresses and flows; uneven settlement \u2014 not settlement itself \u2014 is what tilts the Tower of Pisa.',
    concepts:[
      {label:'Bearing capacity', note:'The load a soil can carry before it fails'},
      {label:'Settlement', note:'Gradual compression of soil under weight'},
      {label:'Differential settlement', note:'Uneven settling that tilts or cracks a structure'},
      {label:'Consolidation', note:'Soil densifying as water is squeezed out'},
      {label:'Water table', note:'The level below which the ground is saturated'},
      {label:'Soil boring', note:'Drilling and testing the ground before design'},
      {label:'Deep foundation', note:'Piles carrying load down to firm soil or rock'},
    ],
    summary:{
      head:'Why buildings sink, lean, and sometimes fall',
      intro:'Every structure ultimately stands on dirt, and dirt is a material like any other \u2014 it compresses, flows, holds water, and gives way. Its most famous lesson stands crooked in an Italian piazza.',
      secs:[
        { h:'Core idea', b:'A foundation spreads weight into the ground without exceeding the soil\u2019s bearing capacity or settling too much. Settlement itself is normal; the killer is differential settlement, when one side sinks more and the structure tilts. That is the Tower of Pisa exactly: a 14,500-tonne tower on a foundation only ~3 m deep, in soft silt, clay, and sand with a high water table. It leaned before the third storey. Ironically, long construction pauses for wars let the soil consolidate and probably saved it.' },
        { h:'Why it matters', b:'Geotechnical engineering is the least visible and least forgiving branch \u2014 you cannot inspect a foundation once buried. The 1990s fix was as subtle as the problem: engineers extracted small amounts of soil from the high side, easing the tower back about half a degree. Today they drill boreholes and test soil first, choosing shallow footings on good ground or deep piles that bypass weak layers.' },
        { h:'Common pitfalls', b:'Settlement is not itself a defect \u2014 virtually every building settles; trouble comes when it settles unevenly. Pisa was not designed to lean, and its tilt began during construction, not centuries later. Bedrock is not required \u2014 engineered foundations on soil are routine; what is required is knowing the soil. And the recent fix deliberately kept most of the lean while making it stable.' },
      ],
      links:[
        { label:'Why Is The Tower Of Pisa Leaning? \u2014 Institution of Civil Engineers', url:'https://www.ice.org.uk/what-is-civil-engineering/infrastructure-projects/stabilising-the-leaning-tower-of-pisa' },
        { label:'The Leaning Tower of Pisa with a civil engineer \u2014 Iowa State University', url:'https://www.intrans.iastate.edu/news/why-should-i-care-leaning-tower-of-pisa-with-a-civil-engineer/' },
        { label:'Is it an Inch or a Mile? Shallow, deep, and intermediate foundations \u2014 Geopier', url:'https://www.geopier.com/resources/articles/is-it-an-inch-or-a-mile' },
      ],
    },
  },
];

const ARCH = [
  {
    id:'a-sway', name:'Why Skyscrapers Sway', field:'Structural Eng. / Architecture', progress:66, notes:9, updated:'1d ago',
    note:'Past a certain height wind, not weight, governs \u2014 engineers control sway rather than eliminate it, sometimes with a giant tuned pendulum.',
    concepts:[
      {label:'Lateral load', note:'A sideways force on a structure, chiefly wind'},
      {label:'Cantilever', note:'Fixed at one end, free at the other \u2014 a tower is one'},
      {label:'Vortex shedding', note:'Rhythmic wind swirls that push a tower side to side'},
      {label:'Moment frame', note:'Joints that flex slightly to absorb lateral force'},
      {label:'Natural frequency', note:'The rhythm at which a structure prefers to sway'},
      {label:'Tuned mass damper', note:'A large mass tuned to swing against the building'},
      {label:'Serviceability', note:'Design limits about comfort and use, not collapse'},
    ],
    summary:{
      head:'Why skyscrapers are designed to sway',
      intro:'Ask most people what holds a skyscraper up and they think of gravity. But past a certain height the harder problem blows sideways \u2014 and the answer hides a giant pendulum near the top of the world\u2019s most famous towers.',
      secs:[
        { h:'Core idea', b:'A tall building is structurally a cantilever \u2014 a beam sticking up out of the ground \u2014 and wind on its face is a lateral load that tries to bend it. Worse, wind flowing around a tower sheds alternating swirls (vortices) that push it rhythmically side to side. Engineers do not fight this with rigidity alone: controlled flexibility lets the frame deflect, absorb energy, and spring back. Many supertalls add a tuned mass damper \u2014 in Taipei 101, a 660-tonne steel pendulum tuned to the tower\u2019s sway, cutting motion by up to ~40 percent.' },
        { h:'Why it matters', b:'The deeper surprise is that the limit on sway is usually human comfort, not safety \u2014 occupants feel motion long before the structure is at risk, with a common comfort limit around 1/500 of building height. Architects also shape towers \u2014 tapering, twisting, softening corners \u2014 to confuse the wind before it organizes a push.' },
        { h:'Common pitfalls', b:'Stiffer is not simply better \u2014 a perfectly rigid tower attracts larger forces and cracks its finishes; controlled flexibility is the goal. Sway does not mean danger: towers that move feet at the top in a storm are operating as designed. And the tuned mass damper does not hold the building up \u2014 remove it and the tower still stands; it manages motion, a serviceability device.' },
      ],
      links:[
        { label:'Why Some Skyscrapers Are Designed to Sway \u2014 AZoBuild', url:'https://www.azobuild.com/article.aspx?ArticleID=8798' },
        { label:'Working With Wind: Design Innovations \u2014 Architizer', url:'https://architizer.com/blog/inspiration/industry/skyscrapers-working-with-wind-load/' },
        { label:'Building for Safety and Security in Skyscrapers \u2014 Altair', url:'https://altair.com/blog/articles/Building-for-Safety-and-Security-in-Skyscrapers' },
      ],
    },
  },
  {
    id:'a-arch', name:'The Arch, Vault & Dome', field:'History of Construction', progress:48, notes:7, updated:'4d ago',
    note:'The arch replaces bending with squeezing, letting compression-only materials span big openings \u2014 extend it for a vault, rotate it for a dome.',
    concepts:[
      {label:'Voussoir', note:'A wedge-shaped stone in an arch ring'},
      {label:'Keystone', note:'The central voussoir that completes the ring'},
      {label:'Thrust', note:'The outward push an arch exerts on its supports'},
      {label:'Abutment / buttress', note:'The mass that resists an arch\u2019s thrust'},
      {label:'Centering', note:'Temporary wooden frame supporting an arch until it closes'},
      {label:'Barrel vault', note:'An arch extended in a line to roof a space'},
      {label:'Dome', note:'An arch rotated through a full circle'},
      {label:'Hoop compression', note:'Rings of squeeze that stiffen a dome \u2014 enabling the oculus'},
    ],
    summary:{
      head:'How the arch let buildings get big',
      intro:'For most of history builders had only materials strong in compression and hopeless in tension: stone, brick, unreinforced concrete. The arch is the geometric trick that escapes the problem \u2014 and it is the story of how architecture first achieved bigness.',
      secs:[
        { h:'Core idea', b:'An arch replaces bending with squeezing. Built from wedge-shaped stones (voussoirs), each presses on its neighbours, the load flowing in compression down the curve and out into the supports. Since stone is superb in compression, an arch spans openings no stone beam could. The price is thrust \u2014 it pushes outward as well as down \u2014 so it needs heavy abutments or neighbouring arches, which is why Roman aqueducts are arcades. During construction the ring is helpless until it closes, so it rises on temporary wooden centering.' },
        { h:'Why it matters', b:'Extend an arch in a line and you get a barrel vault; rotate it through a full circle and you get a dome \u2014 with a bonus, rings of \u201choop\u201d compression run around it horizontally. That is why the Pantheon\u2019s dome can have an open oculus where a keystone would be: the compression rings carry the load around the hole. Nearly two thousand years on, it is still the world\u2019s largest unreinforced concrete dome.' },
        { h:'Common pitfalls', b:'The keystone is not a magic stone holding the arch up \u2014 every voussoir shares the compression, and the supports resisting the thrust matter just as much. An arch is not automatically stable: until the ring closes it cannot stand, and one whose abutments slide outward fails just as surely as an overloaded one. And the oculus is not a structural cheat \u2014 hoop compression carries the load around it.' },
      ],
      links:[
        { label:'Architectural Basics: The Roman Arch \u2014 Christopher P Jones', url:'https://christopherpjones.medium.com/architectural-basics-the-roman-arch-cd6242dd6e39' },
        { label:'Keystone Arch: The Small Stone That Makes Roman Arches Work \u2014 The Art Newbie', url:'https://www.theartnewbie.com/blog/rome/keystone-arch' },
        { label:'Roman Dome Development \u2014 Engineering Rome (University of Washington)', url:'https://engineeringrome.org/roman-dome-development/' },
      ],
    },
  },
];

// Devin's two domains, built from the Computer Science report.
const SYSTEMS = [
  {
    id:'s-bits', name:'How Computers Store Everything', field:'Data Representation', progress:90, notes:10, updated:'5h ago',
    note:'With only 0 and 1, agreed encodings turn bits into numbers, text, images, and sound — n bits give 2ⁿ values.',
    concepts:[
      {label:'Bit', note:'A single binary digit, 0 or 1 — the smallest unit'},
      {label:'Byte', note:'8 bits — 256 possible values, 0 to 255'},
      {label:'Binary', note:'The base-2 number system computers use internally'},
      {label:'Encoding', note:'An agreed scheme mapping data to numbers'},
      {label:'ASCII / Unicode', note:'Standard codes assigning numbers to characters'},
      {label:'2ⁿ', note:'The number of distinct values n bits can represent'},
    ],
    summary:{
      head:'How a machine that only knows 0 and 1 stores everything',
      intro:'Everything in computing sits on one strange fact: deep down, a computer can only tell two states apart. How those become a photo, a paragraph, or a song is the foundation the whole field is built on.',
      secs:[
        { h:'Core idea', b:'A bit is a single 0 or 1 — a switch off or on, a circuit at low or high voltage. Bits combine: with n bits you can represent 2ⁿ values, so a byte (8 bits) covers 256 possibilities. That is enough to encode a number, a character (via ASCII or Unicode), or the redness of one pixel. Everything stored is ultimately numbers in binary, and the trick is agreed encodings: this group of bits means a letter, that group a pixel, another a slice of a sound wave.' },
        { h:'Why it matters', b:'Binary is used not because it is convenient for humans but because two clearly distinguishable states are easy to build reliably in hardware — a circuit only has to tell "on" from "off," not ten voltage levels. It quietly answers everyday puzzles, like why files have sizes and why a kilobyte is 1,024 bytes, not exactly a thousand.' },
        { h:'Common pitfalls', b:'Computers do not "understand" text or images — they store numbers, and meaning comes entirely from agreed encodings on top. Binary is not mathematically special; two distinguishable states are simply easiest to build. And the prefixes are slippery: a kilobyte is strictly 1,024 bytes, which is why a "1 TB" drive looks smaller once formatted.' },
      ],
      links:[
        { label:'Binary numbers — What\u2019s it all about? \u2014 CS Unplugged', url:'https://www.csunplugged.org/en/topics/binary-numbers/whats-it-all-about/' },
        { label:'What is binary and how is it used in computing? \u2014 TechTarget', url:'https://www.techtarget.com/whatis/definition/binary' },
        { label:'How Computers Store Data with Binary Numbers \u2014 Invent with Python', url:'https://inventwithpython.com/blog/2022/10/29/how-computers-store-data-with-binary-numbers/' },
      ],
    },
  },
  {
    id:'s-cpu', name:'What the Processor Does', field:'Computer Architecture', progress:74, notes:9, updated:'1d ago',
    note:'Billions of instructions a second reduce to one loop: fetch, decode, execute — the program counter keeps the CPU\u2019s place.',
    concepts:[
      {label:'CPU', note:'The central processing unit that executes instructions'},
      {label:'Fetch-decode-execute', note:'The repeating cycle that runs every program'},
      {label:'Program counter', note:'Register holding the address of the next instruction'},
      {label:'Control unit', note:'Decodes instructions and directs the CPU'},
      {label:'ALU', note:'Performs the actual math and logic'},
      {label:'Register', note:'A tiny, very fast storage location inside the CPU'},
      {label:'Clock', note:'The signal that paces the cycle — its rate is clock speed'},
    ],
    summary:{
      head:'What the processor is actually doing',
      intro:'A modern processor runs billions of instructions a second, yet the whole performance reduces to one simple loop repeated at blinding speed — the moment a computer stops being magic.',
      secs:[
        { h:'Core idea', b:'A CPU repeats three steps. In fetch, it reads the next instruction from memory; the program counter holds its address and is then advanced. In decode, the control unit works out what operation it is (add, compare, load, jump) and what data it needs. In execute, the CPU carries it out, often using the ALU for the math, and stores the result. Then it repeats, billions of times a second, paced by the clock. Branch and jump instructions change the program counter, which is how loops and decisions happen.' },
        { h:'Why it matters', b:'Every program you run is ultimately broken into instructions passing through this same loop, and it is where "clock speed" and "register" actually come from. Modern chips add pipelining, out-of-order execution, and caches — but every one is an optimization of this same fetch-decode-execute core.' },
        { h:'Common pitfalls', b:'A CPU does not run a whole program "at once" — it executes one instruction at a time per core, just extremely fast. Higher clock speed is not the only thing that makes a chip fast: work per cycle, pipelining, caching, and core count matter as much. And the fancy features do not replace the basic cycle — they do more of it in parallel.' },
      ],
      links:[
        { label:'Introduction to the Fetch-Execute Cycle \u2014 Baeldung on Computer Science', url:'https://www.baeldung.com/cs/fetch-execute-cycle' },
        { label:'Fetch, decode, execute (repeat!) \u2014 University of Vermont', url:'https://www.uvm.edu/~cbcafier/cs2210/content/02_basics_of_architecture/fetch_decode_execute.html' },
        { label:'Fetch Decode Execute Cycle: Meaning and Process \u2014 Vaia', url:'https://www.vaia.com/en-us/explanations/computer-science/computer-organisation-and-architecture/fetch-decode-execute-cycle/' },
      ],
    },
  },
  {
    id:'s-bigo', name:'Why Some Programs Crawl', field:'Algorithms', progress:58, notes:8, updated:'3d ago',
    note:'Big O describes how cost grows with input size; for large n the growth class dominates hardware and language entirely.',
    concepts:[
      {label:'Algorithm', note:'A step-by-step procedure for solving a problem'},
      {label:'Big O notation', note:'How an algorithm\u2019s cost grows with input size n'},
      {label:'Time vs space', note:'How it scales in time versus memory'},
      {label:'O(1) / O(log n) / O(n)', note:'Constant, logarithmic, and linear growth'},
      {label:'O(n log n) / O(n\u00b2)', note:'Efficient sorting vs nested-loop quadratic'},
      {label:'O(2\u207f) / O(n!)', note:'Exponential and factorial — brute-force blow-up'},
      {label:'Binary search', note:'An O(log n) search halving a sorted list each step'},
    ],
    summary:{
      head:'Why some programs are fast and others crawl',
      intro:'Two programs can solve the same problem, run identically on small inputs, then diverge so badly one finishes instantly while the other runs past the heat death of the universe. The difference is the algorithm\u2019s growth rate.',
      secs:[
        { h:'Core idea', b:'Big O describes how running time (or memory) grows as the input size n grows — the shape of the growth, not the exact seconds. From best to worst: O(1) constant (an array lookup); O(log n) logarithmic, each step halving the work (binary search); O(n) linear, one pass; O(n log n), the realistic best for sorting; O(n\u00b2) quadratic, nested loops, painful fast — a million operations at n=1,000; and O(2\u207f)/O(n!), hopeless beyond tiny inputs.' },
        { h:'Why it matters', b:'For large n the growth class dominates everything else: an O(log n) algorithm on a huge list beats an O(n) one so decisively that no faster computer can close the gap. It is what separates code that scales from code that collapses — and the single most tested idea in technical interviews. There is often a trade-off too: a faster algorithm may cost more memory.' },
        { h:'Common pitfalls', b:'Big O does not tell you seconds — it describes growth, so an O(n\u00b2) algorithm can beat an O(n log n) one on small inputs. A faster growth class is not always right: setup costs (sorting before a binary search) and memory trade-offs matter. And "optimized code" is rarely line-level tricks — choosing a better algorithm usually dwarfs any micro-optimization.' },
      ],
      links:[
        { label:'Big-O Notation: Explained in 8 Minutes \u2014 AlgoMaster', url:'https://blog.algomaster.io/p/big-o-notation-explained-in-8-minutes' },
        { label:'Big O Notation \u2014 101 Computing', url:'https://www.101computing.net/big-o-notation/' },
        { label:'Big O Notation: Measuring Algorithm Efficiency \u2014 HowToDoInJava', url:'https://howtodoinjava.com/cs/big-o-notation/' },
      ],
    },
  },
];

const NETAI = [
  {
    id:'n-net', name:'How Messages Cross the World', field:'Computer Networks', progress:76, notes:9, updated:'1d ago',
    note:'Data shatters into addressed packets routed independently; IP delivers best-effort, TCP makes it reliable.',
    concepts:[
      {label:'Packet', note:'A small chunk of data with an addressed header'},
      {label:'Packet switching', note:'Breaking data into independently routed packets'},
      {label:'Circuit switching', note:'The older model — a dedicated line per conversation'},
      {label:'Router', note:'Forwards each packet toward its destination'},
      {label:'IP', note:'Handles addressing and best-effort routing'},
      {label:'TCP', note:'Reassembles, checks, and resends for reliability'},
      {label:'Best-effort delivery', note:'Forwarding with no guarantee of arrival or order'},
    ],
    summary:{
      head:'How a message crosses the world in pieces',
      intro:'When you load a page, the data does not travel as one stream down a dedicated wire. It is shattered into hundreds of packets that scatter across the planet by different routes and are reassembled at the far end.',
      secs:[
        { h:'Core idea', b:'The internet does not give each conversation a private line (that is circuit switching, the old telephone model). It uses packet switching: data is broken into packets, each wrapped in a header with source, destination, and a sequence number. Routers read each packet\u2019s destination and forward it on, choosing routes on the fly — so packets of one message can take different paths and arrive out of order. IP handles addressing and routing on a best-effort basis; TCP sits on top and supplies reliability, reassembling in order, detecting losses, and asking for resends.' },
        { h:'Why it matters', b:'The payoff is robustness and efficiency: if a route is congested or broken, packets simply flow around it, and many conversations share the same links. It explains why the internet scales to billions of devices and what all those acronyms — IP, TCP, router — actually do. (UDP is a leaner alternative that skips the guarantees for speed, used for live video and games.)' },
        { h:'Common pitfalls', b:'Your data does not travel as a single continuous stream down one path — it is split into packets that may take different routes and arrive out of order. The internet itself does not guarantee delivery; IP is best-effort, and TCP on top adds reliability. And there is no single "connection wire" reserved for you — packets from countless conversations share the same links, which is exactly why it scales.' },
      ],
      links:[
        { label:'Understanding Data Packets in TCP/IP Packet Switching \u2014 Warminster School', url:'https://warminsterschool.fireflycloud.net/computer-science/a-level/aqa-7517-a-level-compsci/material/u10-the-internet/t2-packet-switching-and-routers/understanding-data-packets-in-tcpip-packet-switching' },
        { label:'What are Network Packets and How Do They Work? \u2014 TechTarget', url:'https://www.techtarget.com/searchnetworking/definition/packet' },
        { label:'TCP/IP Protocols and Packet Switching \u2014 101 Computing', url:'https://www.101computing.net/tcpip-protocols-and-packet-switching/' },
      ],
    },
  },
  {
    id:'n-crypto', name:'Sharing a Secret in Public', field:'Cryptography', progress:50, notes:7, updated:'4d ago',
    note:'Public-key crypto splits the key in two — a public key anyone can lock with, a private key only you can open.',
    concepts:[
      {label:'Symmetric encryption', note:'One shared key both encrypts and decrypts'},
      {label:'Public-key cryptography', note:'A linked public and private key pair'},
      {label:'Public key', note:'Shared freely — encrypts to you or verifies a signature'},
      {label:'Private key', note:'Kept secret — used to decrypt or to sign'},
      {label:'RSA', note:'Security rests on factoring the product of huge primes'},
      {label:'One-way function', note:'Easy forward, infeasible to reverse'},
      {label:'Digital signature', note:'Proving authorship by signing with a private key'},
    ],
    summary:{
      head:'How you can share a secret in public',
      intro:'Every browser padlock relies on a counterintuitive idea: two computers that have never met can agree on a secret while an eavesdropper watches every byte they exchange.',
      secs:[
        { h:'Core idea', b:'Older symmetric encryption uses a single shared key to lock and unlock — leaving the hard problem of agreeing on that key. Public-key cryptography breaks the symmetry: each person has a pair of linked keys, a public key handed out freely and a private key never revealed. Anything encrypted with the public key can be decrypted only with the matching private key — like a mailbox anyone can drop a letter into but only you can unlock. Run the other way, the same machinery makes digital signatures.' },
        { h:'Why it matters', b:'It solved a problem that looks impossible and is what makes online banking, private messaging, and the secure web possible. The security rests on one-way math — like factoring the product of two huge primes (RSA) — easy forward but believed infeasible to reverse. In practice the slow public-key step usually just exchanges a fast symmetric session key that does the heavy encryption.' },
        { h:'Common pitfalls', b:'The public and private keys are not interchangeable secrets — the public key is meant to be shared; only the private key must stay hidden. Public-key crypto is not "unbreakable" in a proven sense: its security rests on problems believed hard but not proven, and a large enough quantum computer could threaten RSA. And it rarely encrypts your whole conversation — it sets up a fast symmetric key for the bulk work.' },
      ],
      links:[
        { label:'How Does Public Key Encryption Work? \u2014 Cloudflare', url:'https://www.cloudflare.com/learning/ssl/how-does-public-key-encryption-work/' },
        { label:'What Is Public Key Encryption? \u2014 IBM', url:'https://www.ibm.com/think/topics/public-key-encryption' },
        { label:'The RSA Cryptosystem \u2014 University of Toronto', url:'https://www.cs.toronto.edu/~david/course-notes/csc110-111/08-cryptography/04-rsa-cryptosystem.html' },
      ],
    },
  },
  {
    id:'n-ml', name:'How a Machine Learns', field:'Machine Learning / AI', progress:38, notes:6, updated:'6d ago',
    note:'Rules are learned from labeled examples by tuning parameters — so even the makers cannot fully explain the result.',
    concepts:[
      {label:'Machine learning', note:'Learning rules from data instead of being given them'},
      {label:'Training', note:'Adjusting a model\u2019s parameters to fit examples'},
      {label:'Supervised learning', note:'Training on labeled input-output pairs'},
      {label:'Unsupervised / reinforcement', note:'Learning from structure / from reward'},
      {label:'Neural network', note:'Layered weighted transforms that learn by tuning weights'},
      {label:'Parameters (weights)', note:'The adjustable numbers a model learns'},
      {label:'Ground truth', note:'The verified correct answers used to train'},
      {label:'Interpretability', note:'Understanding why a trained model decides as it does'},
    ],
    summary:{
      head:'How a machine learns without being programmed',
      intro:'For most of computing\u2019s history a program did exactly what a human wrote into it. Machine learning broke that mold: we build systems whose abilities are not designed but learned from data.',
      secs:[
        { h:'Core idea', b:'In traditional programming a human writes the rules; in machine learning the developer designs a training process and the rules are learned from examples. In supervised learning, the model is shown a large dataset of labeled examples — inputs paired with correct outputs (the "ground truth") — and during training it repeatedly adjusts its internal parameters to make predictions match the labels. A neural network passes input through many layers of weighted multiplications and non-linear transforms; learning means tuning those weights, of which a large model may have billions.' },
        { h:'Why it matters', b:'It is the defining computer-science story of this moment — systems that can outperform hand-written rules at recognizing images or language. The unsettling consequence: a trained network\u2019s capabilities are written by no one, so a single prediction can involve billions of operations no human specified or fully understands. Making sense of what these models learned is the active research field of interpretability, full of open problems.' },
        { h:'Common pitfalls', b:'Machine learning is not a computer "programming itself" with understanding — it is statistical pattern-fitting; a developer still designs the training, data, and architecture. More data is not automatically better: quality, balance, and freedom from bias matter as much as quantity. And a right answer does not mean the model reasoned like a human, or that anyone can fully explain it — interpretability is genuinely open.' },
      ],
      links:[
        { label:'What Is Machine Learning? \u2014 IBM', url:'https://www.ibm.com/think/topics/machine-learning' },
        { label:'What Is Supervised Learning? \u2014 IBM', url:'https://www.ibm.com/think/topics/supervised-learning' },
        { label:'Methods Overview \u2014 Interpretable Machine Learning (Christoph Molnar)', url:'https://christophm.github.io/interpretable-ml-book/overview.html' },
      ],
    },
  },
];

// Leo's two domains: The Human Body (revised) + Astronomy (new), from the reports.
const BODY = [
  {
    id:'b-caf', name:'Why Caffeine Wakes You Up', field:'Neuroscience', progress:80, notes:9, updated:'4h ago',
    note:'Caffeine doesn\u2019t add energy \u2014 it impersonates adenosine and blocks the brain\u2019s \u201cyou\u2019re tired\u201d signal.',
    concepts:[
      {label:'Adenosine', note:'Builds up while awake and promotes sleep'},
      {label:'Receptor', note:'A protein a molecule binds to, to send a signal'},
      {label:'Antagonist', note:'Blocks a receptor without activating it \u2014 caffeine'},
      {label:'A1 / A2A receptors', note:'The adenosine receptors caffeine slips into'},
      {label:'Tolerance', note:'Reduced effect as the brain grows more receptors'},
      {label:'Neurotransmitter', note:'A chemical messenger between nerve cells'},
    ],
    summary:{
      head:'Why caffeine wakes you up',
      intro:'Caffeine is the most widely used psychoactive substance on Earth, and most people who rely on it have no idea how it works \u2014 a beautiful piece of molecular mimicry.',
      secs:[
        { h:'Core idea', b:'While you are awake, your brain accumulates adenosine, a by-product of using energy. As it builds up and binds its receptors (mainly A1 and A2A), it slows neural activity and makes you feel sleepy \u2014 the brain\u2019s running tally of how long you have been awake. Caffeine\u2019s shape is similar enough that it slips into the same receptors without activating them, blocking adenosine\u2019s sleepy signal. The result is alertness, plus knock-on increases in transmitters like dopamine.' },
        { h:'Why it matters', b:'It is a clean introduction to how neurotransmitters and receptors govern alertness, and it explains tolerance, the afternoon crash, and the quitting headache. With regular use the brain grows more receptors to compensate, which is why stopping suddenly leaves all that adenosine unopposed and produces fatigue and headaches.' },
        { h:'Common pitfalls', b:'Caffeine does not give you energy; it only blocks the signal that you are tired, which is why the crash arrives when it wears off and the backed-up adenosine floods in. It also does not work by a single clean mechanism \u2014 recent research shows several brain systems are involved. And the adenosine you accumulated does not disappear while caffeine acts; it is still there, waiting.' },
      ],
      links:[
        { label:'How Caffeine Works \u2014 HowStuffWorks', url:'https://science.howstuffworks.com/caffeine4.htm' },
        { label:'Caffeine and adenosine: the reason behind the coffee crash \u2014 Ultrahuman', url:'https://blog.ultrahuman.com/blog/caffeine-and-adenosine/' },
        { label:'How Does Caffeine Wake People Up? \u2014 The Scientist', url:'https://www.the-scientist.com/how-does-caffeine-wake-people-up-73355' },
      ],
    },
  },
  {
    id:'b-doms', name:'Why Muscles Ache After Exercise', field:'Physiology', progress:64, notes:8, updated:'1d ago',
    note:'Next-day soreness is microscopic damage and repair \u2014 not lactic acid, which is gone within an hour.',
    concepts:[
      {label:'DOMS', note:'Delayed soreness, peaking 24\u201372 hours after exercise'},
      {label:'Eccentric exercise', note:'Movement where a muscle lengthens under load'},
      {label:'Microtrauma', note:'Microscopic damage to fibres and connective tissue'},
      {label:'Inflammation', note:'The repair response that produces the pain'},
      {label:'Lactate', note:'An exercise by-product, cleared within ~an hour'},
    ],
    summary:{
      head:'Why your muscles ache two days after exercise',
      intro:'The soreness that peaks a day or two after a hard workout is something nearly everyone has felt \u2014 and nearly everyone explains wrongly.',
      secs:[
        { h:'Core idea', b:'It is called delayed onset muscle soreness (DOMS), caused by microscopic damage to muscle fibres and their connective tissue, especially after eccentric exercise \u2014 movements where the muscle lengthens under load, like lowering a weight or running downhill. That microdamage triggers an inflammatory repair response over 24 to 72 hours, and the swelling and chemical signals stimulate pain nerve endings.' },
        { h:'Why it matters', b:'It is a great lesson in how a tidy, confident, century-old explanation can be completely wrong and still get repeated everywhere. A classic 1983 study found volunteers were most sore after downhill (eccentric) running \u2014 exactly when their blood lactic acid was lowest.' },
        { h:'Common pitfalls', b:'The headline myth is that lactic acid causes next-day soreness; lactate is gone within an hour and is recycled as fuel, not \u201cflushed out.\u201d A second myth is that soreness is required for a workout to count \u2014 it mainly signals an unfamiliar or increased load. And the exact mechanism behind the pain is still genuinely debated; one review even argues it is microdamage to nerves, not the muscle fibres.' },
      ],
      links:[
        { label:'Why are my muscles sore after exercise? It\u2019s nothing to do with lactic acid \u2014 The Conversation', url:'https://theconversation.com/why-are-my-muscles-sore-after-exercise-hint-its-nothing-to-do-with-lactic-acid-214638' },
        { label:'Lactic Acid Is Not What Causes Sore Muscles \u2014 Discovery', url:'https://www.discovery.com/science/lactic-acid-is-not-what-causes-sore-muscles' },
        { label:'Delayed onset muscle soreness \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Delayed_onset_muscle_soreness' },
      ],
    },
  },
  {
    id:'b-hic', name:'Why We Get Hiccups', field:'Physiology', progress:52, notes:6, updated:'3d ago',
    note:'A diaphragm spasm pulls air in; the vocal cords snap shut to make the \u201chic\u201d \u2014 but what hiccups are for is unknown.',
    concepts:[
      {label:'Diaphragm', note:'The main breathing muscle below the lungs'},
      {label:'Glottis', note:'The vocal-cord opening that snaps shut for the \u201chic\u201d'},
      {label:'Phrenic nerve', note:'Controls the diaphragm'},
      {label:'Vagus nerve', note:'Links many organs to the brainstem'},
      {label:'Reflex arc', note:'An involuntary nerve loop giving an automatic response'},
    ],
    summary:{
      head:'Why we get hiccups',
      intro:'A hiccup is a tiny, involuntary event that almost everyone experiences and no one can fully explain \u2014 a humbling reminder that some very ordinary bodily events still have no agreed-upon purpose.',
      secs:[
        { h:'Core idea', b:'A hiccup is a sudden, involuntary spasm of the diaphragm, the dome-shaped muscle under your lungs. The spasm pulls air in sharply, and a fraction of a second later the glottis snaps shut, producing the \u201chic.\u201d The reflex runs along a loop involving the phrenic nerve (which controls the diaphragm) and the vagus nerve; irritation of either \u2014 from eating too fast, a distended stomach, fizzy drinks, or sudden excitement \u2014 can trigger it.' },
        { h:'Why it matters', b:'It is a neat way into how reflex arcs and the nerves controlling breathing work. Short bouts are harmless and self-limiting. What hiccups are FOR is unknown; one leading idea is that the reflex is a leftover from our evolutionary past.' },
        { h:'Common pitfalls', b:'Hiccups are not a stomach problem in the usual sense \u2014 they are a neuromuscular reflex, even if a full stomach can trigger them. Despite endless folk cures, none is scientifically proven; the ones that seem to help mostly work by raising carbon dioxide or stimulating the vagus nerve. Persistent hiccups lasting days, however, can signal a real medical issue.' },
      ],
      links:[
        { label:'Hiccups \u2014 Cleveland Clinic', url:'https://my.clevelandclinic.org/health/diseases/17672-hiccups' },
        { label:'Why Do I Hiccup? \u2014 WebMD', url:'https://www.webmd.com/digestive-disorders/why-do-i-hiccup' },
        { label:'Causes and cures of hiccups remain elusive \u2014 Penn State Health', url:'https://pennstatehealthnews.org/2019/01/the-medical-minute-causes-and-cures-of-hiccups-remain-elusive/' },
      ],
    },
  },
  {
    id:'b-dream', name:'Why We Dream', field:'Psychology / Neuroscience', progress:44, notes:7, updated:'4d ago',
    note:'No single answer: memory-filing, emotional processing, threat-rehearsal, and random-signal theories all compete.',
    concepts:[
      {label:'REM sleep', note:'Vivid dreaming \u2014 active brain, still body'},
      {label:'Memory consolidation', note:'Filing the day\u2019s memories, possibly in dreams'},
      {label:'Threat simulation', note:'Dreams as evolved rehearsal of dangers'},
      {label:'Activation-synthesis', note:'Dreams as a story built from random brain signals'},
      {label:'Amygdala', note:'Emotion centre, highly active during REM'},
    ],
    summary:{
      head:'Why we dream',
      intro:'You spend years of your life dreaming, and science still cannot say for sure why \u2014 a perfect case study in how researchers reason about a hard question with competing theories and incomplete evidence.',
      secs:[
        { h:'Core idea', b:'Most vivid dreaming happens during REM sleep, when the brain is highly active \u2014 close to its waking state \u2014 while the body is largely paralysed. There is no single agreed answer; instead there are several serious theories. Memory-consolidation says dreaming replays and files the day\u2019s experiences. Emotional-processing sees dreams as a safe space to work through feelings (the amygdala is active in REM). Threat-simulation casts dreaming as evolved rehearsal of danger. Activation-synthesis argues dreams weave a story out of essentially random brainstem signals.' },
        { h:'Why it matters', b:'It is an introduction to sleep stages, memory, and emotion in the brain, and a live debate where the leading functional theories map onto which brain regions are loud and quiet during REM. These are not mutually exclusive \u2014 the likely answer is several at once, and newer ideas even borrow from machine learning.' },
        { h:'Common pitfalls', b:'It is a myth that dreaming happens only in REM sleep \u2014 it occurs in other stages too, just less vividly. It is also a mistake to treat any one theory as the proven answer; several plausible functions compete and may overlap. And popular \u201cdream dictionaries\u201d that assign fixed meanings to symbols have no scientific support.' },
      ],
      links:[
        { label:'Dreams and Dreaming \u2014 Introduction to Psychology (Lumen/OpenStax)', url:'https://courses.lumenlearning.com/suny-hvcc-psychology-1/chapter/reading-dreams/' },
        { label:'The Neuroscience of Dreams: How and Why We Dream \u2014 ScienceInsights', url:'https://scienceinsights.org/the-neuroscience-of-dreams-how-and-why-we-dream/' },
        { label:'The Functional Role of Dreaming in Emotional Processes \u2014 Frontiers in Psychology', url:'https://www.frontiersin.org/journals/psychology/articles/10.3389/fpsyg.2019.00459/full' },
      ],
    },
  },
  {
    id:'b-blush', name:'Why We Blush', field:'Psychology / Physiology', progress:36, notes:5, updated:'6d ago',
    note:'An honest, unfakeable signal: the fight-or-flight system reddens the face in response to a social threat, not a physical one.',
    concepts:[
      {label:'Vasodilation', note:'Blood vessels widening, reddening the skin'},
      {label:'Sympathetic nervous system', note:'The fight-or-flight system driving the blush'},
      {label:'Social emotion', note:'Embarrassment and shame, tied to belonging'},
      {label:'Honest signal', note:'An involuntary cue others can trust \u2014 it can\u2019t be faked'},
      {label:'Appeasement function', note:'Blushing signals recognition of a misstep'},
    ],
    summary:{
      head:'Why we blush',
      intro:'Blushing is, in Darwin\u2019s words, \u201cthe most peculiar and most human of all expressions.\u201d It is involuntary, impossible to fake, and it broadcasts the very emotion you would most like to hide.',
      secs:[
        { h:'Core idea', b:'Blushing is a reddening of the face \u2014 and often the ears, neck, and upper chest \u2014 caused by the small blood vessels there widening (vasodilation) and filling with blood. It is driven by the sympathetic nervous system, the same fight-or-flight system behind a racing heart, triggered here by social emotions like embarrassment rather than physical danger. The facial skin is unusually rich in wide, near-surface vessels, which makes the face an effective \u201cbillboard.\u201d' },
        { h:'Why it matters', b:'It joins the body\u2019s stress response to one of the deepest puzzles in the science of social emotions: why would evolution give us a signal that seems to work against us? The leading answer is that an honest, uncontrollable signal serves an appeasement function \u2014 it shows you recognize a social misstep, which helps others trust and forgive you. Darwin himself could not fully explain it.' },
        { h:'Common pitfalls', b:'Blushing is not under your control, and trying to suppress it usually makes it worse, because noticing it feeds the response. It is also a mistake to assume it is purely a flaw; the leading evolutionary account treats it as a useful honest signal that smooths social repair. And humans may not be the only blushers \u2014 there is recent evidence of blush-like responses in some animals.' },
      ],
      links:[
        { label:'Why Do We Blush? The Science Behind Rosy Cheeks \u2014 Reader\u2019s Digest', url:'https://www.rd.com/article/why-do-people-blush/' },
        { label:'The Science Behind Why We Blush \u2014 The Swaddle', url:'https://www.theswaddle.com/the-science-behind-why-we-blush' },
        { label:'The Puzzle of Blushing \u2014 The British Psychological Society', url:'https://www.bps.org.uk/psychologist/puzzle-blushing' },
      ],
    },
  },
  {
    id:'b-eye', name:'Why Eyes Are Different Colors', field:'Genetics / Biology', progress:28, notes:5, updated:'1w ago',
    note:'One pigment (melanin) and light scattering \u2014 there is no blue pigment; blue eyes are blue for the same reason the sky is.',
    concepts:[
      {label:'Melanin', note:'The pigment setting eye, skin, and hair colour'},
      {label:'Iris', note:'The coloured ring of muscle around the pupil'},
      {label:'Structural color', note:'Colour from light scattering, not pigment'},
      {label:'Rayleigh / Tyndall scattering', note:'Short wavelengths scatter most, making blue'},
      {label:'Polygenic', note:'A trait controlled by many genes, not one'},
    ],
    summary:{
      head:'Why eyes are different colors',
      intro:'Eye color seems like the simplest possible genetics lesson \u2014 the tidy \u201cbrown beats blue\u201d square from school. It is also a perfect example of how that simple story is wrong.',
      secs:[
        { h:'Core idea', b:'Eye color comes almost entirely from one pigment, melanin, in the front layer of the iris \u2014 the same brown-black pigment that colours skin and hair. There is no blue, green, or hazel pigment. Brown eyes have a lot of melanin, which absorbs most light. Blue eyes have very little; the blue you see is a structural color, produced when light scatters in the iris and the shorter (blue) wavelengths scatter back most \u2014 the same scattering that makes a cloudless sky blue. Green and hazel come from a little melanin plus that scattering.' },
        { h:'Why it matters', b:'Inheritance is polygenic: many genes contribute (OCA2 and HERC2 especially), which is why two brown-eyed parents can have a blue-eyed child and why the schoolbook one-gene model is wrong. The same pigment machinery also explains albinism and heterochromia.' },
        { h:'Common pitfalls', b:'The two big myths are that eye color is set by a single gene with brown dominant over blue (it is polygenic), and that blue and green eyes contain blue and green pigment (they do not \u2014 the color is structural, from scattering). Eye color can also shift in babies and is not perfectly fixed for life.' },
      ],
      links:[
        { label:'What Gives Eyes Their Color: Melanin & Genes \u2014 ScienceInsights', url:'https://scienceinsights.org/what-gives-eyes-their-color-melanin-genes/' },
        { label:'Is Eye Color Determined by Genetics? \u2014 MedlinePlus Genetics (NIH)', url:'https://medlineplus.gov/genetics/understanding/traits/eyecolor/' },
        { label:'Eye color \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Eye_color' },
      ],
    },
  },
];

const ASTRO = [
  {
    id:'a-spec', name:'What Stars Are Made Of', field:'Astrophysics / Spectroscopy', progress:82, notes:10, updated:'5h ago',
    note:'Split starlight into a spectrum and dark lines appear \u2014 each element\u2019s fingerprint, read from light alone.',
    concepts:[
      {label:'Spectrum', note:'Light spread out by wavelength, as through a prism'},
      {label:'Spectroscopy', note:'Analyzing a spectrum to learn about its source'},
      {label:'Absorption line', note:'A dark gap where an element absorbs wavelengths'},
      {label:'Emission line', note:'A bright line where an element emits wavelengths'},
      {label:'Spectral fingerprint', note:'The unique line pattern of each element'},
      {label:'Energy levels', note:'Fixed electron orbits whose jumps make the lines'},
    ],
    summary:{
      head:'How we know what a star is made of',
      intro:'It sounds impossible: we will never collect a sample from a star, yet we can say the Sun is mostly hydrogen and helium. The method that makes this possible \u2014 spectroscopy \u2014 is the single most important tool in all of astronomy.',
      secs:[
        { h:'Core idea', b:'Pass starlight through a prism or grating and it spreads into a spectrum crossed by dark lines. The reason is atomic: each element absorbs light at a fixed set of wavelengths \u2014 a pattern as unique as a fingerprint \u2014 because its electrons can only jump between certain energy levels. As light from a star\u2019s hot interior passes through its cooler atmosphere, the elements there absorb their signature wavelengths, leaving dark absorption lines. Matching those to known patterns measured in Earth laboratories identifies the elements, and line strength gives the amount.' },
        { h:'Why it matters', b:'It is how the whole field is even possible \u2014 composition, temperature, and motion all read from nothing but light. It is how Kirchhoff first detected sodium in the Sun in the 1860s, and how Cecilia Payne-Gaposchkin showed in the 1920s that stars are overwhelmingly hydrogen and helium \u2014 Earth, made of rock and metal, is the oddity, not the rule.' },
        { h:'Common pitfalls', b:'Astronomers do not determine composition by a star\u2019s colour alone \u2014 colour gives temperature; it is the spectral lines that reveal which elements are present. The dark lines are not flaws in the telescope; they are real absorption by specific elements. And the elements found are not exotic \u2014 the same hydrogen, helium, and sodium we know on Earth.' },
      ],
      links:[
        { label:'Spectroscopy in Astronomy \u2014 OpenStax / Lumen Learning', url:'https://courses.lumenlearning.com/suny-astronomy/chapter/spectroscopy-in-astronomy/' },
        { label:'What are stars made of? \u2014 Science in School', url:'https://scienceinschool.org/article/2016/what-are-stars-made/' },
        { label:'Star \u2014 Stellar spectra \u2014 Britannica', url:'https://www.britannica.com/science/star-astronomy/Stellar-spectra' },
      ],
    },
  },
  {
    id:'a-star', name:'Why Stars Shine and Die', field:'Stellar Astrophysics', progress:70, notes:9, updated:'1d ago',
    note:'A star balances fusion against gravity for billions of years; its mass decides whether it fades quietly or explodes.',
    concepts:[
      {label:'Nuclear fusion', note:'Merging light nuclei into heavier ones, releasing energy'},
      {label:'Main sequence', note:'The long, stable hydrogen-fusing phase'},
      {label:'Hydrostatic balance', note:'Fusion\u2019s outward push offsetting gravity\u2019s pull'},
      {label:'Red giant', note:'A swollen late stage after core hydrogen runs low'},
      {label:'White dwarf', note:'The cooling remnant of a Sun-like star'},
      {label:'Supernova', note:'The explosive death of a massive star'},
      {label:'Neutron star / black hole', note:'The dense remnants a supernova can leave'},
    ],
    summary:{
      head:'Why stars shine, and how they die',
      intro:'A star is a delicate, centuries-long balancing act between two titanic forces, and the story of how it lives and dies explains where almost everything around you came from \u2014 the carbon in your body, the iron in your blood.',
      secs:[
        { h:'Core idea', b:'A star is born when gravity pulls gas and dust together until the core gets hot enough \u2014 around 15 million degrees \u2014 to ignite fusion, fusing hydrogen into helium. For most of its life (the main sequence) the outward push of fusion exactly offsets gravity\u2019s inward pull. When core hydrogen runs low, mass decides the ending: a Sun-like star swells to a red giant, sheds its layers, and leaves a white dwarf. A much heavier star fuses elements up to iron \u2014 and because fusing iron absorbs energy, the core collapses in under a second and rebounds as a supernova.' },
        { h:'Why it matters', b:'A supernova can briefly outshine an entire galaxy, leaving a neutron star or black hole and seeding space with the heavy elements that later build planets and people. Understanding stellar life is, quite literally, understanding our own origins \u2014 and the spectroscopy of the previous topic is how we sort stars into these life stages.' },
        { h:'Common pitfalls', b:'Stars do not \u201cburn\u201d like a fire \u2014 there is no combustion; they shine by nuclear fusion. The Sun will not explode as a supernova \u2014 only much more massive stars do; the Sun will become a red giant then a white dwarf. And a supernova is not a big bang of burning fuel \u2014 it is triggered by the sudden gravitational collapse of a core that can no longer support itself.' },
      ],
      links:[
        { label:'Stars \u2014 NASA Science', url:'https://science.nasa.gov/universe/stars/' },
        { label:'Stellar Evolution \u2014 EBSCO Research Starters', url:'https://www.ebsco.com/research-starters/physics/stellar-evolution' },
        { label:'The Life Cycles of Stars \u2014 NASA Goddard (Imagine the Universe)', url:'https://imagine.gsfc.nasa.gov/educators/lifecycles/LC_main3.html' },
      ],
    },
  },
  {
    id:'a-dist', name:'Measuring the Distance to a Star', field:'Observational Astronomy', progress:58, notes:8, updated:'2d ago',
    note:'A ladder of overlapping methods \u2014 parallax, then standard candles \u2014 each rung calibrating the next out to distant galaxies.',
    concepts:[
      {label:'Cosmic distance ladder', note:'A chain of overlapping distance methods'},
      {label:'Parallax', note:'Distance from a star\u2019s shift as Earth orbits'},
      {label:'Standard candle', note:'An object of known true brightness'},
      {label:'Inverse-square law', note:'Brightness falls with the square of distance'},
      {label:'Cepheid variable', note:'A pulsing star whose period reveals its luminosity'},
      {label:'Type Ia supernova', note:'A standard-candle explosion seen across the cosmos'},
    ],
    summary:{
      head:'How we measure the distance to a star',
      intro:'Almost everything in astronomy depends on knowing how far away things are \u2014 yet we cannot stretch a tape measure into space. The solution, a chain of methods each calibrating the next, is one of science\u2019s quiet masterpieces.',
      secs:[
        { h:'Core idea', b:'Because no single method reaches all the way out, astronomers build a cosmic distance ladder. The first rung is parallax: as Earth orbits the Sun, a nearby star appears to shift against the background, and the shift gives its distance by geometry. Parallax works only for nearby stars, so the next rungs use standard candles \u2014 objects whose true brightness we know, so comparing true to apparent brightness yields distance via the inverse-square law. Cepheid variables are the classic example; farther still, Type Ia supernovae have a consistent peak brightness visible across billions of light-years.' },
        { h:'Why it matters', b:'It is what lets us say Andromeda is 2.5 million light-years away with a straight face. Each rung is calibrated against the one below it (parallax calibrates Cepheids, which calibrate supernovae), and the overlaps are deliberate cross-checks \u2014 how astronomers escape the circular problem of needing distance to measure distance. Henrietta Swan Leavitt\u2019s period-luminosity law turned pulsing stars into measuring sticks.' },
        { h:'Common pitfalls', b:'Parallax is not how we measure distances to other galaxies \u2014 it works only for relatively nearby stars; distant objects need standard candles. A light-year is a distance, not a time. And the ladder is not a single clever trick but a chain: each method has a limited range and must be calibrated against the rung below.' },
      ],
      links:[
        { label:'Parallax, Cepheid Variables, Supernovae, and Distance Measurement \u2014 Physics LibreTexts', url:'https://phys.libretexts.org/Courses/University_of_California_Davis/Physics_156:_A_Cosmology_Workbook/01:_Workbook/1.16:_Parallax_Cepheid_Variables_Supernovae_and_Distance_Measurement' },
        { label:'The Cosmic Distance Ladder \u2014 AAVSO', url:'https://www.aavso.org/cosmic-distance-ladder' },
        { label:'Lecture 33: The Cosmic Distance Scale \u2014 Ohio State University', url:'https://www.astronomy.ohio-state.edu/ryden.1/ast162_8/notes33.html' },
      ],
    },
  },
  {
    id:'a-expand', name:'How We Know the Universe Is Expanding', field:'Cosmology', progress:48, notes:7, updated:'4d ago',
    note:'Distant galaxies are redshifted \u2014 space itself is stretching \u2014 and run backwards it points to a hot, dense Big Bang.',
    concepts:[
      {label:'Redshift', note:'Light\u2019s wavelength lengthened by expanding space'},
      {label:'Hubble\u2019s Law', note:'More distant galaxies recede faster, in proportion'},
      {label:'Expansion of space', note:'Space itself stretching, carrying galaxies apart'},
      {label:'Big Bang', note:'The hot, dense early state ~13.8 billion years ago'},
      {label:'Cosmic microwave background', note:'The faint afterglow of the early universe'},
      {label:'Big Bang nucleosynthesis', note:'Early formation of hydrogen and helium'},
    ],
    summary:{
      head:'How we know the universe is expanding',
      intro:'A century ago, almost everyone assumed the universe was static and eternal. The discovery that it is expanding \u2014 and therefore had a beginning \u2014 is one of the great upheavals in the history of thought.',
      secs:[
        { h:'Core idea', b:'When astronomers split the light of distant galaxies, the spectral lines are shifted toward the red \u2014 a redshift. In the 1920s Edwin Hubble (building on Lemaitre) found that the farther a galaxy is, the greater its redshift: Hubble\u2019s Law. The subtle, crucial interpretation is that galaxies are not flying through space from a center; space itself is expanding, stretching the light waves traveling through it. Run that backwards and the universe was once hot, dense, and tiny \u2014 the Big Bang, about 13.8 billion years ago.' },
        { h:'Why it matters', b:'It transforms the night sky from a fixed backdrop into something with a history, an age, and a first moment. Two more pillars clinch it: the cosmic microwave background \u2014 a faint afterglow now stretched to microwaves at ~2.7 degrees above absolute zero (Penzias and Wilson, 1960s) \u2014 and the observed cosmic abundance of hydrogen and helium, which matches Big Bang predictions.' },
        { h:'Common pitfalls', b:'The Big Bang was not an explosion at a point that galaxies are flying away from \u2014 it was an expansion of space itself, everywhere at once, with no center. Redshift here is mostly not ordinary Doppler motion but the stretching of light by expanding space. And the universe has no edge we could reach or center it grew from; from any galaxy, everything else appears to recede.' },
      ],
      links:[
        { label:'Hubble Cosmological Redshift \u2014 NASA Science', url:'https://science.nasa.gov/mission/hubble/science/science-behind-the-discoveries/hubble-cosmological-redshift/' },
        { label:'Hubble Big Bang \u2014 NASA Science', url:'https://science.nasa.gov/mission/hubble/science/science-behind-the-discoveries/hubble-big-bang/' },
        { label:'Evidence for the Big Bang \u2014 Magis Center', url:'https://www.magiscenter.com/blog/evidence-for-the-big-bang' },
      ],
    },
  },
  {
    id:'a-bh', name:'What a Black Hole Really Is', field:'Relativistic Astrophysics', progress:40, notes:6, updated:'5d ago',
    note:'A region where escape would need faster-than-light speed; we detect them by the glowing matter spiraling just outside.',
    concepts:[
      {label:'Black hole', note:'Gravity lets nothing, not even light, escape'},
      {label:'Event horizon', note:'The boundary \u2014 the point of no return'},
      {label:'Singularity', note:'Central point of infinite density; physics breaks down'},
      {label:'Escape velocity', note:'The speed needed to break free of gravity'},
      {label:'Accretion disk', note:'The hot, glowing disk of infalling matter we see'},
      {label:'Gravitational waves', note:'Ripples in spacetime, e.g. from black holes merging'},
      {label:'Quantum gravity', note:'The missing theory needed to describe a singularity'},
    ],
    summary:{
      head:'What a black hole really is',
      intro:'Black holes are where our two best theories of physics collide and where intuition fails completely: regions where gravity is so strong that not even light escapes. We have now photographed their shadows and heard them collide.',
      secs:[
        { h:'Core idea', b:'A black hole is a region where gravity is so strong nothing, not even light, can escape. Most form when a very massive star dies and the core collapses. The defining feature is the event horizon \u2014 not a physical surface but a boundary, the point of no return, where escape velocity would have to exceed the speed of light. At the center, general relativity predicts a singularity, a point of infinite density where the known laws break down \u2014 and near it our theories fail, because we have no working theory of quantum gravity.' },
        { h:'Why it matters', b:'They are the most extreme gravity in the universe and one of the clearest places where current physics admits it does not yet know the answer. Since black holes emit no light, we detect them indirectly: by X-rays from gas heated white-hot as it spirals in, by the motion of stars orbiting an unseen mass, and by gravitational waves from collisions. In 2019 the Event Horizon Telescope produced the first image of a black hole\u2019s shadow, in galaxy M87.' },
        { h:'Common pitfalls', b:'A black hole is not a cosmic vacuum cleaner \u2014 from a safe distance its gravity behaves like any other mass; you orbit it, you are not inevitably pulled in. The event horizon is not a solid surface but a boundary in space. And we have not \u201cseen inside\u201d one: the 2019 image shows the shadow and glowing matter outside the horizon, while what happens at the singularity remains genuinely unknown.' },
      ],
      links:[
        { label:'Anatomy \u2014 NASA Science (Black Holes)', url:'https://science.nasa.gov/universe/black-holes/anatomy/' },
        { label:'Black holes, explained by an astrophysicist \u2014 Astronomy.com', url:'https://www.astronomy.com/science/black-holes-explained-by-an-astrophysicist/' },
        { label:'Black holes, explained \u2014 University of Chicago News', url:'https://news.uchicago.edu/explainer/black-holes-explained' },
      ],
    },
  },
  {
    id:'a-dark', name:'Why Most of the Universe Is Missing', field:'Cosmology', progress:30, notes:5, updated:'1w ago',
    note:'Everything we can see is ~5% of the universe; the other 95% is dark matter and dark energy \u2014 detected, but unexplained.',
    concepts:[
      {label:'Dark matter', note:'Unseen mass detected only through its gravity'},
      {label:'Galaxy rotation curve', note:'The spin-speed evidence for dark matter'},
      {label:'Dark energy', note:'The unknown influence accelerating expansion'},
      {label:'Accelerating expansion', note:'The 1998 supernova discovery that reshaped cosmology'},
      {label:'Cosmic composition', note:'~5% ordinary matter, 27% dark matter, 68% dark energy'},
      {label:'Gravitational lensing', note:'Light bent by mass, used to map dark matter'},
    ],
    summary:{
      head:'Why most of the universe is missing',
      intro:'Here is the most humbling fact in modern science: everything we can see \u2014 every star, planet, and glowing cloud \u2014 adds up to only about five percent of the universe. The other 95 percent is two mysteries we have named but cannot explain.',
      secs:[
        { h:'Core idea', b:'Two separate lines of evidence reveal the visible universe is only a sliver. First, galaxies spin too fast: the gravity of their visible matter is nowhere near enough to hold them together, so they should fly apart \u2014 unless unseen mass provides extra gravity. This is dark matter; it does not emit, absorb, or reflect light, detected only through its gravity. Second, in 1998 two teams measuring distant Type Ia supernovae found the universe\u2019s expansion is not slowing but speeding up. The unknown influence driving it is dark energy, spread evenly through space.' },
        { h:'Why it matters', b:'Adding up: ordinary matter ~5 percent, dark matter ~27 percent, dark energy ~68 percent. Confronting them is confronting the frontier of astronomy itself, where the textbooks stop and the open questions begin. The names are not explanations \u2014 they are honest labels for things detected by their effects but not understood, among the deepest unsolved problems in all of physics.' },
        { h:'Common pitfalls', b:'Dark matter and dark energy are not the same thing \u2014 one is unseen mass that pulls galaxies together, the other a mysterious influence pushing the universe apart faster. \u201cDark\u201d does not mean we know what they are: the words are placeholders for effects we measured but cannot explain. And they are not fringe speculation \u2014 they rest on solid, repeated observations; it is their nature, not their existence, that is uncertain.' },
      ],
      links:[
        { label:'Dark Matter \u2014 NASA Science', url:'https://science.nasa.gov/dark-matter/' },
        { label:'What is Dark Energy? \u2014 NASA Science', url:'https://science.nasa.gov/dark-energy/' },
        { label:'Dark matter \u2014 CERN', url:'https://home.cern/science/physics/dark-matter/' },
      ],
    },
  },
];

// Iris's two domains, built from the Botany report.
const PLANTLIFE = [
  {
    id:'p-photo', name:'Building a Plant from Air and Light', field:'Plant Biochemistry', progress:86, notes:11, updated:'1h ago',
    note:'Photosynthesis runs in two coupled stages \u2014 and most of a tree\u2019s solid body is carbon pulled from the air, not the soil.',
    concepts:[
      {label:'Chloroplast', note:'The organelle where photosynthesis takes place'},
      {label:'Chlorophyll', note:'The green pigment that absorbs light energy'},
      {label:'Light-dependent reactions', note:'Split water, release oxygen, make ATP & NADPH'},
      {label:'Calvin cycle', note:'Uses ATP & NADPH to fix CO\u2082 into sugar'},
      {label:'RuBisCO', note:'The enzyme that captures CO\u2082 from the air'},
      {label:'Stomata', note:'Leaf pores letting CO\u2082 in and water vapour out'},
      {label:'Carbon fixation', note:'Turning gaseous CO\u2082 into solid organic molecules'},
    ],
    summary:{
      head:'How a plant builds itself from air and light',
      intro:'Photosynthesis is the most important chemical process on the planet \u2014 the source of nearly all our food and oxygen, and the reason a plant can build its own body out of air, water, and light.',
      secs:[
        { h:'Core idea', b:'Photosynthesis happens in chloroplasts in two linked stages. In the light-dependent reactions, in the thylakoid membranes, chlorophyll absorbs sunlight and uses its energy to split water \u2014 releasing the oxygen we breathe \u2014 and to charge up two energy carriers, ATP and NADPH. In the Calvin cycle, in the stroma, those carriers power reactions that \u201cfix\u201d carbon dioxide from the air, the enzyme RuBisCO joining CO\u2082 to a waiting molecule until the cycle yields sugar. The light reactions make the energy currency; the Calvin cycle spends it.' },
        { h:'Why it matters', b:'It is the engine that powers the entire living world \u2014 and the counterintuitive payoff is that the bulk of a plant\u2019s solid body, the wood and leaves, is built largely from carbon pulled out of the air as gas, not from material sucked up out of the soil.' },
        { h:'Common pitfalls', b:'A plant does not get most of its mass from the soil \u2014 the bulk of its body is carbon captured from CO\u2082 in the air; soil mainly supplies water and minerals. Plants are not the only photosynthesizers (algae and some bacteria do too). And the \u201cdark reactions\u201d do not happen in the dark \u2014 the Calvin cycle runs in daylight, powered by the light stage.' },
      ],
      links:[
        { label:'The process of photosynthesis \u2014 Monash University', url:'https://www.monash.edu/student-academic-success/biology/photosynthesis/the-process-of-photosynthesis' },
        { label:'The Calvin Cycle \u2014 OpenStax / Lumen Learning', url:'https://courses.lumenlearning.com/suny-biology1/chapter/the-calvin-cycle/' },
        { label:'Calvin cycle \u2014 Wikipedia', url:'https://en.wikipedia.org/wiki/Calvin_cycle' },
      ],
    },
  },
  {
    id:'p-water', name:'How Water Climbs a Tall Tree', field:'Plant Physiology', progress:72, notes:9, updated:'1d ago',
    note:'No pump, no moving parts \u2014 evaporation at the leaves pulls an unbroken thread of water up from the roots.',
    concepts:[
      {label:'Transpiration', note:'Evaporation from leaves \u2014 the driving force'},
      {label:'Xylem', note:'The tissue that carries water up from the roots'},
      {label:'Cohesion', note:'Water molecules sticking to each other'},
      {label:'Adhesion', note:'Water molecules sticking to the xylem walls'},
      {label:'Tension', note:'The negative pressure that pulls the column up'},
      {label:'Cavitation / embolism', note:'An air bubble that breaks and blocks the column'},
    ],
    summary:{
      head:'How water climbs to the top of a tall tree',
      intro:'A redwood lifts water more than 100 metres with no heart, no pump, and no moving parts \u2014 and a simple suction pump physically cannot raise water past about 10 metres, so something stranger is going on.',
      secs:[
        { h:'Core idea', b:'The answer is the cohesion-tension mechanism, powered not from below but from above. Water evaporates from the leaves through stomata (transpiration), creating negative pressure \u2014 tension \u2014 at the top of the plant\u2019s plumbing. Because water molecules cling tightly together (cohesion via hydrogen bonding), they form an unbroken column down the narrow xylem from leaf to root; pulling the top molecule up drags the whole chain, and adhesion to the walls helps hold it. The sun, by evaporating water from the leaves, effectively pulls a continuous thread of water up the trunk.' },
        { h:'Why it matters', b:'It reveals a beautiful piece of physics hiding in every tree \u2014 a forest is, in a sense, evaporating itself skyward all day. The taller the tree, the greater the tension and the greater the risk the column snaps: an air bubble (cavitation) can break the thread and block a vessel (embolism), one of the limits on how tall trees can grow.' },
        { h:'Common pitfalls', b:'Water is not pushed up from the roots by pressure from below \u2014 it is pulled from above by evaporation (root pressure exists but is minor). There is no pump or heart; the movement is passive physics. And capillary action alone can raise water only about a metre, so it cannot explain a tall tree \u2014 cohesion-tension does.' },
      ],
      links:[
        { label:'How do large trees get water from roots to leaves? \u2014 Scientific American', url:'https://www.scientificamerican.com/article/how-do-large-trees-such-a/' },
        { label:'Angiosperm \u2014 Process of xylem transport \u2014 Britannica', url:'https://www.britannica.com/plant/angiosperm/Process-of-xylem-transport' },
        { label:'Water Uptake and Transport in Vascular Plants \u2014 Nature Scitable', url:'https://www.nature.com/scitable/knowledge/library/water-uptake-and-transport-in-vascular-plants-103016037/' },
      ],
    },
  },
  {
    id:'p-seed', name:'How a Seed Knows When to Wake Up', field:'Plant Development', progress:58, notes:7, updated:'3d ago',
    note:'Dormancy is an evolved timer: a seed integrates cold, light, and water cues so it sprouts in the right season.',
    concepts:[
      {label:'Dormancy', note:'An innate block preventing germination despite good conditions'},
      {label:'Imbibition', note:'The initial uptake of water that begins germination'},
      {label:'Abscisic acid (ABA)', note:'The hormone that maintains dormancy'},
      {label:'Gibberellins', note:'Hormones that promote germination'},
      {label:'Stratification', note:'A cold (or warm) period that breaks dormancy'},
      {label:'Scarification', note:'Breaking or softening a hard seed coat'},
      {label:'Radicle', note:'The embryonic root, first to emerge'},
    ],
    summary:{
      head:'How a seed knows when to wake up',
      intro:'A seed is one of biology\u2019s great inventions: a tiny, dehydrated package of life that can wait \u2014 sometimes for centuries \u2014 until conditions are right, then spring into growth.',
      secs:[
        { h:'Core idea', b:'Dormancy is an innate block that stops a viable seed from germinating even when conditions look favourable \u2014 a bet against sprouting at the wrong moment, like a warm autumn spell. Kinds include physical (a hard, water-proof coat), physiological (hormone balance \u2014 abscisic acid suppresses while gibberellins promote), and morphological (an embryo still maturing). To break dormancy, seeds integrate cues over time: many temperate seeds need a long cold, moist period (cold stratification); some need their coat scratched or burned (scarification); some need light. Then germination begins with imbibition \u2014 the dry seed drinks water, swells, switches on enzymes \u2014 and the radicle pushes out first.' },
        { h:'Why it matters', b:'It reveals how plants gamble on the seasons, why some seeds need fire or a winter or a journey through an animal\u2019s gut, and how a plant with no senses \u201creads\u201d its environment before committing to life. The tricks gardeners use \u2014 scratching, chilling, soaking \u2014 are just imitations of nature\u2019s dormancy cues.' },
        { h:'Common pitfalls', b:'A seed that fails to sprout in good conditions is not necessarily dead \u2014 it may be dormant, deliberately waiting. Germination is not triggered by soil nutrients; the first trigger is water (imbibition), and seeds carry their own food supply. And dormancy is not a flaw \u2014 it is an evolved strategy that times sprouting to the season most likely to let the seedling live.' },
      ],
      links:[
        { label:'Germination \u2014 Britannica', url:'https://www.britannica.com/science/germination' },
        { label:'Germination \u2014 Biology LibreTexts (Botany)', url:'https://bio.libretexts.org/Bookshelves/Botany/Botany_(Ha_Morrow_and_Algiers)/04:_Plant_Physiology_and_Regulation/4.06:_Development/4.6.04:_Germination' },
        { label:'Seed Germination: Steps, Factors, Seed Dormancy \u2014 Microbe Notes', url:'https://microbenotes.com/seed-germination/' },
      ],
    },
  },
];

const PLANTWORLD = [
  {
    id:'p-def', name:'How a Rooted Plant Fights Back', field:'Plant Ecology / Chemistry', progress:64, notes:8, updated:'1d ago',
    note:'Plants are master chemists \u2014 barriers, then toxins like caffeine, then summoning a herbivore\u2019s own predators.',
    concepts:[
      {label:'Herbivory', note:'The eating of plants by animals'},
      {label:'Physical defenses', note:'Bark, cuticle, thorns, spines, trichomes, silica'},
      {label:'Secondary metabolites', note:'Defensive compounds beyond basic growth'},
      {label:'Alkaloids', note:'Nitrogen-based toxins such as caffeine and nicotine'},
      {label:'Constitutive vs induced', note:'Always-on versus switched-on-when-attacked'},
      {label:'Jasmonates', note:'Hormone signals that trigger defense responses'},
      {label:'Indirect defense', note:'Recruiting predators (ants, wasps) against herbivores'},
    ],
    summary:{
      head:'How a rooted plant fights back',
      intro:'A plant cannot run from whatever is eating it \u2014 and yet plants are among the most accomplished chemists on Earth. Many substances we prize (caffeine, nicotine, countless medicines) began as plant weapons.',
      secs:[
        { h:'Core idea', b:'Plant defenses come in layers. The first is physical: bark, waxy cuticles, thorns, stinging trichomes, even grains of silicon that wear down a grazer\u2019s teeth. If breached, chemistry takes over: secondary metabolites potent against attackers \u2014 alkaloids like caffeine and nicotine, cyanide compounds, foxglove\u2019s cardiac glycosides. Defenses can be constitutive (always present) or induced (switched on only when attacked): a wounded plant recognizes damage within minutes and uses hormone signals like jasmonates to ramp up toxins, even in undamaged leaves.' },
        { h:'Why it matters', b:'It reveals a hidden arms race in every garden and forest \u2014 and explains why your morning coffee is, from the plant\u2019s point of view, a pesticide. Some plants go further and recruit bodyguards: damaged maize releases airborne compounds that summon parasitic wasps to attack the caterpillars eating it. Inducing defenses only when needed saves the considerable cost of making toxins all the time.' },
        { h:'Common pitfalls', b:'Plants are not passive victims \u2014 they sense attack and respond actively, often within minutes. Many familiar \u201cnatural\u201d plant chemicals (caffeine, nicotine) are not there for our benefit; they evolved as defenses. And defense is not free \u2014 making toxins is costly, which is why so many plants hold their strongest chemistry in reserve and induce it only when attacked.' },
      ],
      links:[
        { label:'Plant Defenses Against Herbivores \u2014 Biology LibreTexts', url:'https://bio.libretexts.org/Bookshelves/Introductory_and_General_Biology/General_Biology_(Boundless)/30:_Plant_Form_and_Physiology/30.24:_Plant_Defense_Mechanisms_-_Against_Herbivores' },
        { label:'Plant Defenses \u2014 University of Utah (Learn.Genetics)', url:'https://learn.genetics.utah.edu/content/herbivores/defenses/' },
        { label:'Plant Resistance against Herbivory \u2014 Nature Scitable', url:'https://www.nature.com/scitable/knowledge/library/plant-resistance-against-herbivory-96675700/' },
      ],
    },
  },
  {
    id:'p-poll', name:'How a Flower Turns an Animal into a Courier', field:'Plant Reproduction / Evolution', progress:50, notes:7, updated:'4d ago',
    note:'Flowers bribe or trick animals into carrying pollen \u2014 a 130-million-year coevolution, sometimes by outright deception.',
    concepts:[
      {label:'Pollination', note:'Transfer of pollen from a flower\u2019s male to female parts'},
      {label:'Pollinator', note:'The animal (or wind/water) that carries the pollen'},
      {label:'Coevolution', note:'Two species adapting in response to each other over time'},
      {label:'Pollination syndrome', note:'Flower traits matched to a pollinator group'},
      {label:'Nectar', note:'The sugary reward that attracts and pays the pollinator'},
      {label:'Floral constancy', note:'A pollinator\u2019s tendency to visit one species in a row'},
      {label:'Floral deception', note:'Luring pollinators with no real reward (some orchids)'},
    ],
    summary:{
      head:'How a flower turns an animal into a courier',
      intro:'A flower is not decoration \u2014 it is reproductive machinery built to solve a hard problem: how does a rooted organism get its sex cells to another individual it can never reach?',
      secs:[
        { h:'Core idea', b:'Most flowering plants move pollen from one flower\u2019s male parts to another\u2019s female parts, and since they cannot move, many enlist animals. Over ~130 million years, flowers and pollinators have shaped each other through coevolution, producing pollination syndromes \u2014 suites of flower traits matched to a pollinator group: bright, scented, nectar-rich for bees; long tubes or spurs for moths and hummingbirds; dull, strong-smelling for flies and beetles. The flower offers a reward (usually nectar), and collecting it the animal brushes anthers and ferries pollen onward; floral constancy makes delivery efficient.' },
        { h:'Why it matters', b:'It is one of evolution\u2019s greatest collaborations \u2014 and cons. Some orchids offer no reward at all, mimicking food or even the appearance and scent of a female insect so males try to mate with the flower and pollinate it for free. Darwin famously predicted, from a Madagascar orchid with a foot-long nectar spur, that a moth with a matching tongue must exist \u2014 and decades later it was found.' },
        { h:'Common pitfalls', b:'Flowers did not evolve to be beautiful for us \u2014 their colours, scents, and shapes are advertisements aimed at pollinators, whose senses differ from ours (many see ultraviolet). Pollination is not always a fair trade: some flowers deceive and give nothing back. And not all plants use animals \u2014 grasses, oaks, and many conifers are wind-pollinated, which is why they make so much pollen and so little show.' },
      ],
      links:[
        { label:'Pollination Syndromes \u2014 Biology LibreTexts (Botany)', url:'https://bio.libretexts.org/Bookshelves/Botany/Botany_(Ha_Morrow_and_Algiers)/02:_Biodiversity_(Organismal_Groups)/2.07:_Angiosperm_Diversity/2.7.02:_Pollination_Syndromes' },
        { label:'The Evolution of Pollination \u2014 Pollinator.org', url:'https://www.pollinator.org/blog/archived/evolution-of-pollination' },
        { label:'Coevolution and Pollination \u2014 Washington Native Plant Society', url:'https://www.wnps.org/blog/coevolution-and-pollination' },
      ],
    },
  },
  {
    id:'p-sense', name:'How a Plant Senses Without a Brain', field:'Plant Signalling', progress:38, notes:6, updated:'6d ago',
    note:'No eyes, nerves, or muscles \u2014 plants sense light, gravity, and touch and bend by redistributing one hormone: auxin.',
    concepts:[
      {label:'Tropism', note:'Directional growth toward or away from a stimulus'},
      {label:'Phototropism', note:'Growth in response to the direction of light'},
      {label:'Gravitropism', note:'Growth in response to gravity \u2014 roots down, shoots up'},
      {label:'Thigmotropism', note:'Growth in response to touch (climbing, coiling)'},
      {label:'Auxin', note:'The hormone driving cell elongation and most tropisms'},
      {label:'Phototropins', note:'Blue-light receptors that sense light direction'},
      {label:'Statoliths', note:'Dense starch grains that settle to signal \u201cdown\u201d'},
    ],
    summary:{
      head:'How a plant senses the world without a brain',
      intro:'A plant has no eyes, ears, nerves, or muscles \u2014 yet a seedling reliably bends toward a window, sends roots down and shoots up in the dark, and curls a tendril around a support it touches.',
      secs:[
        { h:'Core idea', b:'Plants respond to directional cues by growing \u2014 bending toward or away \u2014 in tropisms: phototropism (light), gravitropism (gravity), thigmotropism (touch). The master tool is the hormone auxin, which promotes cell elongation. In phototropism, blue-light receptors (phototropins) at the shoot tip sense light direction and auxin is redistributed to the shaded side, whose cells elongate more, bending the shoot toward light. In gravitropism, dense starch-filled statoliths settle to signal which way is down, and auxin again redistributes so roots grow down and shoots up.' },
        { h:'Why it matters', b:'How a brainless organism senses its surroundings is one of botany\u2019s deepest questions \u2014 it fascinated Darwin, who showed in 1880 that the shoot tip senses the light while the bending happens lower down, implying a travelling signal that led, decades later, to the discovery of auxin itself. All of it is hormone chemistry and differential growth, not thought.' },
        { h:'Common pitfalls', b:'Plants do not \u201csee,\u201d \u201cfeel,\u201d or \u201cdecide\u201d in any conscious sense \u2014 they detect stimuli and respond through hormones and growth, with no brain or nerves. A plant bends toward light not by turning a part it has, but by growing unevenly. And tropisms are not instantaneous like an animal\u2019s movement \u2014 they unfold over minutes to hours as cells grow.' },
      ],
      links:[
        { label:'Plant Hormones and Sensory Systems \u2014 Georgia Tech', url:'https://organismalbio.biosci.gatech.edu/chemical-and-electrical-signals/plant-hormones-and-sensory-systems/' },
        { label:'Understanding Plant Tropisms \u2014 Biology Insights', url:'https://biologyinsights.com/understanding-plant-tropisms-phototropism-gravitropism-and-more/' },
        { label:'Plant Tropism: Cue Detection and Control Over Growth Direction \u2014 The Botanical Review', url:'https://link.springer.com/article/10.1007/s12229-025-09320-z' },
      ],
    },
  },
];

const FRIENDS = [
  {
    id:'mara', name:'Mara Lindqvist', accent:FA.clay, headline:'Geology & Electrical Engineering',
    blurb:'Deep into the planet and the circuits that run on it. Shared two full reading paths with you.',
    streak:12, weekMin:320, lastActive:'2h ago', shared:true, questions:34, challenges:5,
    domains:[
      { id:'geo', name:'Geology', accent:FA.clay, topics:GEOLOGY },
      { id:'ee',  name:'Electrical Engineering', accent:FA.blue, topics:ELECENG },
    ],
    activity:[
      { accent:FA.clay, text:'Read “Why the continents move” summary', meta:'Geology · 2h ago' },
      { accent:FA.blue, text:'Generated a concept map for Ohm\u2019s law', meta:'Electrical Engineering · 6h ago' },
      { accent:FA.clay, text:'Hit a 12-day study streak', meta:'Yesterday' },
      { accent:FA.blue, text:'Added 8 notes on AC vs. DC power', meta:'Electrical Engineering · 1d ago' },
    ],
  },
  {
    id:'devin', name:'Devin Okafor', accent:FA.blue, headline:'Computer Science — from bits to AI',
    blurb:'Opening the sealed box, one layer at a time — bits, the CPU, algorithms, networks, crypto, and machine learning. Shared two reading paths with you.',
    streak:7, weekMin:210, lastActive:'5h ago', shared:true, questions:21, challenges:8,
    domains:[
      { id:'sys',   name:'Computer Systems', accent:FA.blue, topics:SYSTEMS },
      { id:'netai', name:'Networks & AI', accent:FA.green, topics:NETAI },
    ],
    activity:[
      { accent:FA.blue, text:'Read \u201cWhat the processor is actually doing\u201d', meta:'Computer Systems · 5h ago' },
      { accent:FA.green, text:'Generated a concept map for public-key crypto', meta:'Networks & AI · 1d ago' },
      { accent:FA.blue, text:'Added 8 notes on Big O notation', meta:'Computer Systems · 3d ago' },
      { accent:FA.green, text:'Started a topic on how a machine learns', meta:'Networks & AI · 6d ago' },
    ],
  },
  {
    id:'priya', name:'Priya Raman', accent:FA.lilac, headline:'Civil Engineering & Architecture',
    blurb:'Asking the blunt question in front of every structure — why doesn\u2019t this fall down? Shared two reading paths with you.',
    streak:21, weekMin:280, lastActive:'1d ago', shared:true, questions:48, challenges:3,
    domains:[
      { id:'civil', name:'Civil Engineering', accent:FA.blue, topics:CIVIL },
      { id:'arch',  name:'Architecture', accent:FA.clay, topics:ARCH },
    ],
    activity:[
      { accent:FA.blue, text:'Read \u201cWhy concrete needs steel hidden inside it\u201d', meta:'Civil Engineering · 3h ago' },
      { accent:FA.clay, text:'Generated a concept map for the arch & dome', meta:'Architecture · 1d ago' },
      { accent:FA.blue, text:'Added 8 notes on earthquake base isolation', meta:'Civil Engineering · 2d ago' },
      { accent:FA.clay, text:'On a 21-day streak — longest in your circle', meta:'2d ago' },
    ],
  },
  {
    id:'leo', name:'Leo Marchetti', accent:FA.green, headline:'The Human Body & Astronomy',
    blurb:'Turning his own body \u2014 and the night sky \u2014 into a curriculum, from why we dream to what stars are made of. Shared two reading paths with you.',
    streak:4, weekMin:150, lastActive:'3d ago', shared:true, questions:12, challenges:6,
    domains:[
      { id:'body',  name:'The Human Body', accent:FA.green, topics:BODY },
      { id:'astro', name:'Astronomy', accent:FA.blue, topics:ASTRO },
    ],
    activity:[
      { accent:FA.green, text:'Read \u201cWhy caffeine wakes you up\u201d summary', meta:'The Human Body · 4h ago' },
      { accent:FA.blue, text:'Generated a concept map for the cosmic distance ladder', meta:'Astronomy · 1d ago' },
      { accent:FA.green, text:'Added 7 notes on why we dream', meta:'The Human Body · 3d ago' },
      { accent:FA.blue, text:'Started a topic on black holes', meta:'Astronomy · 5d ago' },
    ],
  },
  {
    id:'iris', name:'Iris Calderón', accent:FA.sage, headline:'Botany — how plants actually work',
    blurb:'Treating plants as the ingenious chemists and strategists they are \u2014 from photosynthesis to flowers that trick their pollinators. Shared two reading paths with you.',
    streak:9, weekMin:240, lastActive:'1h ago', shared:true, questions:29, challenges:4,
    domains:[
      { id:'plantlife',  name:'Plant Life', accent:FA.green, topics:PLANTLIFE },
      { id:'plantworld', name:'Plants & the World', accent:FA.clay, topics:PLANTWORLD },
    ],
    activity:[
      { accent:FA.green, text:'Read \u201cHow a plant builds itself from air and light\u201d', meta:'Plant Life · 1h ago' },
      { accent:FA.clay, text:'Generated a concept map for pollination syndromes', meta:'Plants & the World · 1d ago' },
      { accent:FA.green, text:'Added 9 notes on how water climbs a tall tree', meta:'Plant Life · 2d ago' },
      { accent:FA.clay, text:'Started a topic on plant defenses', meta:'Plants & the World · 4d ago' },
    ],
  },
];

const friendById = (id) => FRIENDS.find((f) => f.id === id);
const friendOverall = (f) => {
  const ts = f.domains.flatMap((d) => d.topics);
  return Math.round(ts.reduce((s, t) => s + t.progress, 0) / ts.length);
};
const friendTopicCount = (f) => f.domains.reduce((s, d) => s + d.topics.length, 0);

Object.assign(window, { FRIENDS, friendById, friendOverall, friendTopicCount });
