Definition, etiopathogenesis, clinical manifestations, nonpharmacological and pharmacological management of the diseases associated with hypertension

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File

Hypertension: A Comprehensive Review


1. Definition

Hypertension is defined as a sustained elevation of arterial blood pressure above a threshold that confers increased cardiovascular risk. Sir George Pickering first established that blood pressure in a population is distributed continuously as a bell-shaped curve with no natural separation between normotension and hypertension - the dividing line is therefore operational, not absolute. The diagnosis is based on the average of two or more readings on two or more occasions, in adults not currently taking antihypertensives and not acutely ill. - Park's Textbook of Preventive and Social Medicine
Starting at 115/75 mm Hg, cardiovascular disease risk doubles with each increment of 20/10 mm Hg throughout the blood pressure range. Even mild hypertension (130/80 mm Hg) increases the risk of eventual end-organ damage. - Katzung's Basic and Clinical Pharmacology, 16th Edition

Classification (ESH/WHO)

CategorySystolic (mm Hg)Diastolic (mm Hg)
Optimal< 120and< 80
Normal120-129and/or80-84
High Normal130-139and/or85-89
Grade 1 Hypertension140-159and/or90-99
Grade 2 Hypertension160-179and/or100-109
Grade 3 Hypertension≥ 180and/or> 110
Isolated Systolic HTN≥ 140and< 90
When systolic and diastolic values fall in different categories, the higher category is used. - Park's Textbook
ACC/AHA 2017 Classification (used in USA):
  • Stage I: 130-139/80-89 mm Hg
  • Stage II: ≥ 140/≥ 90 mm Hg

2. Types

  • Primary (Essential) Hypertension: No identifiable single cause; ~90% of all cases. Results from multifactorial interactions.
  • Secondary Hypertension: ~10% of cases; a specific underlying cause is identified - e.g., chronic glomerulonephritis, chronic pyelonephritis, renal artery stenosis, adrenal tumors (pheochromocytoma, Conn syndrome), coarctation of the aorta, Cushing disease, toxemia of pregnancy. - Park's Textbook; Katzung's Pharmacology

3. Etiopathogenesis

A. Essential Hypertension - Pathophysiology

Elevated blood pressure is typically caused by a combination of multifactorial abnormalities, not a single lesion. Meticulous investigation of the autonomic nervous system, baroreceptors, renin-angiotensin-aldosterone system (RAAS), and the kidney has failed to identify one single cause. - Katzung's Basic and Clinical Pharmacology
The final common pathway in most cases is an overall increase in peripheral vascular resistance, while cardiac output is usually normal. In hypertensive individuals, both the baroreceptors and the renal blood volume-pressure control systems appear to be "set" at a higher level of blood pressure.
Key pathophysiologic mechanisms:
1. Renin-Angiotensin-Aldosterone System (RAAS)
  • Decreased renal perfusion pressure stimulates renin secretion from juxtaglomerular cells (also triggered by sympathetic beta-receptor activation).
  • Renin cleaves angiotensinogen → angiotensin I → angiotensin II (by ACE).
  • Angiotensin II: (a) directly constricts resistance vessels (vasoconstriction) and (b) stimulates aldosterone synthesis → sodium and water retention → increased blood volume and cardiac output. - Katzung's Pharmacology
2. Sympathetic Nervous System (SNS)
  • Increased sympathetic tone raises peripheral vascular resistance via arteriolar constriction.
  • Baroreceptors in hypertension appear "reset" at a higher set-point, blunting the normal buffering reflex.
  • Central vasomotor neurons (medulla) are tonically active; carotid baroreceptor activation normally inhibits this discharge. This feedback is impaired in hypertension.
3. Renal Sodium Handling
  • Impaired renal sodium excretion leads to volume expansion.
  • Increased salt loading raises BP, especially in "salt-sensitive" individuals.
  • Natriuretic peptides (ANP, BNP) counterbalance sodium retention but are overridden in sustained hypertension.
4. Endothelial Dysfunction
  • Reduced nitric oxide (NO) bioavailability impairs endothelium-dependent vasorelaxation.
  • Increased endothelin-1 contributes to vasoconstriction.
  • Elevated reactive oxygen species (ROS) accelerate NO degradation. - Brenner and Rector's The Kidney
5. Insulin Resistance / Metabolic Factors
  • Hyperinsulinemia stimulates SNS activity and promotes renal sodium retention.
  • Visceral adiposity releases pro-inflammatory cytokines (IL-6, TNF-α) promoting endothelial dysfunction.
B. Contributing Risk Factors (Epidemiological)
  • Genetic factors: Heritability of essential hypertension estimated at ~30%
  • Dietary salt: High sodium intake; low potassium and calcium intake
  • Obesity: BMI >30; visceral adipocytes drive a pro-inflammatory state
  • Alcohol consumption
  • Physical inactivity
  • Psychological stress
  • Aging: BP rises progressively; prevalence >60% in those aged >60 years
  • Race: Higher prevalence and severity in Black Americans; higher rates in Sikh and Jain populations in India - Park's Textbook; Katzung's Pharmacology

4. Diseases Associated with Hypertension

Hypertension is an "iceberg" disease - it is usually asymptomatic until overt target-organ damage has occurred or is imminent. Sustained hypertension damages blood vessels in the kidney, heart, and brain, leading to:

A. Cardiovascular Diseases

1. Coronary Artery Disease (CAD) / Ischemic Heart Disease (IHD)
  • HTN is a major independent risk factor for atherosclerosis.
  • Accelerates endothelial injury, lipid deposition, and plaque formation.
  • Systolic BP ≥140 mm Hg accounts for ~4.9 million deaths from IHD annually. - Park's Textbook
Clinical features: Chest pain/angina, dyspnea, myocardial infarction, sudden cardiac death.
2. Heart Failure
  • Left ventricular hypertrophy (LVH) develops as the heart works against chronic pressure overload.
  • LVH → diastolic dysfunction → systolic dysfunction → congestive heart failure.
  • Hypertension is the single most common cause of heart failure in Western populations.
Clinical features: Exertional dyspnea, orthopnea, paroxysmal nocturnal dyspnea, leg edema, pulmonary congestion.
3. Aortic Dissection
  • Chronic HTN is the most important predisposing factor.
  • Shearing forces from high pulse pressure cause intimal tears.
Clinical features: Sudden severe tearing chest/back pain radiating to the abdomen, pulse differentials.

B. Cerebrovascular Diseases

4. Hemorrhagic Stroke
  • Hypertension is the principal cause of intracerebral hemorrhage (ICH).
  • ~2 million deaths/year from hemorrhagic stroke attributable to systolic BP ≥140 mm Hg. - Park's Textbook
Clinical features: Sudden onset of severe headache ("worst headache of life"), focal neurological deficits, altered consciousness, vomiting.
5. Ischemic Stroke
  • HTN promotes atherosclerosis of large and small cerebral arteries.
  • ~1.5 million ischemic stroke deaths/year related to elevated systolic BP.
Clinical features: Hemiplegia/hemiparesis, speech disturbance, visual field deficits.
6. Hypertensive Encephalopathy
  • Occurs when BP exceeds the limits of cerebral autoregulation.
  • Characterized by severe BP elevation, obtundation, visual disturbances, altered sensorium, seizures, and marked hypertensive retinopathy (with or without papilledema) - but absence of focal neurological signs (unlike stroke). - Goldman-Cecil Medicine
  • A subset has posterior reversible encephalopathy syndrome (PRES): symmetrical vasogenic edema in the posterior occipital regions, best seen on MRI.

C. Renal Diseases

7. Chronic Kidney Disease (CKD) / Hypertensive Nephrosclerosis
  • Hypertension causes afferent arteriolar thickening and glomerulosclerosis.
  • Progressive proteinuria, rising creatinine, eventually end-stage renal disease (ESRD).
  • Conversely, renal disease (e.g., glomerulonephritis, PKD) worsens hypertension through RAAS activation - a vicious cycle.
Clinical features: Proteinuria, hematuria, edema, eventual uremic symptoms (nausea, fatigue, pruritus).

D. Ocular Disease

8. Hypertensive Retinopathy
  • Graded I-IV (Keith-Wagener-Barker classification):
    • Grade I: Mild arteriolar narrowing
    • Grade II: Arteriovenous nicking (copper/silver wiring)
    • Grade III: Flame hemorrhages, cotton wool spots, exudates
    • Grade IV: Papilledema (indicates hypertensive emergency)
Clinical features: Usually asymptomatic; severe cases - visual blurring, visual loss.

E. Hypertensive Emergency / Urgency

  • Urgency: BP ≥180/110 mm Hg without new/worsening target-organ injury. Patients often asymptomatic or mildly symptomatic. - Goldman-Cecil Medicine
  • Emergency: BP ≥180/110 mm Hg with new end-organ damage (encephalopathy, acute MI, acute pulmonary edema, aortic dissection, eclampsia, acute kidney injury). - Goldman-Cecil Medicine

5. Clinical Manifestations

Uncomplicated Hypertension

  • Usually asymptomatic - this is the "silent killer" phenomenon.
  • Nonspecific symptoms when present: morning occipital headache (classically), epistaxis, dizziness, tinnitus, palpitations.
  • Examination may reveal: thickened/tortuous radial artery, loud A2, LV heave.

With Target-Organ Damage

SystemManifestation
HeartAngina, dyspnea, S3/S4 gallop, features of heart failure
BrainHeadache, confusion, focal neurological deficits, seizures
KidneyProteinuria, hematuria, nocturia, edema
EyesRetinal changes, papilledema, visual disturbances
VesselsDiminished peripheral pulses (PAD), bruits

