teach me aortic stenosis starting from rheumatic heart disease to surgical management, mch cardiac surgery level in detailed from standard textbooks and literature, pictures lacked notes plz

Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Loading Image
Loading Image
Reading File
Loading Image
Reading File
Loading Image
Finding Sources
These are your comprehensive MCh Cardiac Surgery level notes on Aortic Stenosis, built directly from six standard textbooks. Here's a quick orientation to what was covered:

What These Notes Cover (17 Parts)

PartTopic
1Rheumatic Heart Disease - molecular mimicry, Aschoff bodies, Jones criteria, chronic RHD pathology
2Full etiology classification - Calcific, Bicuspid, Rheumatic, rare causes
3Pathophysiology - Laplace law, Frank-Starling, concentric hypertrophy, progression rates
4Clinical features - pulsus parvus et tardus, Gallavardin phenomenon, symptom triad
5Investigations - ECG, CXR, Gorlin formula
6Echocardiography - 2D imaging, continuity equation, DVI, low-flow low-gradient AS
72021 ACC/AHA Staging (Stage A through D3)
8Natural history - "5-3-2" survival rule
9Medical management - why no drugs work, BAV as bridge
10Indications for intervention (Class I, IIa, IIb)
11Operative approach - CPB setup, aortotomy, annular debridement
12Prosthetic valves - mechanical vs. tissue, suturing techniques, root enlargement (Nicks/Manougian/Konno)
13SAVR step-by-step
14TAVI - valve types, access routes, steps, complications, key trials (PARTNER, Evolut)
15Special situations - redo surgery, Bentall, David, Ross procedure
16Post-op management - ICU care, anticoagulation, follow-up
17Outcomes and prognostic factors
The three textbook images embedded show: (1) the four types of aortic valve disease by echocardiographic appearance, (2) the complete natural history/pathophysiology/management flowchart from Fuster & Hurst, and (3) CW Doppler differentiation of valvular AS vs. subaortic obstruction vs. HCM.

Generate a PowerPoint presentation on aortic stenosis for MCh cardiology teaching rounds

Reading File
Reading File
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/aortic-stenosis-ppt

Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js "https://cdn.orris.care/cdss_images/e3476113f8ca1b8c3587f3768a9ec0d115a289ba8d5a8ad55c7e1e90cf221438.png" "https://cdn.orris.care/cdss_images/210bcc14d6feb9ac6b12973ea2114c1196e7959d82d1f7abe2da295c61b20bed.png" "https://cdn.orris.care/cdss_images/e0dde8d70e5315322961d837763d57b676c7d3df92e896906b5ae49eb88f7302.png" "https://cdn.orris.care/cdss_images/b066f763c551005c2db9e9831280415a205a914074c4321c8f35b78c09f77000.png" 2>/dev/null | node -e "const d=require('fs');let x='';process.stdin.on('data',c=>x+=c);process.stdin.on('end',()=>{const arr=JSON.parse(x);arr.forEach((item,i)=>{d.writeFileSync('/home/daytona/workspace/aortic-stenosis-ppt/img'+i+'.txt',item.error?'ERROR:'+item.error:item.base64)});console.log('Done, errors:',arr.filter(a=>a.error).length)})"

Writing File

~/aortic-stenosis-ppt/build.js

const pptxgen = require("pptxgenjs");
const fs = require("fs");

// Load pre-fetched images
const img0 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img0.txt", "utf8"); // valve types
const img1 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img1.txt", "utf8"); // natural history flowchart
const img2 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img2.txt", "utf8"); // CW Doppler
const img3 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img3.txt", "utf8"); // gross pathology

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "MCh Cardiac Surgery Teaching";
pres.title = "Aortic Stenosis – MCh Cardiology Teaching Rounds";

// ─── COLOUR PALETTE ───────────────────────────────────────────────
// Deep navy dominant, crimson accent, light slate content areas
const C = {
  navy:     "0A1628",  // dominant dark bg
  navyMid:  "122040",  // card/panel bg
  navyLt:   "1A3060",  // subtle divider / sub-panel
  crimson:  "C0392B",  // accent / highlight
  crimsonLt:"E74C3C",  // lighter accent
  gold:     "F39C12",  // 2nd accent / warning
  teal:     "1ABC9C",  // 3rd accent / positive
  white:    "FFFFFF",
  offWhite: "ECF0F1",
  gray:     "95A5A6",
  grayLt:   "BDC3C7",
};

// ─── HELPER: Slide Header Bar ─────────────────────────────────────
function addHeader(slide, title, subtitle) {
  // Full-width top bar
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.82,
    fill: { color: C.navyMid },
    line: { color: C.navyMid }
  });
  // Crimson accent left strip
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 0.06, h: 0.82,
    fill: { color: C.crimson },
    line: { color: C.crimson }
  });
  // Title text
  slide.addText(title.toUpperCase(), {
    x: 0.18, y: 0, w: subtitle ? 7.5 : 9.7, h: 0.82,
    fontSize: 20, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", margin: 0, charSpacing: 1
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 7.7, y: 0, w: 2.2, h: 0.82,
      fontSize: 9, color: C.grayLt,
      fontFace: "Calibri", valign: "middle", align: "right", margin: 0
    });
  }
}

// ─── HELPER: Content Card ─────────────────────────────────────────
function addCard(slide, x, y, w, h, opts = {}) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h,
    fill: { color: opts.fill || C.navyMid },
    line: { color: opts.border || C.navyLt, pt: opts.borderPt || 1 },
    shadow: opts.shadow ? { type: "outer", color: "000000", blur: 8, offset: 2, angle: 135, opacity: 0.25 } : undefined
  });
  if (opts.accent) {
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 0.05, h,
      fill: { color: opts.accent },
      line: { color: opts.accent }
    });
  }
}

