digraph harmony_test {
    bgcolor="transparent"
    rankdir=TB
    pad=0.5
    nodesep=0.8
    ranksep=0.9

    node [
        fontname="Helvetica"
        fontsize=12
        style="filled"
        penwidth=2
        shape=box
        width=2.4
        height=0.8
    ]

    edge [
        fontname="Helvetica"
        fontsize=10
        penwidth=2.5
    ]

    // Harmony definition
    harmony [
        label="HARMONY TEST\n\na system in harmony has\nappropriate inputs for all outputs"
        shape=doublecircle
        fillcolor="#263238"
        fontcolor="#CDDC39"
        color="#CDDC39"
        fontsize=11
        width=2.6
        fixedsize=true
    ]

    // Natural system passes
    subgraph cluster_pass {
        label="PASSES: a tree"
        fontname="Helvetica"
        fontsize=13
        fontcolor="#2E7D32"
        style="rounded,filled"
        color="#4CAF50"
        fillcolor="#E8F5E9"

        sun [label="sunlight" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]
        water [label="water + minerals" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]
        co2 [label="CO2" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]
        tree [label="TREE" fillcolor="#4CAF50" fontcolor="white" color="#2E7D32" shape=ellipse]
        oxygen [label="oxygen" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]
        fruit [label="fruit + wood" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]
        soil [label="leaf litter → soil" fillcolor="#C8E6C9" color="#4CAF50" fontcolor="#1B5E20"]

        sun -> tree [color="#4CAF50"]
        water -> tree [color="#4CAF50"]
        co2 -> tree [color="#4CAF50"]
        tree -> oxygen [color="#4CAF50"]
        tree -> fruit [color="#4CAF50"]
        tree -> soil [color="#4CAF50"]
        soil -> water [color="#4CAF50" style=dashed label="cycle\ncloses" fontcolor="#2E7D32" fontsize=9]
    }

    // Plastic fails
    subgraph cluster_fail {
        label="FAILS: a plastic bottle"
        fontname="Helvetica"
        fontsize=13
        fontcolor="#C62828"
        style="rounded,filled"
        color="#F44336"
        fillcolor="#FFEBEE"

        oil [label="crude oil" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]
        energy [label="fossil energy" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]
        chemicals [label="industrial chemicals" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]
        bottle [label="PLASTIC BOTTLE" fillcolor="#F44336" fontcolor="white" color="#B71C1C" shape=ellipse]
        waste [label="landfill forever" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]
        microplastic [label="microplastics\nin blood, water, soil" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]
        co2out [label="CO2 emissions" fillcolor="#FFCDD2" color="#F44336" fontcolor="#B71C1C"]

        oil -> bottle [color="#F44336"]
        energy -> bottle [color="#F44336"]
        chemicals -> bottle [color="#F44336"]
        bottle -> waste [color="#F44336"]
        bottle -> microplastic [color="#F44336"]
        bottle -> co2out [color="#F44336"]
        waste -> oil [color="#B71C1C" style=dashed label="cycle\nbroken" fontcolor="#B71C1C" fontsize=9]
    }

    harmony -> sun [style=invis]
    harmony -> oil [style=invis]
}
