/* SubMedium mock content — fictional but plausible (June 2026) */

const MARKETS = [
  { sym: "S&P 500", val: "5,842.10", pct: +0.62 },
  { sym: "NASDAQ", val: "19,104.7", pct: +0.94 },
  { sym: "DOW", val: "42,388",   pct: -0.18 },
  { sym: "FTSE 100", val: "8,471.2", pct: +0.31 },
  { sym: "10Y", val: "4.21%",   pct: -0.04 },
  { sym: "BTC", val: "$71,420", pct: +2.18 },
  { sym: "WTI", val: "$78.04",  pct: -1.12 },
  { sym: "GOLD", val: "$2,388", pct: +0.40 },
  { sym: "EUR/USD", val: "1.0914", pct: +0.07 },
];

const SECTIONS = ["Top", "World", "Tech", "Business", "Markets", "Politics", "Culture", "Science"];

// source registry: tier 1 = wire/record, used for cluster avatars
const SRC = {
  reuters:  { name: "Reuters",            tag: "Wire" },
  ap:       { name: "Associated Press",   tag: "Wire" },
  bloomberg:{ name: "Bloomberg",          tag: "Markets" },
  ft:       { name: "Financial Times",    tag: "Record" },
  wsj:      { name: "The Wall St. Journal",tag: "Record" },
  nyt:      { name: "The New York Times", tag: "Record" },
  guardian: { name: "The Guardian",       tag: "Record" },
  bbc:      { name: "BBC News",           tag: "Public" },
  economist:{ name: "The Economist",      tag: "Analysis" },
  verge:    { name: "The Verge",          tag: "Tech" },
  axios:    { name: "Axios",              tag: "Brief" },
  politico: { name: "Politico",           tag: "Politics" },
  nature:   { name: "Nature",             tag: "Science" },
  cnbc:     { name: "CNBC",               tag: "Markets" },
};

function initials(name) {
  return name.replace(/^The\s+/, "").split(/\s+/).slice(0, 2).map(w => w[0]).join("").toUpperCase();
}

