flowchart TD
    classDef linkNode stroke:#333333,color:#333333,stroke-width:1.5px
    classDef legendRed fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    classDef legendYellow fill:#FBC02D,stroke:#F9A825,color:#000000
    classDef legendGreen fill:#66BB6A,stroke:#2E7D32,color:#000000

    subgraph ds [Data Sources]
        Statistical@{ shape: lean-l}
        Foundation@{ shape: lean-l}
        EnvClimate@{ shape: lean-l, label: "Environment, Climate, & Health"}
        Orthoimagery@{ shape: lean-l}
        FieldImagery@{ shape: lean-l, label: "Field Imagery"}
        WebCorpus@{ shape: lean-l, label: "Web Corpus"}
        Elevation@{ shape: lean-l}
    end

    DataPkgs@{ shape: rect, label: "Data Packages"}

    subgraph df [Dissemination Formats]
        subgraph sot [Long-Term Storage]
            Parquet@{ shape: lean-l}
            Zarr@{ shape: lean-l}
            GeoTIFF@{ shape: lean-l}
            AV1@{ shape: lean-l, label: "Next-Gen Video"}
            JPEGXL@{ shape: lean-l, label: "Next-Gen Imagery"}
            WARC@{ shape: lean-l, label: "Unstructured Web Data"}
            FAIRCat@{ shape: lean-l, label: "FAIR Data Catalogue"}
        end

        FlatGeoBuf@{ shape: lean-l}

        subgraph vt [Vector Tiles]
            VectorTiles@{ shape: lean-l, label: "Mapbox Vector Tiles"}
            NextGenVT@{ shape: lean-l, label: "Next-Gen Vector Tiles"}
        end

        subgraph visuals [" "]
            WebP@{ shape: lean-l}
            JPG@{ shape: lean-l}
            PNG@{ shape: lean-l}
        end

        subgraph pkg [Portable Databases]
            PMTiles@{ shape: lean-l}
            SQLite@{ shape: lean-l}
        end

        subgraph ent [Enterprise]
            FileGDB@{shape: lean-l, label: "File Geodatabase"}
        end
    end

    subgraph di [Distribution]
        ObjStorage@{ shape: bow-rect, label: "Storage"}
        Metadata@{ shape: rect, label: "FAIR Data Catalogue"}
        HTTP@{ shape: rect, label: "Systems-Ready Data"}
        DecenDist@{ shape: rect, label: "Decentralized Distribution"}
    end

    subgraph ei [Experimental Infrastructure]
        GeoServices@{ shape: rect, label: "Geospatial Services"}
    end

    subgraph consumption [Consumption]
        DataSci@{ shape: rect, label: "Data People & Developers"}
        Systems@{ shape: rect, label: "Systems"}
    end

    Statistical e1@<--> DataPkgs
    e1@{animate: true, animation: slow}
    Foundation e2@<--> DataPkgs
    e2@{animate: true, animation: slow}
    Orthoimagery e3@<--> DataPkgs
    e3@{animate: true, animation: slow}
    EnvClimate e4@<--> DataPkgs
    e4@{animate: true, animation: fast}
    Elevation e5@<--> DataPkgs
    e5@{animate: true, animation: slow}
    WebCorpus e6@<--> DataPkgs
    e6@{animate: true, animation: fast}
    FieldImagery e7@<--> DataPkgs
    e7@{animate: true, animation: fast}

    DataPkgs e8@--> df
    e8@{animate: true, animation: fast}

    sot e9@<--> FlatGeoBuf
    e9@{animate: true, animation: fast}

    FlatGeoBuf e10@--> vt
    e10@{animate: true, animation: fast}

    sot e11@<--> visuals
    e11@{animate: true, animation: slow}

    vt e12@<--> pkg
    e12@{animate: true, animation: fast}

    visuals e13@<--> pkg
    e13@{animate: true, animation: slow}

    sot e14@<--> ent
    e14@{animate: true, animation: slow}

    visuals e15@--> ent
    e15@{animate: true, animation: slow}

    df e16@<--> di
    e16@{animate: true, animation: slow}

    ObjStorage e17@<--> Metadata
    e17@{animate: true, animation: slow}
    Metadata e18@<--> HTTP
    e18@{animate: true, animation: slow}

    HTTP e19@<--> ei
    e19@{animate: true, animation: slow}
    HTTP e20@<--> DecenDist
    e20@{animate: true, animation: slow}
    HTTP e21@<--> DataSci
    e21@{animate: true, animation: slow}

    DecenDist e22@--> Systems
    e22@{animate: true, animation: fast}
    DecenDist e23@--> DataSci
    e23@{animate: true, animation: fast}

    Systems e24@<--> DataSci
    e24@{animate: true, animation: fast}
    ei e25@<--> DataSci
    e25@{animate: true, animation: slow}

    consumption ~~~ legend
    subgraph legend [Priority Legend]
        direction LR
        L1[High]:::legendRed ~~~ L2[Medium]:::legendYellow ~~~ L3[Low]:::legendGreen
    end

    style EnvClimate fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style Orthoimagery fill:#FBC02D,stroke:#F9A825,color:#000000
    style FieldImagery fill:#66BB6A,stroke:#2E7D32,color:#000000
    style WebCorpus fill:#66BB6A,stroke:#2E7D32,color:#000000
    style Elevation fill:#FBC02D,stroke:#F9A825,color:#000000

    style VectorTiles fill:#66BB6A,stroke:#2E7D32,color:#000000
    style NextGenVT fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style WebP fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style JPG fill:#66BB6A,stroke:#2E7D32,color:#000000
    style PNG fill:#66BB6A,stroke:#2E7D32,color:#000000
    style FileGDB fill:#fff,stroke:#2E7D32,color:#000000
    style GeoServices fill:#66BB6A,stroke:#2E7D32,color:#000000
    style ObjStorage fill:#FBC02D,stroke:#F9A825,color:#000000

    style DataPkgs fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style FAIRCat fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style DecenDist fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style HTTP fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style Systems fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style Metadata fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style Statistical fill:#B71C1C,stroke:#7F0000,color:#FFFFFF
    style Foundation fill:#B71C1C,stroke:#7F0000,color:#FFFFFF

    style sot fill:#EF9A9A,stroke:#C62828,color:#000000
    style Parquet fill:#FFCDD2,stroke:#E57373,color:#000000
    style Zarr fill:#FFCDD2,stroke:#E57373,color:#000000
    style GeoTIFF fill:#FFCDD2,stroke:#E57373,color:#000000
    style JPEGXL fill:#FFCDD2,stroke:#E57373,color:#000000
    style WARC fill:#FFCDD2,stroke:#E57373,color:#000000
    style AV1 fill:#FFCDD2,stroke:#E57373,color:#000000

    style pkg fill:#FFB74D,stroke:#EF6C00,color:#000000
    style SQLite fill:#EF6C00,stroke:#E65100,color:#000000
    style PMTiles fill:#FFCC80,stroke:#FB8C00,color:#000000

    style vt fill:#FBC02D,stroke:#F9A825,color:#000000
    style FlatGeoBuf fill:#FBC02D,stroke:#F9A825,color:#000000
    style visuals fill:#FBC02D,stroke:#F9A825,color:#000000

    style ent fill:#66BB6A,stroke:#2E7D32,color:#000000
    style DataSci fill:#D32F2F,stroke:#8E0000,color:#FFFFFF

    style legend fill:none,stroke:#999,stroke-width:1px

    class FieldImagery linkNode
    class Parquet,FlatGeoBuf,SQLite,FileGDB,VectorTiles,NextGenVT,GeoTIFF,Zarr,WebP,PMTiles,JPEGXL,AV1,WARC linkNode

    click DataPkgs "https://github.com/dataforcanada/d4c-pkgs" _blank
    click Foundation "https://github.com/dataforcanada/d4c-datapkg-foundation" _blank
    click Statistical "https://github.com/dataforcanada/d4c-datapkg-statistical" _blank
    click Orthoimagery "https://github.com/dataforcanada/d4c-datapkg-orthoimagery" _blank
    click FieldImagery "https://github.com/dataforcanada/d4c-datapkg-field-imagery" _blank
    click EnvClimate "https://github.com/dataforcanada/d4c-datapkg-environment-climate-health" _blank
    click Elevation "https://github.com/dataforcanada/d4c-datapkg-elevation" _blank
    click WebCorpus "https://github.com/dataforcanada/d4c-datapkg-web-corpus" _blank
    click Parquet "https://github.com/apache/parquet-format/" _blank
    click FlatGeoBuf "https://flatgeobuf.org/" _blank
    click SQLite "https://www.geopackage.org/" _blank
    click FileGDB "https://gdal.org/en/stable/drivers/vector/openfilegdb.html" _blank
    click VectorTiles "https://github.com/mapbox/vector-tile-spec/" _blank
    click NextGenVT "https://github.com/maplibre/maplibre-tile-spec/" _blank
    click GeoTIFF "https://cogeo.org/" _blank
    click Zarr "https://github.com/zarr-developers/geozarr-spec/" _blank
    click WebP "https://developers.google.com/speed/webp/" _blank
    click PMTiles "https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md" _blank
    click JPEGXL "https://jpeg.org/jpegxl/" _blank
    click AV1 "https://aomedia.org/specifications/av1/" _blank
    click WARC "https://github.com/iipc/warc-specifications/" _blank
    click FAIRCat "https://stac-utils.github.io/stac-geoparquet/latest/spec/stac-geoparquet-spec/" _blank
    click HTTP "https://www.dataforcanada.org/docs/" _blank
    click DecenDist "https://www.dataforcanada.org/docs/d4c-infra-distribution/" _blank
    click Metadata "https://stac-utils.github.io/stac-geoparquet/latest/spec/stac-geoparquet-spec/" _blank