6. Management

A. Non-Pharmacological (Lifestyle) Interventions

These are the first-line interventions for all stages and are maintained alongside drug therapy. They can reduce BP by 5-20 mm Hg each, and together can often normalize mild hypertension without drugs.
InterventionRecommendationExpected BP Reduction
Weight reductionTarget BMI 18.5-24.9 kg/m²5-20 mm Hg per 10 kg weight loss
DASH dietRich in fruits, vegetables, low-fat dairy; reduce saturated fat8-14 mm Hg
Sodium restriction< 2.4 g Na/day (< 6 g NaCl/day)2-8 mm Hg
Physical activity30 min moderate aerobic exercise most days4-9 mm Hg
Alcohol moderation≤ 2 drinks/day men; ≤ 1 drink/day women2-4 mm Hg
Smoking cessationComplete cessation (lowers CVD risk, not BP directly)-
Stress reductionRelaxation, meditation, yogaVariable
Potassium intakeIncrease dietary potassiumModest reduction
Effective primordial prevention of hypertension requires widespread adoption of a prudent diet, weight control, reduction of sodium and alcohol, and increased physical activity - these are societal-level interventions. - Goldman-Cecil Medicine

B. Pharmacological Management

When to Start Drugs:

  • Stage I HTN (130-139/80-89): Initiate if 10-year CVD risk ≥10% (ACC/AHA), or if Grade 1 HTN with evidence of organ damage, diabetes, or high risk.
  • Stage II / Grade 2 HTN (≥140/≥90): Start drug therapy promptly.
  • Blood pressure target: < 130/80 mm Hg for most; < 120 mm Hg systolic for high cardiovascular-risk patients (SPRINT trial data). - Goldman-Cecil Medicine; Katzung's Pharmacology

First-Line Drug Classes

1. Thiazide / Thiazide-like Diuretics
  • Agents: Chlorthalidone (preferred), hydrochlorothiazide, indapamide
  • Mechanism: Inhibit NaCl reabsorption in the distal convoluted tubule → volume depletion and reduced cardiac output; long-term effect is reduction of peripheral vascular resistance.
  • Key indication: First-line in most patients; preferred in elderly, isolated systolic HTN, Black patients, and heart failure.
  • Side effects: Hypokalemia, hyponatremia, hyperuricemia, glucose intolerance, dyslipidemia.
  • Doses: Chlorthalidone 12.5-25 mg/day; HCTZ 25-50 mg/day. - Goldman-Cecil Medicine
2. Calcium Channel Blockers (CCBs)
  • Agents: Amlodipine (DHP, preferred); nifedipine; verapamil/diltiazem (non-DHP)
  • Mechanism: Inhibit voltage-gated calcium channels in vascular smooth muscle → arteriolar dilation → reduced peripheral vascular resistance.
  • Key indication: First-line in all patients; most effective class for primary stroke prevention; equally effective in all ethnic groups including Black patients; useful in patients with angina.
  • Special note: Antihypertensive effects are independent of dietary sodium intake and NSAIDs. - Goldman-Cecil Medicine
  • Side effects (DHP): Dose-dependent ankle edema (worse later in day), flushing, reflex tachycardia. Verapamil: constipation, AV node depression. Non-DHPs should be avoided with beta-blockers (additive bradycardia/heart block).
  • Caution: Short-acting nifedipine should NOT be used chronically - causes precipitous vasodilation with reflex sympathetic activation.
3. ACE Inhibitors (ACE-I)
  • Agents: Ramipril, enalapril, lisinopril, perindopril, captopril, benazepril
  • Mechanism: Inhibit ACE → reduced angiotensin II (vasoconstriction) + reduced bradykinin degradation (vasodilation via NO/prostacyclin). Reduce peripheral vascular resistance without reflex tachycardia. - Katzung's Pharmacology
  • Key indications: First-line in diabetes with CKD/proteinuria (reduce intraglomerular pressure and slow CKD progression), heart failure (with reduced ejection fraction), post-MI, left ventricular dysfunction.
  • Side effects: Dry cough (bradykinin-mediated; occurs in 10-15%), angioedema (rare but serious), hyperkalemia, acute kidney injury in bilateral renal artery stenosis. Contraindicated in pregnancy.
  • Do NOT combine two RAAS inhibitors (ACE-I + ARB, or ACE-I + aliskiren) - increased risk of renal impairment and hyperkalemia. - Goldman-Cecil Medicine
4. Angiotensin Receptor Blockers (ARBs)
  • Agents: Losartan, valsartan, candesartan, irbesartan, olmesartan, telmisartan
  • Mechanism: Block AT1 receptors → reduced angiotensin II-mediated vasoconstriction and aldosterone release. Allow angiotensin II to bind preferentially to AT2 receptors. - Goldman-Cecil Medicine
  • Key indications: Same as ACE inhibitors; preferred when ACE-I causes cough. Used in heart failure (with or without reduced EF), diabetic nephropathy, post-MI.
  • Side effects: Hyperkalemia, acute kidney injury; no cough (bradykinin not affected). Contraindicated in pregnancy.

Second-Line / Adjunctive Drug Classes

5. Beta-Blockers
  • Agents: Metoprolol, atenolol, bisoprolol (beta-1 selective); carvedilol, labetalol (alpha+beta)
  • Mechanism: Block beta-1 adrenoceptors → reduced heart rate and cardiac output; also inhibit renin secretion.
  • Key indications: Preferred in post-MI, heart failure with reduced EF (carvedilol, bisoprolol), angina, tachyarrhythmias. Labetalol/hydralazine: preferred in pregnancy.
  • NOT recommended as first-line for uncomplicated hypertension - less effective at reducing stroke than CCBs. - Katzung's Pharmacology; Goldman-Cecil Medicine
  • Side effects: Fatigue, bradycardia, AV block, cold extremities, worsening of asthma/COPD (non-selective agents), impotence, masking of hypoglycemia in diabetes.
  • Beta-1-selective agents (atenolol, bisoprolol, metoprolol) are preferred in asthma, COPD, diabetes, peripheral vascular disease.
6. Alpha-1 Blockers
  • Agents: Prazosin, terazosin, doxazosin
  • Mechanism: Block alpha-1 receptors in arterioles and venules → arteriolar and venous dilation.
  • Key indications: Hypertension + benign prostatic hyperplasia (BPH) in men (dual benefit).
  • Side effects: First-dose phenomenon (orthostatic hypotension after initial dose - give at bedtime, start low), dizziness, palpitations. Salt and water retention if used without a diuretic.
7. Central Sympatholytics
  • Agents: Clonidine (alpha-2 agonist), methyldopa, moxonidine
  • Mechanism: Reduce central sympathetic outflow → decrease peripheral vascular resistance and heart rate.
  • Methyldopa: Drug of choice in hypertension in pregnancy.
  • Clonidine: Rebound hypertension on abrupt withdrawal - must be tapered.
8. Mineralocorticoid Receptor Antagonists (MRAs)
  • Agents: Spironolactone, eplerenone
  • Mechanism: Block aldosterone receptors in collecting duct → natriuresis, reduced BP.
  • Key indications: Resistant hypertension (4th-line add-on agent), primary aldosteronism, heart failure.
  • Side effects: Hyperkalemia, gynecomastia (spironolactone), menstrual irregularity.
9. Direct Vasodilators
  • Agents: Hydralazine, minoxidil
  • Mechanism: Direct relaxation of arteriolar smooth muscle.
  • Hydralazine: Used in pregnancy (with methyldopa) and heart failure. Causes reflex tachycardia and fluid retention - always combine with beta-blocker and diuretic.
  • Minoxidil: For refractory hypertension; causes severe fluid retention (requires loop diuretic) and hypertrichosis.

Combination Therapy

Most patients with moderate-to-severe hypertension require two or more agents. Preferred combinations:
  • ACE-I or ARB + CCB (e.g., ramipril + amlodipine) - complementary mechanisms
  • ACE-I or ARB + thiazide diuretic - synergistic
  • ACE-I or ARB + CCB + thiazide diuretic (triple therapy for difficult-to-control HTN) - Katzung's Pharmacology
  • If a 4th drug is needed: add a beta-blocker or clonidine.
Fixed-dose triple combination (e.g., telmisartan 20 mg + amlodipine 2.5 mg + chlorthalidone 12.5 mg) demonstrates high efficacy in moderate hypertension with minimal side effects and improves adherence. - Katzung's Pharmacology

Special Situations - Drug Selection Guide

ConditionPreferred Drug(s)
Heart failure (HFrEF)ACE-I/ARB, beta-blocker (carvedilol/bisoprolol), diuretic, MRA
Post-MIACE-I/ARB, beta-blocker
Angina pectorisBeta-blocker, CCB
Diabetic nephropathy / CKD with proteinuriaACE-I or ARB (first choice)
Isolated systolic HTN (elderly)Thiazide diuretic, CCB
PregnancyMethyldopa, labetalol, hydralazine, nifedipine (AVOID ACE-I/ARB)
BPH in menAlpha-1 blocker (doxazosin)
Black patientsCCB, thiazide diuretic (respond less to ACE-I/beta-blockers alone)
Resistant HTNAdd spironolactone/eplerenone
Hypertensive emergency (IV)Nicardipine, clevidipine, labetalol, enalaprilat, sodium nitroprusside, fenoldopam

Hypertensive Emergency - IV Drugs