// Each story is a CLUSTER. `sources` lists outlets w/ their own angle headline.
const STORIES = [
  {
    id: "ecb-rate",
    section: "Markets",
    kicker: "Monetary Policy",
    headline: "ECB holds rates as inflation cools, signals first cut could slip to autumn",
    dek: "Policymakers in Frankfurt left the deposit rate unchanged for a third meeting, even as core price growth fell to its slowest pace in two years.",
    brief: "Twelve outlets agree the ECB held rates; coverage splits on timing — wires frame a steady hold, while FT and Bloomberg read the statement as quietly hawkish on the autumn cut.",
    region: "Europe", time: "18m", live: true, lead: true, image: true,
    sourceCount: 14,
    sources: [
      { k: "ft",        h: "ECB's cautious hold leaves markets guessing on timing", time: "18m" },
      { k: "bloomberg", h: "Lagarde keeps door open but won't 'pre-commit' to a cut", time: "22m" },
      { k: "reuters",   h: "European Central Bank keeps rates steady for third meeting", time: "31m" },
      { k: "economist", h: "Why the ECB is right to wait — and what it risks", time: "1h" },
      { k: "cnbc",      h: "Euro climbs as traders push first cut to September", time: "44m" },
    ],
  },
  {
    id: "ai-chips",
    section: "Tech",
    kicker: "Semiconductors",
    headline: "Cloud giants race to lock in next-gen AI accelerators amid supply crunch",
    dek: "A scramble for high-bandwidth memory is reshaping multi-year supply deals as hyperscalers pre-buy capacity through 2027.",
    brief: "Reporting converges on a tightening HBM market; The Verge and WSJ add that two unnamed cloud providers signed exclusive allocations, a detail wires have not confirmed.",
    region: "Global", time: "41m", image: true, big: true,
    sourceCount: 9,
    sources: [
      { k: "wsj",   h: "Memory shortage hands chipmakers rare pricing power", time: "41m" },
      { k: "verge", h: "Inside the quiet war for AI memory capacity", time: "55m" },
      { k: "reuters", h: "Chip suppliers lift outlook on AI-driven demand", time: "1h" },
      { k: "bloomberg", h: "HBM lead times stretch past 40 weeks, buyers say", time: "1h" },
    ],
  },
  {
    id: "climate-summit",
    section: "World",
    kicker: "Climate",
    headline: "Coastal nations press for binding adaptation fund at Nairobi summit",
    dek: "Delegates from forty low-lying states are demanding a financing floor, setting up a tense final 48 hours of negotiation.",
    brief: "Outlets agree on the demand for a financing floor; the Guardian and BBC emphasize island-state framing, while Reuters leads on the diplomatic stalemate.",
    region: "Africa", time: "1h", image: true,
    sourceCount: 11,
    sources: [
      { k: "guardian", h: "'We are not negotiating our survival,' island leaders say", time: "1h" },
      { k: "bbc",      h: "Nairobi climate talks enter make-or-break phase", time: "1h" },
      { k: "reuters",  h: "Adaptation fund stalls as donors resist fixed targets", time: "2h" },
    ],
  },
  {
    id: "labor-report",
    section: "Business",
    kicker: "Labor",
    headline: "Hiring slows but wages hold, painting a muddled picture for the Fed",
    dek: "Payrolls rose less than forecast while average earnings ticked up, complicating the case for a near-term rate cut.",
    brief: "A classic split: markets desks read 'soft landing intact,' while AP and the NYT foreground the cooling labor market for households.",
    region: "U.S.", time: "2h", image: false,
    sourceCount: 16,
    sources: [
      { k: "ap",       h: "U.S. employers add fewer jobs as labor market cools", time: "2h" },
      { k: "wsj",      h: "Wage resilience keeps the Fed boxed in", time: "2h" },
      { k: "nyt",      h: "What a slower jobs market means for workers", time: "2h" },
    ],
  },
  {
    id: "election-court",
    section: "Politics",
    kicker: "Courts",
    headline: "High court agrees to hear challenge over redistricting maps",
    dek: "The decision sets up a ruling that could reshape dozens of contested districts before the midterm cycle.",
    brief: "Coverage is uniform on the facts; Politico adds strategic implications for both parties, while wires keep to procedure.",
    region: "U.S.", time: "3h", image: false,
    sourceCount: 8,
    sources: [
      { k: "politico", h: "Redistricting case could redraw the midterm map", time: "3h" },
      { k: "ap",       h: "Supreme Court takes up congressional maps dispute", time: "3h" },
      { k: "reuters",  h: "Justices to weigh partisan gerrymandering test", time: "3h" },
    ],
  },
  {
    id: "fusion",
    section: "Science",
    kicker: "Energy",
    headline: "Fusion startup reports net-energy shot sustained past five seconds",
    dek: "Independent reviewers are cautious, but the milestone marks the longest controlled burn yet from a private reactor.",
    brief: "Nature urges caution pending peer review; tech and wire outlets are more bullish on the commercialization timeline.",
    region: "Global", time: "4h", image: true,
    sourceCount: 6,
    sources: [
      { k: "nature",  h: "Private reactor's claim awaits independent verification", time: "4h" },
      { k: "verge",   h: "The five-second burn that could matter", time: "5h" },
      { k: "reuters", h: "Fusion firm says latest test beats prior record", time: "5h" },
    ],
  },
  {
    id: "merger",
    section: "Business",
    kicker: "Deals",
    headline: "Payments rivals confirm $34bn all-stock merger talks",
    dek: "The combination would create the largest non-bank processor in the region, drawing immediate antitrust scrutiny.",
    brief: "Bloomberg and FT broke the talks; the companies' confirmation aligns figures, though regulators' posture remains unreported.",
    region: "Global", time: "5h", image: false,
    sourceCount: 10,
    sources: [
      { k: "bloomberg", h: "Processors near deal to form payments heavyweight", time: "5h" },
      { k: "ft",        h: "Merger would test regulators' appetite for scale", time: "5h" },
      { k: "cnbc",      h: "Shares jump on confirmation of merger talks", time: "5h" },
    ],
  },
  {
    id: "culture-archive",
    section: "Culture",
    kicker: "Heritage",
    headline: "A vast newspaper archive goes public, and historians are recalibrating",
    dek: "Two centuries of regional press, newly digitized and searchable, are already rewriting small assumptions at scale.",
    brief: "A rare single-source story for now; the NYT feature stands alone, with no competing coverage yet in the cluster.",
    region: "Global", time: "6h", image: true,
    sourceCount: 2,
    sources: [
      { k: "nyt",      h: "What a fully searchable past does to history", time: "6h" },
      { k: "guardian", h: "The archive that swallowed two centuries", time: "7h" },
    ],
  },
  {
    id: "energy-grid",
    section: "World",
    kicker: "Infrastructure",
    headline: "Heatwave pushes regional grids to record demand, holds without blackouts",
    dek: "Operators credit battery storage and demand response for averting outages during the season's first major heat event.",
    brief: "Consensus that the grid held; analysts disagree on whether storage or curtailment did the heavier lifting.",
    region: "U.S.", time: "7h", image: false,
    sourceCount: 7,
    sources: [
      { k: "ap",      h: "Grid sets demand record but avoids rolling outages", time: "7h" },
      { k: "reuters", h: "Battery storage credited as heat strains power supply", time: "8h" },
    ],
  },
];

const TOPICS = ["Central Banks", "AI & Compute", "Climate Policy", "Elections", "Energy", "Semiconductors", "Markets", "Geopolitics"];

const TRENDING = [
  { t: "ECB rate decision", n: 14 },
  { t: "AI memory shortage", n: 9 },
  { t: "Nairobi climate summit", n: 11 },
  { t: "Payments merger", n: 10 },
  { t: "Redistricting case", n: 8 },
];

Object.assign(window, { MARKETS, SECTIONS, SRC, STORIES, TOPICS, TRENDING, initials });
