/* Stingray Bookkeeping: the MONEY RIVER look. Goes with money-river.js (global MoneyRiver). Plain ASCII.
   Load after portal.css (and the page's own CSS): fonts.css, portal.css, ..., money-river.css.

   Colours, as his pick (B pictures): teal for money in, cool blues and violets for money out, gold for kept and
   the bank pool. Words never wear a ribbon colour: names in --soft, amounts in --ink, kept and bank amounts in the
   look's gold words (--accent), so every look keeps its own contrast:
     dark cards (Northern lights, Night sky, Engraved night): the defaults below.
     cream card (Engraved cream: .panel / .set turn light there): the deeper colours further down.
   Checked contrasts (WCAG AA): white on the Came in node #157F78 4.8:1 (and its words are 16px+ / 26px bold);
   navy #1c1405 on the gold pool 10:1+; gold words #f0c577 on the dark chip 9:1+; cream card gold words #7a5716 on
   #fdfaf4 6.3:1. The ribbons carry no meaning by colour alone: each one has its words and amount next to it.
   A theme change needs no redraw for colour (all of it is here); money-river.js redraws on "portal:look" only to
   measure the words again (Night sky and Engraved night use other fonts).
   A negative line (refund, credit) is a pale dashed "back" ribbon (.mr-rib-back), in its side's colour. */

.money-river {
  /* dark cards */
  --mr-in: #36c9b7;
  --mr-in-deep: #13786f;
  --mr-in-other: #6fb8ae;
  --mr-o1: #5f92f0;
  --mr-o2: #9d80f2;
  --mr-o3: #58b0e2;
  --mr-o4: #7f89e2;
  --mr-o5: #c08bea;
  --mr-o6: #6fa0cc;
  --mr-other: #97a5ba;
  --mr-gold: #f2c766;
  --mr-gold-deep: #c58f2c;
  --mr-rib-o0: .62;          /* ribbon opacity at its start ... */
  --mr-rib-o1: .94;          /* ... and at its end */
  --mr-node-bg: #157f78;
  --mr-node-line: rgba(140, 240, 226, .75);
  --mr-node-glow: rgba(54, 201, 183, .42);
  --mr-node-ink: #ffffff;
  --mr-pool-bg: #f2c766;
  --mr-pool-line: rgba(255, 238, 196, .85);
  --mr-pool-ink: #1c1405;
  --mr-pool-glow: rgba(242, 199, 102, .55);
  --mr-chip-bg: rgba(6, 17, 28, .86);
  --mr-chip-line: rgba(242, 199, 102, .75);
  --mr-name-ink: var(--soft, #dfe7ea);
  --mr-amt-ink: var(--ink, #f7f2e8);
  --mr-gold-ink: var(--accent, #f0c577);
  --mr-quiet-ink: var(--quiet, #c8d5db);
  --mr-short-line: var(--bad-line, rgba(255, 160, 146, .65));
  --mr-short-bg: var(--bad-bg, rgba(226, 96, 80, .16));

  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
}

/* the cream card of Engraved cream (light): deeper colours so the ribbons and words hold on the paper */
[data-theme="engraved-cream"] .panel .money-river,
[data-theme="engraved-cream"] .set .money-river,
[data-theme="engraved-cream"] .popup-box .money-river,
.money-river.mr-on-light {
  --mr-in: #13897c;
  --mr-in-deep: #0b5d55;
  --mr-in-other: #4f8f87;
  --mr-o1: #2c63c4;
  --mr-o2: #6b4fc8;
  --mr-o3: #1f7fb4;
  --mr-o4: #4a55b0;
  --mr-o5: #8a4fc0;
  --mr-o6: #3f6f9e;
  --mr-other: #7d8798;
  --mr-gold: #d9a744;
  --mr-gold-deep: #a87a26;
  --mr-rib-o0: .70;
  --mr-rib-o1: .95;
  --mr-node-line: rgba(10, 24, 38, .55);
  --mr-node-glow: rgba(19, 137, 124, .25);
  --mr-pool-bg: #edc46a;
  --mr-pool-line: #a87a26;
  --mr-pool-glow: rgba(217, 167, 68, .45);
  --mr-chip-bg: #fffdf8;
  --mr-chip-line: #b08a4a;
  --mr-name-ink: var(--soft, #23323f);
  --mr-amt-ink: var(--ink, #0a1826);
  --mr-gold-ink: #7a5716;
  --mr-quiet-ink: var(--quiet, #465665);
}

.money-river .mr-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow: visible;
  font-variant-numeric: lining-nums;
  -webkit-user-select: text;
  user-select: text;
}

/* ---- ribbons: gradients set in CSS so every look recolours them without a redraw ---- */
.mr-g .mr-s0 { stop-color: var(--mr-c0); stop-opacity: var(--mr-rib-o0); }
.mr-g .mr-s1 { stop-color: var(--mr-c1); stop-opacity: var(--mr-rib-o1); }
.mr-k-in       { --mr-c0: var(--mr-in-deep); --mr-c1: var(--mr-in); }
.mr-k-in-other { --mr-c0: var(--mr-in-deep); --mr-c1: var(--mr-in-other); }
.mr-k-o1       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o1); }
.mr-k-o2       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o2); }
.mr-k-o3       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o3); }
.mr-k-o4       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o4); }
.mr-k-o5       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o5); }
.mr-k-o6       { --mr-c0: var(--mr-in); --mr-c1: var(--mr-o6); }
.mr-k-other    { --mr-c0: var(--mr-in); --mr-c1: var(--mr-other); }
.mr-k-kept     { --mr-c0: var(--mr-in); --mr-c1: var(--mr-gold); }
.mr-g.mr-k-kept .mr-s1 { stop-opacity: 1; }