A hypertensive emergency (BP ≥180/110 mm Hg + new end-organ damage) requires parenteral treatment in a monitored critical care setting. The goal is to reduce BP by 10-15% in the first 1-2 hours, then another 10-15% over the next 12-24 hours (except in aortic dissection or pulmonary edema where more rapid reduction is needed). Avoid sudden normalization - risk of iatrogenic ischemia. - Goldman-Cecil Medicine
  • Sodium nitroprusside: Arterial and venous dilation; titratable; monitor cyanide toxicity.
  • Nicardipine, clevidipine: IV CCBs; excellent BP control outside ICU.
  • Labetalol (IV): Alpha + beta blockade; preferred in aortic dissection, post-operative HTN.
  • Esmolol: Short-acting IV beta-1 blocker; useful in peri-operative HTN with tachycardia.
  • Fenoldopam: Dopamine D1-receptor agonist; arteriolar dilation + natriuresis; useful in renal impairment. - Katzung's Pharmacology
  • Hydralazine (IV): Preferred in pre-eclampsia/eclampsia.

Summary of Non-Pharmacological vs Pharmacological Approach

ApproachKey Points
Non-pharmacologicalWeight loss, DASH diet, salt restriction, exercise, alcohol/smoking reduction. Mandatory for ALL patients regardless of drug therapy.
Pharmacological3 first-line classes: CCB + ACE-I/ARB + thiazide. Choose based on comorbidities. Combination therapy needed in most moderate-severe cases.

Sources consulted:
  • Park's Textbook of Preventive and Social Medicine - definition, classification, epidemiology, etiology
  • Katzung's Basic and Clinical Pharmacology, 16th Edition - pathophysiology, mechanisms, drug pharmacology
  • Goldman-Cecil Medicine, 2-Volume Set - clinical management, drug classes, emergencies
  • Brenner and Rector's The Kidney, 2-Volume Set - renal mechanisms and CKD-related HTN

Create a study guide PDF with structures and key points for exam prep

Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || echo "workspace empty or missing"

Running Command

mkdir -p /tmp/workspace/hypertension-study-guide && python3 -c "from reportlab.lib.pagesizes import A4; print('reportlab OK')"

Writing File

~/hypertension-study-guide/build_pdf.py

#!/usr/bin/env python3
"""
Hypertension Study Guide PDF - Exam Prep
Built with ReportLab
"""

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import HRFlowable
from reportlab.lib.colors import HexColor
import os

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY       = HexColor("#1a2b5e")
MED_BLUE   = HexColor("#2563eb")
LIGHT_BLUE = HexColor("#dbeafe")
TEAL       = HexColor("#0d9488")
TEAL_LIGHT = HexColor("#ccfbf1")
RED        = HexColor("#dc2626")
RED_LIGHT  = HexColor("#fee2e2")
ORANGE     = HexColor("#ea580c")
ORANGE_LIGHT = HexColor("#ffedd5")
GREY_DARK  = HexColor("#374151")
GREY_MID   = HexColor("#6b7280")
GREY_LIGHT = HexColor("#f3f4f6")
WHITE      = colors.white
GREEN      = HexColor("#16a34a")
GREEN_LIGHT= HexColor("#dcfce7")
PURPLE     = HexColor("#7c3aed")
PURPLE_LIGHT = HexColor("#ede9fe")
YELLOW_LIGHT = HexColor("#fef9c3")

# ── Output path ─────────────────────────────────────────────────────────────
OUT = "/tmp/workspace/hypertension-study-guide/Hypertension_Study_Guide.pdf"
doc = SimpleDocTemplate(
    OUT,
    pagesize=A4,
    leftMargin=18*mm, rightMargin=18*mm,
    topMargin=22*mm, bottomMargin=22*mm,
    title="Hypertension – Complete Study Guide",
    author="Orris Medical AI",
)

W, H = A4
CONTENT_W = W - 36*mm

# ── Styles ───────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def style(name, **kw):
    s = ParagraphStyle(name, **kw)
    return s

S_TITLE = style("DocTitle",
    fontSize=24, textColor=WHITE, alignment=TA_CENTER,
    fontName="Helvetica-Bold", leading=30, spaceAfter=6)

S_SUBTITLE = style("DocSubtitle",
    fontSize=12, textColor=LIGHT_BLUE, alignment=TA_CENTER,
    fontName="Helvetica", leading=16)

S_SECTION = style("SectionHead",
    fontSize=13, textColor=WHITE, fontName="Helvetica-Bold",
    leading=18, spaceBefore=4, spaceAfter=4,
    leftIndent=6, rightIndent=6)

S_SUBSEC = style("SubsectionHead",
    fontSize=10.5, textColor=NAVY, fontName="Helvetica-Bold",
    leading=14, spaceBefore=6, spaceAfter=3,
    borderPad=2)

S_BODY = style("Body",
    fontSize=9, textColor=GREY_DARK, fontName="Helvetica",
    leading=13, spaceAfter=2, alignment=TA_JUSTIFY)

S_BULLET = style("Bullet",
    fontSize=9, textColor=GREY_DARK, fontName="Helvetica",
    leading=13, spaceAfter=2,
    leftIndent=12, firstLineIndent=-10)

S_SUBBULLET = style("SubBullet",
    fontSize=8.5, textColor=GREY_DARK, fontName="Helvetica",
    leading=12, spaceAfter=1,
    leftIndent=24, firstLineIndent=-10)

S_TABLE_HDR = style("TblHdr",
    fontSize=8.5, textColor=WHITE, fontName="Helvetica-Bold",
    alignment=TA_CENTER, leading=11)

S_TABLE_CELL = style("TblCell",
    fontSize=8, textColor=GREY_DARK, fontName="Helvetica",
    leading=11, alignment=TA_LEFT)

S_TABLE_CELL_C = style("TblCellC",
    fontSize=8, textColor=GREY_DARK, fontName="Helvetica",
    leading=11, alignment=TA_CENTER)

S_HIGHLIGHT = style("Highlight",
    fontSize=9, textColor=NAVY, fontName="Helvetica-Bold",
    leading=13, spaceAfter=3, spaceBefore=3,
    backColor=YELLOW_LIGHT, borderPad=4,
    leftIndent=8, rightIndent=8)

S_MNEMONIC = style("Mnemonic",
    fontSize=9.5, textColor=PURPLE, fontName="Helvetica-Bold",
    leading=14, spaceAfter=4, spaceBefore=4,
    alignment=TA_CENTER)

S_ALERT = style("Alert",
    fontSize=9, textColor=RED, fontName="Helvetica-Bold",
    leading=13, spaceAfter=3, leftIndent=8)

S_TOC = style("TOC",
    fontSize=10, textColor=NAVY, fontName="Helvetica",
    leading=16, leftIndent=8)

S_TOC_ITEM = style("TOCItem",
    fontSize=9.5, textColor=GREY_DARK, fontName="Helvetica",
    leading=14, leftIndent=20)

# ── Helper builders ──────────────────────────────────────────────────────────

def section_header(title, color=NAVY):
    """Coloured full-width section banner."""
    tbl = Table([[Paragraph(title, S_SECTION)]], colWidths=[CONTENT_W])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [color]),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return tbl

def colored_box(content_items, bg_color, border_color=None, radius=4):
    """Wrap a list of flowables in a coloured rounded box using a 1-cell table."""
    inner = Table([[item] for item in content_items],
                  colWidths=[CONTENT_W - 16])
    inner.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg_color),
        ("TOPPADDING",    (0,0), (-1,-1), 0),
        ("BOTTOMPADDING", (0,0), (-1,-1), 0),
        ("LEFTPADDING",   (0,0), (-1,-1), 0),
        ("RIGHTPADDING",  (0,0), (-1,-1), 0),
    ]))
    outer = Table([[inner]], colWidths=[CONTENT_W])
    style_cmds = [
        ("BACKGROUND",    (0,0), (-1,-1), bg_color),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [radius]),
    ]
    if border_color:
        style_cmds += [
            ("BOX", (0,0), (-1,-1), 1, border_color),
        ]
    outer.setStyle(TableStyle(style_cmds))
    return outer

def two_col(left_items, right_items, ratio=(0.50, 0.50)):
    """Two-column layout."""
    lw = CONTENT_W * ratio[0] - 3
    rw = CONTENT_W * ratio[1] - 3
    left_tbl  = Table([[i] for i in left_items],  colWidths=[lw])
    right_tbl = Table([[i] for i in right_items], colWidths=[rw])
    for t in (left_tbl, right_tbl):
        t.setStyle(TableStyle([
            ("TOPPADDING",    (0,0), (-1,-1), 0),
            ("BOTTOMPADDING", (0,0), (-1,-1), 0),
            ("LEFTPADDING",   (0,0), (-1,-1), 0),
            ("RIGHTPADDING",  (0,0), (-1,-1), 0),
        ]))
    row = Table([[left_tbl, right_tbl]], colWidths=[lw+3, rw+3])
    row.setStyle(TableStyle([
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING",   (0,0), (-1,-1), 0),
        ("RIGHTPADDING",  (0,0), (-1,-1), 0),
        ("TOPPADDING",    (0,0), (-1,-1), 0),
        ("BOTTOMPADDING", (0,0), (-1,-1), 0),
    ]))
    return row

def make_table(headers, rows, col_widths, hdr_color=NAVY, alt=True):
    data = [[Paragraph(h, S_TABLE_HDR) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), S_TABLE_CELL) for c in row])
    tbl = Table(data, colWidths=col_widths)
    cmds = [
        ("BACKGROUND",    (0,0), (-1,0), hdr_color),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("RIGHTPADDING",  (0,0), (-1,-1), 5),
        ("GRID",          (0,0), (-1,-1), 0.4, HexColor("#d1d5db")),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY_LIGHT] if alt else [WHITE]),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]
    tbl.setStyle(TableStyle(cmds))
    return tbl