// ─── HELPER: Section Label ────────────────────────────────────────
function addLabel(slide, text, x, y, color) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w: text.length * 0.095 + 0.25, h: 0.25,
    fill: { color: color || C.crimson },
    line: { color: color || C.crimson }
  });
  slide.addText(text, {
    x, y, w: text.length * 0.095 + 0.25, h: 0.25,
    fontSize: 8, bold: true, color: C.white,
    fontFace: "Calibri", align: "center", valign: "middle", margin: 0
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE SLIDE
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };

  // Large crimson left accent bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 0.18, h: 5.625,
    fill: { color: C.crimson }, line: { color: C.crimson }
  });

  // Horizontal mid divider
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.18, y: 2.55, w: 9.82, h: 0.04,
    fill: { color: C.navyLt }, line: { color: C.navyLt }
  });

  // Main title
  s.addText("AORTIC STENOSIS", {
    x: 0.4, y: 0.9, w: 9.3, h: 1.2,
    fontSize: 52, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 2
  });

  // Subtitle
  s.addText("A Comprehensive Review for MCh Cardiology Teaching Rounds", {
    x: 0.4, y: 2.1, w: 9.3, h: 0.6,
    fontSize: 18, color: C.grayLt, fontFace: "Calibri", italic: true
  });

  // Topic tags
  const tags = ["Rheumatic Heart Disease", "Pathophysiology", "Echocardiography", "Surgical Management", "TAVI"];
  tags.forEach((tag, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.4 + i * 1.92, y: 2.82, w: 1.78, h: 0.3,
      fill: { color: C.navyMid }, line: { color: C.navyLt, pt: 1 }
    });
    s.addText(tag, {
      x: 0.4 + i * 1.92, y: 2.82, w: 1.78, h: 0.3,
      fontSize: 8, color: C.grayLt, fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0
    });
  });

  // Key stat box
  addCard(s, 0.4, 3.3, 4.5, 1.9, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("KEY EPIDEMIOLOGY", {
    x: 0.6, y: 3.3, w: 4.2, h: 0.35,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText([
    { text: "• 2-5% of adults >65 years have significant AS\n", options: {} },
    { text: "• Most common valvular heart disease in developed world\n", options: {} },
    { text: "• 50% mortality at 2-3 years once symptomatic\n", options: {} },
    { text: "• 100,000+ AVR procedures performed annually in USA", options: {} },
  ], {
    x: 0.55, y: 3.65, w: 4.25, h: 1.4,
    fontSize: 11, color: C.offWhite, fontFace: "Calibri", valign: "top"
  });

  // Source box
  addCard(s, 5.1, 3.3, 4.7, 1.9, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("SOURCES", {
    x: 5.3, y: 3.3, w: 4.4, h: 0.35,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText([
    { text: "• Braunwald's Heart Disease, 10th Ed.\n", options: {} },
    { text: "• Schwartz's Principles of Surgery, 11th Ed.\n", options: {} },
    { text: "• Sabiston Textbook of Surgery, 21st Ed.\n", options: {} },
    { text: "• Fuster & Hurst's The Heart, 15th Ed.\n", options: {} },
    { text: "• Otto: Textbook of Clinical Echocardiography", options: {} },
  ], {
    x: 5.3, y: 3.65, w: 4.4, h: 1.4,
    fontSize: 10, color: C.offWhite, fontFace: "Calibri", valign: "top"
  });

  // Bottom bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.37, w: 10, h: 0.255,
    fill: { color: C.navyMid }, line: { color: C.navyMid }
  });
  s.addText("MCh Cardiology Teaching Rounds  |  Aortic Stenosis", {
    x: 0.2, y: 5.37, w: 9.6, h: 0.255,
    fontSize: 8, color: C.gray, fontFace: "Calibri", valign: "middle"
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 – OUTLINE / TABLE OF CONTENTS
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Lecture Outline", "MCh Cardiology Teaching Rounds");

  const sections = [
    { num: "01", title: "Rheumatic Heart Disease", sub: "ARF → Molecular mimicry → Chronic RHD → Valve pathology", color: C.crimson },
    { num: "02", title: "Etiology & Classification", sub: "Calcific · Bicuspid · Rheumatic – comparative features", color: C.crimsonLt },
    { num: "03", title: "Pathophysiology", sub: "Pressure overload · LV hypertrophy · Laplace law · Symptom triad", color: C.gold },
    { num: "04", title: "Clinical Features & Investigations", sub: "Examination findings · ECG · CXR · Cardiac catheterization", color: C.teal },
    { num: "05", title: "Echocardiography", sub: "Quantitation · Continuity equation · Low-flow low-gradient AS", color: "#3498DB" },
    { num: "06", title: "Staging & Indications for Intervention", sub: "2021 ACC/AHA Guidelines · Stage A–D3", color: "#9B59B6" },
    { num: "07", title: "Surgical Management", sub: "SAVR · Prosthetic valves · Root enlargement · TAVI · Ross", color: "#27AE60" },
    { num: "08", title: "Outcomes & Follow-up", sub: "Mortality data · Anticoagulation · SVD · Key trials", color: "#E67E22" },
  ];

  sections.forEach((sec, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i % 4;
    const x = 0.18 + col * 4.95;
    const y = 0.95 + row * 1.15;

    addCard(s, x, y, 4.7, 1.0, { fill: C.navyMid, border: C.navyLt, accent: sec.color, shadow: true });
    s.addText(sec.num, {
      x: x + 0.15, y: y, w: 0.55, h: 1.0,
      fontSize: 26, bold: true, color: sec.color,
      fontFace: "Calibri", valign: "middle", align: "center", margin: 0
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: x + 0.72, y: y + 0.22, w: 0.02, h: 0.56,
      fill: { color: C.navyLt }, line: { color: C.navyLt }
    });
    s.addText(sec.title, {
      x: x + 0.82, y: y + 0.08, w: 3.76, h: 0.38,
      fontSize: 12, bold: true, color: C.white,
      fontFace: "Calibri", valign: "middle", margin: 0
    });
    s.addText(sec.sub, {
      x: x + 0.82, y: y + 0.48, w: 3.76, h: 0.42,
      fontSize: 9, color: C.gray,
      fontFace: "Calibri", valign: "top", margin: 0
    });
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 – RHEUMATIC HEART DISEASE
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Rheumatic Heart Disease", "Sabiston Surgery 21e · Braunwald's 10e");

  // Left panel – cascade
  addCard(s, 0.18, 0.95, 4.6, 4.5, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("THE RHEUMATIC CASCADE", {
    x: 0.35, y: 0.98, w: 4.3, h: 0.3,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const cascade = [
    { step: "01", text: "Group A β-hemolytic Streptococcal pharyngitis (GAS)", color: C.crimson },
    { step: "02", text: "Genetically susceptible host (HLA-DR2, DR4)", color: C.crimsonLt },
    { step: "03", text: "Molecular mimicry — M-protein vs. cardiac laminin", color: C.gold },
    { step: "04", text: "Cross-reactive T-cells & antibodies attack endocardium", color: C.gold },
    { step: "05", text: "Acute Rheumatic Valvulitis (2-6 wks post-infection)", color: C.teal },
    { step: "06", text: "Repeated strep exposures → cumulative valve damage", color: C.teal },
    { step: "07", text: "Commissural fusion + fibrosis → CHRONIC RHD", color: "#3498DB" },
  ];

  cascade.forEach((c, i) => {
    const y = 1.4 + i * 0.55;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.3, y, w: 0.42, h: 0.37,
      fill: { color: c.color }, line: { color: c.color }
    });
    s.addText(c.step, {
      x: 0.3, y, w: 0.42, h: 0.37,
      fontSize: 9, bold: true, color: C.navy,
      fontFace: "Calibri", align: "center", valign: "middle", margin: 0
    });
    s.addText(c.text, {
      x: 0.82, y, w: 3.85, h: 0.37,
      fontSize: 9.5, color: C.offWhite, fontFace: "Calibri", valign: "middle", margin: 0
    });
    if (i < cascade.length - 1) {
      s.addShape(pres.shapes.RECTANGLE, {
        x: 0.48, y: y + 0.37, w: 0.05, h: 0.18,
        fill: { color: C.gray }, line: { color: C.gray }
      });
    }
  });

  // Right panel – pathology details
  addCard(s, 4.95, 0.95, 4.87, 2.1, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("ASCHOFF BODY — PATHOGNOMONIC LESION", {
    x: 5.12, y: 0.98, w: 4.6, h: 0.3,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText([
    { text: "• Central fibrinoid necrosis\n", options: {} },
    { text: "• Anitschkow (caterpillar) cells — activated macrophages\n", options: {} },
    { text: "• Aschoff giant cells (multinucleated)\n", options: {} },
    { text: "• Verrucous endocarditis — 1-2 mm sterile vegetations at valve closure line\n", options: {} },
    { text: "• Pancarditis: endocardium + myocardium + pericardium", options: {} },
  ], {
    x: 5.12, y: 1.32, w: 4.6, h: 1.65,
    fontSize: 10, color: C.offWhite, fontFace: "Calibri", valign: "top"
  });

  // Gross pathology image
  addCard(s, 4.95, 3.18, 2.3, 2.2, { fill: C.navyMid, border: C.navyLt, shadow: true });
  s.addImage({ data: img3, x: 5.0, y: 3.22, w: 2.2, h: 1.85 });
  s.addText("Rheumatic MV — 'fish-mouth' orifice", {
    x: 4.95, y: 5.05, w: 2.3, h: 0.25,
    fontSize: 7.5, color: C.gray, fontFace: "Calibri", align: "center", italic: true, margin: 0
  });

  // Valve features comparison
  addCard(s, 7.35, 3.18, 2.47, 2.27, { fill: C.navyMid, border: C.navyLt, accent: C.teal, shadow: true });
  s.addText("RHEUMATIC AV — KEY FEATURES", {
    x: 7.5, y: 3.21, w: 2.2, h: 0.3,
    fontSize: 8, bold: true, color: C.teal, fontFace: "Calibri", valign: "middle", margin: 0
  });
  s.addText([
    { text: "✦ Commissural fusion\n", options: { color: C.teal } },
    { text: "✦ Triangular orifice in systole\n", options: { color: C.teal } },
    { text: "✦ Mitral valve always involved\n", options: { color: C.offWhite } },
    { text: "✦ Mixed lesion: stenosis + regurgitation\n", options: { color: C.offWhite } },
    { text: "✦ Presents 4th–6th decade", options: { color: C.offWhite } },
  ], {
    x: 7.5, y: 3.55, w: 2.2, h: 1.85,
    fontSize: 9.5, fontFace: "Calibri", valign: "top"
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 – ETIOLOGY & MORPHOLOGY (with image)
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Etiology & Valve Morphology", "Textbook of Clinical Echocardiography · Braunwald's");

  // Main image
  addCard(s, 0.18, 0.95, 5.5, 4.35, { fill: C.navyMid, border: C.navyLt, shadow: true });
  s.addImage({ data: img0, x: 0.25, y: 1.0, w: 5.36, h: 4.0 });
  s.addText("Fig 11.5 — Textbook of Clinical Echocardiography: Aortic valve viewed from above. Top row: diastole. Bottom row: systole.", {
    x: 0.18, y: 5.05, w: 5.5, h: 0.3,
    fontSize: 7.5, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
  });

  // Three etiology cards on right
  const etiologies = [
    {
      title: "CALCIFIC / DEGENERATIVE", color: C.gold, age: "70s–80s",
      items: [
        "Most common in developed world",
        "Fibrocalcification at leaflet bases, aortic side",
        "NO commissural fusion (key!)",
        "Stellate-shaped orifice in systole",
        "Shared risk factors with atherosclerosis",
        "25% adults >65y have aortic sclerosis",
      ]
    },
    {
      title: "BICUSPID AORTIC VALVE", color: C.teal, age: "50s–60s",
      items: [
        "2/3 of severe AS in adults <70 y",
        "Prevalence ~1-2%, M:F = 3:1",
        "Accelerated calcification of congenital valve",
        "Elliptical orifice; diastolic sagging/systolic doming",
        "50% have associated aortopathy",
        "Right-left cusp fusion most common (~75%)",
      ]
    },
    {
      title: "RHEUMATIC", color: C.crimson, age: "40s–60s",
      items: [
        "Commissural fusion — pathognomonic",
        "Triangular orifice in systole",
        "Mitral valve ALWAYS involved",
        "Common in developing world",
        "Decreasing incidence with GAS treatment",
        "Mixed stenosis + regurgitation typical",
      ]
    },
  ];

  etiologies.forEach((et, i) => {
    const y = 0.95 + i * 1.55;
    addCard(s, 5.85, y, 3.97, 1.42, { fill: C.navyMid, border: C.navyLt, accent: et.color, shadow: true });
    s.addText(et.title, {
      x: 6.05, y: y + 0.05, w: 3.4, h: 0.3,
      fontSize: 9, bold: true, color: et.color, fontFace: "Calibri",
      valign: "middle", margin: 0, charSpacing: 0.5
    });
    s.addText(`Peak age: ${et.age}`, {
      x: 6.05, y: y + 0.05, w: 3.65, h: 0.3,
      fontSize: 8.5, color: C.gray, fontFace: "Calibri",
      align: "right", valign: "middle", margin: 0
    });
    s.addText(et.items.map(x => `• ${x}`).join("\n"), {
      x: 6.05, y: y + 0.36, w: 3.65, h: 1.0,
      fontSize: 9, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
    });
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 – PATHOPHYSIOLOGY
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Pathophysiology", "Sabiston · Schwartz Principles of Surgery");

  // Top: Core mechanism
  addCard(s, 0.18, 0.95, 9.65, 0.82, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("CORE MECHANISM: Fixed outflow obstruction → ↑LV systolic pressure → Concentric LV Hypertrophy (Laplace Law: Wall Stress ∝ P × r / 2h)", {
    x: 0.3, y: 0.95, w: 9.4, h: 0.82,
    fontSize: 11.5, bold: true, color: C.white, fontFace: "Calibri", valign: "middle", margin: 0
  });

  // LV response stages
  addCard(s, 0.18, 1.88, 6.1, 1.32, { fill: C.navyMid, border: C.navyLt, accent: C.teal, shadow: true });
  s.addText("LV RESPONSE STAGES", {
    x: 0.35, y: 1.91, w: 5.8, h: 0.28,
    fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri", valign: "middle", margin: 0, charSpacing: 1
  });

  const stages = [
    { stage: "Compensation", lv: "Concentric hypertrophy, EF normal", hemo: "↑LVESP, normal CO", col: C.teal },
    { stage: "Early decompensation", lv: "Diastolic dysfunction", hemo: "↑LVEDP, ↓compliance", col: C.gold },
    { stage: "Late decompensation", lv: "Systolic dysfunction", hemo: "Low CO, pulm. congestion", col: C.crimsonLt },
    { stage: "End-stage", lv: "Dilated LV, ↓EF", hemo: "Low-flow, low-gradient", col: C.crimson },
  ];

  const stageHeaders = ["Stage", "LV Change", "Hemodynamics"];
  const stageData = [
    stageHeaders.map(h => ({ text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8 } })),
    ...stages.map(st => [
      { text: st.stage, options: { bold: true, color: st.col, fontSize: 8.5 } },
      { text: st.lv, options: { color: C.offWhite, fontSize: 8.5 } },
      { text: st.hemo, options: { color: C.offWhite, fontSize: 8.5 } }
    ])
  ];
  s.addTable(stageData, {
    x: 0.25, y: 2.22, w: 5.9, h: 0.9,
    colW: [1.6, 2.3, 2.0],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Symptom triad
  addCard(s, 6.45, 1.88, 3.38, 1.32, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("CLASSIC SYMPTOM TRIAD", {
    x: 6.62, y: 1.91, w: 3.1, h: 0.28,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri", valign: "middle", margin: 0, charSpacing: 1
  });
  const triad = [
    { s: "Angina", y: "5-yr survival", col: C.gold },
    { s: "Syncope", y: "3-yr survival", col: C.crimsonLt },
    { s: "Heart Failure", y: "<2-yr survival", col: C.crimson },
  ];
  triad.forEach((t, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 6.55 + i * 1.1, y: 2.28, w: 1.0, h: 0.82,
      fill: { color: C.navyLt }, line: { color: t.col, pt: 1.5 }
    });
    s.addText(t.s, {
      x: 6.55 + i * 1.1, y: 2.32, w: 1.0, h: 0.35,
      fontSize: 9, bold: true, color: t.col,
      fontFace: "Calibri", align: "center", margin: 0
    });
    s.addText(t.y, {
      x: 6.55 + i * 1.1, y: 2.68, w: 1.0, h: 0.35,
      fontSize: 7.5, color: C.offWhite,
      fontFace: "Calibri", align: "center", margin: 0
    });
  });

  // Progression rates
  addCard(s, 0.18, 3.28, 4.6, 1.0, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("AVERAGE ANNUAL PROGRESSION (Schwartz)", {
    x: 0.35, y: 3.31, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri", valign: "middle", margin: 0, charSpacing: 1
  });
  const prog = [
    { label: "Peak Jet Velocity", val: "+0.3 m/s / yr" },
    { label: "Mean Gradient", val: "+7 mmHg / yr" },
    { label: "Valve Area", val: "−0.1 cm² / yr" },
  ];
  prog.forEach((p, i) => {
    s.addText(`${p.label}:`, {
      x: 0.32 + i * 1.52, y: 3.65, w: 1.1, h: 0.55,
      fontSize: 8.5, color: C.gray, fontFace: "Calibri", valign: "top", margin: 0
    });
    s.addText(p.val, {
      x: 0.32 + i * 1.52, y: 3.98, w: 1.45, h: 0.25,
      fontSize: 10, bold: true, color: C.gold, fontFace: "Calibri", valign: "middle", margin: 0
    });
  });

  // Natural history flowchart image (bottom half)
  addCard(s, 4.92, 3.28, 5.0, 2.1, { fill: C.navyMid, border: C.navyLt, shadow: true });
  s.addImage({ data: img1, x: 4.97, y: 3.32, w: 4.9, h: 1.9 });
  s.addText("Natural History & Management Overview (Fuster & Hurst, Ch. 28)", {
    x: 4.92, y: 5.25, w: 5.0, h: 0.2,
    fontSize: 7, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
  });

  // Medical Rx note
  addCard(s, 0.18, 4.32, 4.6, 1.0, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("MEDICAL MANAGEMENT — KEY POINT", {
    x: 0.35, y: 4.35, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri", valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText("NO proven medical therapy modifies the natural history or slows progression of AS. Statins (SEAS/ASTRONOMER trials) showed no benefit. Medical Rx = bridge to surgery only.", {
    x: 0.32, y: 4.66, w: 4.35, h: 0.6,
    fontSize: 9, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 – CLINICAL FEATURES & EXAMINATION
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Clinical Features & Physical Examination", "Braunwald's Heart Disease 10e");

  // Examination findings table
  addCard(s, 0.18, 0.95, 9.65, 0.35, { fill: C.navyLt, border: C.navyLt });
  s.addText("PHYSICAL EXAMINATION FINDINGS", {
    x: 0.25, y: 0.95, w: 9.5, h: 0.35,
    fontSize: 9, bold: true, color: C.white, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const examData = [
    [
      { text: "Finding", options: { bold: true, color: C.navy, fill: { color: C.navyLt } } },
      { text: "Sign", options: { bold: true, color: C.navy, fill: { color: C.navyLt } } },
      { text: "Mechanism", options: { bold: true, color: C.navy, fill: { color: C.navyLt } } }
    ],
    [
      { text: "Pulse", options: { bold: true, color: C.gold } },
      { text: "Pulsus parvus et tardus", options: { bold: true, color: C.offWhite } },
      { text: "Fixed reduced CO and delayed ejection", options: { color: C.grayLt } }
    ],
    [
      { text: "Apex Beat", options: { bold: true, color: C.gold } },
      { text: "Sustained, forceful, non-displaced", options: { bold: true, color: C.offWhite } },
      { text: "Concentric hypertrophy (thick walls, no dilation)", options: { color: C.grayLt } }
    ],
    [
      { text: "Murmur", options: { bold: true, color: C.crimson } },
      { text: "Harsh crescendo-decrescendo SEM, 2nd RICS → carotids", options: { bold: true, color: C.offWhite } },
      { text: "Turbulent flow through stenotic valve; late-peaking = more severe", options: { color: C.grayLt } }
    ],
    [
      { text: "S2", options: { bold: true, color: C.gold } },
      { text: "Absent A2 or single / paradoxically split S2", options: { bold: true, color: C.offWhite } },
      { text: "Calcified immobile leaflets; reduced aortic valve closure sound", options: { color: C.grayLt } }
    ],
    [
      { text: "S4 Gallop", options: { bold: true, color: C.gold } },
      { text: "Prominent S4", options: { bold: true, color: C.offWhite } },
      { text: "Forceful atrial kick into stiff non-compliant LV", options: { color: C.grayLt } }
    ],
    [
      { text: "Ejection Click", options: { bold: true, color: C.teal } },
      { text: "Early systolic click", options: { bold: true, color: C.offWhite } },
      { text: "Abrupt halt of mobile valve at max opening (bicuspid/early calcific)", options: { color: C.grayLt } }
    ],
    [
      { text: "Gallavardin Phenomenon", options: { bold: true, color: C.teal } },
      { text: "Musical component at apex (mimics MR)", options: { bold: true, color: C.offWhite } },
      { text: "High-frequency component of AS murmur radiates to apex", options: { color: C.grayLt } }
    ],
  ];

  s.addTable(examData, {
    x: 0.18, y: 1.33, w: 9.65, h: 3.2,
    colW: [1.8, 2.95, 4.9],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Pitfall box
  addCard(s, 0.18, 4.6, 9.65, 0.78, { fill: C.navyMid, border: C.crimson, accent: C.crimson, shadow: true });
  s.addText("⚠  CLINICAL PITFALL:", {
    x: 0.32, y: 4.63, w: 1.5, h: 0.72,
    fontSize: 10, bold: true, color: C.crimson, fontFace: "Calibri", valign: "middle", margin: 0
  });
  s.addText("Pulsus parvus et tardus may be ABSENT in elderly patients due to large artery stiffening — a common false-reassurance trap. Always confirm with Doppler echocardiography. The murmur intensity does NOT correlate with stenosis severity. (Braunwald's Heart Disease, Ch. 83)", {
    x: 1.85, y: 4.63, w: 7.9, h: 0.72,
    fontSize: 9.5, color: C.offWhite, fontFace: "Calibri", valign: "middle", margin: 0
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 – ECHOCARDIOGRAPHY
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Echocardiographic Assessment", "Textbook of Clinical Echocardiography (Otto)");

  // Left: Severity grading table
  addCard(s, 0.18, 0.95, 4.5, 3.0, { fill: C.navyMid, border: C.navyLt, accent: C.teal, shadow: true });
  s.addText("ACC / AHA SEVERITY GRADING", {
    x: 0.35, y: 0.98, w: 4.2, h: 0.28,
    fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const gradeData = [
    [
      { text: "Parameter", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "Mild", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "Moderate", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "Severe", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } }
    ],
    [
      { text: "Peak Jet Velocity (m/s)", options: { color: C.offWhite, fontSize: 9 } },
      { text: "< 3.0", options: { color: C.teal, fontSize: 9 } },
      { text: "3.0–4.0", options: { color: C.gold, fontSize: 9 } },
      { text: "> 4.0", options: { bold: true, color: C.crimson, fontSize: 10 } }
    ],
    [
      { text: "Mean Gradient (mmHg)", options: { color: C.offWhite, fontSize: 9 } },
      { text: "< 25", options: { color: C.teal, fontSize: 9 } },
      { text: "25–40", options: { color: C.gold, fontSize: 9 } },
      { text: "> 40", options: { bold: true, color: C.crimson, fontSize: 10 } }
    ],
    [
      { text: "Valve Area (cm²)", options: { color: C.offWhite, fontSize: 9 } },
      { text: "> 1.5", options: { color: C.teal, fontSize: 9 } },
      { text: "1.0–1.5", options: { color: C.gold, fontSize: 9 } },
      { text: "< 1.0", options: { bold: true, color: C.crimson, fontSize: 10 } }
    ],
    [
      { text: "AVA Index (cm²/m²)", options: { color: C.offWhite, fontSize: 9 } },
      { text: "—", options: { color: C.gray, fontSize: 9 } },
      { text: "—", options: { color: C.gray, fontSize: 9 } },
      { text: "< 0.6", options: { bold: true, color: C.crimson, fontSize: 10 } }
    ],
    [
      { text: "DVI (velocity ratio)", options: { color: C.offWhite, fontSize: 9 } },
      { text: "> 0.50", options: { color: C.teal, fontSize: 9 } },
      { text: "0.25–0.50", options: { color: C.gold, fontSize: 9 } },
      { text: "< 0.25", options: { bold: true, color: C.crimson, fontSize: 10 } }
    ],
  ];

  s.addTable(gradeData, {
    x: 0.25, y: 1.3, w: 4.35, h: 2.55,
    colW: [1.75, 0.7, 0.85, 1.05],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Continuity equation
  addCard(s, 0.18, 4.02, 4.5, 1.37, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("CONTINUITY EQUATION (Most Accurate)", {
    x: 0.35, y: 4.05, w: 4.2, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText("AVA = (CSA_LVOT × VTI_LVOT) / VTI_AV\n= 0.785 × D_LVOT² × VTI_LVOT / VTI_AV", {
    x: 0.32, y: 4.35, w: 4.25, h: 0.55,
    fontSize: 11, bold: true, color: C.white, fontFace: "Courier New", valign: "top", margin: 0
  });
  s.addText("Based on conservation of mass: flow through LVOT = flow through stenotic valve", {
    x: 0.32, y: 4.92, w: 4.25, h: 0.4,
    fontSize: 8.5, color: C.gray, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Right: CW Doppler image
  addCard(s, 4.85, 0.95, 2.35, 4.44, { fill: C.navyMid, border: C.navyLt, shadow: true });
  s.addImage({ data: img2, x: 4.9, y: 1.0, w: 2.25, h: 3.85 });
  s.addText("CW Doppler: valvular AS vs. subaortic membrane vs. HCM (Otto)", {
    x: 4.85, y: 4.88, w: 2.35, h: 0.45,
    fontSize: 7, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
  });

  // Low-flow low-gradient
  addCard(s, 7.32, 0.95, 2.52, 4.44, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("LOW-FLOW, LOW-GRADIENT AS", {
    x: 7.48, y: 0.98, w: 2.25, h: 0.3,
    fontSize: 8.5, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 0.5
  });

  s.addText("TYPE 1 — Reduced EF (<50%)", {
    x: 7.48, y: 1.32, w: 2.25, h: 0.25,
    fontSize: 8.5, bold: true, color: C.gold, fontFace: "Calibri", valign: "middle", margin: 0
  });
  s.addText([
    { text: "• AVA <1.0 cm², mean grad <40 mmHg, EF <50%\n", options: {} },
    { text: "• 'Pseudo-severe' vs true severe AS\n", options: {} },
    { text: "• Dobutamine stress echo: true severe → AVA stays <1.0, gradient rises\n", options: {} },
    { text: "• False severe → AVA opens >1.0 cm²", options: {} },
  ], {
    x: 7.48, y: 1.6, w: 2.25, h: 1.2,
    fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });

  s.addShape(pres.shapes.RECTANGLE, {
    x: 7.4, y: 2.85, w: 2.4, h: 0.02,
    fill: { color: C.navyLt }, line: { color: C.navyLt }
  });

  s.addText("TYPE 2 — Preserved EF ≥50% (Paradoxical)", {
    x: 7.48, y: 2.9, w: 2.25, h: 0.3,
    fontSize: 8.5, bold: true, color: C.teal, fontFace: "Calibri", valign: "middle", margin: 0
  });
  s.addText([
    { text: "• AVA <1.0, grad <40, EF ≥50%, SVi <35 mL/m²\n", options: {} },
    { text: "• Small hypertrophied LV with ↓SV\n", options: {} },
    { text: "• More common in women/elderly/hypertensive\n", options: {} },
    { text: "• CT Ca score confirms: >2000 AU (men), >1200 AU (women)\n", options: {} },
    { text: "• Prognosis same as high-gradient AS; AVR beneficial", options: {} },
  ], {
    x: 7.48, y: 3.22, w: 2.25, h: 2.1,
    fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 – STAGING & INDICATIONS
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Staging & Indications for Intervention", "2021 ACC/AHA Valvular Heart Disease Guidelines");

  // Staging table
  addCard(s, 0.18, 0.95, 9.65, 0.28, { fill: C.navyLt, border: C.navyLt });
  s.addText("2021 ACC/AHA STAGING OF AORTIC STENOSIS", {
    x: 0.25, y: 0.95, w: 9.5, h: 0.28,
    fontSize: 8.5, bold: true, color: C.white, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const stageData2 = [
    ["Stage", "Definition", "Hemodynamics", "Symptoms", "LV Function"].map(h => ({
      text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8 }
    })),
    [
      { text: "A — At Risk", options: { bold: true, color: C.teal, fontSize: 8.5 } },
      { text: "Risk factors for AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "None", options: { color: C.gray, fontSize: 8.5 } },
      { text: "None", options: { color: C.gray, fontSize: 8.5 } },
      { text: "Normal", options: { color: C.teal, fontSize: 8.5 } }
    ],
    [
      { text: "B — Progressive", options: { bold: true, color: C.teal, fontSize: 8.5 } },
      { text: "Mild–moderate AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Vmax 2–3.9 m/s; mean grad <40; AVA >1.0", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "None", options: { color: C.gray, fontSize: 8.5 } },
      { text: "Normal or early remodeling", options: { color: C.teal, fontSize: 8.5 } }
    ],
    [
      { text: "C1 — Severe Asymptomatic EF≥50%", options: { bold: true, color: C.gold, fontSize: 8.5 } },
      { text: "Severe AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Vmax ≥4 m/s; mean grad ≥40; AVA ≤1.0 cm²", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "None", options: { color: C.gray, fontSize: 8.5 } },
      { text: "LVEF ≥50%", options: { color: C.gold, fontSize: 8.5 } }
    ],
    [
      { text: "C2 — Severe Asymptomatic EF<50%", options: { bold: true, color: C.gold, fontSize: 8.5 } },
      { text: "Severe AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "As above", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "None", options: { color: C.gray, fontSize: 8.5 } },
      { text: "LVEF <50%", options: { bold: true, color: C.crimson, fontSize: 8.5 } }
    ],
    [
      { text: "D1 — Severe Symptomatic High-Gradient", options: { bold: true, color: C.crimson, fontSize: 8.5 } },
      { text: "Severe AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Vmax ≥4 m/s; mean grad ≥40", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Angina / Syncope / HF", options: { bold: true, color: C.crimson, fontSize: 8.5 } },
      { text: "Usually preserved EF", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
    [
      { text: "D2 — Low-Flow, Low-Gradient, Low EF", options: { bold: true, color: C.crimson, fontSize: 8.5 } },
      { text: "Severe AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "AVA <1.0, grad <40", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Symptoms present", options: { bold: true, color: C.crimson, fontSize: 8.5 } },
      { text: "LVEF <50%", options: { bold: true, color: C.crimson, fontSize: 8.5 } }
    ],
    [
      { text: "D3 — Paradoxical Low-Flow, Low-Gradient, EF≥50%", options: { bold: true, color: C.crimsonLt, fontSize: 8.5 } },
      { text: "Severe AS", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "AVA <1.0, grad <40, SVi <35 mL/m²", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Symptoms present", options: { bold: true, color: C.crimson, fontSize: 8.5 } },
      { text: "LVEF ≥50%", options: { color: C.gold, fontSize: 8.5 } }
    ],
  ];

  s.addTable(stageData2, {
    x: 0.18, y: 1.26, w: 9.65, h: 2.55,
    colW: [2.3, 1.0, 2.4, 1.55, 2.4],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Indications
  const indBoxes = [
    {
      label: "CLASS I  (MUST DO)", color: C.teal, items: [
        "Symptomatic severe AS (Stage D1) → AVR",
        "Severe AS (any stage) undergoing other cardiac surgery",
        "Asymptomatic severe AS with LVEF <50% (Stage C2)",
      ]
    },
    {
      label: "CLASS IIa  (SHOULD DO)", color: C.gold, items: [
        "Asymptomatic very severe AS: Vmax ≥5 m/s or mean grad ≥60 mmHg (Stage C1)",
        "Asymptomatic severe AS undergoing non-cardiac surgery",
        "Low-flow, low-gradient AS with reduced EF confirmed by dobutamine stress echo (D2)",
      ]
    },
    {
      label: "CLASS IIb  (CONSIDER)", color: C.crimsonLt, items: [
        "Asymptomatic severe AS with rapid progression (+0.3 m/s/yr) or high institutional TAVI expertise",
        "Moderate AS undergoing cardiac surgery for other indications",
      ]
    },
  ];

  indBoxes.forEach((box, i) => {
    const x = 0.18 + i * 3.27;
    addCard(s, x, 3.88, 3.15, 1.5, { fill: C.navyMid, border: box.color, accent: box.color, shadow: true });
    s.addText(box.label, {
      x: x + 0.15, y: 3.91, w: 2.95, h: 0.28,
      fontSize: 8.5, bold: true, color: box.color, fontFace: "Calibri",
      valign: "middle", margin: 0, charSpacing: 0.5
    });
    s.addText(box.items.map(it => `• ${it}`).join("\n"), {
      x: x + 0.15, y: 4.22, w: 2.95, h: 1.1,
      fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
    });
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 – SURGICAL MANAGEMENT: SAVR
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Surgical Aortic Valve Replacement (SAVR)", "Schwartz's Principles of Surgery 11e · Sabiston 21e");

  // Left: Step-by-step
  addCard(s, 0.18, 0.95, 4.6, 4.5, { fill: C.navyMid, border: C.navyLt, accent: C.teal, shadow: true });
  s.addText("OPERATIVE STEPS", {
    x: 0.35, y: 0.98, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const steps = [
    "Median sternotomy — pericardial suspension",
    "Heparin 300–400 IU/kg (ACT >400 s)",
    "Aortic cannulation (distal ascending aorta)",
    "Venous cannulation (RA single stage or bicaval)",
    "CPB established — mild hypothermia 28–32°C",
    "Aortic cross-clamp applied",
    "Antegrade ± retrograde cold blood cardioplegia",
    "Transverse/oblique aortotomy 1.5-2 cm above RCA ostium",
    "Valve excision + meticulous annular decalcification",
    "Annular sizing — avoid patient-prosthesis mismatch",
    "Prosthesis implanted (interrupted pledgeted sutures)",
    "Aortotomy closed (two-layer felt-reinforced suture)",
    "De-airing maneuvers",
    "Aortic cross-clamp release; wean from CPB",
    "TEE assessment: gradient, paravalvular leak, LV function",
    "Protamine reversal; hemostasis; sternal closure",
  ];

  steps.forEach((step, i) => {
    const y = 1.33 + i * 0.26;
    s.addText(`${i + 1}.`, {
      x: 0.28, y, w: 0.28, h: 0.25,
      fontSize: 8.5, bold: true, color: C.teal,
      fontFace: "Calibri", valign: "middle", margin: 0
    });
    s.addText(step, {
      x: 0.55, y, w: 4.08, h: 0.25,
      fontSize: 8.5, color: C.offWhite,
      fontFace: "Calibri", valign: "middle", margin: 0
    });
  });

  // Top right: Prosthesis types
  addCard(s, 4.95, 0.95, 4.87, 2.25, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("PROSTHETIC VALVE SELECTION", {
    x: 5.12, y: 0.98, w: 4.6, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const prosthData = [
    ["", "Mechanical", "Bioprosthetic"].map(h => ({
      text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 }
    })),
    [
      { text: "Durability", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "30+ years (indefinite)", options: { color: C.teal, fontSize: 8.5, bold: true } },
      { text: "10–20 years (SVD risk)", options: { color: C.gold, fontSize: 8.5 } }
    ],
    [
      { text: "Anticoagulation", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "LIFELONG warfarin (INR 2.0–3.0)", options: { color: C.crimson, fontSize: 8.5 } },
      { text: "Aspirin only after 3–6 months", options: { color: C.teal, fontSize: 8.5, bold: true } }
    ],
    [
      { text: "Thromboembolism", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "~1–2%/year (with anticoag)", options: { color: C.gold, fontSize: 8.5 } },
      { text: "Lower", options: { color: C.teal, fontSize: 8.5 } }
    ],
    [
      { text: "Best for", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Age <60 y, can tolerate anticoag", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Age >65 y; sedentary; anticoag risk", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
    [
      { text: "Types", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Bileaflet (St Jude, CarboMedics)", options: { color: C.grayLt, fontSize: 8.5 } },
      { text: "Porcine, Bovine pericardial, Homograft", options: { color: C.grayLt, fontSize: 8.5 } }
    ],
  ];

  s.addTable(prosthData, {
    x: 5.05, y: 1.3, w: 4.7, h: 1.85,
    colW: [1.35, 1.7, 1.65],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Mid right: Root enlargement
  addCard(s, 4.95, 3.28, 4.87, 1.3, { fill: C.navyMid, border: C.navyLt, accent: C.crimsonLt, shadow: true });
  s.addText("AORTIC ROOT ENLARGEMENT (for small annuli / PPM prevention)", {
    x: 5.12, y: 3.31, w: 4.6, h: 0.28,
    fontSize: 9, bold: true, color: C.crimsonLt, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 0.5
  });
  const rootPros = [
    { name: "Nicks", desc: "Incise non-coronary sinus into ant. MV leaflet → +1-2 sizes" },
    { name: "Manougian", desc: "NC/LC commissure through ant. MV leaflet → larger enlargement" },
    { name: "Konno-Rastan", desc: "Through RCA/RVOT into septum → maximal enlargement; risk: VSD, CHB" },
  ];
  rootPros.forEach((p, i) => {
    s.addText(`${p.name}:`, { x: 5.08, y: 3.62 + i * 0.3, w: 1.0, h: 0.28, fontSize: 9, bold: true, color: C.crimsonLt, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(p.desc, { x: 6.1, y: 3.62 + i * 0.3, w: 3.65, h: 0.28, fontSize: 9, color: C.offWhite, fontFace: "Calibri", valign: "middle", margin: 0 });
  });

  // PPM definition
  addCard(s, 4.95, 4.63, 4.87, 0.78, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("PATIENT-PROSTHESIS MISMATCH (PPM):", {
    x: 5.12, y: 4.65, w: 4.6, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri", valign: "middle", margin: 0
  });
  s.addText("Moderate PPM: indexed EOA <0.85 cm²/m² | Severe PPM: <0.65 cm²/m². Prevent with oversizing or root enlargement. Surgical mortality 1–3% (isolated AVR at experienced centres).", {
    x: 5.12, y: 4.95, w: 4.6, h: 0.43,
    fontSize: 9, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 – TAVI
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Transcatheter Aortic Valve Implantation (TAVI/TAVR)", "Schwartz 11e · Braunwald's 10e · PARTNER / Evolut Trials");

  // Valve types side by side
  addCard(s, 0.18, 0.95, 4.6, 1.65, { fill: C.navyMid, border: C.navyLt, accent: C.teal, shadow: true });
  s.addText("TRANSCATHETER VALVE TYPES", {
    x: 0.35, y: 0.98, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.teal, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  // Balloon-expandable
  s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 1.3, w: 2.15, h: 1.22, fill: { color: C.navyLt }, line: { color: C.navyLt } });
  s.addText("BALLOON-EXPANDABLE\n(Edwards SAPIEN 3/Ultra)", {
    x: 0.28, y: 1.32, w: 2.1, h: 0.38,
    fontSize: 8.5, bold: true, color: "#3498DB", fontFace: "Calibri", align: "center", margin: 0
  });
  s.addText("• Co-Cr stent + bovine pericardial leaflets\n• Rapid ventricular pacing during deployment\n• Precise annular positioning\n• PPM: 5–10%", {
    x: 0.28, y: 1.72, w: 2.1, h: 0.78,
    fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Self-expanding
  s.addShape(pres.shapes.RECTANGLE, { x: 2.55, y: 1.3, w: 2.12, h: 1.22, fill: { color: C.navyLt }, line: { color: C.navyLt } });
  s.addText("SELF-EXPANDING\n(Medtronic CoreValve / Evolut)", {
    x: 2.58, y: 1.32, w: 2.09, h: 0.38,
    fontSize: 8.5, bold: true, color: C.teal, fontFace: "Calibri", align: "center", margin: 0
  });
  s.addText("• Nitinol frame + porcine pericardial\n• No rapid pacing; repositionable (Evolut R)\n• Supra-annular leaflets → better hemodynamics\n• PPM: 15–25% (AV node compression)", {
    x: 2.58, y: 1.72, w: 2.09, h: 0.78,
    fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Access routes
  addCard(s, 0.18, 2.68, 4.6, 1.35, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("ACCESS ROUTES", {
    x: 0.35, y: 2.71, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  const routes = [
    { r: "Transfemoral (TF)", note: "~90% of cases — gold standard; ≥5.5 mm artery required", col: C.teal },
    { r: "Transaortic (TAo)", note: "Upper J ministernotomy; for severe PVD", col: C.gold },
    { r: "Transapical (TA)", note: "Anterolateral thoracotomy; LV apex antegrade", col: C.crimsonLt },
    { r: "Transaxillary/Subclavian", note: "Alternative when femoral unsuitable; ≥5.5 mm artery", col: "#9B59B6" },
  ];
  routes.forEach((r, i) => {
    s.addText(`${r.r}:`, { x: 0.32, y: 3.02 + i * 0.24, w: 1.75, h: 0.22, fontSize: 8.5, bold: true, color: r.col, fontFace: "Calibri", valign: "middle", margin: 0 });
    s.addText(r.note, { x: 2.1, y: 3.02 + i * 0.24, w: 2.55, h: 0.22, fontSize: 8.5, color: C.offWhite, fontFace: "Calibri", valign: "middle", margin: 0 });
  });

  // Key Trials table
  addCard(s, 0.18, 4.1, 4.6, 1.3, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("KEY LANDMARK TRIALS", {
    x: 0.35, y: 4.13, w: 4.3, h: 0.28,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  const trialsData = [
    ["Trial (Year)", "Population", "Key Finding"].map(h => ({
      text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 7.5 }
    })),
    [
      { text: "PARTNER B (2010)", options: { color: C.teal, fontSize: 8 } },
      { text: "Inoperable", options: { color: C.offWhite, fontSize: 8 } },
      { text: "TAVI: 50% RRR all-cause mortality vs. medical Rx", options: { color: C.offWhite, fontSize: 8 } }
    ],
    [
      { text: "PARTNER A (2011)", options: { color: C.teal, fontSize: 8 } },
      { text: "High risk", options: { color: C.offWhite, fontSize: 8 } },
      { text: "TAVI non-inferior to SAVR at 1 year", options: { color: C.offWhite, fontSize: 8 } }
    ],
    [
      { text: "PARTNER 2 (2016)", options: { color: C.gold, fontSize: 8 } },
      { text: "Intermediate risk", options: { color: C.offWhite, fontSize: 8 } },
      { text: "TAVI non-inferior; TF subgroup superior", options: { color: C.offWhite, fontSize: 8 } }
    ],
    [
      { text: "PARTNER 3 (2019)", options: { bold: true, color: C.crimson, fontSize: 8 } },
      { text: "Low risk", options: { color: C.offWhite, fontSize: 8 } },
      { text: "TAVI SUPERIOR to SAVR (composite endpoint at 1 yr)", options: { bold: true, color: C.crimson, fontSize: 8 } }
    ],
  ];
  s.addTable(trialsData, {
    x: 0.25, y: 4.44, w: 4.45, h: 0.9,
    colW: [1.3, 0.95, 2.2],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // Right: Complications + SAVR vs TAVI guidance
  addCard(s, 4.95, 0.95, 4.87, 2.38, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("TAVI COMPLICATIONS", {
    x: 5.12, y: 0.98, w: 4.6, h: 0.28,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const compsData = [
    ["Complication", "Rate", "Management"].map(h => ({
      text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8 }
    })),
    [{ text: "Stroke", options: { color: C.offWhite, fontSize: 8 } }, { text: "2–5%", options: { color: C.crimson, fontSize: 8, bold: true } }, { text: "Cerebral embolic protection (Sentinel)", options: { color: C.grayLt, fontSize: 8 } }],
    [{ text: "Paravalvular leak", options: { color: C.offWhite, fontSize: 8 } }, { text: "5–15% trace-mild", options: { color: C.gold, fontSize: 8 } }, { text: "Post-dilatation; valve-in-valve if severe", options: { color: C.grayLt, fontSize: 8 } }],
    [{ text: "Permanent pacemaker", options: { color: C.offWhite, fontSize: 8 } }, { text: "SE 15–25%; BE 5–10%", options: { color: C.gold, fontSize: 8 } }, { text: "Permanent pacemaker implant", options: { color: C.grayLt, fontSize: 8 } }],
    [{ text: "Vascular access complications", options: { color: C.offWhite, fontSize: 8 } }, { text: "5–10%", options: { color: C.gold, fontSize: 8 } }, { text: "Surgical repair / covered stent", options: { color: C.grayLt, fontSize: 8 } }],
    [{ text: "Annular rupture", options: { color: C.offWhite, fontSize: 8 } }, { text: "<1%", options: { color: C.crimson, fontSize: 8, bold: true } }, { text: "Emergency surgery; often fatal", options: { color: C.crimson, fontSize: 8 } }],
    [{ text: "Coronary occlusion", options: { color: C.offWhite, fontSize: 8 } }, { text: "<1%", options: { color: C.crimson, fontSize: 8, bold: true } }, { text: "Emergency PCI/CABG; coronary protection wire", options: { color: C.grayLt, fontSize: 8 } }],
  ];

  s.addTable(compsData, {
    x: 5.05, y: 1.3, w: 4.7, h: 1.96,
    colW: [1.7, 1.2, 1.8],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });

  // SAVR vs TAVI decision
  addCard(s, 4.95, 3.42, 4.87, 1.98, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("TAVI vs. SAVR — 2021 ACC/AHA DECISION GUIDE", {
    x: 5.12, y: 3.45, w: 4.6, h: 0.28,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 0.5
  });

  const decData = [
    ["Age / Risk", "Preferred Approach"].map(h => ({
      text: h, options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 }
    })),
    [{ text: "< 65 years", options: { bold: true, color: C.teal, fontSize: 9 } }, { text: "SAVR preferred (better long-term data; TAVI durability uncertain)", options: { color: C.offWhite, fontSize: 8.5 } }],
    [{ text: "65–80 years", options: { bold: true, color: C.gold, fontSize: 9 } }, { text: "Shared decision — TAVI or SAVR (heart valve team)", options: { color: C.offWhite, fontSize: 8.5 } }],
    [{ text: "> 80 years / Prohibitive risk", options: { bold: true, color: C.crimson, fontSize: 9 } }, { text: "TAVI preferred", options: { bold: true, color: C.crimson, fontSize: 9 } }],
    [{ text: "Redo surgery / degenerated bioprosthesis", options: { color: C.offWhite, fontSize: 8.5 } }, { text: "Valve-in-Valve TAVI (avoids redo sternotomy)", options: { color: C.teal, fontSize: 8.5 } }],
  ];

  s.addTable(decData, {
    x: 5.05, y: 3.77, w: 4.7, h: 1.56,
    colW: [1.75, 2.95],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 – SPECIAL PROCEDURES & OUTCOMES
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };
  addHeader(s, "Special Procedures, Outcomes & Follow-up", "Schwartz 11e · Sabiston · Braunwald's");

  // Ross procedure
  addCard(s, 0.18, 0.95, 3.1, 2.68, { fill: C.navyMid, border: C.navyLt, accent: "#9B59B6", shadow: true });
  s.addText("ROSS PROCEDURE", {
    x: 0.35, y: 0.98, w: 2.85, h: 0.28,
    fontSize: 9, bold: true, color: "#9B59B6", fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });
  s.addText([
    { text: "Concept:\n", options: { bold: true, color: "#9B59B6" } },
    { text: "Native pulmonary valve → aortic position (autograft)\nHomograft → pulmonary position\n\n", options: { color: C.offWhite } },
    { text: "Advantages:\n", options: { bold: true, color: C.teal } },
    { text: "• Living autograft — grows with patient\n• No anticoagulation\n• Best hemodynamics\n• Endocarditis-resistant\n\n", options: { color: C.offWhite } },
    { text: "Best for:\n", options: { bold: true, color: C.gold } },
    { text: "Children, young adults, women of childbearing age, athletes\n\n", options: { color: C.offWhite } },
    { text: "Outcomes:\n", options: { bold: true, color: C.gray } },
    { text: "10-yr survival 90%; freedom from reoperation 75-80% at 15-20 yrs\nRisk: autograft dilatation; pulmonary homograft calcification", options: { color: C.offWhite } },
  ], {
    x: 0.32, y: 1.3, w: 2.9, h: 2.28,
    fontSize: 8.5, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Bentall procedure
  addCard(s, 3.42, 0.95, 3.1, 2.68, { fill: C.navyMid, border: C.navyLt, accent: C.gold, shadow: true });
  s.addText("BENTALL PROCEDURE (Composite Root Replacement)", {
    x: 3.58, y: 0.98, w: 2.85, h: 0.36,
    fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri",
    valign: "middle", margin: 0
  });
  s.addText([
    { text: "Indication:\n", options: { bold: true, color: C.gold } },
    { text: "AS + ascending aortic aneurysm OR bicuspid AS with aortopathy (≥4.5-5.0 cm)\n\n", options: { color: C.offWhite } },
    { text: "Classic Bentall:\n", options: { bold: true, color: C.crimsonLt } },
    { text: "Mechanical valve + Dacron graft — composite conduit; coronary reimplantation as buttons\n\n", options: { color: C.offWhite } },
    { text: "Tissue Bentall:\n", options: { bold: true, color: C.crimsonLt } },
    { text: "Bioprosthetic valve + Dacron graft (BioValsalva) — avoids anticoagulation\n\n", options: { color: C.offWhite } },
    { text: "David Procedure (Valve-Sparing):\n", options: { bold: true, color: C.teal } },
    { text: "Native valve reimplanted into Dacron tube. Ideal when valve morphology is good (no calcification). Avoids prosthesis entirely.", options: { color: C.offWhite } },
  ], {
    x: 3.58, y: 1.38, w: 2.88, h: 2.2,
    fontSize: 8.5, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Redo AVR
  addCard(s, 6.66, 0.95, 3.17, 2.68, { fill: C.navyMid, border: C.navyLt, accent: C.crimson, shadow: true });
  s.addText("REDO AVR — SPECIAL CONSIDERATIONS", {
    x: 6.82, y: 0.98, w: 2.92, h: 0.36,
    fontSize: 9, bold: true, color: C.crimson, fontFace: "Calibri",
    valign: "middle", margin: 0
  });
  s.addText([
    { text: "Redo sternotomy risks:\n", options: { bold: true, color: C.crimson } },
    { text: "• Adhesions → injury to patent grafts (RIMA, SVG)\n• Higher morbidity and mortality (5–10%)\n• Cannulation: femoral or axillary first\n\n", options: { color: C.offWhite } },
    { text: "Valve-in-Valve TAVI:\n", options: { bold: true, color: C.teal } },
    { text: "• TAVI inside degenerated bioprosthesis\n• Avoids redo sternotomy entirely\n• VIVID registry: good outcomes\n• Risk: coronary obstruction if tall leaflets → coronary protection wire mandatory\n• Ideal for high-risk redo patients", options: { color: C.offWhite } },
  ], {
    x: 6.82, y: 1.38, w: 2.94, h: 2.2,
    fontSize: 8.5, fontFace: "Calibri", valign: "top", margin: 0
  });

  // Outcomes
  addCard(s, 0.18, 3.72, 9.65, 0.35, { fill: C.navyLt, border: C.navyLt });
  s.addText("OUTCOMES & POST-OPERATIVE MANAGEMENT", {
    x: 0.25, y: 3.72, w: 9.5, h: 0.35,
    fontSize: 9, bold: true, color: C.white, fontFace: "Calibri",
    valign: "middle", margin: 0, charSpacing: 1
  });

  const outData = [
    [
      { text: "Procedure", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "30-day Mortality", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "5-yr Survival", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "Anticoagulation", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
      { text: "Follow-up Echo", options: { bold: true, color: C.navy, fill: { color: C.navyLt }, fontSize: 8.5 } },
    ],
    [
      { text: "Isolated SAVR (elective)", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "1–3%", options: { color: C.teal, bold: true, fontSize: 9 } },
      { text: "~80%", options: { color: C.teal, fontSize: 8.5 } },
      { text: "Tissue: Aspirin ± warfarin 3-6 mo; Mechanical: Warfarin lifelong (INR 2.0–3.0)", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Every 3–5 years (stable bioprosthesis)", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
    [
      { text: "SAVR + CABG", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "3–5%", options: { color: C.gold, bold: true, fontSize: 9 } },
      { text: "~70%", options: { color: C.gold, fontSize: 8.5 } },
      { text: "As per prosthesis type + DAPT post-CABG", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Every 3–5 years", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
    [
      { text: "TAVI (transfemoral, low risk)", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "<2%", options: { color: C.teal, bold: true, fontSize: 9 } },
      { text: "~85%", options: { color: C.teal, fontSize: 8.5 } },
      { text: "DAPT 3–6 months → aspirin alone; warfarin if AF", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Annual (assess SVD, thrombosis, PVL)", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
    [
      { text: "Redo Sternotomy AVR", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "5–10%", options: { color: C.crimsonLt, bold: true, fontSize: 9 } },
      { text: "~65%", options: { color: C.gold, fontSize: 8.5 } },
      { text: "As per new prosthesis type", options: { color: C.offWhite, fontSize: 8.5 } },
      { text: "Every 3–5 years", options: { color: C.offWhite, fontSize: 8.5 } }
    ],
  ];

  s.addTable(outData, {
    x: 0.18, y: 4.1, w: 9.65, h: 1.3,
    colW: [1.9, 1.1, 1.0, 3.5, 2.15],
    border: { pt: 0.5, color: C.navyLt },
    fill: { color: C.navyMid }
  });
}


// ═══════════════════════════════════════════════════════════════════
// SLIDE 12 – SUMMARY / TAKE-HOME
// ═══════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  s.background = { color: C.navy };

  // Top bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 1.1,
    fill: { color: C.navyMid }, line: { color: C.navyMid }
  });
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 0.18, h: 1.1,
    fill: { color: C.crimson }, line: { color: C.crimson }
  });
  s.addText("TAKE-HOME MESSAGES", {
    x: 0.3, y: 0, w: 9.5, h: 0.65,
    fontSize: 30, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", charSpacing: 2
  });
  s.addText("Aortic Stenosis — MCh Cardiology Teaching Rounds", {
    x: 0.3, y: 0.65, w: 9.5, h: 0.45,
    fontSize: 13, color: C.grayLt, fontFace: "Calibri", italic: true
  });

  const takeHome = [
    { n: "01", txt: "RHD mechanism is MOLECULAR MIMICRY — streptococcal M-protein mimics cardiac laminin. Commissural fusion distinguishes rheumatic from calcific AS (stellate orifice, no fusion).", col: C.crimson },
    { n: "02", txt: "Calcific AS is most common in developed world; bicuspid AV accounts for 2/3 of AS in adults <70 yrs. Bicuspid carries 50% risk of associated aortopathy — always screen the aorta.", col: C.gold },
    { n: "03", txt: "Symptom onset is the critical inflection point. The '5-3-2 rule': angina (5-yr survival), syncope (3 yr), heart failure (<2 yr). 50% mortality without intervention once symptomatic.", col: C.teal },
    { n: "04", txt: "Echo is definitive: AVA <1.0 cm², mean gradient >40 mmHg, Vmax >4 m/s = severe. The continuity equation (conservation of mass) is the most accurate method for AVA calculation.", col: "#3498DB" },
    { n: "05", txt: "NO medical therapy slows AS progression. BAV is a bridge, not a cure (in calcific AS). AVR is the only definitive treatment with dramatic improvement in survival and quality of life.", col: "#9B59B6" },
    { n: "06", txt: "TAVI has revolutionised management. PARTNER 3 (2019) showed TAVI superior to SAVR in low-risk patients at 1 year. Age <65 → SAVR preferred; 65–80 → shared decision; >80 → TAVI preferred.", col: "#E67E22" },
    { n: "07", txt: "For small annuli — prevent PPM with root enlargement (Nicks/Manougian/Konno). Ross procedure (pulmonary autograft) is best for young patients requiring durable, anticoagulation-free valve.", col: "#27AE60" },
  ];

  takeHome.forEach((item, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = col === 0 ? 0.18 : 5.12;
    const w = col === 0 ? 4.82 : 4.7;
    const h = col === 0 ? 1.05 : (i === 6 ? 1.4 : 1.05);
    const y = col === 0 ? 1.2 + row * 1.1 : (i === 4 ? 1.2 : i === 5 ? 2.3 : 3.4);

    addCard(s, x, y, w, h - 0.05, { fill: C.navyMid, border: C.navyLt, accent: item.col, shadow: true });
    s.addText(item.n, {
      x: x + 0.1, y, w: 0.45, h: h - 0.05,
      fontSize: 20, bold: true, color: item.col,
      fontFace: "Calibri", valign: "middle", align: "center", margin: 0
    });
    s.addText(item.txt, {
      x: x + 0.65, y: y + 0.08, w: w - 0.75, h: h - 0.2,
      fontSize: 9.5, color: C.offWhite,
      fontFace: "Calibri", valign: "middle", margin: 0
    });
  });

  // Bottom bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.37, w: 10, h: 0.255,
    fill: { color: C.navyMid }, line: { color: C.navyMid }
  });
  s.addText("Sources: Braunwald's Heart Disease 10e · Schwartz's Principles of Surgery 11e · Sabiston Textbook of Surgery 21e · Fuster & Hurst's The Heart 15e · Textbook of Clinical Echocardiography (Otto)", {
    x: 0.2, y: 5.37, w: 9.6, h: 0.255,
    fontSize: 7, color: C.gray, fontFace: "Calibri", valign: "middle"
  });
}


// ─── WRITE FILE ────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/aortic-stenosis-ppt/Aortic_Stenosis_MCh_Teaching_Rounds.pptx" })
  .then(() => console.log("✅ Presentation written successfully!"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/aortic-stenosis-ppt && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/aortic-stenosis-ppt/Aortic_Stenosis_MCh_Teaching_Rounds.pptx

Your presentation is ready (8.3 MB, 12 slides):

Aortic Stenosis MCh Teaching Rounds

Presentation · PPTX


What's in the presentation (12 slides):

SlideContent
1 - TitleDark navy theme with epidemiology stats and source textbooks
2 - Outline8-section colour-coded table of contents
3 - Rheumatic HDFull cascade diagram (GAS → molecular mimicry → Aschoff bodies → chronic RHD), gross pathology image
4 - Etiology & MorphologyFull textbook image (normal/rheumatic/calcific/bicuspid), 3 etiology cards with distinguishing features
5 - PathophysiologyLV response stages table, symptom triad (5-3-2 rule), progression rates, natural history flowchart image, medical Rx pitfall
6 - Clinical FeaturesFull examination findings table: pulsus parvus et tardus, Gallavardin phenomenon, S2 changes, S4, ejection click - with mechanisms
7 - EchocardiographyACC/AHA severity grading table, continuity equation formula, CW Doppler image, low-flow low-gradient AS (Type 1 & 2)
8 - Staging & IndicationsFull 2021 ACC/AHA Stage A–D3 table, Class I/IIa/IIb indications
9 - SAVR16-step operative sequence, mechanical vs. tissue prosthesis table, root enlargement procedures (Nicks/Manougian/Konno), PPM definition
10 - TAVIValve types, 4 access routes, PARTNER/Evolut trial results, complications table, age-based TAVI vs. SAVR decision guide
11 - Special Procedures & OutcomesRoss procedure, Bentall/David, Redo AVR/Valve-in-Valve TAVI, outcomes table with anticoagulation protocols
12 - Take-Home Messages7 high-yield summary points colour-coded
Design: Deep navy + crimson + gold colour palette with accent sidebars, card shadows, and all 4 textbook images embedded.

the ppt so packed increase the slide number to 30 and make it less congested

Running Command

ls /home/daytona/workspace/aortic-stenosis-ppt/ && ls -lh /home/daytona/workspace/aortic-stenosis-ppt/img0.txt

ppt plz

Running Command

ls /home/daytona/workspace/aortic-stenosis-ppt/img0.txt && echo "images ready"

Writing File

~/aortic-stenosis-ppt/build30.js

const pptxgen = require("pptxgenjs");
const fs = require("fs");

const img0 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img0.txt","utf8"); // valve types
const img1 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img1.txt","utf8"); // natural history
const img2 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img2.txt","utf8"); // CW Doppler
const img3 = fs.readFileSync("/home/daytona/workspace/aortic-stenosis-ppt/img3.txt","utf8"); // gross path

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Aortic Stenosis — MCh Cardiology Teaching Rounds";

// ── PALETTE ──────────────────────────────────────────────────────
const C = {
  navy:    "0B1E3D",
  mid:     "132540",
  panel:   "1A3060",
  panel2:  "0E2246",
  crimson: "C0392B",
  red2:    "E74C3C",
  gold:    "E8A020",
  teal:    "1ABC9C",
  blue:    "2980B9",
  purple:  "8E44AD",
  green:   "27AE60",
  orange:  "D35400",
  white:   "FFFFFF",
  off:     "ECF0F1",
  gray:    "7F8C8D",
  grayLt:  "BDC3C7",
  slate:   "2C3E50",
};

// ── SHARED HELPERS ───────────────────────────────────────────────
const W = 10, H = 5.625;

function bg(s, color){ s.background = { color: color || C.navy }; }

// Top header bar with left accent stripe
function hdr(s, title, sub){
  s.addShape(pres.shapes.RECTANGLE,{ x:0,y:0,w:W,h:0.78, fill:{color:C.mid}, line:{color:C.mid} });
  s.addShape(pres.shapes.RECTANGLE,{ x:0,y:0,w:0.07,h:0.78, fill:{color:C.crimson}, line:{color:C.crimson} });
  s.addText(title,{ x:0.2,y:0,w:sub?7.2:9.7,h:0.78, fontSize:21, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:0.8, margin:0 });
  if(sub) s.addText(sub,{ x:7.5,y:0,w:2.4,h:0.78, fontSize:8.5, color:C.grayLt, fontFace:"Calibri", valign:"middle", align:"right", margin:0 });
  // bottom rule
  s.addShape(pres.shapes.RECTANGLE,{ x:0.07,y:0.78,w:9.93,h:0.03, fill:{color:C.panel}, line:{color:C.panel} });
}

// Simple card (filled rectangle with optional left accent)
function card(s,x,y,w,h,fill,accent){
  s.addShape(pres.shapes.RECTANGLE,{ x,y,w,h, fill:{color:fill||C.mid}, line:{color:C.panel,pt:0.8},
    shadow:{type:"outer",color:"000000",blur:6,offset:2,angle:135,opacity:0.2} });
  if(accent) s.addShape(pres.shapes.RECTANGLE,{ x,y,w:0.05,h, fill:{color:accent}, line:{color:accent} });
}

// Section divider label pill
function pill(s,text,x,y,color){
  const w = Math.max(1.5, text.length*0.093+0.3);
  s.addShape(pres.shapes.RECTANGLE,{ x,y,w,h:0.27, fill:{color:color||C.crimson}, line:{color:color||C.crimson} });
  s.addText(text,{ x,y,w,h:0.27, fontSize:8, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle", margin:0 });
}

// Bullet list inside a card
function bullets(s,items,x,y,w,h,opts){
  const o = opts||{};
  s.addText(items.map(i=>`• ${i}`).join("\n"),{
    x,y,w,h, fontSize:o.fs||11, color:o.col||C.off, fontFace:"Calibri",
    valign:"top", lineSpacingMultiple:1.15, margin:0
  });
}

// Horizontal rule
function rule(s,x,y,w,color){
  s.addShape(pres.shapes.RECTANGLE,{ x,y,w,h:0.025, fill:{color:color||C.panel}, line:{color:color||C.panel} });
}

// Footer bar
function footer(s,txt){
  s.addShape(pres.shapes.RECTANGLE,{ x:0,y:5.38,w:W,h:0.245, fill:{color:C.mid}, line:{color:C.mid} });
  s.addText(txt||"Aortic Stenosis · MCh Cardiology Teaching Rounds",{
    x:0.2,y:5.38,w:9.6,h:0.245, fontSize:7.5, color:C.gray, fontFace:"Calibri", valign:"middle"
  });
}

// Big stat box
function statBox(s,x,y,w,h,num,label,color){
  card(s,x,y,w,h,C.mid,color);
  s.addText(num,{ x:x+0.1,y:y+0.08,w:w-0.2,h:h*0.55, fontSize:28, bold:true, color:color||C.gold, fontFace:"Calibri", align:"center", valign:"bottom", margin:0 });
  s.addText(label,{ x:x+0.1,y:y+h*0.6,w:w-0.2,h:h*0.38, fontSize:9, color:C.grayLt, fontFace:"Calibri", align:"center", valign:"top", margin:0 });
}

// Section title slide helper
function sectionTitle(s, num, title, subtitle, color){
  bg(s, C.navy);
  s.addShape(pres.shapes.RECTANGLE,{ x:0,y:0,w:0.22,h:H, fill:{color:color}, line:{color:color} });
  s.addShape(pres.shapes.RECTANGLE,{ x:0.22,y:0,w:W-0.22,h:H, fill:{color:C.navy}, line:{color:C.navy} });
  s.addText(num,{ x:0.5,y:1.0,w:3,h:1.5, fontSize:96, bold:true, color:color, fontFace:"Calibri", align:"left", valign:"middle", margin:0, transparency:20 });
  s.addText(title,{ x:0.5,y:2.3,w:9.2,h:1.1, fontSize:40, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0 });
  s.addText(subtitle,{ x:0.5,y:3.4,w:9.2,h:0.7, fontSize:15, color:C.grayLt, fontFace:"Calibri", italic:true, valign:"top", margin:0 });
  footer(s);
}


// ════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:0.22,h:H,fill:{color:C.crimson},line:{color:C.crimson}});
  s.addShape(pres.shapes.RECTANGLE,{x:0.22,y:2.5,w:W-0.22,h:0.04,fill:{color:C.panel},line:{color:C.panel}});

  s.addText("AORTIC STENOSIS",{x:0.42,y:0.65,w:9.3,h:1.35,fontSize:58,bold:true,color:C.white,fontFace:"Calibri",charSpacing:2});
  s.addText("A Comprehensive Review for MCh Cardiology Teaching Rounds",{x:0.42,y:2.0,w:9.3,h:0.55,fontSize:16,color:C.grayLt,fontFace:"Calibri",italic:true});

  // tag row
  const tags=["Rheumatic HD","Pathophysiology","Echo Assessment","Staging & Indications","SAVR","TAVI","Special Procedures"];
  tags.forEach((t,i)=>{
    s.addShape(pres.shapes.RECTANGLE,{x:0.42+i*1.37,y:2.7,w:1.28,h:0.28,fill:{color:C.mid},line:{color:C.panel,pt:0.8}});
    s.addText(t,{x:0.42+i*1.37,y:2.7,w:1.28,h:0.28,fontSize:7.5,color:C.grayLt,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
  });

  // stat boxes
  const stats=[["2–5%","Adults >65 y with AS",C.gold],["50%","Mortality at 2–3 yr (untreated symptomatic)",C.crimson],[">100k","AVR/TAVI annually, USA",C.teal],["1–3%","Operative mortality, isolated SAVR",C.green]];
  stats.forEach(([n,l,c],i)=>{ statBox(s,0.42+i*2.38,3.12,2.22,1.92,n,l,c); });
  footer(s,"Sources: Braunwald's Heart Disease 10e · Schwartz's Principles of Surgery 11e · Sabiston Textbook of Surgery 21e · Fuster & Hurst's The Heart 15e · Otto: Textbook of Clinical Echocardiography");
}

// ════════════════════════════════════════════════════════════════
// SLIDE 2 — CONTENTS
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Lecture Outline");

  const secs=[
    {n:"01",t:"Rheumatic Heart Disease",d:"ARF · Molecular mimicry · Aschoff body · Chronic RHD",c:C.crimson},
    {n:"02",t:"Etiology & Classification",d:"Calcific · Bicuspid · Rheumatic — comparative morphology",c:C.red2},
    {n:"03",t:"Pathophysiology",d:"Pressure overload · Concentric hypertrophy · Laplace law",c:C.gold},
    {n:"04",t:"Natural History & Symptom Triad",d:"5-3-2 rule · Angina · Syncope · Heart failure",c:C.orange},
    {n:"05",t:"Clinical Features",d:"Examination · Pulsus parvus et tardus · Gallavardin · S2/S4",c:C.teal},
    {n:"06",t:"Investigations",d:"ECG · CXR · Cardiac catheterization · Gorlin formula",c:C.blue},
    {n:"07",t:"Echocardiography",d:"Continuity equation · Grading · Low-flow low-gradient AS",c:C.purple},
    {n:"08",t:"Staging & Indications",d:"2021 ACC/AHA Stages A–D3 · Class I / IIa / IIb",c:C.green},
    {n:"09",t:"Surgical Management (SAVR)",d:"Operative steps · Prosthesis types · Root enlargement",c:C.teal},
    {n:"10",t:"TAVI / Special Procedures",d:"PARTNER trials · Valve types · Ross · Bentall · Redo AVR",c:C.orange},
  ];

  secs.forEach((sec,i)=>{
    const col=i<5?0:1, row=i%5;
    const x=0.18+col*4.95, y=0.9+row*0.92;
    card(s,x,y,4.72,0.82,C.mid,sec.c);
    s.addText(sec.n,{x:x+0.12,y,w:0.55,h:0.82,fontSize:22,bold:true,color:sec.c,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    rule(s,x+0.7,y+0.2,0.02,C.panel);
    s.addShape(pres.shapes.RECTANGLE,{x:x+0.72,y:y+0.18,w:0.02,h:0.46,fill:{color:C.panel},line:{color:C.panel}});
    s.addText(sec.t,{x:x+0.84,y:y+0.06,w:3.76,h:0.36,fontSize:12,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(sec.d,{x:x+0.84,y:y+0.44,w:3.76,h:0.32,fontSize:8.5,color:C.gray,fontFace:"Calibri",valign:"top",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 3 — SECTION DIVIDER: RHEUMATIC HEART DISEASE
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"01","Rheumatic Heart Disease","From Group A Streptococcal Pharyngitis to Chronic Valve Damage",C.crimson); }

// ════════════════════════════════════════════════════════════════
// SLIDE 4 — ACUTE RHEUMATIC FEVER: MECHANISM
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Acute Rheumatic Fever — Pathogenesis","Sabiston Textbook of Surgery 21e");

  // Left flow arrows
  const steps=[
    {t:"Group A β-hemolytic Streptococcal Pharyngitis",c:C.crimson},
    {t:"Genetically susceptible host  (HLA-DR2, DR4 alleles)",c:C.red2},
    {t:"MOLECULAR MIMICRY\nStreptococcal M-protein ↔ Cardiac laminin",c:C.gold},
    {t:"Cross-reactive T-cells & antibodies\nattack the cardiac endocardium",c:C.orange},
    {t:"Acute Rheumatic Valvulitis\n(2–6 weeks post-infection)",c:C.teal},
  ];

  steps.forEach((st,i)=>{
    card(s,0.2,0.93+i*0.86,4.55,0.72,C.mid,st.c);
    s.addText(st.t,{x:0.35,y:0.93+i*0.86,w:4.3,h:0.72,fontSize:11.5,bold:i===2,color:i===2?C.gold:C.off,fontFace:"Calibri",valign:"middle",margin:0});
    if(i<4){
      s.addShape(pres.shapes.RECTANGLE,{x:0.6,y:0.93+i*0.86+0.72,w:0.06,h:0.14,fill:{color:C.gray},line:{color:C.gray}});
      s.addText("▼",{x:0.52,y:0.93+i*0.86+0.76,w:0.22,h:0.14,fontSize:9,color:C.gray,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    }
  });

  // Right: Jones Criteria
  card(s,4.93,0.93,4.9,2.15,C.mid,C.blue);
  pill(s,"REVISED JONES CRITERIA (2015)",4.93,0.93,C.blue);
  s.addText("MAJOR CRITERIA",{x:5.08,y:1.24,w:4.6,h:0.28,fontSize:10,bold:true,color:C.blue,fontFace:"Calibri",valign:"middle",margin:0});
  bullets(s,["Carditis (clinical or subclinical on echo)","Polyarthritis / Monoarthritis","Chorea (Sydenham's)","Erythema marginatum","Subcutaneous nodules"],5.08,1.54,4.6,1.25,{fs:10.5});
  
  card(s,4.93,3.15,4.9,1.6,C.mid,C.gold);
  pill(s,"MINOR CRITERIA",4.93,3.15,C.gold);
  s.addText([
    {text:"• Fever (≥38.5°C)\n",options:{}},{text:"• Elevated ESR ≥60 mm/hr OR CRP ≥3 mg/dL\n",options:{}},
    {text:"• Prolonged PR interval on ECG\n",options:{}},{text:"• Evidence of preceding GAS infection\n  (positive throat culture / ASOT ≥200 IU/mL)",options:{}},
  ],{x:5.08,y:3.45,w:4.6,h:1.25,fontSize:10.5,color:C.off,fontFace:"Calibri",valign:"top",margin:0});

  // ARF note
  card(s,0.2,5.1,9.63,0.32,C.panel2,C.crimson);
  s.addText("⚠  DIAGNOSIS: 2 major criteria OR 1 major + 2 minor — with evidence of preceding GAS infection. Diagnosis requires CLINICAL JUDGMENT.",{x:0.32,y:5.1,w:9.4,h:0.32,fontSize:9,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
}

// ════════════════════════════════════════════════════════════════
// SLIDE 5 — ASCHOFF BODY & VALVULAR PATHOLOGY
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Rheumatic Carditis — Pathological Features","Braunwald's Heart Disease 10e · Sabiston 21e");

  // Aschoff body
  card(s,0.2,0.93,4.55,2.65,C.mid,C.gold);
  pill(s,"ASCHOFF BODY — PATHOGNOMONIC LESION",0.2,0.93,C.gold);
  bullets(s,[
    "Central area of FIBRINOID NECROSIS",
    "Anitschkow cells (caterpillar cells) — activated macrophages with owl-eye nuclei",
    "Aschoff giant cells — multinucleated",
    "Perivascular granulomatous inflammation",
    "Found in myocardium; heals by fibrosis",
  ],0.32,1.25,4.35,2.2,{fs:11});

  // Valvular pathology
  card(s,0.2,3.68,4.55,1.68,C.mid,C.crimson);
  pill(s,"ACUTE VALVULAR CHANGES",0.2,3.68,C.crimson);
  bullets(s,[
    "Verrucous endocarditis: 1–2 mm sterile vegetations along line of valve closure",
    "Mitral valve most affected (65–70%) → combined mitral + aortic (25%)",
    "Chordal involvement: oedema → later fusion and shortening",
    "Pancarditis: endocarditis + myocarditis + pericarditis",
  ],0.32,4.0,4.35,1.3,{fs:11});

  // Gross image
  card(s,4.93,0.93,4.9,3.8,C.mid);
  s.addImage({data:img3,x:5.0,y:0.98,w:4.75,h:3.35});
  s.addText("Gross specimen: rheumatic valve — fused leaflets forming slit-like orifice (Sabiston, Fig. 112.12)",{x:4.93,y:4.36,w:4.9,h:0.32,fontSize:8,color:C.gray,fontFace:"Calibri",italic:true,align:"center",margin:0});

  // Chronic RHD note
  card(s,4.93,4.73,4.9,0.63,C.mid,C.teal);
  s.addText("CHRONIC RHD: Repeated streptococcal exposures → cumulative valve damage → commissural fusion + fibrosis → stenosis. Develops silently over 10–40 years.",{x:5.05,y:4.73,w:4.7,h:0.63,fontSize:9.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 6 — SECTION: ETIOLOGY
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"02","Etiology & Classification","Calcific · Bicuspid · Rheumatic — Morphology & Distinguishing Features",C.gold); }

// ════════════════════════════════════════════════════════════════
// SLIDE 7 — THREE CAUSES WITH IMAGE
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Causes of Aortic Stenosis — Valve Morphology","Textbook of Clinical Echocardiography (Otto)");

  card(s,0.2,0.93,5.55,4.45,C.mid);
  s.addImage({data:img0,x:0.27,y:0.97,w:5.41,h:4.1});
  s.addText("Fig 11.5 — TTE parasternal short-axis. Top: diastole. Bottom: systole. (Otto: Textbook of Clinical Echocardiography)",{x:0.2,y:5.05,w:5.55,h:0.3,fontSize:7.5,color:C.gray,fontFace:"Calibri",italic:true,align:"center"});

  // Three label cards
  const causes=[
    {t:"CALCIFIC / DEGENERATIVE",a:"Aortic side calcification at leaflet bases · NO commissural fusion · Stellate orifice · Age 70–80s · Shared risk factors with atherosclerosis",c:C.gold},
    {t:"BICUSPID AORTIC VALVE",a:"2/3 of severe AS in adults <70 y · Prevalence 1–2% (M:F 3:1) · Elliptical orifice · Associated aortopathy in 50% · Accelerated calcification",c:C.teal},
    {t:"RHEUMATIC",a:"Commissural fusion (pathognomonic) · Triangular orifice · Mitral valve ALWAYS involved · Developing world · Age 40–60s",c:C.crimson},
  ];
  causes.forEach((c2,i)=>{
    card(s,5.92,0.93+i*1.52,3.88,1.38,C.mid,c2.c);
    s.addText(c2.t,{x:6.08,y:0.96+i*1.52,w:3.62,h:0.34,fontSize:11,bold:true,color:c2.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(c2.a,{x:6.08,y:1.32+i*1.52,w:3.62,h:0.92,fontSize:10,color:C.off,fontFace:"Calibri",valign:"top",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 8 — COMPARATIVE TABLE
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Comparative Features of AS Etiology","Braunwald's · Otto · Schwartz");

  const rows=[
    ["Feature","Calcific / Degenerative","Bicuspid AV","Rheumatic"],
    ["Age at presentation","70s–80s","50s–60s","40s–60s"],
    ["Commissural fusion","NO","NO (raphe present)","YES — pathognomonic"],
    ["Orifice shape (systole)","Stellate / irregular","Elliptical","Triangular"],
    ["Calcification site","Base of leaflets (aortic side)","Leaflet body","Leaflet tips + commissures"],
    ["Mitral valve","Separate disease","Independent (possible assoc)","ALMOST ALWAYS involved"],
    ["Regurgitation","Uncommon","Possible (aortopathy/prolapse)","Common — mixed lesion"],
    ["Associated condition","Atherosclerosis","Aortopathy (50%)","Mitral stenosis"],
    ["Prevalence (developed)","Most common","Common in <70 yr","Decreasing"],
    ["Genetic/hereditary factor","Risk factor overlap","Autosomal dominant (fibrillin)","HLA-DR susceptibility"],
  ];

  const colColors=[null,C.gold,C.teal,C.crimson];
  const tableData = rows.map((row,ri)=>
    row.map((cell,ci)=>({
      text: cell,
      options:{
        bold: ri===0 || ci===0,
        fontSize: ri===0?9.5:10,
        color: ri===0?(ci===0?C.navy:C.navy): (ci===0?C.grayLt:(cell.includes("YES")||cell.includes("ALMOST")||cell.includes("pathogno")?C.crimson:C.off)),
        fill:{color: ri===0?(ci===0?C.panel:colColors[ci]||C.panel): (ri%2===0?C.mid:C.panel2)},
        align: ci===0?"left":"left",
        valign:"middle",
      }
    }))
  );

  s.addTable(tableData,{x:0.2,y:0.93,w:9.63,h:4.35,
    colW:[2.2,2.48,2.48,2.47],
    border:{pt:0.5,color:C.panel},
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 9 — SECTION: PATHOPHYSIOLOGY
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"03","Pathophysiology","Pressure Overload · Concentric Hypertrophy · Laplace Law · Frank-Starling",C.teal); }

// ════════════════════════════════════════════════════════════════
// SLIDE 10 — CORE MECHANISM
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Pressure Overload — Core Mechanism","Sabiston · Schwartz Principles of Surgery 11e");

  card(s,0.2,0.93,9.63,0.88,C.panel2,C.crimson);
  s.addText("FIXED OUTFLOW OBSTRUCTION → ↑ LV Systolic Pressure → CONCENTRIC LV HYPERTROPHY",{x:0.32,y:0.93,w:9.4,h:0.88,fontSize:14,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",align:"center",margin:0});

  // Laplace law
  card(s,0.2,1.93,4.7,1.6,C.mid,C.gold);
  pill(s,"LAPLACE LAW",0.2,1.93,C.gold);
  s.addText("Wall Stress  ∝  (Pressure × Radius)\n                  2 × Wall Thickness",{x:0.32,y:2.24,w:4.48,h:0.72,fontSize:14,bold:true,color:C.white,fontFace:"Courier New",valign:"middle",margin:0});
  s.addText("As LV pressure ↑, wall thickness ↑ proportionally → wall stress normalised → myocardial work preserved",{x:0.32,y:2.98,w:4.48,h:0.48,fontSize:9.5,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});

  // Frank-Starling
  card(s,5.08,1.93,4.75,1.6,C.mid,C.teal);
  pill(s,"FRANK-STARLING MECHANISM",5.08,1.93,C.teal);
  s.addText("As EDV increases → myocardial stretch → ↑ contractile force → maintained stroke volume.",{x:5.22,y:2.24,w:4.5,h:0.55,fontSize:11,color:C.off,fontFace:"Calibri",valign:"top",margin:0});
  s.addText("Once sarcomere length exceeds 2.2 μm (optimal) → contractile function falls → heart failure ensues.",{x:5.22,y:2.82,w:4.5,h:0.65,fontSize:10.5,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});

  // 4-stage progression
  const stages=[
    {s:"COMPENSATION",d:"Concentric hypertrophy · EF normal · Preserved SV · ↑ LVESP · Normal CO",c:C.teal},
    {s:"EARLY DECOMP.",d:"Diastolic dysfunction · Impaired relaxation · ↑ LVEDP · Reduced LV compliance",c:C.gold},
    {s:"LATE DECOMP.",d:"Systolic dysfunction · EF begins to fall · Low CO · Pulmonary congestion",c:C.orange},
    {s:"END-STAGE",d:"Dilated LV · Markedly reduced EF · Low-flow, low-gradient pattern",c:C.crimson},
  ];
  stages.forEach((st,i)=>{
    card(s,0.2+i*2.42,3.65,2.28,1.72,C.mid,st.c);
    s.addShape(pres.shapes.RECTANGLE,{x:0.2+i*2.42,y:3.65,w:2.28,h:0.32,fill:{color:st.c},line:{color:st.c}});
    s.addText(st.s,{x:0.2+i*2.42,y:3.65,w:2.28,h:0.32,fontSize:8.5,bold:true,color:C.navy,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(st.d,{x:0.28+i*2.42,y:4.0,w:2.12,h:1.3,fontSize:9.5,color:C.off,fontFace:"Calibri",valign:"top",margin:0});
    if(i<3) s.addText("→",{x:2.34+i*2.42,y:4.3,w:0.22,h:0.4,fontSize:18,color:C.gray,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 11 — NATURAL HISTORY & SYMPTOM TRIAD
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Natural History & The Classic Symptom Triad","Schwartz · Braunwald · Fuster & Hurst 15e");

  // Natural history image
  card(s,0.2,0.93,6.0,3.35,C.mid);
  s.addImage({data:img1,x:0.27,y:0.97,w:5.86,h:3.05});
  s.addText("Fuster & Hurst Ch. 28: Natural history — long latent period, rapid decline once symptoms develop",{x:0.2,y:4.3,w:6.0,h:0.28,fontSize:7.5,color:C.gray,fontFace:"Calibri",italic:true,align:"center"});

  // Progression rates
  card(s,6.38,0.93,3.45,1.55,C.mid,C.gold);
  pill(s,"ANNUAL PROGRESSION (AVERAGE)",6.38,0.93,C.gold);
  const pr=[["Peak Jet Velocity","+ 0.3 m/s / yr"],["Mean Gradient","+ 7 mmHg / yr"],["Valve Area","− 0.1 cm² / yr"]];
  pr.forEach(([l,v],i)=>{
    s.addText(l+":",{x:6.52,y:1.26+i*0.37,w:2.0,h:0.34,fontSize:10,color:C.grayLt,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(v,{x:8.55,y:1.26+i*0.37,w:1.2,h:0.34,fontSize:11,bold:true,color:C.gold,fontFace:"Calibri",valign:"middle",align:"right",margin:0});
  });

  // Triad boxes
  const triad=[
    {sym:"ANGINA",surv:"~5 yr survival",mech:"↑O₂ demand (hypertrophy) + ↓supply (subendocardial compression, reduced CPP)",c:C.gold},
    {sym:"SYNCOPE",surv:"~3 yr survival",mech:"Fixed CO → cerebral hypoperfusion on exertion; baroreceptor dysfunction; arrhythmia",c:C.orange},
    {sym:"HEART FAILURE",surv:"< 2 yr survival",mech:"Diastolic dysfunction → ↑LVEDP → pulmonary oedema; late: systolic failure, low output",c:C.crimson},
  ];
  triad.forEach((t,i)=>{
    card(s,6.38,2.6+i*0.98,3.45,0.84,C.mid,t.c);
    s.addText(t.sym,{x:6.52,y:2.62+i*0.98,w:1.55,h:0.38,fontSize:11,bold:true,color:t.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(t.surv,{x:8.1,y:2.62+i*0.98,w:1.65,h:0.38,fontSize:9.5,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",align:"right",margin:0});
    s.addText(t.mech,{x:6.52,y:3.0+i*0.98,w:3.22,h:0.4,fontSize:8.5,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});
  });

  card(s,0.2,4.62,9.63,0.72,C.panel2,C.crimson);
  s.addText("KEY POINT: Annual sudden death risk in ASYMPTOMATIC severe AS is <1%. Once SYMPTOMATIC → 50% mortality at 2–3 years without AVR. Symptom onset is the critical intervention trigger.",{x:0.32,y:4.62,w:9.4,h:0.72,fontSize:10.5,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",margin:0});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 12 — SECTION: CLINICAL
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"04","Clinical Features & Investigations","Examination · ECG · CXR · Cardiac Catheterization",C.blue); }

// ════════════════════════════════════════════════════════════════
// SLIDE 13 — PHYSICAL EXAMINATION
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Physical Examination Findings","Braunwald's Heart Disease 10e");

  const rows=[
    ["Finding","Clinical Sign","Mechanism / Notes"],
    ["Pulse","Pulsus parvus et tardus\n(slow-rising, small-volume, delayed)","Fixed reduced CO and delayed LV ejection. Note: may be ABSENT in elderly (large artery stiffening — false reassurance!)"],
    ["Apex beat","Sustained, forceful, non-displaced","Concentric hypertrophy — increased wall thickness, NOT chamber dilation → no displacement"],
    ["Systolic murmur","Harsh crescendo-decrescendo (diamond-shaped)\nSEM at right 2nd ICS → carotids","Turbulent flow through stenotic valve. LATE-PEAKING murmur = more severe stenosis"],
    ["Second heart sound","Absent A2 or single/paradoxically split S2","Calcified immobile leaflets → reduced or absent aortic valve closure sound"],
    ["S4 gallop","Prominent presystolic S4","Forceful atrial contraction against stiff non-compliant, hypertrophied LV"],
    ["Ejection click","Early systolic click (before SEM)","Abrupt halt of mobile valve at max opening. Present in bicuspid / early calcific AS"],
    ["Gallavardin phenomenon","Musical/squeaky component at apex — mimics MR","High-frequency component of AS murmur radiates to apex. Distinct from the basal harsher murmur"],
  ];

  const td=rows.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{
      bold:ri===0||ci===0,
      fontSize:ri===0?9.5:(ci===0?10.5:9.5),
      color:ri===0?C.navy:(ci===0?C.gold:C.off),
      fill:{color:ri===0?C.panel:(ri%2===0?C.mid:C.panel2)},
      valign:"middle",
    }
  })));

  s.addTable(td,{x:0.2,y:0.93,w:9.63,h:4.65,
    colW:[1.85,2.7,5.08],
    border:{pt:0.5,color:C.panel},
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 14 — ECG & CHEST X-RAY
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Investigations — ECG & Chest X-Ray","Braunwald's Heart Disease 10e");

  card(s,0.2,0.93,4.7,4.35,C.mid,C.blue);
  pill(s,"ELECTROCARDIOGRAM (ECG)",0.2,0.93,C.blue);
  const ecg=[
    "LV Hypertrophy: Sokolov-Lyon: S(V1) + R(V5/V6) ≥ 35 mm",
    "Strain pattern: ST depression + T-wave inversion in lateral leads (I, aVL, V5–V6)",
    "Left axis deviation",
    "Left atrial enlargement (P-mitrale) — especially rheumatic AS with MS",
    "Left bundle branch block (LBBB) in advanced disease",
    "1st-degree AV block (PR prolongation)",
    "Atrial fibrillation — particularly in rheumatic AS with coexistent MS",
    "Q waves: non-specific; may suggest ischaemia / fibrosis",
  ];
  ecg.forEach((e,i)=>{
    s.addText(`• ${e}`,{x:0.32,y:1.27+i*0.48,w:4.48,h:0.45,fontSize:10.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });

  card(s,5.08,0.93,4.75,4.35,C.mid,C.teal);
  pill(s,"CHEST X-RAY",5.08,0.93,C.teal);
  const cxr=[
    "NORMAL HEART SIZE (concentric hypertrophy → no cardiomegaly initially — key point!)",
    "Post-stenotic dilatation of ascending aorta (esp. bicuspid AS)",
    "Aortic valve calcification — best seen on LATERAL view / fluoroscopy",
    "Cardiomegaly — LATE sign: indicates systolic dysfunction",
    "Pulmonary venous hypertension: upper lobe diversion → interstitial oedema → alveolar oedema",
    "Kerley B lines — horizontal lines in lung periphery (pulmonary oedema)",
    "Pleural effusions (late, decompensated)",
    "LA enlargement in rheumatic AS (associated MS)",
  ];
  cxr.forEach((c2,i)=>{
    s.addText(`• ${c2}`,{x:5.22,y:1.27+i*0.48,w:4.5,h:0.45,fontSize:10.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 15 — CARDIAC CATHETERIZATION
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Cardiac Catheterization & Gorlin Formula","Braunwald's Heart Disease 10e · Schwartz 11e");

  card(s,0.2,0.93,5.6,3.0,C.mid,C.gold);
  pill(s,"GORLIN FORMULA — AORTIC VALVE AREA",0.2,0.93,C.gold);
  s.addText("          CO / (SEP × HR)\nAVA =  ─────────────────────\n       44.3 × √(Mean Gradient)",{x:0.32,y:1.27,w:5.38,h:1.08,fontSize:15,bold:true,color:C.white,fontFace:"Courier New",valign:"middle",margin:0});
  s.addText("CO = Cardiac Output (mL/min)\nSEP = Systolic Ejection Period (sec/beat)\nHR = Heart Rate (beats/min)\nMean Gradient = mean aortic–LV pressure difference (mmHg)",{x:0.32,y:2.38,w:5.38,h:1.45,fontSize:10.5,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});

  card(s,0.2,4.02,5.6,1.32,C.panel2,C.crimson);
  pill(s,"INDICATIONS FOR CATHETERIZATION",0.2,4.02,C.crimson);
  bullets(s,["Echo inconclusive or technically inadequate","Discordant symptoms and echo findings","Pre-operatively: coronary angiography mandatory (CAD in 30–50%)","TAVI planning: CT angiography of aortic root + iliofemoral vessels"],0.32,4.32,5.38,0.97,{fs:10.5});

  card(s,5.97,0.93,4.06,4.41,C.mid,C.teal);
  pill(s,"HAEMODYNAMIC CATHETER DATA",5.97,0.93,C.teal);
  const hemRows=[
    ["Parameter","Normal","Mild AS","Severe AS"],
    ["LV systolic pressure (mmHg)","120","140–160",">180"],
    ["Aortic systolic pressure (mmHg)","120","110–120","90–110"],
    ["Aortic valve gradient (mmHg)","<5","10–30",">50"],
    ["Aortic valve area (cm²)","3.0–4.0","1.5–2.5","<1.0"],
    ["Cardiac index (L/min/m²)","≥2.5","2.0–2.5","Often ↓ (<2.0)"],
    ["PCWP (mmHg)","<12","12–18","Often elevated"],
  ];
  const hemTD=hemRows.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{bold:ri===0||ci===0,fontSize:ri===0?9:10,
      color:ri===0?C.navy:(ci===0?C.grayLt:(ci===3?C.crimson:C.off)),
      fill:{color:ri===0?C.panel:(ri%2===0?C.mid:C.panel2)},valign:"middle"}
  })));
  s.addTable(hemTD,{x:6.07,y:1.27,w:3.85,h:3.75,colW:[1.75,0.72,0.72,0.66],border:{pt:0.5,color:C.panel}});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 16 — SECTION: ECHOCARDIOGRAPHY
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"05","Echocardiography","Quantitation · Continuity Equation · CW Doppler · Low-flow Patterns",C.purple); }

// ════════════════════════════════════════════════════════════════
// SLIDE 17 — ECHO SEVERITY GRADING
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Echocardiographic Severity Grading","Textbook of Clinical Echocardiography (Otto) · 2021 ACC/AHA");

  card(s,0.2,0.93,9.63,0.35,C.panel,C.crimson);
  s.addText("ACC / AHA SEVERITY CLASSIFICATION — AORTIC STENOSIS",{x:0.32,y:0.93,w:9.4,h:0.35,fontSize:10,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",charSpacing:0.5,margin:0});

  const gradeData=[
    ["Parameter","Mild","Moderate","Severe","Very Severe"],
    ["Peak Jet Velocity (m/s)","< 3.0","3.0–4.0","> 4.0","> 5.0"],
    ["Mean Gradient (mmHg)","< 25","25–40","> 40","> 60"],
    ["Valve Area (cm²)","> 1.5","1.0–1.5","< 1.0","< 1.0"],
    ["Indexed AVA (cm²/m²)","—","—","< 0.6","< 0.6"],
    ["Doppler Velocity Index","> 0.50","0.25–0.50","< 0.25","< 0.20"],
    ["Velocity ratio (VTI_LVOT/VTI_AV)","—","—","< 0.25","—"],
  ];
  const gradeCols=[null,C.teal,C.gold,C.crimson,"#8E44AD"];
  const gTD=gradeData.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{
      bold:ri===0||ci===0,fontSize:ri===0?9.5:11,
      color:ri===0?(ci===0?C.navy:C.navy):(ci===0?C.grayLt:(ci===3||ci===4?C.crimson:ci===2?C.gold:ci===1?C.teal:C.off)),
      fill:{color:ri===0?(gradeCols[ci]||C.panel):(ri%2===0?C.mid:C.panel2)},
      valign:"middle",align:"center",
    }
  })));
  s.addTable(gTD,{x:0.2,y:1.31,w:9.63,h:3.3,colW:[2.6,1.6,1.6,1.62,1.61],border:{pt:0.5,color:C.panel}});

  card(s,0.2,4.68,9.63,0.65,C.panel2,C.gold);
  pill(s,"IMPORTANT NOTE",0.2,4.68,C.gold);
  s.addText("Valve gradients are FLOW-DEPENDENT. Always interpret in the context of cardiac output / forward flow. A low gradient does NOT always mean mild stenosis — consider low-flow states.",{x:0.32,y:4.68,w:9.4,h:0.65,fontSize:10,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 18 — CONTINUITY EQUATION & CW DOPPLER
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Continuity Equation & CW Doppler","Textbook of Clinical Echocardiography (Otto)");

  card(s,0.2,0.93,5.55,2.45,C.mid,C.gold);
  pill(s,"CONTINUITY EQUATION — MOST ACCURATE AVA METHOD",0.2,0.93,C.gold);
  s.addText("Conservation of mass:\nFlow at LVOT = Flow at Aortic Valve",{x:0.32,y:1.27,w:5.33,h:0.55,fontSize:12,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});
  s.addText("AVA = CSA_LVOT × VTI_LVOT\n              VTI_AV\n\n    = 0.785 × D_LVOT² × VTI_LVOT\n                  VTI_AV",{x:0.32,y:1.84,w:5.33,h:1.42,fontSize:13.5,bold:true,color:C.white,fontFace:"Courier New",valign:"top",margin:0});

  card(s,0.2,3.47,5.55,1.87,C.mid,C.teal);
  pill(s,"KEY MEASUREMENTS",0.2,3.47,C.teal);
  const meas=[
    ["D_LVOT","PLAX view, 0.5–1.0 cm below AV (internal diameter)"],
    ["VTI_LVOT","PW Doppler, apical 5-chamber, sample just below AV"],
    ["VTI_AV","CW Doppler from MULTIPLE windows (apex, right parasternal, suprasternal) — use HIGHEST velocity"],
  ];
  meas.forEach(([k,v],i)=>{
    s.addText(k+":",{x:0.32,y:3.8+i*0.48,w:1.2,h:0.44,fontSize:10,bold:true,color:C.teal,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(v,{x:1.55,y:3.8+i*0.48,w:4.05,h:0.44,fontSize:10,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });

  // CW Doppler image
  card(s,5.93,0.93,3.9,4.41,C.mid);
  s.addImage({data:img2,x:6.0,y:0.97,w:3.76,h:3.75});
  s.addText("Fig 11.9: CW Doppler waveforms. Valvular AS (symmetric peak) vs. Subaortic membrane (similar + valve flutter) vs. HCM (late-peaking 'dagger' pattern). Otto, Textbook of Clinical Echocardiography.",{x:5.93,y:4.72,w:3.9,h:0.58,fontSize:7.5,color:C.gray,fontFace:"Calibri",italic:true,align:"center"});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 19 — LOW-FLOW LOW-GRADIENT AS
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Low-Flow, Low-Gradient Aortic Stenosis","Braunwald's Heart Disease 10e · 2021 ACC/AHA Guidelines");

  card(s,0.2,0.93,9.63,0.48,C.panel2,C.crimson);
  s.addText(">40% of older patients present with LOW gradient despite severe anatomical AS",{x:0.32,y:0.93,w:9.4,h:0.48,fontSize:12,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",margin:0});

  const types=[
    {t:"TYPE 1 — Classical Low-Flow, Low-Gradient\n(Reduced EF < 50%) — Stage D2",
     d:["AVA < 1.0 cm² AND mean gradient < 40 mmHg AND LVEF < 50%","Low gradient due to REDUCED FORWARD FLOW from impaired LV","Differentiate 'True Severe' vs 'Pseudo-severe' AS with dobutamine stress echo","TRUE SEVERE: gradient rises ≥40 mmHg, AVA stays <1.0 cm²","PSEUDO-SEVERE: AVA opens to >1.0 cm² as contractility improves with dobutamine"],c:C.crimson,stage:"D2"},
    {t:"TYPE 2 — Paradoxical Low-Flow, Low-Gradient\n(Preserved EF ≥ 50%) — Stage D3",
     d:["AVA <1.0 cm², mean gradient <40 mmHg, EF ≥50%, BUT SVi <35 mL/m²","Small, concentrically hypertrophied LV with reduced stroke volume","More common in WOMEN, elderly, hypertensive patients","CT calcium scoring confirms: >2000 AU in men; >1200 AU in women","Prognosis SAME as high-gradient AS — benefit from AVR"],c:C.purple,stage:"D3"},
    {t:"TYPE 3 — High-Flow, Low-Gradient AS\n(Normal EF, AVA > 1.0 cm²)",
     d:["Vmax > 4 m/s BUT AVA > 1.0 cm²","Usually caused by LVOT diameter OVERESTIMATION","Other causes: high cardiac output state, moderate-severe AR","Does NOT generally benefit from AVR","Careful echo re-measurement required before labelling"],c:C.blue,stage:"Special"},
  ];

  types.forEach((t,i)=>{
    card(s,0.2+i*3.22,1.52,3.1,3.55,C.mid,t.c);
    s.addShape(pres.shapes.RECTANGLE,{x:0.2+i*3.22,y:1.52,w:3.1,h:0.4,fill:{color:t.c},line:{color:t.c}});
    s.addText(t.t,{x:0.28+i*3.22,y:1.52,w:2.94,h:0.4,fontSize:8.5,bold:true,color:C.navy,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    t.d.forEach((item,j)=>{
      s.addText(`• ${item}`,{x:0.3+i*3.22,y:1.97+j*0.62,w:2.93,h:0.58,fontSize:9.5,color:j===2||j===3?t.c:C.off,fontFace:"Calibri",valign:"middle",margin:0});
    });
  });

  card(s,0.2,5.12,9.63,0.35,C.panel2,C.gold);
  s.addText("DOBUTAMINE STRESS ECHO PROTOCOL (Type 1): Infuse 5–40 μg/kg/min. Flow-reserve positive (ΔSV ≥20%) — proceed to dobutamine-induced gradient interpretation.",{x:0.32,y:5.12,w:9.4,h:0.35,fontSize:9,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 20 — SECTION: STAGING & INDICATIONS
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"06","Staging & Indications for Intervention","2021 ACC/AHA Valvular Heart Disease Guidelines · Stage A through D3",C.green); }

// ════════════════════════════════════════════════════════════════
// SLIDE 21 — STAGING TABLE
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"2021 ACC/AHA Staging of Aortic Stenosis","2021 ACC/AHA Valvular Heart Disease Guidelines");

  const stageRows=[
    ["Stage","Definition","Haemodynamics","Symptoms","LV Function"],
    ["A\nAt Risk","Risk factors for AS\n(bicuspid valve, age, hypertension, smoking)","Normal valve\nno obstruction","None","Normal"],
    ["B\nProgressive","Mild–moderate AS\nValve changes present","Vmax 2–3.9 m/s\nMean grad <40 mmHg\nAVA >1.0 cm²","None","Normal or early remodelling"],
    ["C1\nSevere Asymptomatic\nPreserved EF","Severe AS\nAsymptomatic","Vmax ≥4 m/s\nMean grad ≥40 mmHg\nAVA ≤1.0 cm²","None","LVEF ≥50%\nMay have early decompensation"],
    ["C2\nSevere Asymptomatic\nReduced EF","Severe AS\nAsymptomatic","As C1","None","LVEF <50%"],
    ["D1\nSevere Symptomatic\nHigh-Gradient","Severe AS","Vmax ≥4 m/s\nMean grad ≥40 mmHg","Angina\nSyncope\nHeart failure","Usually EF preserved initially"],
    ["D2\nLow-Flow Low-Gradient\nReduced EF","Severe AS\n(confirmed by DSE)","AVA <1.0 cm²\nMean grad <40 mmHg","Symptoms present","LVEF <50%"],
    ["D3\nLow-Flow Low-Gradient\nPreserved EF (Paradoxical)","Severe AS\n(confirmed by CT Ca score)","AVA <1.0, grad <40\nSVi <35 mL/m²","Symptoms present","LVEF ≥50%\n(small hypertrophied LV)"],
  ];

  const stageCols=[null,C.teal,C.teal,C.gold,C.gold,C.crimson,C.crimson,C.crimson];
  const sTD=stageRows.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{
      bold:ri===0||ci===0,
      fontSize:ri===0?8.5:9,
      color:ri===0?C.navy:(ci===0?(ri<=2?C.teal:ri<=4?C.gold:C.crimson):C.off),
      fill:{color:ri===0?C.panel:(ri%2===0?C.mid:C.panel2)},
      valign:"middle",
    }
  })));
  s.addTable(sTD,{x:0.2,y:0.93,w:9.63,h:4.65,
    colW:[1.65,1.95,2.05,1.4,2.58],
    border:{pt:0.5,color:C.panel},
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 22 — INDICATIONS FOR INTERVENTION
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Indications for Intervention","2021 ACC/AHA Valvular Heart Disease Guidelines");

  const boxes=[
    {cls:"CLASS I",sub:"Benefit >> Risk — MUST DO",col:C.green,items:[
      "Symptomatic severe high-gradient AS (Stage D1) → AVR indicated (COR I, LOE B-NR)",
      "Severe AS (any stage) in patient undergoing other cardiac surgery → concomitant AVR (COR I, LOE B-NR)",
      "Asymptomatic severe AS with LVEF <50% (Stage C2) → AVR indicated (COR I, LOE B-NR)",
    ]},
    {cls:"CLASS IIa",sub:"Benefit > Risk — SHOULD DO",col:C.gold,items:[
      "Asymptomatic severe AS (C1) with very severe hemodynamics: Vmax ≥5 m/s or mean grad ≥60 mmHg → AVR reasonable",
      "Asymptomatic severe AS (C1) undergoing non-cardiac surgery → AVR first if feasible",
      "Low-flow, low-gradient severe AS (D2) confirmed by dobutamine stress echo → AVR",
      "Moderate AS (Stage B) in patients undergoing cardiac surgery for other indications",
    ]},
    {cls:"CLASS IIb",sub:"Uncertain Benefit — CONSIDER",col:C.orange,items:[
      "Asymptomatic severe AS (C1) with rapid progression (Vmax ↑≥0.3 m/s/yr) — AVR may be considered",
      "Asymptomatic severe AS (C1) with new onset AF or pulmonary hypertension",
      "Low-flow, low-gradient paradoxical AS (D3) with confirmed severity (CT calcium score)",
    ]},
  ];

  boxes.forEach((b,i)=>{
    const y=0.93+i*1.57;
    card(s,0.2,y,9.63,1.44,C.mid,b.col);
    s.addShape(pres.shapes.RECTANGLE,{x:0.2,y,w:9.63,h:0.35,fill:{color:b.col},line:{color:b.col}});
    s.addText(`${b.cls} — ${b.sub}`,{x:0.32,y,w:9.4,h:0.35,fontSize:10,bold:true,color:C.navy,fontFace:"Calibri",valign:"middle",margin:0});
    b.items.forEach((item,j)=>{
      s.addText(`• ${item}`,{x:0.32,y:y+0.38+j*0.34,w:9.3,h:0.33,fontSize:10.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
    });
  });

  card(s,0.2,5.66,9.63,0.0,C.mid); // spacer
  footer(s,"2021 ACC/AHA Guideline for the Management of Patients with Valvular Heart Disease — Key Recommendations for Aortic Stenosis");
}

// ════════════════════════════════════════════════════════════════
// SLIDE 23 — SECTION: SAVR
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"07","Surgical Aortic Valve Replacement","Operative Technique · Myocardial Protection · Prosthesis Selection",C.teal); }

// ════════════════════════════════════════════════════════════════
// SLIDE 24 — PRE-OP WORKUP & CPB SETUP
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Pre-operative Workup & CPB Setup","Schwartz Principles of Surgery 11e · Sabiston 21e");

  card(s,0.2,0.93,4.7,4.42,C.mid,C.blue);
  pill(s,"PRE-OPERATIVE ASSESSMENT",0.2,0.93,C.blue);
  const preop=[
    "Doppler TTE: confirm severity, LV function, screen all valves",
    "Coronary angiography — MANDATORY (CAD in 30–50%)",
    "TEE: detailed valve morphology, annulus sizing",
    "CT angiography (for TAVI): annulus, root anatomy, coronary heights, iliofemoral access",
    "Carotid Doppler: significant stenosis → staged or combined procedure",
    "STS-PROM / EuroSCORE II: operative risk stratification",
    "Frailty assessment (TAVI candidates): 5-metre walk, grip strength, albumin, Katz ADL",
    "Pulmonary function tests (if significant respiratory symptoms)",
    "Renal function: eGFR, creatinine — affects contrast and anticoagulation",
  ];
  preop.forEach((p,i)=>{
    s.addText(`• ${p}`,{x:0.32,y:1.27+i*0.46,w:4.48,h:0.44,fontSize:10,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });

  card(s,5.08,0.93,4.75,4.42,C.mid,C.teal);
  pill(s,"CARDIOPULMONARY BYPASS SETUP",5.08,0.93,C.teal);
  const cpb=[
    "Aortic cannulation: distal ascending aorta (purse-string sutures)",
    "Venous cannulation: RA (single 2-stage) or bicaval for combined procedures",
    "LV vent: via right superior pulmonary vein or LV apex (decompresses LV)",
    "Temperature: mild–moderate hypothermia 28–32°C",
    "Antegrade cardioplegia: aortic root or direct coronary ostia cannulae",
    "Retrograde cardioplegia: coronary sinus cannula — especially useful in AVR",
    "Cold blood cardioplegia preferred (4:1 blood:crystalloid)",
    "Myocardial protection critical: hypertrophied LV less tolerant of ischaemia",
    "Target ACT >400 sec after heparin (300–400 IU/kg)",
  ];
  cpb.forEach((p,i)=>{
    s.addText(`• ${p}`,{x:5.22,y:1.27+i*0.46,w:4.5,h:0.44,fontSize:10,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 25 — OPERATIVE STEPS
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Surgical AVR — Operative Steps","Schwartz Principles of Surgery 11e · Sabiston Textbook of Surgery 21e");

  const steps=[
    {n:"1",t:"Median sternotomy",d:"Oscillating saw; sternal retractor; pericardial stay sutures",c:C.blue},
    {n:"2",t:"Heparin & cannulation",d:"300–400 IU/kg heparin; ACT >400 s; aortic + venous cannulae; LV vent placed",c:C.blue},
    {n:"3",t:"CPB established",d:"Mild hypothermia 28–32°C; commence cardioplegia circuit; de-air lines",c:C.teal},
    {n:"4",t:"Aortic cross-clamp",d:"Applied across ascending aorta distal to cannulation site",c:C.teal},
    {n:"5",t:"Cardioplegia delivery",d:"Antegrade via aortic root (confirm with AV closure); retrograde via coronary sinus; repeat every 20 min",c:C.teal},
    {n:"6",t:"Aortotomy",d:"Transverse/oblique aortotomy 1.5–2 cm above right coronary ostium; extend into non-coronary sinus",c:C.gold},
    {n:"7",t:"Valve excision",d:"Leaflets excised at bases; meticulously DEBRIDE all calcium; CRITICAL — avoid injury to LCA/RCA ostia",c:C.gold},
    {n:"8",t:"Annular sizing",d:"Sequential sizers; choose largest valve that fits without tension; critical for PPM prevention",c:C.gold},
    {n:"9",t:"Prosthesis implantation",d:"Interrupted pledgeted sutures (2-0 Ticron); everted or inerted technique; confirm proper seating",c:C.orange},
    {n:"10",t:"Aortotomy closure",d:"Two-layer continuous Prolene; felt strip reinforcement; check for haemostasis",c:C.orange},
    {n:"11",t:"De-airing",d:"Vigorous de-air: fill LV via pulmonary vein; suction aortic root; needle aspiration through aorta",c:C.crimson},
    {n:"12",t:"Cross-clamp release & wean",d:"Assess rhythm (VF → defibrillate); warm reperfusion; wean from CPB gradually; TEE assessment",c:C.crimson},
  ];

  steps.forEach((st,i)=>{
    const col=i<6?0:1, row=i%6;
    const x=0.2+col*4.93, y=0.93+row*0.76;
    card(s,x,y,4.73,0.65,C.mid,st.c);
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:0.42,h:0.65,fill:{color:st.c},line:{color:st.c}});
    s.addText(st.n,{x,y,w:0.42,h:0.65,fontSize:12,bold:true,color:C.navy,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(st.t,{x:x+0.5,y:y+0.03,w:4.1,h:0.28,fontSize:10.5,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(st.d,{x:x+0.5,y:y+0.32,w:4.1,h:0.3,fontSize:8.5,color:C.grayLt,fontFace:"Calibri",valign:"top",margin:0});
  });
  footer(s,"Operative mortality: 1–3% isolated AVR (elective) · 3–5% AVR+CABG · 5–10% redo sternotomy (STS database)");
}

// ════════════════════════════════════════════════════════════════
// SLIDE 26 — PROSTHETIC VALVE SELECTION
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Prosthetic Valve Selection","Sabiston · Schwartz · 2021 ACC/AHA Guidelines");

  // Mechanical vs tissue comparison
  const prosthRows=[
    ["Feature","Mechanical Valve","Bioprosthetic Valve"],
    ["Durability","30+ years — essentially indefinite","10–20 years; deterioration rate increases in younger patients"],
    ["Anticoagulation","LIFELONG warfarin (INR 2.0–3.0 for aortic position)","Aspirin 81 mg only (after 3–6 months); NO warfarin long-term"],
    ["Thromboembolism","~1–2% / year (with anticoagulation)","Lower; ~0.5–1% / year"],
    ["Structural failure","No structural deterioration","Calcification, leaflet tear, degeneration (SVD)"],
    ["Haemodynamics","Excellent (bileaflet)","Good (pericardial supra-annular best)"],
    ["Reoperation risk","Low (durable)","Higher with SVD (valve-in-valve TAVI option available)"],
    ["Examples","St Jude Regent, CarboMedics, Medtronic-Hall","Edwards Perimount Magna, Medtronic Mosaic, Sorin Mitroflow"],
    ["Best for","Age <60 y; patients already on anticoagulation; non-compliant with follow-up","Age >65 y; bleeding risk; cannot tolerate anticoagulation; preference"],
  ];
  const pTD=prosthRows.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{
      bold:ri===0||ci===0,fontSize:ri===0?9.5:10,
      color:ri===0?C.navy:(ci===0?C.grayLt:(ci===1?C.blue:C.off)),
      fill:{color:ri===0?C.panel:(ri%2===0?C.mid:C.panel2)},
      valign:"middle",
    }
  })));
  s.addTable(pTD,{x:0.2,y:0.93,w:9.63,h:3.6,colW:[1.9,3.87,3.86],border:{pt:0.5,color:C.panel}});

  // Age guidance
  card(s,0.2,4.62,9.63,0.72,C.mid,C.gold);
  pill(s,"2021 ACC/AHA PROSTHESIS CHOICE BY AGE",0.2,4.62,C.gold);
  const ageGuide=[
    {age:"< 50 years",rec:"Mechanical preferred (lifetime durability; young patients have higher SVD risk with tissue valves)",c:C.blue},
    {age:"50–65 years",rec:"Shared decision-making: discuss anticoagulation burden vs. reoperation risk",c:C.gold},
    {age:"> 65 years",rec:"Bioprosthetic preferred (slower SVD; avoid anticoagulation; valve-in-valve TAVI option for future failure)",c:C.crimson},
  ];
  ageGuide.forEach((a,i)=>{
    s.addText(a.age+":",{x:0.32+i*3.22,y:4.95,w:1.3,h:0.35,fontSize:10,bold:true,color:a.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(a.rec,{x:1.65+i*3.22,y:4.95,w:1.72,h:0.35,fontSize:8.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 27 — ROOT ENLARGEMENT & PPM
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"Root Enlargement Procedures & Patient-Prosthesis Mismatch","Schwartz 11e · Sabiston 21e");

  card(s,0.2,0.93,9.63,0.55,C.panel2,C.crimson);
  pill(s,"PATIENT-PROSTHESIS MISMATCH (PPM)",0.2,0.93,C.crimson);
  s.addText("Moderate PPM: Indexed EOA < 0.85 cm²/m²  |  Severe PPM: Indexed EOA < 0.65 cm²/m²  →  Results in residually elevated transvalvular gradients post-AVR → worse outcomes. PREVENT by upsizing prosthesis or root enlargement.",
    {x:0.32,y:1.1,w:9.3,h:0.35,fontSize:10,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});

  const procs=[
    {t:"NICKS PROCEDURE",d:["Incise the non-coronary sinus inferiorly through annulus into the anterior mitral leaflet","Repair with a pericardial or Dacron patch","Allows 1–2 prosthesis size increase","Simplest and most commonly used root enlargement","Risk: AV block if incision too deep into interventricular fibrous body"],c:C.teal},
    {t:"MANOUGIAN PROCEDURE",d:["Incision through non-coronary / left coronary commissure into anterior mitral leaflet","More extensive enlargement than Nicks — allows larger prosthesis","Requires repair of both the aortic and mitral annuli","Takes more operating time; used when Nicks insufficient"],c:C.gold},
    {t:"KONNO-RASTAN PROCEDURE",d:["Most extensive — incision through RCA commissure, through aortic root into RVOT and interventricular septum","Separate Dacron patches for LVOT/aortic annulus and RVOT","Allows VERY large prosthesis (used in children, redo cases)","Risks: VSD, complete heart block (AV node proximity), RV injury","High complexity; reserved for extreme small annulus cases"],c:C.crimson},
  ];

  procs.forEach((p,i)=>{
    card(s,0.2+i*3.22,1.6,3.1,3.72,C.mid,p.c);
    s.addShape(pres.shapes.RECTANGLE,{x:0.2+i*3.22,y:1.6,w:3.1,h:0.36,fill:{color:p.c},line:{color:p.c}});
    s.addText(p.t,{x:0.28+i*3.22,y:1.6,w:2.94,h:0.36,fontSize:9.5,bold:true,color:C.navy,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    p.d.forEach((item,j)=>{
      s.addText(`• ${item}`,{x:0.3+i*3.22,y:2.0+j*0.66,w:2.92,h:0.63,fontSize:9.5,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
    });
  });
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 28 — SECTION: TAVI
// ════════════════════════════════════════════════════════════════
{ sectionTitle(pres.addSlide(),"08","Transcatheter Aortic Valve Replacement","PARTNER Trials · Valve Types · Access Routes · Complications · Decision Guide",C.orange); }

// ════════════════════════════════════════════════════════════════
// SLIDE 29 — TAVI: VALVES, ACCESS, TRIALS
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"TAVI — Valve Types, Access Routes & Key Trials","Schwartz 11e · Braunwald's 10e · PARTNER / Evolut Trials");

  // Valve types
  card(s,0.2,0.93,4.7,2.3,C.mid,C.teal);
  pill(s,"TRANSCATHETER VALVE TYPES",0.2,0.93,C.teal);

  card(s,0.28,1.27,2.18,1.82,C.panel2,C.blue);
  s.addText("BALLOON-EXPANDABLE\nEdwards SAPIEN 3 / Ultra",{x:0.35,y:1.3,w:2.04,h:0.42,fontSize:9,bold:true,color:C.blue,fontFace:"Calibri",align:"center",margin:0});
  bullets(s,["Co-Cr stent + bovine pericardial leaflets","Rapid ventricular pacing during deployment (~180 bpm)","Precise annular position","PPM rate: 5–10%"],0.35,1.74,2.04,1.28,{fs:9});

  card(s,2.6,1.27,2.18,1.82,C.panel2,C.teal);
  s.addText("SELF-EXPANDING\nMedtronic CoreValve / Evolut R",{x:2.67,y:1.3,w:2.04,h:0.42,fontSize:9,bold:true,color:C.teal,fontFace:"Calibri",align:"center",margin:0});
  bullets(s,["Nitinol frame + porcine pericardial","No rapid pacing; repositionable (Evolut R/PRO)","Supra-annular → better hemodynamics","PPM: 15–25% (AV node compression)"],2.67,1.74,2.04,1.28,{fs:9});

  // Access routes
  card(s,0.2,3.33,4.7,2.03,C.mid,C.gold);
  pill(s,"ACCESS ROUTES",0.2,3.33,C.gold);
  const routes=[
    {r:"Transfemoral (TF)",pct:"~90%",n:"Gold standard · ≥5.5 mm femoral artery · Best outcomes · Percutaneous closure",c:C.teal},
    {r:"Transaortic (TAo)",pct:"~4%",n:"Upper J ministernotomy · Severe peripheral vascular disease",c:C.gold},
    {r:"Transapical (TA)",pct:"~3%",n:"Left anterolateral thoracotomy · LV apex antegrade delivery · Higher morbidity",c:C.orange},
    {r:"Transaxillary",pct:"~3%",n:"Subclavian/axillary artery · Good alternative when femoral unsuitable",c:C.blue},
  ];
  routes.forEach((r,i)=>{
    s.addText(r.r,{x:0.32,y:3.68+i*0.41,w:1.75,h:0.38,fontSize:9,bold:true,color:r.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(r.pct,{x:2.1,y:3.68+i*0.41,w:0.45,h:0.38,fontSize:9,color:r.c,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(r.n,{x:2.58,y:3.68+i*0.41,w:2.2,h:0.38,fontSize:8.5,color:C.grayLt,fontFace:"Calibri",valign:"middle",margin:0});
  });

  // Key Trials
  card(s,5.08,0.93,4.75,4.43,C.mid,C.crimson);
  pill(s,"LANDMARK CLINICAL TRIALS",5.08,0.93,C.crimson);
  const trials=[
    {t:"PARTNER B (2010)","pop":"Inoperable","find":"TAVI vs. medical Rx → 50% RRR all-cause mortality at 1 yr",c:C.teal},
    {t:"PARTNER A (2011)","pop":"High risk","find":"TAVI non-inferior to SAVR in mortality at 1 yr",c:C.teal},
    {t:"CoreValve HR (2014)","pop":"High risk","find":"Self-expanding TAVI superior to SAVR at 1 yr",c:C.teal},
    {t:"PARTNER 2 (2016)","pop":"Intermediate","find":"TAVI non-inferior; TF subgroup statistically superior",c:C.gold},
    {t:"SURTAVI (2017)","pop":"Intermediate","find":"Self-expanding TAVI non-inferior to SAVR",c:C.gold},
    {t:"PARTNER 3 (2019)","pop":"LOW RISK","find":"TAVI SUPERIOR to SAVR (composite: death/stroke/rehospitalisation) at 1 yr — landmark result",c:C.crimson},
    {t:"Evolut Low Risk (2019)","pop":"LOW RISK","find":"TAVI non-inferior to SAVR; SE valve excellent haemodynamics at 2 yrs",c:C.crimson},
  ];

  const trTD=[
    ["Trial","Population","Key Finding"].map(h=>({text:h,options:{bold:true,fontSize:8.5,color:C.navy,fill:{color:C.panel},valign:"middle"}})),
    ...trials.map(t=>[
      {text:t.t,options:{bold:true,fontSize:9,color:t.c,valign:"middle",fill:{color:C.mid}}},
      {text:t.pop,options:{fontSize:9,color:C.grayLt,valign:"middle",fill:{color:C.mid}}},
      {text:t.find,options:{fontSize:9,color:t.c===C.crimson?C.crimson:C.off,valign:"middle",fill:{color:C.mid}}},
    ])
  ];
  s.addTable(trTD,{x:5.2,y:1.27,w:4.5,h:3.96,colW:[1.45,0.9,2.15],border:{pt:0.5,color:C.panel}});
  footer(s);
}

// ════════════════════════════════════════════════════════════════
// SLIDE 30 — TAVI COMPLICATIONS, DECISION GUIDE & TAKE-HOME
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  hdr(s,"TAVI — Complications, Decision Guide & Summary","Schwartz · Braunwald's · 2021 ACC/AHA");

  // Complications table
  card(s,0.2,0.93,5.5,0.3,C.panel,C.crimson);
  s.addText("TAVI COMPLICATIONS",{x:0.3,y:0.93,w:5.3,h:0.3,fontSize:9,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",charSpacing:0.5,margin:0});
  const comps=[
    ["Complication","Rate","Management"],
    ["Stroke","2–5%","Cerebral embolic protection device (Sentinel); antiplatelet optimisation"],
    ["Paravalvular leak","5–15% (trace-mild); severe <3%","Post-dilatation; valve-in-valve if severe haemodynamically significant"],
    ["Permanent pacemaker (SE)","15–25%","PPM implant; LBBB alone may not require immediate pacing"],
    ["Permanent pacemaker (BE)","5–10%","As above"],
    ["Vascular access complications","5–10%","Surgical repair / covered endovascular stent"],
    ["Annular rupture","<1%","Emergency surgical conversion — often fatal; prevent by CT sizing"],
    ["Coronary occlusion","<1%","Emergency PCI / CABG; coronary protection wire mandatory in redo cases"],
  ];
  const cTD=comps.map((row,ri)=>row.map((cell,ci)=>({
    text:cell,
    options:{bold:ri===0,fontSize:ri===0?8.5:9,
      color:ri===0?C.navy:(ci===1?(parseFloat(cell)>=5||cell.includes("<1")?C.crimson:C.gold):C.off),
      fill:{color:ri===0?C.panel:(ri%2===0?C.mid:C.panel2)},valign:"middle"}
  })));
  s.addTable(cTD,{x:0.2,y:1.26,w:5.5,h:2.9,colW:[1.75,0.9,2.85],border:{pt:0.5,color:C.panel}});

  // Decision guide
  card(s,5.88,0.93,3.95,3.23,C.mid,C.gold);
  pill(s,"TAVI vs SAVR — DECISION GUIDE",5.88,0.93,C.gold);
  const dec=[
    {a:"< 50 years",r:"SAVR strongly preferred",c:C.blue},
    {a:"50–65 years",r:"SAVR preferred; shared decision (heart valve team)",c:C.teal},
    {a:"65–80 years",r:"Shared decision — either TAVI or SAVR acceptable",c:C.gold},
    {a:"> 80 years",r:"TAVI preferred",c:C.crimson},
    {a:"Prohibitive risk",r:"TAVI or palliative care",c:C.crimson},
    {a:"Redo bioprosthesis",r:"Valve-in-Valve TAVI — avoids redo sternotomy",c:C.teal},
    {a:"Bicuspid AS + young",r:"SAVR preferred (TAVI limited experience in bicuspid)",c:C.blue},
    {a:"Significant AR",r:"SAVR preferred (TAVI anchoring unreliable)",c:C.orange},
  ];
  dec.forEach((d,i)=>{
    s.addText(d.a+":",{x:6.0,y:1.27+i*0.35,w:1.55,h:0.32,fontSize:9,bold:true,color:d.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(d.r,{x:7.58,y:1.27+i*0.35,w:2.12,h:0.32,fontSize:9,color:C.off,fontFace:"Calibri",valign:"middle",margin:0});
  });

  // Bottom: Special procedures quick ref
  const specials=[
    {t:"ROSS PROCEDURE",d:"Native PV autograft → aortic position. Best for young patients / athletes. No anticoagulation. 10-yr survival 90%. Risk: autograft dilation, pulmonary homograft stenosis.",c:C.purple},
    {t:"BENTALL PROCEDURE",d:"Composite graft (valve + aortic tube). For AS + aortic aneurysm or bicuspid aortopathy (≥4.5–5.0 cm). Classic: mechanical + Dacron. Tissue variant: Bio-Bentall.",c:C.gold},
    {t:"DAVID PROCEDURE",d:"Valve-sparing root replacement. Native valve reimplanted in Dacron tube. Ideal when valve morphology normal. Preserves native leaflets — no anticoagulation needed.",c:C.teal},
  ];
  specials.forEach((sp,i)=>{
    card(s,0.2+i*3.27,4.25,3.1,1.1,C.mid,sp.c);
    s.addText(sp.t,{x:0.32+i*3.27,y:4.28,w:2.88,h:0.28,fontSize:8.5,bold:true,color:sp.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(sp.d,{x:0.32+i*3.27,y:4.58,w:2.88,h:0.74,fontSize:8.5,color:C.off,fontFace:"Calibri",valign:"top",margin:0});
  });

  footer(s,"Sources: Braunwald's Heart Disease 10e · Schwartz's Principles of Surgery 11e · Sabiston Textbook of Surgery 21e · Fuster & Hurst's The Heart 15e · Textbook of Clinical Echocardiography (Otto)");
}

// ════════════════════════════════════════════════════════════════
// SLIDE 31 — TAKE-HOME MESSAGES
// ════════════════════════════════════════════════════════════════
{
  let s = pres.addSlide(); bg(s);
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:W,h:1.05,fill:{color:C.mid},line:{color:C.mid}});
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:0.18,h:1.05,fill:{color:C.crimson},line:{color:C.crimson}});
  s.addText("TAKE-HOME MESSAGES",{x:0.3,y:0,w:9.5,h:0.68,fontSize:30,bold:true,color:C.white,fontFace:"Calibri",valign:"middle",charSpacing:2});
  s.addText("Aortic Stenosis — MCh Cardiology Teaching Rounds",{x:0.3,y:0.68,w:9.5,h:0.37,fontSize:12,color:C.grayLt,fontFace:"Calibri",italic:true});

  const msgs=[
    {n:"1",t:"RHD = Molecular Mimicry",d:"Streptococcal M-protein mimics cardiac laminin → cross-reactive immune attack → Aschoff bodies → commissural fusion (pathognomonic of rheumatic AS, distinguishes it from calcific)",c:C.crimson},
    {n:"2",t:"Calcific AS is most common",d:"Bicuspid AV accounts for 2/3 of AS in adults <70 yr. Always screen for associated aortopathy (50% risk). Bicuspid AS presents ~10–15 years earlier than degenerative AS.",c:C.gold},
    {n:"3",t:"Symptom onset = critical point",d:"'5-3-2 rule': Angina → 5 yr, Syncope → 3 yr, Heart Failure → <2 yr survival without intervention. Annual sudden death risk in asymptomatic severe AS is <1%.",c:C.teal},
    {n:"4",t:"Echo is definitive",d:"AVA <1.0 cm², mean gradient >40 mmHg, Vmax >4 m/s = severe. Continuity equation (conservation of mass) is most accurate for AVA. Beware low-flow, low-gradient AS.",c:C.blue},
    {n:"5",t:"No drug modifies natural history",d:"Statins (SEAS/ASTRONOMER trials) showed NO benefit. Balloon valvuloplasty is palliative only in calcific AS (restenosis at 6–12 months). Surgery is the ONLY proven treatment.",c:C.purple},
    {n:"6",t:"TAVI has transformed management",d:"PARTNER 3 (2019): TAVI superior to SAVR in low-risk patients at 1 year. Age <65 → SAVR preferred; 65–80 → shared decision; >80 → TAVI preferred. Heart valve team is mandatory.",c:C.orange},
    {n:"7",t:"Surgical nuances matter",d:"Prevent PPM with root enlargement (Nicks/Manougian/Konno). Ross procedure is ideal for young patients (no anticoagulation, growth potential). Valve-in-Valve TAVI for failed bioprostheses.",c:C.green},
  ];

  msgs.forEach((m,i)=>{
    const col=i<4?0:1, row=i%4;
    const x=col===0?0.2:5.08, y=1.12+row*1.1;
    const w=col===0?4.72:4.75;
    card(s,x,y,w,0.97,C.mid,m.c);
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:0.5,h:0.97,fill:{color:m.c},line:{color:m.c}});
    s.addText(m.n,{x,y,w:0.5,h:0.97,fontSize:18,bold:true,color:C.navy,fontFace:"Calibri",align:"center",valign:"middle",margin:0});
    s.addText(m.t,{x:x+0.58,y:y+0.06,w:w-0.68,h:0.3,fontSize:10.5,bold:true,color:m.c,fontFace:"Calibri",valign:"middle",margin:0});
    s.addText(m.d,{x:x+0.58,y:y+0.37,w:w-0.68,h:0.57,fontSize:9,color:C.off,fontFace:"Calibri",valign:"top",margin:0});
  });

  footer(s,"Sources: Braunwald's Heart Disease 10e · Schwartz's Principles of Surgery 11e · Sabiston Textbook of Surgery 21e · Fuster & Hurst's The Heart 15e · Otto: Textbook of Clinical Echocardiography");
}

// ── WRITE ─────────────────────────────────────────────────────────
pres.writeFile({fileName:"/home/daytona/workspace/aortic-stenosis-ppt/AS_MCh_Teaching_30slides.pptx"})
  .then(()=>console.log("✅ Done!"))
  .catch(err=>{console.error(err);process.exit(1);});
Running Command

cd /home/daytona/workspace/aortic-stenosis-ppt && node build30.js 2>&1

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.