{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "description": "Global Oil: 25-Year Supply vs Demand Timeline",
  "width": 1400,
  "height": 900,
  "padding": 60,
  "background": "#001219",
  "signals": [
    {"name": "chartWidth", "value": 1280},
    {"name": "chartHeight", "value": 600},
    {"name": "titleX", "value": 60},
    {"name": "titleY", "value": 70},
    {"name": "chartY", "value": 220},
    {"name": "fontMain", "value": "Inter, system-ui, sans-serif"}
  ],
  "data": [
    {
      "name": "world_data",
      "values": [
        {"year": 1995, "total_reserves": 772.162711, "total_consumption": 24301.853856},
        {"year": 1996, "total_reserves": 771.328053, "total_consumption": 24896.369036},
        {"year": 1997, "total_reserves": 836.037463, "total_consumption": 25600.95855},
        {"year": 1998, "total_reserves": 843.878413, "total_consumption": 25527.36763},
        {"year": 1999, "total_reserves": 842.000695, "total_consumption": 26201.50576},
        {"year": 2000, "total_reserves": 845.882651, "total_consumption": 26746.24115},
        {"year": 2001, "total_reserves": 849.124225, "total_consumption": 26945.66},
        {"year": 2002, "total_reserves": 850.937771, "total_consumption": 27152.47616},
        {"year": 2003, "total_reserves": 1032.483684, "total_consumption": 27856.29595},
        {"year": 2004, "total_reserves": 1071.9207, "total_consumption": 29053.29583},
        {"year": 2005, "total_reserves": 1075.337724, "total_consumption": 29305.22925},
        {"year": 2006, "total_reserves": 1088.37724, "total_consumption": 29698.27884},
        {"year": 2007, "total_reserves": 1090.13478, "total_consumption": 29881.10596},
        {"year": 2008, "total_reserves": 1099.607375, "total_consumption": 29546.0181},
        {"year": 2009, "total_reserves": 1107.251655, "total_consumption": 28912.55297},
        {"year": 2010, "total_reserves": 1112.132255, "total_consumption": 30192.35009},
        {"year": 2011, "total_reserves": 1226.484115, "total_consumption": 30505.25708},
        {"year": 2012, "total_reserves": 1272.0984, "total_consumption": 31198.03983},
        {"year": 2013, "total_reserves": 1387.363607, "total_consumption": 31767.88175},
        {"year": 2014, "total_reserves": 1395.554969, "total_consumption": 32143.31191},
        {"year": 2015, "total_reserves": 1403.922923, "total_consumption": 32735.35482},
        {"year": 2016, "total_reserves": 1398.744607, "total_consumption": 33342.38264},
        {"year": 2017, "total_reserves": 1395.88938, "total_consumption": 33858.4272},
        {"year": 2018, "total_reserves": 1409.183239, "total_consumption": 34269.98045},
        {"year": 2019, "total_reserves": 1408.988967, "total_consumption": 34560.74931},
        {"year": 2020, "total_reserves": 1410.947021, "total_consumption": 32013.87264},
        {"year": 2021, "total_reserves": 1447.338429, "total_consumption": 33701.46083}
      ]
    }
  ],
  "scales": [
    {
      "name": "xscale",
      "type": "linear",
      "domain": {"data": "world_data", "field": "year"},
      "range": [0, {"signal": "chartWidth"}],
      "zero": false,
      "nice": true
    },
    {
      "name": "yscale_reserves",
      "type": "linear",
      "domain": {"data": "world_data", "field": "total_reserves"},
      "range": [{"signal": "chartHeight"}, 0],
      "nice": true,
      "zero": false
    },
    {
      "name": "yscale_consumption",
      "type": "linear",
      "domain": {"data": "world_data", "field": "total_consumption"},
      "range": [{"signal": "chartHeight"}, 0],
      "nice": true,
      "zero": false
    }
  ],
  "marks": [
    {
      "type": "image",
      "encode": {
        "enter": {
          "url": {"value": "https://taraenergy.com/wp-content/uploads/2023/01/oil-as-energy-source-image-of-oil-drilling-rigs.jpeg"},
          "x": {"value": 0},
          "y": {"value": 0},
          "width": {"signal": "width"},
          "height": {"signal": "height"},
          "aspect": {"value": false},
          "opacity": {"value": 0.08}
        }
      }
    },
    {
      "type": "text",
      "encode": {
        "enter": {
          "x": {"signal": "titleX"},
          "y": {"signal": "titleY"},
          "text": {"value": "GLOBAL OIL: RESERVES vs CONSUMPTION"},
          "fontSize": {"value": 56},
          "fontWeight": {"value": 800},
          "fill": {"value": "#ffffff"},
          "font": {"signal": "fontMain"},
          "letterSpacing": {"value": 1}
        }
      }
    },
    {
      "type": "rect",
      "encode": {
        "enter": {
          "x": {"signal": "titleX"},
          "y": {"signal": "titleY + 15"},
          "width": {"value": 120},
          "height": {"value": 6},
          "fill": {"value": "#F72585"}
        }
      }
    },
    {
      "type": "text",
      "encode": {
        "enter": {
          "x": {"signal": "titleX"},
          "y": {"signal": "titleY + 50"},
          "text": {"value": "A Quarter-Century of Energy Dynamics (1995-2021)"},
          "fontSize": {"value": 18},
          "fontWeight": {"value": 600},
          "fill": {"value": "#4CC9F0"},
          "font": {"signal": "fontMain"},
          "letterSpacing": {"value": 1}
        }
      }
    },
    {
      "type": "text",
      "encode": {
        "enter": {
          "x": {"signal": "titleX"},
          "y": {"signal": "titleY + 85"},
          "text": {"value": "Global oil reserves doubled from 772B to 1,447B barrels (87% growth) while consumption increased 39% from 24,300 TWh to 33,700 TWh. The 2003 jump reflects Venezuela's heavy oil reclassification. The 2020 dip shows COVID-19's unprecedented demand shock."},
          "fontSize": {"value": 14},
          "fill": {"value": "#98c1d9"},
          "font": {"signal": "fontMain"},
          "opacity": {"value": 0.85},
          "lineHeight": {"value": 22}
        }
      }
    },
    {
      "type": "group",
      "encode": {
        "enter": {
          "x": {"signal": "titleX"},
          "y": {"signal": "chartY"},
          "width": {"signal": "chartWidth"},
          "height": {"signal": "chartHeight"}
        }
      },
      "marks": [
        {
          "type": "area",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_reserves", "field": "total_reserves"},
              "y2": {"signal": "chartHeight"},
              "fill": {"value": "#00D9FF"},
              "fillOpacity": {"value": 0.15}
            }
          }
        },
        {
          "type": "line",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_reserves", "field": "total_reserves"},
              "stroke": {"value": "#00D9FF"},
              "strokeWidth": {"value": 3}
            }
          }
        },
        {
          "type": "symbol",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_reserves", "field": "total_reserves"},
              "fill": {"value": "#00D9FF"},
              "stroke": {"value": "#001219"},
              "strokeWidth": {"value": 2},
              "size": {"value": 60}
            }
          }
        },
        {
          "type": "area",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_consumption", "field": "total_consumption"},
              "y2": {"signal": "chartHeight"},
              "fill": {"value": "#FF6B9D"},
              "fillOpacity": {"value": 0.15}
            }
          }
        },
        {
          "type": "line",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_consumption", "field": "total_consumption"},
              "stroke": {"value": "#FF6B9D"},
              "strokeWidth": {"value": 3}
            }
          }
        },
        {
          "type": "symbol",
          "from": {"data": "world_data"},
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "field": "year"},
              "y": {"scale": "yscale_consumption", "field": "total_consumption"},
              "fill": {"value": "#FF6B9D"},
              "stroke": {"value": "#001219"},
              "strokeWidth": {"value": 2},
              "size": {"value": 60}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2021, "offset": 2},
              "y": {"scale": "yscale_reserves", "value": 1450},
              "text": {"value": "1,447B"},
              "fontSize": {"value": 14},
              "fontWeight": {"value": "bold"},
              "fill": {"value": "#00D9FF"},
              "align": {"value": "right"},
              "baseline": {"value": "bottom"},
              "font": {"signal": "fontMain"}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2021, "offset": 0},
              "y": {"scale": "yscale_consumption", "value": 33801},
              "text": {"value": "33,701 TWh"},
              "fontSize": {"value": 14},
              "fontWeight": {"value": "bold"},
              "fill": {"value": "#FF6B9D"},
              "align": {"value": "right"},
              "baseline": {"value": "bottom"},
              "font": {"signal": "fontMain"}
            }
          }
        },
        {
          "type": "rule",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2003},
              "y": {"value": 0},
              "y2": {"signal": "chartHeight"},
              "stroke": {"value": "#FFD93D"},
              "strokeWidth": {"value": 2},
              "strokeDash": {"value": [5, 5]},
              "opacity": {"value": 0.5}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2003, "offset": 15},
              "y": {"value": 0},
              "text": {"value": "2003: Venezuela Heavy Oil Reclassification"},
              "fontSize": {"value": 11},
              "fontWeight": {"value": 600},
              "fill": {"value": "#FFD93D"},
              "align": {"value": "right"},
              "angle": {"value": -90},
              "font": {"signal": "fontMain"}
            }
          }
        },
        {
          "type": "rule",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2020},
              "y": {"value": 0},
              "y2": {"signal": "chartHeight"},
              "stroke": {"value": "#F72585"},
              "strokeWidth": {"value": 2},
              "strokeDash": {"value": [5, 5]},
              "opacity": {"value": 0.5}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"scale": "xscale", "value": 2020, "offset": 15},
              "y": {"signal": "chartHeight-5"},
              "text": {"value": "2020: COVID-19 Demand Collapse"},
              "fontSize": {"value": 11},
              "fontWeight": {"value": 600},
              "fill": {"value": "#F72585"},
              "align": {"value": "left"},
              "angle": {"value": -90},
              "font": {"signal": "fontMain"}
            }
          }
        }
      ],
      "axes": [
        {
          "orient": "bottom",
          "scale": "xscale",
          "labelFont": {"signal": "fontMain"},
          "labelFontSize": 12,
          "labelColor": "#98c1d9",
          "labelOpacity": 0.8,
          "domain": true,
          "domainColor": "#98c1d9",
          "domainOpacity": 0.3,
          "ticks": true,
          "tickColor": "#98c1d9",
          "tickOpacity": 0.5,
          "format": "d"
        },
        {
          "orient": "left",
          "scale": "yscale_reserves",
          "labelFont": {"signal": "fontMain"},
          "labelFontSize": 11,
          "labelColor": "#00D9FF",
          "title": "Proven Reserves (Billion Barrels)",
          "titleColor": "#00D9FF",
          "grid": true,
          "gridColor": "#98c1d9",
          "gridOpacity": 0.08
        },
        {
          "orient": "right",
          "scale": "yscale_consumption",
          "labelFont": {"signal": "fontMain"},
          "labelFontSize": 11,
          "labelColor": "#FF6B9D",
          "title": "Global Consumption (TWh)",
          "titleColor": "#FF6B9D"
        }
      ]
    },
    {
      "type": "group",
      "encode": {
        "enter": {
          "x": {"signal": 100},
          "y": {"signal": 250},
          "width": {"value": 600},
          "height": {"value": 80}
        }
      },
      "marks": [
        {
          "type": "symbol",
          "encode": {
            "enter": {
              "x": {"value": 0},
              "y": {"value": 0},
              "fill": {"value": "#00D9FF"},
              "stroke": {"value": "#001219"},
              "size": {"value": 100}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"value": 20},
              "y": {"value": 0},
              "text": {"value": "Proven Reserves (Billion Barrels)"},
              "fill": {"value": "#00D9FF"},
              "font": {"signal": "fontMain"},
              "baseline": {"value": "middle"}
            }
          }
        },
        {
          "type": "symbol",
          "encode": {
            "enter": {
              "x": {"value": 0},
              "y": {"value": 40},
              "fill": {"value": "#FF6B9D"},
              "stroke": {"value": "#001219"},
              "size": {"value": 100}
            }
          }
        },
        {
          "type": "text",
          "encode": {
            "enter": {
              "x": {"value": 20},
              "y": {"value": 40},
              "text": {"value": "Global Consumption (TWh per Year)"},
              "fill": {"value": "#FF6B9D"},
              "font": {"signal": "fontMain"},
              "baseline": {"value": "middle"}
            }
          }
        }
      ]
    },
    {
      "type": "text",
      "encode": {
        "enter": {
          "x": {"value": 60},
          "y": {"signal": "height - 30"},
          "text": {"value": "Data Source: Kaggle - Oil Reserves and Consumption (1995-2022)"},
          "fill": {"value": "#98c1d9"},
          "fontSize": {"value": 11},
          "fillOpacity": {"value": 0.5}
        }
      }
    }
  ]
}