def bullet(text, sub=False):
    s = S_SUBBULLET if sub else S_BULLET
    prefix = "   –  " if sub else "  •  "
    return Paragraph(f"{prefix}{text}", s)

def subbullet(text):
    return bullet(text, sub=True)

def sp(n=4):
    return Spacer(1, n)

def hr(color=HexColor("#e5e7eb"), thickness=0.5):
    return HRFlowable(width="100%", thickness=thickness, color=color, spaceAfter=4, spaceBefore=4)

def body(text):
    return Paragraph(text, S_BODY)

def sub(text):
    return Paragraph(text, S_SUBSEC)

def alert(text):
    return Paragraph(f"⚠  {text}", S_ALERT)

def key_point(text):
    return Paragraph(f"★  {text}", S_HIGHLIGHT)

# ── Cover page ───────────────────────────────────────────────────────────────
def cover_page():
    items = []

    # Title banner
    banner_data = [
        [Paragraph("HYPERTENSION", S_TITLE)],
        [Paragraph("Complete Study Guide for Exam Preparation", S_SUBTITLE)],
        [Spacer(1, 6)],
        [Paragraph("Definition  •  Etiopathogenesis  •  Clinical Features  •  Management", S_SUBTITLE)],
    ]
    banner = Table(banner_data, colWidths=[CONTENT_W])
    banner.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), NAVY),
        ("TOPPADDING",    (0,0), (-1,-1), 10),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("RIGHTPADDING",  (0,0), (-1,-1), 12),
        ("ROUNDEDCORNERS", [6]),
    ]))
    items.append(banner)
    items.append(sp(10))

    # TOC box
    toc_title = Paragraph("<b>TABLE OF CONTENTS</b>", style("tc",
        fontSize=11, textColor=NAVY, fontName="Helvetica-Bold",
        alignment=TA_CENTER, leading=16))
    toc_items = [
        ("1.", "Definition & Classification of Blood Pressure"),
        ("2.", "Etiology – Primary vs Secondary Hypertension"),
        ("3.", "Etiopathogenesis – Mechanisms & Risk Factors"),
        ("4.", "Diseases Associated with Hypertension"),
        ("5.", "Clinical Manifestations (Symptoms & Signs)"),
        ("6.", "Target-Organ Damage & Complications"),
        ("7.", "Non-Pharmacological Management"),
        ("8.", "Pharmacological Management – Drug Classes"),
        ("9.", "Drug Selection Guide & Special Situations"),
        ("10.", "Hypertensive Emergency vs Urgency"),
        ("11.", "High-Yield Exam Mnemonics & Quick Recalls"),
    ]
    toc_rows = [[Paragraph(f"<b>{n}</b>", S_TABLE_CELL_C),
                 Paragraph(t, S_TABLE_CELL)] for n, t in toc_items]
    toc_tbl = Table([[toc_title]] + toc_rows,
                    colWidths=[18*mm, CONTENT_W - 34*mm])
    toc_tbl.setStyle(TableStyle([
        ("SPAN",          (0,0), (-1,0)),
        ("BACKGROUND",    (0,0), (-1,0), LIGHT_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("RIGHTPADDING",  (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY_LIGHT]),
        ("GRID",          (0,0), (-1,-1), 0.3, HexColor("#d1d5db")),
        ("BOX",           (0,0), (-1,-1), 1,   NAVY),
        ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ]))
    items.append(toc_tbl)
    items.append(sp(10))

    # Key stats box
    stats = [
        Paragraph("<b>KEY EPIDEMIOLOGY FACTS</b>", style("sf",
            fontSize=9.5, textColor=TEAL, fontName="Helvetica-Bold",
            alignment=TA_CENTER, leading=14)),
        sp(4),
    ]
    stat_rows = [
        ["Global prevalence:", "~1.13 billion people affected (2015)"],
        ["Adult prevalence:", "30–40% worldwide; >60% in those aged >60 yrs"],
        ["Primary (Essential):", "~90% of all hypertension cases"],
        ["Secondary:", "~10% – identifiable treatable cause"],
        ["'Rule of halves':", "½ aware → ½ treated → ½ adequately controlled"],
        ["CVD risk:", "Doubles with every 20/10 mmHg rise above 115/75"],
    ]
    st = Table(stat_rows, colWidths=[52*mm, CONTENT_W - 68*mm])
    st.setStyle(TableStyle([
        ("FONTNAME",      (0,0), (0,-1), "Helvetica-Bold"),
        ("FONTSIZE",      (0,0), (-1,-1), 8.5),
        ("TEXTCOLOR",     (0,0), (0,-1), TEAL),
        ("TEXTCOLOR",     (1,0), (1,-1), GREY_DARK),
        ("TOPPADDING",    (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("ROWBACKGROUNDS",(0,0), (-1,-1), [TEAL_LIGHT, WHITE]),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("GRID",          (0,0), (-1,-1), 0.3, HexColor("#99f6e4")),
    ]))
    stats.append(st)
    items.append(colored_box(stats, TEAL_LIGHT, TEAL))
    items.append(sp(8))

    # Disclaimer
    items.append(Paragraph(
        "<i>Based on: Park's Preventive Medicine | Katzung's Pharmacology 16e | Goldman-Cecil Medicine | Brenner & Rector's Kidney</i>",
        style("disc", fontSize=7.5, textColor=GREY_MID, alignment=TA_CENTER, leading=10)))

    return items

# ── Section 1: Definition & Classification ──────────────────────────────────
def section_definition():
    items = []
    items.append(section_header("1.  DEFINITION & CLASSIFICATION OF BLOOD PRESSURE", NAVY))
    items.append(sp(6))

    items.append(body(
        "<b>Hypertension</b> is defined as a sustained elevation of arterial blood pressure above a threshold "
        "that increases cardiovascular risk. The dividing line between normal and elevated BP is "
        "<b>operational</b>, not absolute – BP in a population follows a continuous bell-shaped curve "
        "(Pickering). Diagnosis requires the <b>average of ≥2 readings on ≥2 separate occasions</b>."))
    items.append(sp(4))

    items.append(sub("ESH / WHO Classification"))
    cls_data = [
        ["Category", "Systolic (mmHg)", "", "Diastolic (mmHg)"],
        ["Optimal",        "< 120",     "and",  "< 80"],
        ["Normal",         "120–129",   "and/or","80–84"],
        ["High Normal",    "130–139",   "and/or","85–89"],
        ["Grade 1 HTN ★",  "140–159",   "and/or","90–99"],
        ["Grade 2 HTN ★",  "160–179",   "and/or","100–109"],
        ["Grade 3 HTN ★",  "≥ 180",     "and/or","> 110"],
        ["Isolated Systolic HTN", "≥ 140", "and","< 90"],
    ]
    widths = [52*mm, 38*mm, 16*mm, 38*mm]
    data_rows = []
    hdr = [Paragraph(f"<b>{h}</b>", S_TABLE_HDR) for h in cls_data[0]]
    data_rows.append(hdr)
    for row in cls_data[1:]:
        is_htn = "★" in row[0]
        fg = RED if is_htn else GREY_DARK
        s = ParagraphStyle("tc2", parent=S_TABLE_CELL, textColor=fg,
                           fontName="Helvetica-Bold" if is_htn else "Helvetica")
        data_rows.append([Paragraph(str(c), s) for c in row])
    tbl = Table(data_rows, colWidths=widths)
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("GRID",          (0,0), (-1,-1), 0.4, HexColor("#d1d5db")),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY_LIGHT]),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("ALIGN",         (1,0), (3,-1), "CENTER"),
        ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ]))
    items.append(tbl)
    items.append(sp(4))

    items.append(sub("ACC/AHA 2017 (US Guidelines)"))
    acc_rows = [
        ["Elevated", "120–129 / < 80"],
        ["Stage I HTN", "130–139 / 80–89"],
        ["Stage II HTN", "≥ 140 / ≥ 90"],
    ]
    items.append(make_table(["Category","BP (mmHg)"], acc_rows,
                             [60*mm, CONTENT_W-66*mm], hdr_color=MED_BLUE))
    items.append(sp(4))

    items.append(key_point(
        "RULE: When systolic & diastolic fall in different categories → use the HIGHER category."))

    return items

