%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#1B1B1B", "primaryBorderColor": "#D6002A", "primaryTextColor": "#fff", "secondaryColor": "#fff", "secondaryBorderColor": "#D6002A", "secondaryTextColor": "#1B1B1B", "tertiaryColor": "#F0F0F0", "clusterBkg": "#F0F0F0", "lineColor": "#1B1B1B", "fontFamily": "\"Akkurat Pro\", \"Helvetica Neue\", \"Arial\", sans-serif"}}}%%

flowchart TD
    subgraph UP ["Consumer surfaces — upstream"]
        direction LR
        U1["Technical dev\napp code + contract"]
        U2["Citizen dev\nintent → AI agent → contract"]
    end

    subgraph ACDL ["Nova — infrastructure only"]
        direction TB
        CS["Contract schema\n(validate + fail-fast)"]
        subgraph PIPE ["Central pipeline — fixed stages, every deployment"]
            direction LR
            P1["Validate"] --> P2["Resolve\ntarget stack"] --> P3["Security\nchecks"] --> P4["Infra plan"] --> P5["Policy\nchecks"] --> P6["Confidence\nsignal"] --> P7["Evidence\nevent"] --> P8["Infra apply"]
        end
        CAT["Module catalog\nprimitives + modules\n(security-reviewed)"]
        ADAPT["Engine adapter\n(stateless → Terraform)"]
        ENV["Platform-managed\nenvironments\naccount · VPC · state · IAM"]
        HITL["HITL gates\nqa · prod · dr"]
        EVID["Evidence stream\nhash-chained outbox\n(RPO = 0)"]
        CS --> PIPE
        CAT --> P2
        ADAPT --> P4
        ADAPT --> P8
        ENV --> P8
        P6 --> HITL
        HITL --> P8
        P7 --> EVID
    end

    subgraph DOWN ["Downstream"]
        direction LR
        D1["AWS resources\nrunning\n(tagged, encrypted)"]
        D2["Consumer pipeline\ndeploys image"]
    end

    U1 --> CS
    U2 --> CS
    P8 --> D1
    D1 --> D2

    classDef accent fill:#1B1B1B,color:#fff,stroke:#D6002A,stroke-width:2px
    classDef supporting fill:#fff,color:#1B1B1B,stroke:#D6002A,stroke-width:1px
    classDef clusterTitle fill:#F0F0F0,color:#1B1B1B,stroke:#D6002A,stroke-width:1px
    class CS,P6,P7,EVID,ADAPT,ENV accent
    class U1,U2,P1,P2,P3,P4,P5,P8,CAT,HITL,D1,D2 supporting