/* Article "COVID-19 and the economy" (/articles/covid-economy/), on top of
   style.css and articles.css. Classes start with .cv-. Falls in --bad, gains in
   --good (a light-to-dark scale over the card's surface); 2020 in c1 (blue),
   the 2007-09 recession in c6 (gray); the relief groups in c1 ... c6. */

/* ---------- every economy's 2020: tiles by region ---------- */
.cv-bins { gap: 6px 12px; }
.cv-bins .sw-sq { border-radius: 3px; }
.cv-regs { position: relative; column-width: 330px; column-gap: 28px; padding: 10px 10px 4px; }
.cv-reg { break-inside: avoid; padding-bottom: 18px; }
.cv-reg-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 7px; font: 600 13px/1.3 var(--font); color: var(--ink); }
.cv-reg-n { font: 500 11px/1.3 var(--mono); color: var(--muted); white-space: nowrap; }
.cv-tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.cv-tile { width: 38px; height: 26px; display: inline-grid; place-items: center; border-radius: 6px; cursor: default;
  font: 600 10px/1 var(--mono); letter-spacing: 0.02em; color: var(--ink); outline: none; }
.cv-tile.on, .cv-tile:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
/* seven steps: deep falls dark red ... growth green */
.cv-b0 { background: color-mix(in srgb, var(--bad) 92%, var(--surface)); color: #fff; }
.cv-b1 { background: color-mix(in srgb, var(--bad) 70%, var(--surface)); color: #fff; }
.cv-b2 { background: color-mix(in srgb, var(--bad) 46%, var(--surface)); }
.cv-b3 { background: color-mix(in srgb, var(--bad) 28%, var(--surface)); }
.cv-b4 { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); }
.cv-b5 { background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.cv-b6 { background: color-mix(in srgb, var(--good) 36%, var(--surface)); }
.cv-b7 { background: color-mix(in srgb, var(--good) 66%, var(--surface)); color: #fff; }
.cv-b4, .cv-b5 { box-shadow: inset 0 0 0 1px var(--border); }
.sw-sq.cv-b0, .sw-sq.cv-b1, .sw-sq.cv-b2, .sw-sq.cv-b3, .sw-sq.cv-b4, .sw-sq.cv-b5, .sw-sq.cv-b6, .sw-sq.cv-b7 { width: 12px; height: 12px; }

/* ---------- the largest economies: 2020 bars and the year back ---------- */
.cv-sw-down { background: var(--bad); }
.cv-leg-when { color: var(--muted); }
.cv-rows { position: relative; padding: 6px 10px 2px; }
.cv-row { display: grid; grid-template-columns: minmax(96px, 170px) 1fr 92px; align-items: center; gap: 10px; padding: 3px 0; border-radius: 8px; font-size: 13px; }
.cv-row:hover { background: var(--hover); }
.cv-row-n { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.cv-row-n a { color: inherit; text-decoration: none; }
.cv-row-n a:hover { color: var(--accent-ink); }
.cv-row-bar { position: relative; height: 20px; }
.cv-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.cv-bar { position: absolute; top: 4px; height: 12px; border-radius: 3px; }
.cv-bar.down { background: var(--bad); opacity: 0.85; }
.cv-bar.up { background: var(--good); opacity: 0.85; }
.cv-row-v2 { display: none; }
.cv-row-v { position: absolute; top: 2px; padding: 0 5px; font: 600 11px/16px var(--mono); color: var(--ink); white-space: nowrap; }
.cv-when { justify-self: start; font: 600 11px/1 var(--mono); padding: 5px 8px; border-radius: 999px; background: var(--track); color: var(--ink-2); white-space: nowrap; }
.cv-when.cv-w0 { background: var(--good-soft); color: var(--good); }
.cv-when.cv-w1 { background: color-mix(in srgb, var(--s1) 16%, var(--surface)); color: var(--accent-ink); }
.cv-when.cv-w2 { background: color-mix(in srgb, var(--s2) 20%, var(--surface)); color: var(--ink); }
.cv-when.cv-w3, .cv-when.cv-w4 { background: var(--bad-soft); color: var(--bad); }

/* ---------- the recovery race ---------- */
.cv-plot-lanes { min-height: 560px; }
.cv-plot-gantt { min-height: 300px; }
.cv-lane { fill: var(--bad); fill-opacity: 0.26; }
.cv-lane.gf { fill-opacity: 0.45; }
.cv-lane.hot { fill-opacity: 0.85; }
.cv-lane-base { stroke: var(--axis); stroke-width: 1; }
.cv-lane-base.hot { stroke: var(--bad); stroke-width: 2; }
.cv-finish { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.cv-finish.open { stroke-dasharray: 3 3; stroke-opacity: 0.5; }
.cv-lane-t { fill: var(--ink-2); font: 600 11px/1 var(--mono); }
.cv-lane-t.hot { fill: var(--ink); font-weight: 700; }
.cv-lane-n { fill: var(--ink-2); font: 600 12px/1 var(--font); }
.cv-lane-n.hot, .cv-lane-n.gf { fill: var(--ink); font-weight: 700; }
.cv-lane-d { fill: var(--muted); font: 500 10px/1 var(--mono); }
.cv-lane-hi { fill: var(--hover); }
.sw-sq.cv-sw-hot { background: var(--bad); }
.sw-sq.cv-sw-lane { background: var(--bad); opacity: 0.3; }

/* ---------- the way back ---------- */
.cv-gbar.c1 { fill: var(--s1); }
.cv-gbar.c6 { fill: var(--s6); }
.cv-gbar.open { fill-opacity: 0.45; }
.cv-gdot { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.cv-g-n { fill: var(--ink); font: 600 13px/1 var(--font); }
.cv-g-t { fill: var(--ink-2); font: 600 11px/1 var(--mono); }
.cv-g-peak { stroke: var(--ink); stroke-opacity: 0.45; stroke-width: 1; stroke-dasharray: 3 3; }
.cv-g-peak-t { fill: var(--muted); font: 500 10px/1 var(--mono); }

/* ---------- the relief money: one square per $10 billion ---------- */
.cv-wkey { margin: 0 10px 6px; padding-right: 36px; font-size: 13px; color: var(--muted); }
.cv-wgrid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px 28px; padding: 6px 10px 6px; }
.cv-wh { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.cv-wh .sw-sq { width: 12px; height: 12px; flex: none; }
.cv-wname { font-weight: 600; flex: 1; min-width: 0; }
.cv-wh b { font: 600 15px/1 var(--mono); letter-spacing: -0.02em; }
.cv-wsq { display: flex; flex-wrap: wrap; gap: 3px; }
.cv-sq { display: block; width: 12px; height: 12px; border-radius: 3px; cursor: default; }
.cv-sq.c1 { background: var(--s1); } .cv-sq.c2 { background: var(--s2); } .cv-sq.c3 { background: var(--s3); }
.cv-sq.c4 { background: var(--s4); } .cv-sq.c5 { background: var(--s5); } .cv-sq.c6 { background: var(--s6); }
.cv-sq.on { box-shadow: 0 0 0 2px var(--ink); }
.cv-wsq:hover .cv-sq { opacity: 0.55; }
.cv-wsq:hover .cv-sq.on { opacity: 1; }
.cv-wsub { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.cv-tip-o { font-size: 11px; line-height: 1.35; color: var(--muted); margin: -2px 0 6px; max-width: 260px; }
.cv-world .tip, .cv-waffle .tip { top: 0; }

/* ---------- 2008 against 2020: four cards ---------- */
.cv-vs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 6px 10px 6px; }
@media (min-width: 1100px) { .cv-vs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cv-vs-card { background: var(--surface-2); box-shadow: none; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.cv-vs-card .label { margin: 0; min-height: 2.6em; }
.cv-vs-row { display: grid; grid-template-columns: 54px 1fr auto; grid-template-rows: auto auto; gap: 3px 10px; align-items: center; }
.cv-vs-k { font: 600 12px/1 var(--mono); color: var(--ink-2); }
.cv-vs-track { height: 12px; border-radius: 4px; background: var(--track); overflow: hidden; }
.cv-vs-bar { display: block; height: 100%; border-radius: 4px; }
.cv-vs-bar.c1 { background: var(--s1); } .cv-vs-bar.c6 { background: var(--s6); }
.cv-vs-v { font: 650 16px/1 var(--mono); letter-spacing: -0.03em; color: var(--ink); text-align: right; }
.cv-vs-sub { grid-column: 2 / 4; font-size: 12px; line-height: 1.35; color: var(--muted); }
.cv-vs-foot { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- now ---------- */
.cv-now-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
@media (min-width: 1100px) { .cv-now-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cv-now .pill.flat { background: var(--track); color: var(--ink-2); }
.cv-now { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; }
.cv-now .label { margin: 0; }
.cv-now .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-now-when { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.cv-now-l { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding-top: 6px; border-top: 1px solid var(--border); font-size: 13px; color: var(--ink-2); }
.cv-now-l b { font: 600 13px/1.4 var(--mono); color: var(--ink); white-space: nowrap; }

/* ---------- monthly deficits ---------- */
.cv-plot-mts { min-height: 280px; }
.cv-dbar { fill: var(--s1); }
.cv-dbar.sur { fill: var(--s6); }
.cv-dbar.rec { fill: var(--ink); }
.cv-dbar.on { fill-opacity: 0.6; }
.cv-dbar-t { fill: var(--ink); font: 600 11px/1 var(--mono); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .cv-vs-grid, .cv-now-grid { grid-template-columns: 1fr; }
  .cv-regs { padding: 8px 4px 2px; }
  .cv-reg { padding-bottom: 14px; }
  .cv-tile { width: 34px; height: 24px; font-size: 9.5px; }
  .cv-row { grid-template-columns: 1fr auto auto; grid-template-areas: "n v w" "b b b"; gap: 2px 8px; font-size: 13px; padding: 4px 0 2px; }
  .cv-row-n { grid-area: n; }
  .cv-row-v2 { grid-area: v; display: block; font: 600 12px/1 var(--mono); color: var(--ink); }
  .cv-when { grid-area: w; justify-self: end; }
  .cv-row-bar { grid-area: b; height: 14px; }
  .cv-bar { top: 2px; height: 10px; }
  .cv-row-v { display: none; }
  .cv-row-n { padding-left: 2px; }
  .cv-when { padding: 4px 6px; font-size: 10px; }
  .cv-rows { padding: 4px 2px 2px; }
  .cv-wgrid { grid-template-columns: 1fr; gap: 16px; padding: 4px 4px; }
  .cv-sq { width: 11px; height: 11px; }
  .cv-vs-grid { padding: 4px 2px; }
  .cv-plot-lanes { min-height: 470px; }
}

/* full screen: let the static pictures use the room */
.is-full .cv-regs, .is-full .cv-wgrid, .is-full .cv-rows, .is-full .cv-vs-grid { overflow: auto; }