# ── Section 2: Etiology ──────────────────────────────────────────────────────
def section_etiology():
    items = []
    items.append(section_header("2.  ETIOLOGY – PRIMARY vs SECONDARY HYPERTENSION", MED_BLUE))
    items.append(sp(6))

    left = [
        colored_box([
            Paragraph("<b>PRIMARY (ESSENTIAL) HTN</b>", style("ph",
                fontSize=9.5, textColor=MED_BLUE, fontName="Helvetica-Bold", leading=13)),
            sp(3),
            bullet("<b>~90%</b> of all cases"),
            bullet("No single identifiable cause"),
            bullet("Multifactorial – genetic + environmental"),
            bullet("Diagnosis of exclusion"),
            sp(3),
            Paragraph("<b>Risk factors:</b>", style("rf", fontSize=9, textColor=GREY_DARK,
                fontName="Helvetica-Bold", leading=12)),
            bullet("Age, family history, male sex"),
            bullet("Obesity (BMI > 30)"),
            bullet("High sodium / low potassium diet"),
            bullet("Alcohol excess"),
            bullet("Sedentary lifestyle"),
            bullet("Psychological stress"),
            bullet("Race (Black > White)"),
        ], LIGHT_BLUE, MED_BLUE),
    ]

    right_items_top = [
        colored_box([
            Paragraph("<b>SECONDARY HTN (~10%)</b>", style("sh",
                fontSize=9.5, textColor=RED, fontName="Helvetica-Bold", leading=13)),
            sp(3),
        ] + [bullet(t) for t in [
            "<b>Renal:</b> Chronic GN, pyelonephritis, PKD, RAS",
            "<b>Endocrine:</b> Pheochromocytoma, Conn syndrome (primary aldosteronism), Cushing syndrome, hypothyroidism",
            "<b>Cardiovascular:</b> Coarctation of the aorta",
            "<b>Drugs:</b> OCP, NSAIDs, steroids, stimulants",
            "<b>Pregnancy:</b> Pre-eclampsia / eclampsia",
        ]], RED_LIGHT, RED),
    ]
    right_items_top.append(sp(4))
    right_items_top.append(colored_box([
        Paragraph("<b>CLUES TO SECONDARY HTN</b>", style("cs",
            fontSize=8.5, textColor=ORANGE, fontName="Helvetica-Bold", leading=12)),
        sp(2),
        bullet("Age < 30 or sudden-onset HTN"),
        bullet("Resistant to ≥3 drugs"),
        bullet("Hypokalemia → primary aldosteronism"),
        bullet("Episodic HTN + sweating/palpitations → pheo"),
        bullet("Abdominal bruit → renal artery stenosis"),
    ], ORANGE_LIGHT, ORANGE))

    items.append(two_col(left, right_items_top, ratio=(0.48, 0.52)))
    return items

# ── Section 3: Etiopathogenesis ──────────────────────────────────────────────
def section_pathogenesis():
    items = []
    items.append(section_header("3.  ETIOPATHOGENESIS – KEY MECHANISMS", TEAL))
    items.append(sp(6))

    items.append(body(
        "In essential hypertension, elevated BP is caused by <b>multifactorial abnormalities</b>. "
        "The final common pathway is increased <b>peripheral vascular resistance (PVR)</b>, "
        "with cardiac output typically normal. Baroreceptors and the renal pressure-volume control "
        "system are 'reset' at a higher set-point."))
    items.append(sp(6))

    mechs = [
        ("RAAS Activation", TEAL, TEAL_LIGHT, [
            "↓ renal perfusion → juxtaglomerular cells release <b>Renin</b>",
            "Renin: Angiotensinogen → Angiotensin I",
            "ACE (lung): Ang I → <b>Angiotensin II</b>",
            "Ang II: (1) vasoconstriction ↑ PVR; (2) ↑ aldosterone → Na⁺/H₂O retention",
            "Also: intrarenal RAAS in PKD, CKD independently drives HTN",
        ]),
        ("Sympathetic Nervous System", MED_BLUE, LIGHT_BLUE, [
            "Increased SNS tone → arteriolar constriction → ↑ PVR",
            "Baroreceptors reset at higher set-point → blunted buffering",
            "Beta-adrenoceptor stimulation → ↑ renin secretion",
            "Stress → central sympathetic overdrive",
        ]),
        ("Renal Na⁺ Handling", NAVY, GREY_LIGHT, [
            "Impaired renal Na⁺ excretion → volume expansion → ↑ BP",
            "Salt-sensitive individuals: ↑ Na intake → proportional ↑ BP",
            "Pressure-natriuresis curve shifted rightward in HTN",
        ]),
        ("Endothelial Dysfunction", ORANGE, ORANGE_LIGHT, [
            "↓ Nitric oxide (NO) → impaired vasodilation",
            "↑ Endothelin-1 → vasoconstriction",
            "↑ Reactive oxygen species (ROS) → accelerates NO degradation",
            "Impaired endothelium-dependent vasorelaxation (demonstrated in ADPKD before HTN onset)",
        ]),
        ("Insulin Resistance / Metabolic", GREEN, GREEN_LIGHT, [
            "Hyperinsulinemia → SNS activation + renal Na⁺ retention",
            "Visceral adipocytes secrete IL-6, TNF-α, CRP → endothelial injury",
            "Strong association: obesity, MetS, Type 2 DM → HTN",
        ]),
        ("Genetic Factors", PURPLE, PURPLE_LIGHT, [
            "Heritability of essential HTN ~30%",
            "Polygenic: multiple loci, each with small effect",
            "Monogenic causes: Liddle syndrome, Gordon syndrome, glucocorticoid-remediable aldosteronism",
        ]),
    ]

    for title, hdr_col, bg_col, points in mechs:
        box_items = [
            Paragraph(f"<b>{title}</b>", style("mt",
                fontSize=9.5, textColor=hdr_col, fontName="Helvetica-Bold", leading=13)),
            sp(3),
        ] + [bullet(p) for p in points]
        items.append(colored_box(box_items, bg_col, hdr_col))
        items.append(sp(5))

    return items

# ── Section 4: Associated Diseases ───────────────────────────────────────────
def section_assoc_diseases():
    items = []
    items.append(section_header("4.  DISEASES ASSOCIATED WITH HYPERTENSION", RED))
    items.append(sp(6))

    items.append(body(
        "Hypertension is the 'silent killer' – usually <b>asymptomatic</b> until target-organ damage occurs. "
        "Sustained elevated BP damages vessels in the heart, brain, kidneys, and eyes. "
        "Global deaths attributable to systolic BP ≥140 mmHg: <b>~10 million/year</b>."))
    items.append(sp(5))

    disease_data = [
        ["IHD / CAD", "Atherosclerosis accelerated by HTN-induced endothelial injury and shear stress",
         "Angina, MI, sudden cardiac death", "~4.9 million deaths/yr"],
        ["Heart Failure", "LV pressure overload → LVH → diastolic/systolic dysfunction",
         "Dyspnea, orthopnea, PND, leg edema, S3 gallop", "Most common cause of HF in West"],
        ["Haemorrhagic Stroke", "Arteriolar rupture (Charcot-Bouchard aneurysms) → ICH",
         "Sudden severe headache, vomiting, focal deficits, coma", "~2 million deaths/yr"],
        ["Ischaemic Stroke / TIA", "Atherosclerosis of cerebral arteries, lacunar infarcts",
         "Hemiplegia, dysphasia, visual field defects", "~1.5 million deaths/yr"],
        ["Hypertensive Encephalopathy", "BP exceeds cerebral autoregulation → vasogenic oedema",
         "Severe headache, confusion, seizures, visual disturbance – NO focal signs (unlike stroke)",
         "PRES syndrome on MRI"],
        ["Aortic Dissection", "High pulse pressure → intimal tear",
         "Sudden tearing chest/back pain, pulse differentials, AR murmur", "Type A → surgery; Type B → medical"],
        ["CKD / Nephrosclerosis", "Arteriolar thickening → glomerulosclerosis → proteinuria",
         "Proteinuria, rising creatinine, oedema, nocturia, uraemia",
         "HTN ↔ CKD vicious cycle"],
        ["Hypertensive Retinopathy", "Arteriolar wall changes, haemorrhages, exudates",
         "Grade I-IV (see below); visual blurring in severe cases",
         "Grade IV = papilloedema = EMERGENCY"],
        ["Peripheral Arterial Disease", "Atherosclerosis of limb arteries – HTN is 2.5× risk (men), 3.9× (women)",
         "Intermittent claudication, rest pain, ulcers",
         "ABI < 0.9 diagnostic"],
    ]

    d_tbl = make_table(
        ["Disease", "Mechanism", "Clinical Features", "Key Fact"],
        disease_data,
        [38*mm, 48*mm, 52*mm, 40*mm],
        hdr_color=RED,
    )
    items.append(d_tbl)
    items.append(sp(6))

    # Retinopathy grading
    items.append(sub("Hypertensive Retinopathy – Keith-Wagener-Barker Grading"))
    ret_rows = [
        ["Grade I", "Mild arteriolar narrowing / increased light reflex ('silver wiring')", "Asymptomatic"],
        ["Grade II", "AV nicking (Gunn's sign); copper wiring", "Asymptomatic"],
        ["Grade III", "Flame haemorrhages, cotton-wool spots, hard exudates", "Possible visual blurring"],
        ["Grade IV ⚠", "Papilloedema (disc swelling) ± all Grade III features", "HYPERTENSIVE EMERGENCY"],
    ]
    r_tbl = make_table(
        ["Grade", "Fundus Findings", "Significance"],
        ret_rows,
        [22*mm, 90*mm, CONTENT_W - 118*mm],
        hdr_color=ORANGE,
    )
    items.append(r_tbl)

    return items

