/* Article "The value of a dollar" (/articles/value-of-a-dollar/): the bills,
   the inflation stripes and grid, the runs and the doublings. Rising prices in
   the inflation red (--cash), falling prices in a cool blue (--s1); every step
   is mixed from theme variables, so all four themes work. */

.dv {
  --dv-n3: color-mix(in srgb, var(--s1) 76%, var(--surface));
  --dv-n2: color-mix(in srgb, var(--s1) 48%, var(--surface));
  --dv-n1: color-mix(in srgb, var(--s1) 22%, var(--surface));
  --dv-z: var(--track);
  --dv-p1: color-mix(in srgb, var(--cash) 14%, var(--surface));
  --dv-p2: color-mix(in srgb, var(--cash) 32%, var(--surface));
  --dv-p3: color-mix(in srgb, var(--cash) 54%, var(--surface));
  --dv-p4: color-mix(in srgb, var(--cash) 80%, var(--surface));
  --dv-p5: color-mix(in srgb, var(--cash) 84%, black 16%);
  --dv-bill: color-mix(in srgb, #6f8f72 13%, var(--surface));
}
.dv-n3 { --c: var(--dv-n3); } .dv-n2 { --c: var(--dv-n2); } .dv-n1 { --c: var(--dv-n1); } .dv-z { --c: var(--dv-z); }
.dv-p1 { --c: var(--dv-p1); } .dv-p2 { --c: var(--dv-p2); } .dv-p3 { --c: var(--dv-p3); } .dv-p4 { --c: var(--dv-p4); } .dv-p5 { --c: var(--dv-p5); }
.sw-sq.dv-n3, .sw-sq.dv-n2, .sw-sq.dv-n1, .sw-sq.dv-z, .sw-sq.dv-p1, .sw-sq.dv-p2, .sw-sq.dv-p3, .sw-sq.dv-p4, .sw-sq.dv-p5 { background: var(--c); }
.sw-sq.dv-z, .sw-sq.dv-p1, .sw-sq.dv-n1 { box-shadow: inset 0 0 0 1px var(--border); }

/* the calculator, right under the key numbers */
.dv-cta { display: flex; align-items: center; gap: 18px; margin-top: 16px; padding: 22px 26px; color: inherit; text-decoration: none;
  transition: box-shadow 0.15s ease; }
.dv-cta:hover { box-shadow: var(--shadow-lg); }
.dv-cta-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dv-cta-h { font: 700 24px/1.15 var(--display); letter-spacing: -0.02em; color: var(--ink); }
.dv-cta-p { color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.dv-cta .btn { margin-left: auto; white-space: nowrap; }
@media (max-width: 640px) {
  .dv-cta { flex-wrap: wrap; padding: 18px; gap: 12px 14px; }
  .dv-cta .ico.l { width: 44px; height: 44px; font-size: 20px; }
  .dv-cta-text { flex: 1 1 200px; }
  .dv-cta .btn { margin-left: 0; width: 100%; text-align: center; }
}

/* a dollar from each decade */
.dv-billsfig { padding-top: 16px; }
.dv-billnote { margin: 0 40px 10px 10px; font-size: 13px; color: var(--muted); }
.dv-bills { list-style: none; margin: 0; padding: 0 4px 6px; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.dv-card { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; padding: 14px 10px 12px;
  border-radius: 16px; color: inherit; text-decoration: none; background: var(--surface-2); transition: background 0.15s ease; }
.dv-card:hover { background: var(--hover); }
.dv-box { display: flex; align-items: flex-end; justify-content: center; width: 100%; aspect-ratio: 156 / 66; margin-bottom: 10px; }
.dv-fit { display: block; }
.dv-bill { display: block; width: 100%; height: auto; overflow: visible; }
.dv-bill-bg { fill: var(--dv-bill); stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1; }
.dv-bill-ln { fill: none; stroke: var(--ink); stroke-opacity: 0.38; stroke-width: 0.8; }
.dv-bill-ln.dv-thin { stroke-opacity: 0.22; }
.dv-bill-d { fill: var(--ink); fill-opacity: 0.55; font: 600 22px var(--display); }
.dv-bill-1 { fill: var(--ink); fill-opacity: 0.45; font: 700 12px var(--display); }
.dv-year { font-size: 13px; font-weight: 600; color: var(--muted); }
.dv-v { font: 650 21px/1.2 var(--mono); color: var(--ink); letter-spacing: -0.01em; }
.dv-sub { font-size: 12px; color: var(--muted); text-align: center; }
.dv-sub b { color: var(--ink-2); font-weight: 600; }
.dv-card.now .dv-year { color: var(--cash-ink); }
.dv-card.now .dv-bill-bg { stroke: var(--cash); stroke-opacity: 0.9; }
@media (max-width: 560px) {
  .dv-bills { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .dv-card { padding: 10px 4px; border-radius: 12px; }
  .dv-v { font-size: 15px; }
  .dv-sub { font-size: 10.5px; }
  .dv-sub b { display: block; }
  .dv-year { font-size: 12px; }
}

/* inflation stripes */
.dv-legend { gap: 6px 14px; }
.dv-stripes { min-height: 210px; }
.dv-cell { fill: var(--c); }
.dv-cell.dv-part { fill-opacity: 0.55; }
.dv-cpi { stroke: var(--ink); stroke-opacity: 0.6; stroke-width: 1.2; }
.dv-axl { fill: var(--ink-2); font: 600 11.5px var(--font); }
.dv-tk { stroke: var(--axis); }
.dv-on { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.dv-run-mark { stroke-width: 3; stroke-linecap: round; }
.dv-run-mark.up { stroke: var(--dv-p4); }
.dv-run-mark.down { stroke: var(--dv-n3); }
.dv-run-end { stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1; }
.dv-tag { font-weight: 500; font-size: 11px; color: var(--muted); }
.dv-tip-run { margin: 4px 0 0 28px; font-size: 11.5px; color: var(--muted); }
.tip-row b.dv-cool { color: var(--s1); }

/* the decade × year grid (fixed layout: the header row sets the widths) */
.dv-grid { table-layout: fixed; width: 100%; }
.dv-grid caption { padding-bottom: 10px; }
.dv-grid th[scope="row"] { font-size: 13px; }
.dv-grid thead th { text-align: center; font: 500 11px var(--mono); color: var(--muted); }
.dv-grid thead th:first-child { width: 76px; text-align: left; font-family: var(--font); }
.dv-grid thead th:last-child { width: 68px; }
.dv-grid td { padding: 7px 2px; text-align: center; font: 500 12px var(--mono); background: var(--c, transparent);
  color: var(--ink); border: 1px solid var(--surface); }
.dv-grid td.dv-p4, .dv-grid td.dv-p5, .dv-grid td.dv-n3 { color: #fff; }
.dv-grid td.dv-ytd { outline: 1.5px dashed var(--ink); outline-offset: -3px; }
.dv-grid td.dv-ytd sup, .dv-grid td.dv-avg sup { font-size: 9px; }
.dv-grid td.dv-none { background: transparent; }
.dv-grid td.dv-avg { font-weight: 650; background: transparent; border-left: 1px solid var(--border); }
@media (max-width: 560px) {
  .dv-grid thead th { font-size: 10px; padding-left: 0; padding-right: 0; }
  .dv-grid thead th:first-child { width: 40px; padding-left: 8px; font-size: 0; }
  .dv-grid thead th:last-child { width: 42px; }
  .dv-grid th[scope="row"] { font-size: 10.5px; padding: 6px 0 6px 8px; letter-spacing: -0.02em; }
  .dv-grid td { font-size: 9.5px; padding: 6px 0; letter-spacing: -0.05em; }
  .dv-grid td.dv-avg { font-size: 10px; }
  .dv-grid caption { padding-left: 10px; }
}

/* longest runs */
.dv-runsfig { margin-top: 8px; padding: 20px 22px 6px; }
.dv-runs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 40px; }
.dv-runs-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.dv-runlist { list-style: none; margin: 0; padding: 0; }
.dv-run { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 8px 0; border-top: 1px solid var(--border); }
.dv-run-h { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); }
.dv-run-h b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dv-run-bar { display: block; height: 10px; border-radius: 3px; background: var(--track); overflow: hidden; }
.dv-run-bar i { display: block; height: 100%; border-radius: 3px; }
.dv-run.up .dv-run-bar i { background: var(--dv-p4); }
.dv-run.down .dv-run-bar i { background: var(--dv-n2); }
.dv-run.live .dv-run-bar i { background: linear-gradient(90deg, var(--dv-p4) 92%, var(--dv-p2)); }
.dv-run-x { font: 500 11.5px var(--mono); color: var(--muted); }
@media (max-width: 640px) { .dv-runs { grid-template-columns: minmax(0, 1fr); } .dv-runsfig { padding: 16px 14px 4px; } }

/* doublings since 1913: a staircase, each step as wide as the time it took */
.dv-dblfig { margin-top: 8px; padding: 22px 22px 6px; }
.dv-dbl { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; }
.dv-dbl-seg { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex-basis: 0; }
.dv-dbl-now { min-width: 52px; }
.dv-dbl-zone { display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; height: 112px; }
.dv-dbl-x { font: 650 15px var(--mono); color: var(--ink); white-space: nowrap; }
.dv-dbl-bar { display: block; height: calc(var(--h) * 14px); border-radius: 4px 4px 2px 2px; background: var(--dv-p3); }
.dv-dbl-seg:nth-child(2n) .dv-dbl-bar { background: var(--dv-p4); }
.dv-dbl-seg.dv-dbl-now .dv-dbl-bar { background: repeating-linear-gradient(135deg, var(--dv-p2) 0 4px, transparent 4px 8px);
  box-shadow: inset 0 0 0 1.5px var(--dv-p3); }
.dv-dbl-t { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); line-height: 1.35; white-space: nowrap; }
.dv-dbl-t b { color: var(--ink); font-weight: 650; font-size: 13.5px; }
@media (max-width: 760px) {
  .dv-dbl { flex-direction: column; gap: 10px; }
  .dv-dbl-now { min-width: 0; }
  .dv-dbl-seg { display: grid; grid-template-columns: 52px 1fr; grid-template-areas: "x bar" "x t"; gap: 4px 10px; }
  .dv-dbl-zone { display: contents; }
  .dv-dbl-x { grid-area: x; align-self: center; }
  .dv-dbl-bar { grid-area: bar; width: var(--w, 100%); min-width: 6px; height: 14px; }
  .dv-dbl-t { grid-area: t; flex-direction: row; gap: 8px; }
}