.mr-rib { stroke-linecap: butt; }
.mr-rib-kept { filter: drop-shadow(0 0 6px var(--mr-pool-glow)); }
/* a negative line (a refund on the came-in side, a credit on the went-out side): money flowing the other way,
   drawn as a pale band with a dashed edge; its words carry the minus sign, so the colour is never the only sign */
.mr-rib-back {
  fill: var(--mr-c1);
  fill-opacity: .2;
  stroke: var(--mr-c1);
  stroke-opacity: .95;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  stroke-linejoin: round;
}
.mr-cap { fill: var(--mr-c1); }
.mr-tall .mr-cap {
  stroke: rgba(255, 255, 255, .55);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px var(--mr-c1));
}
[data-theme="engraved-cream"] .panel .mr-tall .mr-cap,
.mr-on-light.mr-tall .mr-cap { stroke: #fffdf8; filter: none; }

/* ---- the Came in node ---- */
.mr-node-box {
  fill: var(--mr-node-bg);
  stroke: var(--mr-node-line);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 10px var(--mr-node-glow));
}
.mr-node-name {
  fill: var(--mr-node-ink);
  font-family: var(--font-body, serif);
  font-weight: 400;
}
.mr-node-amt {
  fill: var(--mr-node-ink);
  font-family: var(--font-fig, serif);
  font-weight: var(--w-fig, 660);
}

/* ---- the words next to the ribbons ---- */
.mr-name {
  fill: var(--mr-name-ink);
  font-family: var(--font-body, serif);
  font-weight: 400;
}
.mr-amt {
  fill: var(--mr-amt-ink);
  font-family: var(--font-fig, serif);
  font-weight: var(--w-fig, 660);
}
.mr-label { cursor: default; }

/* ---- kept and the bank pool ---- */
.mr-glow-0 { stop-color: var(--mr-gold); stop-opacity: .75; }
.mr-glow-1 { stop-color: var(--mr-gold); stop-opacity: 0; }
.mr-pool-box {
  fill: var(--mr-pool-bg);
  stroke: var(--mr-pool-line);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 12px var(--mr-pool-glow));
}
.mr-pool-ring {
  fill: none;
  stroke: var(--mr-gold);
  stroke-opacity: .85;
  stroke-width: 2;
  filter: drop-shadow(0 0 6px var(--mr-pool-glow));
}
.mr-pool-ring-in { stroke-opacity: .55; stroke-width: 1.5; }
.mr-pool-name,
.mr-pool-note {
  fill: var(--mr-pool-ink);
  font-family: var(--font-body, serif);
  font-weight: 400;
}
.mr-pool-amt {
  fill: var(--mr-pool-ink);
  font-family: var(--font-fig, serif);
  font-weight: var(--w-fig, 660);
}
/* the phone pool is open water: its words sit on the card */
.mr-pool-name.mr-pool-open { fill: var(--mr-name-ink); }
.mr-pool-note.mr-pool-open { fill: var(--mr-quiet-ink); }
.mr-pool-amt.mr-pool-open { fill: var(--mr-gold-ink); }

.mr-chip-box {
  fill: var(--mr-chip-bg);
  stroke: var(--mr-chip-line);
  stroke-width: 1.5;
}
.mr-chip-name {
  fill: var(--mr-name-ink);
  font-family: var(--font-body, serif);
  font-weight: 400;
}
.mr-chip-amt {
  fill: var(--mr-gold-ink);
  font-family: var(--font-fig, serif);
  font-weight: var(--w-fig, 660);
}

/* ---- spent more than came in: plain words, no gold ---- */
.mr-short-box {
  fill: var(--mr-short-bg);
  stroke: var(--mr-short-line);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.mr-short-words,
.mr-short-amt {
  fill: var(--mr-amt-ink);
  font-family: var(--font-fig, serif);
  font-weight: var(--w-fig, 660);
}
.mr-short-name { fill: var(--mr-name-ink); font-family: var(--font-body, serif); }
.mr-short-note { fill: var(--mr-quiet-ink); font-family: var(--font-body, serif); }

/* ---- no numbers yet ---- */
.mr-empty,
.mr-empty-bank {
  margin: 0;
  color: var(--soft, inherit);
  font-family: var(--font-body, serif);
  font-size: max(1rem, 16px);
  line-height: 1.5;
}
.mr-empty-bank { margin-top: 6px; color: var(--ink, inherit); }
.mr-empty-amt { color: var(--accent, inherit); font-family: var(--font-fig, serif); font-weight: var(--w-fig, 660); }
@media (max-width: 600px) {
  .mr-empty,
  .mr-empty-bank { font-size: max(1.125rem, 18px); }
}

/* ---- for screen readers only (the same rule as portal.css .sr) ---- */
.money-river .mr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* glow costs nothing to read without: drop it where people ask for less, and on paper */
@media (prefers-reduced-transparency: reduce) {
  .mr-node-box, .mr-pool-box, .mr-pool-ring, .mr-rib-kept, .mr-tall .mr-cap { filter: none; }
}
@media (forced-colors: active) {
  .mr-name, .mr-amt, .mr-node-name, .mr-node-amt, .mr-pool-name, .mr-pool-amt, .mr-pool-note,
  .mr-chip-name, .mr-chip-amt, .mr-short-words, .mr-short-amt, .mr-short-name, .mr-short-note { fill: CanvasText; }
  .mr-node-box, .mr-pool-box, .mr-chip-box, .mr-short-box { fill: Canvas; stroke: CanvasText; filter: none; }
  .mr-rib-back { fill: none; stroke: CanvasText; }
}
@media print {
  .mr-node-box, .mr-pool-box, .mr-pool-ring, .mr-rib-kept, .mr-cap { filter: none; }
}