# ── Section 5: Clinical Manifestations ──────────────────────────────────────
def section_clinical():
    items = []
    items.append(section_header("5.  CLINICAL MANIFESTATIONS", MED_BLUE))
    items.append(sp(6))

    left = [
        colored_box([
            Paragraph("<b>UNCOMPLICATED HTN</b>", style("uh",
                fontSize=9.5, textColor=MED_BLUE, fontName="Helvetica-Bold", leading=13)),
            sp(3),
            Paragraph("Usually <b>ASYMPTOMATIC</b>", style("as",
                fontSize=9, textColor=RED, fontName="Helvetica-Bold",
                alignment=TA_CENTER, leading=13)),
            sp(3),
            Paragraph("<i>When symptoms occur:</i>", style("ws",
                fontSize=8.5, textColor=GREY_MID, fontName="Helvetica-Oblique", leading=12)),
            bullet("Morning occipital headache"),
            bullet("Epistaxis"),
            bullet("Dizziness / tinnitus"),
            bullet("Palpitations"),
            bullet("Visual disturbances (in severe HTN)"),
            sp(4),
            Paragraph("<i>Physical examination findings:</i>", style("pe",
                fontSize=8.5, textColor=GREY_MID, fontName="Helvetica-Oblique", leading=12)),
            bullet("Thickened / tortuous radial artery"),
            bullet("Accentuated A2 heart sound"),
            bullet("LV heave / LVH on ECG"),
            bullet("Retinal changes on fundoscopy"),
        ], LIGHT_BLUE, MED_BLUE),
    ]

    right = [
        colored_box([
            Paragraph("<b>WITH TARGET-ORGAN DAMAGE</b>", style("tod",
                fontSize=9.5, textColor=RED, fontName="Helvetica-Bold", leading=13)),
            sp(3),
            Paragraph("<b>Heart:</b>", style("h1", fontSize=9, textColor=NAVY,
                fontName="Helvetica-Bold", leading=12)),
            bullet("Exertional dyspnea, orthopnea"),
            bullet("S3 / S4 gallop, basal crepitations"),
            bullet("Angina / chest pain"),
            sp(2),
            Paragraph("<b>Brain:</b>", style("h2", fontSize=9, textColor=NAVY,
                fontName="Helvetica-Bold", leading=12)),
            bullet("Headache, confusion, seizures"),
            bullet("Focal neurological deficits (stroke)"),
            bullet("Obtundation (encephalopathy)"),
            sp(2),
            Paragraph("<b>Kidneys:</b>", style("h3", fontSize=9, textColor=NAVY,
                fontName="Helvetica-Bold", leading=12)),
            bullet("Proteinuria, haematuria"),
            bullet("Nocturia, oedema"),
            bullet("Uraemic symptoms (late)"),
            sp(2),
            Paragraph("<b>Eyes:</b>", style("h4", fontSize=9, textColor=NAVY,
                fontName="Helvetica-Bold", leading=12)),
            bullet("Blurred vision, visual loss"),
            bullet("Papilloedema (Grade IV)"),
        ], RED_LIGHT, RED),
    ]

    items.append(two_col(left, right))
    return items

# ── Section 6: Non-Pharmacological Management ────────────────────────────────
def section_nonpharm():
    items = []
    items.append(section_header("6.  NON-PHARMACOLOGICAL MANAGEMENT", GREEN))
    items.append(sp(6))

    items.append(body(
        "Lifestyle modifications are <b>mandatory for ALL patients</b> at every stage of hypertension "
        "and should be maintained alongside drug therapy. They can lower BP by <b>5–20 mmHg each</b> "
        "and may normalize mild hypertension without drugs."))
    items.append(sp(5))

    lifestyle_rows = [
        ["Weight Reduction", "Achieve BMI 18.5–24.9 kg/m²; reduce waist circumference",
         "5–20 mmHg per 10 kg lost"],
        ["DASH Diet", "Rich in fruits, vegetables, low-fat dairy; ↓ saturated fat & red meat",
         "8–14 mmHg"],
        ["Sodium Restriction", "< 2.4 g Na/day (< 6 g NaCl); avoid processed foods",
         "2–8 mmHg"],
        ["Physical Activity", "≥ 30 min moderate aerobic exercise on most days (brisk walking, swimming)",
         "4–9 mmHg"],
        ["Alcohol Moderation", "≤ 2 drinks/day (men); ≤ 1 drink/day (women)",
         "2–4 mmHg"],
        ["Smoking Cessation", "Complete cessation – lowers CVD risk (not BP directly)",
         "↓ CVD risk"],
        ["Increase Potassium", "Dietary potassium ≥ 3,500 mg/day (bananas, sweet potatoes, spinach)",
         "2–4 mmHg"],
        ["Stress Reduction", "Relaxation techniques, yoga, cognitive-behavioural therapy",
         "Variable (2–5 mmHg)"],
    ]
    items.append(make_table(
        ["Intervention", "How / Target", "Expected BP Reduction"],
        lifestyle_rows,
        [42*mm, 90*mm, CONTENT_W - 138*mm],
        hdr_color=GREEN,
    ))
    items.append(sp(5))

    items.append(key_point(
        "DASH = Dietary Approaches to Stop Hypertension – the most evidence-based dietary intervention. "
        "Salt restriction potentiates the effect of ALL antihypertensive drugs."))

    return items

# ── Section 7: Pharmacological Management ────────────────────────────────────
def section_pharm():
    items = []
    items.append(section_header("7.  PHARMACOLOGICAL MANAGEMENT", NAVY))
    items.append(sp(6))

    # When to start
    items.append(sub("When to Initiate Drug Therapy"))
    start_rows = [
        ["Grade 1 / Stage I HTN\n(140–159/90–99)", "If: high CV risk, organ damage, DM, CKD OR after 3–6 months lifestyle trial failure"],
        ["Grade 2 / Stage II HTN\n(160–179/100–109)", "Start drug therapy promptly alongside lifestyle changes"],
        ["Grade 3 HTN (≥180/110)", "Start drug therapy immediately; 2-drug combination from outset"],
        ["BP target (most patients)", "< 130/80 mmHg (ACC/AHA); < 140/90 (ESH/WHO)"],
        ["BP target (high-risk / SPRINT)", "< 120 mmHg systolic (standard protocol measurement)"],
    ]
    items.append(make_table(
        ["Scenario", "Action"],
        start_rows,
        [58*mm, CONTENT_W - 64*mm],
        hdr_color=MED_BLUE,
    ))
    items.append(sp(6))

    # First-line drugs
    items.append(sub("First-Line Drug Classes"))
    items.append(body(
        "Guidelines recommend initiating therapy with <b>TWO OR MORE</b> of the three primary classes: "
        "<b>CCBs</b>, <b>ACE-I or ARBs</b>, and <b>Thiazide/Thiazide-like Diuretics</b>."))
    items.append(sp(5))

    drug_classes = [
        {
            "name": "A – ACE INHIBITORS",
            "color": TEAL,
            "bg": TEAL_LIGHT,
            "agents": "Ramipril, Enalapril, Lisinopril, Perindopril, Captopril",
            "moa": "Inhibit ACE → ↓ Ang II (vasoconstriction) + ↓ bradykinin degradation → ↑ NO/prostacyclin vasodilation",
            "indications": "DM with CKD/proteinuria ★, Heart failure (HFrEF) ★, Post-MI ★, LV dysfunction",
            "side_effects": "Dry cough (10–15%, bradykinin-mediated), Angioedema (rare), Hyperkalaemia, AKI in bilateral RAS",
            "contraind": "Pregnancy, bilateral RAS, hyperkalaemia; AVOID dual RAAS blockade",
        },
        {
            "name": "B – ANGIOTENSIN RECEPTOR BLOCKERS (ARBs)",
            "color": MED_BLUE,
            "bg": LIGHT_BLUE,
            "agents": "Losartan, Valsartan, Candesartan, Irbesartan, Telmisartan, Olmesartan",
            "moa": "Block AT1 receptors → ↓ Ang II effects. Allow preferential AT2 binding (vasodilation). NO bradykinin effect → no cough",
            "indications": "Same as ACE-I; use when ACE-I causes cough ★. DM nephropathy, HF, post-MI",
            "side_effects": "Hyperkalaemia, AKI – similar to ACE-I but NO cough. Angioedema (rare)",
            "contraind": "Pregnancy; AVOID with ACE-I (dual blockade)",
        },
        {
            "name": "C – CALCIUM CHANNEL BLOCKERS (CCBs)",
            "color": GREEN,
            "bg": GREEN_LIGHT,
            "agents": "Amlodipine (DHP, preferred) ★; Nifedipine; Diltiazem / Verapamil (non-DHP)",
            "moa": "Block voltage-gated L-type Ca²⁺ channels in vascular smooth muscle → arteriolar vasodilation → ↓ PVR",
            "indications": "Most patients ★; Most effective for STROKE prevention ★; Angina; Elderly; Black patients; Effect independent of Na intake & NSAIDs",
            "side_effects": "DHP: ankle oedema (dose-dependent), flushing, reflex tachycardia. Verapamil: constipation, ↓ AV conduction",
            "contraind": "Non-DHP + beta-blocker = additive bradycardia/heart block. Short-acting nifedipine NOT for chronic use",
        },
        {
            "name": "D – THIAZIDE / THIAZIDE-LIKE DIURETICS",
            "color": ORANGE,
            "bg": ORANGE_LIGHT,
            "agents": "Chlorthalidone ★ (preferred), Hydrochlorothiazide 25–50 mg, Indapamide 1.25–2.5 mg",
            "moa": "Inhibit NaCl reabsorption in DCT → initial volume depletion; long-term: ↓ peripheral vascular resistance",
            "indications": "First-line in most patients ★; Elderly / isolated systolic HTN; Heart failure; Black patients",
            "side_effects": "Hypokalaemia ★, Hyponatraemia, Hyperuricaemia (gout), Glucose intolerance, Dyslipidaemia",
            "contraind": "Gout (caution); Hypokalaemia; Avoid if eGFR < 30 (thiazides lose efficacy)",
        },
    ]

    for d in drug_classes:
        box_content = [
            Paragraph(f"<b>{d['name']}</b>", style("dn",
                fontSize=10, textColor=d["color"], fontName="Helvetica-Bold", leading=14)),
            sp(3),
        ]
        inner_rows = [
            ["Agents:", d["agents"]],
            ["Mechanism:", d["moa"]],
            ["Key Indications:", d["indications"]],
            ["Side Effects:", d["side_effects"]],
            ["Contraindications:", d["contraind"]],
        ]
        inner_tbl = Table(inner_rows, colWidths=[32*mm, CONTENT_W - 52*mm])
        inner_tbl.setStyle(TableStyle([
            ("FONTNAME",      (0,0), (0,-1), "Helvetica-Bold"),
            ("FONTSIZE",      (0,0), (-1,-1), 8.5),
            ("TEXTCOLOR",     (0,0), (0,-1), d["color"]),
            ("TEXTCOLOR",     (1,0), (1,-1), GREY_DARK),
            ("TOPPADDING",    (0,0), (-1,-1), 3),
            ("BOTTOMPADDING", (0,0), (-1,-1), 3),
            ("VALIGN",        (0,0), (-1,-1), "TOP"),
            ("ROWBACKGROUNDS",(0,0), (-1,-1), [d["bg"], WHITE]),
        ]))
        box_content.append(inner_tbl)
        items.append(colored_box(box_content, d["bg"], d["color"]))
        items.append(sp(6))

    return items

