digraph cellulose_extraction {
  bgcolor="#1a1a2e"
  rankdir=TB
  node [fontname="Helvetica" fontsize=10 style=filled shape=box]
  edge [color="#888888" fontname="Helvetica" fontsize=9 fontcolor="#aaaaaa"]

  subgraph cluster_prep {
    label="PREPARE" fontcolor="#4CAF50" fontsize=11 fontname="Helvetica Bold"
    color="#4CAF50" style=dashed

    dry [label="dry bast fiber\n50°C until constant weight" fillcolor="#2E7D32" fontcolor="white"]
    cut [label="cut to 2-3 cm lengths" fillcolor="#388E3C" fontcolor="white"]
    grind [label="grind & sieve\nthrough 1.5mm mesh" fillcolor="#43A047" fontcolor="white"]
    weigh [label="weigh 50g powder\n(test batch)" fillcolor="#66BB6A" fontcolor="white"]
  }

  subgraph cluster_alkali {
    label="ALKALI TREATMENT" fontcolor="#2196F3" fontsize=11 fontname="Helvetica Bold"
    color="#2196F3" style=dashed

    naoh [label="dissolve 90g NaOH\nin 750 mL water\n= 12% solution" fillcolor="#1565C0" fontcolor="white"]
    bath [label="add hemp powder\n80°C, stir at 500 rpm\n3 hours" fillcolor="#1976D2" fontcolor="white"]
    filter1 [label="vacuum filter\nwash 4-5 times\nuntil pH neutral" fillcolor="#1E88E5" fontcolor="white"]
  }

  subgraph cluster_bleach {
    label="BLEACH (optional)" fontcolor="#9C27B0" fontsize=11 fontname="Helvetica Bold"
    color="#9C27B0" style=dashed

    h2o2 [label="8% hydrogen peroxide\nadjust pH to 12 with NaOH\n40°C for 1 hour\nrepeat 4 cycles" fillcolor="#7B1FA2" fontcolor="white"]
    filter2 [label="wash until neutral\nvacuum filter" fillcolor="#8E24AA" fontcolor="white"]
  }

  subgraph cluster_purify {
    label="PURIFY" fontcolor="#FF9800" fontsize=11 fontname="Helvetica Bold"
    color="#FF9800" style=dashed

    hemi [label="17.5% NaOH solution\nroom temperature\n5 hours, stir at 500 rpm\nremoves hemicellulose" fillcolor="#E65100" fontcolor="white"]
    filter3 [label="vacuum filter\nwash 3 times\ndry at 60°C overnight" fillcolor="#F57C00" fontcolor="white"]
    result [label="~25g pure cellulose\nwhite fibrous material\n~50% yield from bast" fillcolor="#FF9800" fontcolor="white"]
  }

  dry -> cut -> grind -> weigh
  weigh -> naoh [label="add to"]
  naoh -> bath
  bath -> filter1 [label="lignin\ndissolved"]
  filter1 -> h2o2
  h2o2 -> filter2
  filter2 -> hemi
  hemi -> filter3 [label="hemicellulose\nremoved"]
  filter3 -> result

  waste [label="waste liquor\nneutralize to pH 7\nbefore disposal\nlignin is compostable" fillcolor="#37474F" fontcolor="#aaaaaa" shape=ellipse]
  bath -> waste [style=dashed color="#555555"]
  hemi -> waste [style=dashed color="#555555"]
}