# ── Section 8: Additional Drug Classes ──────────────────────────────────────
def section_extra_drugs():
    items = []
    items.append(section_header("8.  ADDITIONAL ANTIHYPERTENSIVE DRUG CLASSES", PURPLE))
    items.append(sp(6))

    extra_rows = [
        ["Beta-Blockers\n(β-blockers)",
         "Metoprolol, Atenolol, Bisoprolol (β1-selective); Carvedilol, Labetalol (α+β)",
         "Block β1 → ↓ HR, ↓ CO; inhibit renin secretion",
         "Post-MI ★, HFrEF ★, Angina ★, Tachyarrhythmias. Labetalol/Hydralazine in PREGNANCY ★",
         "NOT first-line for uncomplicated HTN (less stroke protection). Fatigue, bradycardia, AV block, bronchoconstriction, impotence, masks hypoglycaemia"],
        ["Alpha-1 Blockers",
         "Prazosin, Terazosin, Doxazosin",
         "Block α1 in arterioles/venules → ↓ PVR. Dilation of resistance & capacitance vessels",
         "HTN + BPH in men ★ (dual benefit); Phaeochromocytoma (phenoxybenzamine)",
         "First-dose orthostatic hypotension ★ (give at bedtime, start low); Salt/water retention without diuretic"],
        ["Central Sympatholytics",
         "Clonidine (α2-agonist), Methyldopa, Moxonidine",
         "↓ Central sympathetic outflow → ↓ PVR and HR",
         "Methyldopa = DOC in PREGNANCY ★. Clonidine in resistant HTN",
         "Clonidine: rebound HTN on abrupt withdrawal ★. Methyldopa: hepatotoxicity, haemolytic anaemia"],
        ["MRAs (Aldosterone\nAntagonists)",
         "Spironolactone, Eplerenone",
         "Block aldosterone receptors in collecting duct → natriuresis",
         "Resistant HTN (4th agent) ★, Primary aldosteronism, HFrEF",
         "Hyperkalaemia ★, Gynaecomastia (spironolactone). Avoid if eGFR < 30"],
        ["Direct Vasodilators",
         "Hydralazine, Minoxidil",
         "Direct arteriolar smooth muscle relaxation",
         "Hydralazine: HF, PREGNANCY. Minoxidil: refractory HTN",
         "Reflex tachycardia + fluid retention – ALWAYS combine with beta-blocker + diuretic. Minoxidil: hypertrichosis"],
        ["Direct Renin\nInhibitor",
         "Aliskiren",
         "Blocks conversion of pro-renin → renin (1st step RAAS)",
         "Alternative if ACE-I/ARB not tolerated",
         "Avoid with ACE-I or ARB (dual RAAS blockade). Contraindicated in pregnancy"],
    ]

    items.append(make_table(
        ["Drug Class", "Agents", "Mechanism", "Indications ★", "Side Effects / Notes"],
        extra_rows,
        [30*mm, 38*mm, 38*mm, 42*mm, CONTENT_W - 154*mm],
        hdr_color=PURPLE,
    ))
    return items

# ── Section 9: Drug Selection Guide ─────────────────────────────────────────
def section_selection():
    items = []
    items.append(section_header("9.  DRUG SELECTION GUIDE & COMBINATION THERAPY", TEAL))
    items.append(sp(6))

    items.append(sub("Compelling Indications – Preferred Drugs"))
    comp_rows = [
        ["Heart Failure (HFrEF)", "ACE-I or ARB + Beta-blocker (carvedilol/bisoprolol) + Diuretic + MRA (spironolactone)"],
        ["Post-MI / ACS", "ACE-I or ARB + Beta-blocker"],
        ["Angina Pectoris", "Beta-blocker or CCB (non-DHP: diltiazem/verapamil)"],
        ["DM / CKD with Proteinuria", "ACE-I or ARB ★ (slow CKD progression, reduce intraglomerular pressure)"],
        ["Isolated Systolic HTN (Elderly)", "Thiazide diuretic or CCB (amlodipine)"],
        ["PREGNANCY ★", "Methyldopa ★, Labetalol, Hydralazine, Nifedipine (AVOID ACE-I/ARB/Aliskiren)"],
        ["BPH + HTN (Men)", "Doxazosin (α1-blocker) – dual benefit"],
        ["Black Patients", "CCB + Thiazide (respond less to ACE-I/beta-blocker monotherapy)"],
        ["Resistant HTN", "Add Spironolactone (MRA) as 4th agent ★"],
        ["Tachycardia / Post-operative HTN", "IV Esmolol (short-acting β1-blocker)"],
        ["Phaeochromocytoma (pre-op)", "Alpha-blocker first ★ (phenoxybenzamine), then add beta-blocker"],
        ["Aortic Dissection (acute)", "IV Labetalol + Nitroprusside / Nicardipine; target SBP < 120 rapidly"],
    ]
    items.append(make_table(
        ["Condition", "Preferred Drug(s)"],
        comp_rows,
        [60*mm, CONTENT_W - 66*mm],
        hdr_color=TEAL,
    ))
    items.append(sp(6))

    items.append(sub("Combination Therapy Strategies"))
    combo_rows = [
        ["2-drug", "ACE-I/ARB + CCB (e.g., ramipril + amlodipine) – most preferred"],
        ["2-drug", "ACE-I/ARB + Thiazide diuretic – effective; especially in heart failure"],
        ["2-drug", "CCB + Thiazide diuretic – effective in elderly, Black patients"],
        ["3-drug", "ACE-I/ARB + CCB + Thiazide – standard triple therapy"],
        ["4-drug", "Add beta-blocker or clonidine or MRA"],
        ["Resistant HTN", "Add spironolactone (best evidence as 4th agent)"],
        ["AVOID ★", "ACE-I + ARB, or ACE-I + Aliskiren – dual RAAS blockade → ↑ AKI, hyperkalaemia"],
    ]
    items.append(make_table(
        ["Type", "Combination"],
        combo_rows,
        [28*mm, CONTENT_W - 34*mm],
        hdr_color=MED_BLUE,
    ))
    items.append(sp(5))
    items.append(alert(
        "NEVER combine two RAAS inhibitors (ACE-I + ARB, ACE-I + aliskiren) – significantly increased risk of "
        "acute kidney injury, hyperkalaemia, and hypotension."))

    return items

# ── Section 10: HTN Emergency ────────────────────────────────────────────────
def section_emergency():
    items = []
    items.append(section_header("10.  HYPERTENSIVE EMERGENCY vs URGENCY", RED))
    items.append(sp(6))

    left = [
        colored_box([
            Paragraph("<b>HYPERTENSIVE URGENCY</b>", style("hu",
                fontSize=9.5, textColor=ORANGE, fontName="Helvetica-Bold", leading=13)),
            sp(3),
            bullet("BP ≥ 180/110 mmHg"),
            bullet("<b>NO new / worsening target-organ injury</b>"),
            bullet("Often asymptomatic or mild symptoms"),
            sp(3),
            Paragraph("<b>Management:</b>", style("hum",
                fontSize=9, textColor=GREY_DARK, fontName="Helvetica-Bold", leading=12)),
            bullet("Restart/optimise oral medications"),
            bullet("Oral agents: labetalol, clonidine, captopril, amlodipine"),
            bullet("Outpatient follow-up in 24–48 hrs"),
            bullet("Avoid rapid IV reduction (risk of ischaemia)"),
        ], ORANGE_LIGHT, ORANGE),
    ]

    right = [
        colored_box([
            Paragraph("<b>HYPERTENSIVE EMERGENCY</b>", style("he",
                fontSize=9.5, textColor=RED, fontName="Helvetica-Bold", leading=13)),
            sp(3),
            bullet("BP ≥ 180/110 mmHg"),
            bullet("<b>WITH new/worsening target-organ damage</b>"),
            sp(2),
            Paragraph("<i>Common emergencies:</i>", style("ce",
                fontSize=8.5, textColor=GREY_MID, fontName="Helvetica-Oblique", leading=12)),
            bullet("Hypertensive encephalopathy / PRES"),
            bullet("Acute HF / pulmonary oedema"),
            bullet("ACS / acute MI"),
            bullet("Aortic dissection"),
            bullet("Eclampsia"),
            bullet("Haemorrhagic / ischaemic stroke"),
            sp(3),
            Paragraph("<b>Management:</b>", style("hem",
                fontSize=9, textColor=GREY_DARK, fontName="Helvetica-Bold", leading=12)),
            bullet("ICU admission + IV antihypertensives"),
            bullet("Reduce BP by <b>10–15%</b> in 1st 1–2 hrs"),
            bullet("Then 10–15% over next 12–24 hrs"),
            bullet("<b>EXCEPTION:</b> Aortic dissection & pulmonary oedema → rapid reduction"),
        ], RED_LIGHT, RED),
    ]
    items.append(two_col(left, right))
    items.append(sp(6))

    items.append(sub("Intravenous Drugs for Hypertensive Emergency"))
    iv_rows = [
        ["Nicardipine", "CCB (DHP)", "0.5–15 mcg/kg/min IV", "Most emergencies; outside ICU; safe in stroke"],
        ["Clevidipine", "CCB (DHP)", "1–32 mg/hr IV", "Perioperative HTN; rapid, titratable"],
        ["Labetalol", "α+β blocker", "20–80 mg IV bolus or 0.5–2 mg/min infusion", "Aortic dissection, post-op, pregnancy"],
        ["Esmolol", "β1-blocker (short-acting)", "0.5 mg/kg load → 50–300 mcg/kg/min", "Peri-op HTN with tachycardia; short half-life"],
        ["Sodium Nitroprusside", "Arterial + venous dilator", "0.25–10 mcg/kg/min IV", "Most emergencies; monitor cyanide toxicity"],
        ["Fenoldopam", "Dopamine D1 agonist", "0.1–1.6 mcg/kg/min IV", "Renal impairment (natriuretic effect)"],
        ["Hydralazine", "Direct vasodilator", "10–20 mg IV q4–6h", "Pre-eclampsia / eclampsia ★"],
        ["Enalaprilat", "ACE-I (IV)", "1.25–5 mg IV q6h", "Hypertensive emergency with high-renin states"],
    ]
    items.append(make_table(
        ["Drug", "Class", "Dose", "Use / Notes"],
        iv_rows,
        [30*mm, 35*mm, 50*mm, CONTENT_W - 121*mm],
        hdr_color=RED,
    ))

    return items

# ── Section 11: Mnemonics & Quick Recall ─────────────────────────────────────
def section_mnemonics():
    items = []
    items.append(section_header("11.  HIGH-YIELD EXAM MNEMONICS & QUICK RECALLS", PURPLE))
    items.append(sp(6))

    mnemonics = [
        ("ABCD – First-Line Antihypertensives",
         "A = ACE inhibitors / ARBs\nB = Beta-blockers (not first-line alone)\nC = Calcium channel blockers\nD = Diuretics (thiazide)",
         PURPLE, PURPLE_LIGHT),
        ("RAAS Chain – Remember This Sequence",
         "Angiotensinogen → (Renin) → Ang I → (ACE) → Ang II → Vasoconstriction + Aldosterone → Na⁺/H₂O retention → ↑ BP",
         TEAL, TEAL_LIGHT),
        ("Secondary HTN Causes – CHAPS",
         "C = Coarctation of aorta\nH = Hyperaldosteronism (Conn syndrome)\nA = Adrenal (Phaeochromocytoma, Cushing)\nP = Parenchymal renal disease / RAS\nS = Steroid drugs / OCP",
         ORANGE, ORANGE_LIGHT),
        ("Drug + Side Effect High-Yield Pairs",
         "ACE-I → DRY COUGH ★\nACE-I / ARB → Hyperkalaemia, Angioedema\nThiazide → Hypokalaemia, Hyperuricaemia, Glucose intolerance\nCCB (DHP) → Ankle oedema, Flushing\nVerapamil → CONSTIPATION, AV block\nClonidine → Rebound HTN on sudden withdrawal\nMinoxidil → Hypertrichosis, fluid retention\nAlpha-blockers → First-dose hypotension",
         RED, RED_LIGHT),
        ("Pregnancy – Safe Antihypertensives (MAN)",
         "M = Methyldopa (DOC)\nA = Amlodipine (CCB)\nN = Nifedipine, labetalol, hydralazine\n✗ AVOID: ACE-I, ARBs, Aliskiren (teratogenic)",
         GREEN, GREEN_LIGHT),
        ("Resistant HTN Definition",
         "BP ≥ 130/80 mmHg despite ≥ 3 antihypertensives (one being a diuretic) at optimal doses\n"
         "OR controlled on ≥ 4 drugs.\n"
         "Add SPIRONOLACTONE as 4th agent (best evidence).",
         MED_BLUE, LIGHT_BLUE),
        ("Target BP Quick Reference",
         "General: < 130/80 mmHg\nHigh-risk (SPRINT): < 120 mmHg systolic\nDiabetes: < 130/80 mmHg\nElderly (≥80 yrs): < 150/90 (tolerated); intensive if tolerating well",
         NAVY, GREY_LIGHT),
        ("HTN + Comorbidity → Best Drug",
         "HTN + DM + proteinuria → ACE-I / ARB ★\nHTN + HF → ACE-I/ARB + beta-blocker + MRA + diuretic\nHTN + Angina → Beta-blocker or CCB\nHTN + BPH → Doxazosin (alpha-blocker)\nHTN + Black patient → CCB + Thiazide (not ACE-I alone)\nHTN + Gout → AVOID thiazides → use amlodipine/ACE-I",
         TEAL, TEAL_LIGHT),
    ]

    for title, content, fg, bg in mnemonics:
        mbox = [
            Paragraph(f"<b>{title}</b>", style("mt2",
                fontSize=9.5, textColor=fg, fontName="Helvetica-Bold", leading=14)),
            sp(3),
        ]
        for line in content.split("\n"):
            if line.strip():
                mbox.append(Paragraph(f"  {line}", style("ml",
                    fontSize=9, textColor=GREY_DARK, fontName="Helvetica",
                    leading=13, leftIndent=8)))
        items.append(colored_box(mbox, bg, fg))
        items.append(sp(5))

    return items

# ── Page header / footer ─────────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    W_p, H_p = A4
    # Header bar
    canvas.setFillColor(NAVY)
    canvas.rect(0, H_p - 14*mm, W_p, 14*mm, fill=1, stroke=0)
    canvas.setFillColor(WHITE)
    canvas.setFont("Helvetica-Bold", 9)
    canvas.drawString(18*mm, H_p - 9*mm, "HYPERTENSION  |  Complete Study Guide")
    canvas.setFont("Helvetica", 8)
    canvas.drawRightString(W_p - 18*mm, H_p - 9*mm, "Orris Medical AI  •  2026")
    # Footer
    canvas.setFillColor(GREY_LIGHT)
    canvas.rect(0, 0, W_p, 10*mm, fill=1, stroke=0)
    canvas.setFillColor(GREY_MID)
    canvas.setFont("Helvetica", 7.5)
    canvas.drawString(18*mm, 3.5*mm,
        "Sources: Park's Preventive Medicine | Katzung's Pharmacology 16e | Goldman-Cecil Medicine | Brenner & Rector's Kidney")
    canvas.setFont("Helvetica-Bold", 8)
    canvas.drawRightString(W_p - 18*mm, 3.5*mm, f"Page {doc.page}")
    canvas.restoreState()

# ── Assemble document ────────────────────────────────────────────────────────
story = []

# Cover
story.extend(cover_page())
story.append(PageBreak())

# Sections
for fn in [
    section_definition,
    section_etiology,
    section_pathogenesis,
    section_assoc_diseases,
    section_clinical,
    section_nonpharm,
    section_pharm,
    section_extra_drugs,
    section_selection,
    section_emergency,
    section_mnemonics,
]:
    story.extend(fn())
    story.append(sp(10))
    story.append(hr(GREY_MID, 0.8))
    story.append(sp(6))

doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print(f"PDF created: {OUT}")
Running Command

cd /tmp/workspace/hypertension-study-guide && python3 build_pdf.py 2>&1

Running Command

python3 -c " from pypdf import PdfReader r = PdfReader('/tmp/workspace/hypertension-study-guide/Hypertension_Study_Guide.pdf') print(f'Pages: {len(r.pages)}') import os size_kb = os.path.getsize('/tmp/workspace/hypertension-study-guide/Hypertension_Study_Guide.pdf') // 1024 print(f'Size: {size_kb} KB') "

Your study guide PDF is ready — 10 pages, fully structured for exam prep.

Hypertension Study Guide

PDF Document · PDF


What's inside (10 pages):
SectionContent
Cover + TOCTitle banner, table of contents, key epidemiology stats
1. Definition & ClassificationESH/WHO & ACC/AHA grade tables with colour-coded HTN thresholds
2. EtiologyPrimary vs Secondary HTN in two-column layout; CHAPS clues to secondary HTN
3. Etiopathogenesis6 colour-coded mechanism boxes (RAAS, SNS, Renal Na⁺, Endothelial dysfunction, Metabolic, Genetic)
4. Associated DiseasesFull disease table with mechanism, features, key facts; KWB retinopathy grading
5. Clinical ManifestationsTwo-column: uncomplicated vs with target-organ damage
6. Non-PharmacologicalDASH diet, salt, exercise, weight — with expected mmHg reductions
7. First-Line PharmacologyABCD drugs (ACE-I, ARBs, CCBs, Thiazides) — mechanism, indications, side effects, contraindications
8. Additional Drug ClassesBeta-blockers, alpha-blockers, central agents, MRAs, vasodilators, renin inhibitors
9. Drug Selection GuideCompelling indications table + combination therapy strategies + AVOID list
10. HTN Emergency vs UrgencySide-by-side comparison + IV drugs table with doses
11. MnemonicsABCD, CHAPS, RAAS chain, pregnancy-safe drugs (MAN), drug-SE pairs, resistant HTN, target BP
This is a shared conversation. Sign in to Orris to start your own chat.