/* money.css — the struck figure.
 *
 * Every amount that is someone's earnings is set in one face, one way, and in
 * no other: Luminary Mint, a banknote Bodoni (Bodoni Moda, OFL — see
 * FONT-LICENSE.txt) declared for money glyphs only, so it cannot leak into
 * ordinary text. The figure is engraved rather than typed: its fill is cut
 * with fine parallel lines the way intaglio is, and a hairline of light and
 * shade on its edges presses it into the surface it sits on.
 *
 *   .lm            the figure (font-size is inherited: size it where it is used)
 *   .lm-paper      ink pressed into paper   (--lm-ink)
 *   .lm-dark       foil struck on a dark ground (--lm-foil)
 *   .lm-inline     an amount inside a sentence: the face and the cut, no setting
 *   .lm-row        a statement line: the same figure, set to read small
 *   .lm-bank       the account balance: the same figure, ruled off and sealed
 *   .lm-sign / .lm-whole / .lm-cents   the dollar sign and cents are set
 *                  superior, the way a cheque writes them
 *
 * This is the only stylesheet that styles a money figure. Change the look
 * here; do not restyle .lm from another file.
 */
@font-face {
  font-family: 'Luminary Mint';
  src: url('./luminary-mint.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  /* $ + , - . 0-9 and the true minus: money, and nothing else. */
  unicode-range: U+0024, U+002B-002E, U+0030-0039, U+2212;
}

.lm {
  --lm-ink: currentColor;
  --lm-foil: currentColor;
  --lm-cut: .024em;                 /* width of one engraved line */
  display: inline-block;
  position: relative;
  font-family: 'Luminary Mint', 'Bodoni Moda', 'Bodoni 72', Didot, 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  letter-spacing: .012em;
  line-height: 1;
  white-space: nowrap;
  text-transform: none;
}
.lm-face { display: inline-flex; align-items: flex-start; -webkit-user-select: none; user-select: none; }

/* Superior sign and cents: "$5·00" as a cheque sets it, ruled under the cents. */
.lm-sign  { font-size: .56em; margin: .1em .05em 0 0; }
.lm-cents { font-size: .5em;  margin: .1em 0 0 .09em; padding-bottom: .1em; border-bottom: .05em solid currentColor; letter-spacing: .03em; }

/* Inside a sentence: the amount as plain text in the money face, cut with
   the same lines, taking the colour of the text around it. No edge light, so
   it sits correctly on any surface. */
.lm-inline {
  font-size: 1.06em; line-height: inherit; vertical-align: baseline;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  background-image: repeating-linear-gradient(-56deg,
    currentColor 0 calc(var(--lm-cut) * 1.5),
    color-mix(in srgb, currentColor 80%, transparent) calc(var(--lm-cut) * 1.5) calc(var(--lm-cut) * 2.2));
}

/* In a list the superior parts come down a size so a 14px line still reads. */
.lm-row .lm-sign  { font-size: .78em; margin-top: .06em; }
.lm-row .lm-cents { font-size: .74em; margin-top: .06em; padding-bottom: .04em; border-bottom-width: .04em; }

/* The engraving. The glyphs are filled with fine diagonal lines, not a flat
   colour, and edged so they sit below (paper) or proud of (foil) the surface.
   Each part carries its own fill so the lines stay continuous across sizes. */
.lm-paper .lm-face > span, .lm-paper:not(:has(.lm-face)),
.lm-dark  .lm-face > span, .lm-dark:not(:has(.lm-face)) {
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lm-paper .lm-face > span, .lm-paper:not(:has(.lm-face)) {
  background-image: repeating-linear-gradient(-56deg,
    var(--lm-ink) 0 calc(var(--lm-cut) * 1.5),
    color-mix(in srgb, var(--lm-ink) 80%, transparent) calc(var(--lm-cut) * 1.5) calc(var(--lm-cut) * 2.2));
  /* pressed in: light catches the lower lip, shade falls from the upper */
  filter: drop-shadow(0 .018em 0 rgba(255,255,255,.8)) drop-shadow(0 -.012em 0 rgba(0,0,0,.28));
}
.lm-paper .lm-cents { border-bottom-color: color-mix(in srgb, var(--lm-ink) 70%, transparent); }
.lm-dark .lm-face > span, .lm-dark:not(:has(.lm-face)) {
  /* Three layers: a narrow band of light parked off to the left (see
     lm-sheen), the engraved lines, and the foil itself. */
  background-image:
    linear-gradient(100deg, transparent 38%, rgba(255,255,255,.85) 50%, transparent 62%),
    repeating-linear-gradient(-56deg, transparent 0 calc(var(--lm-cut) * 1.5), rgba(0,0,0,.26) calc(var(--lm-cut) * 1.5) calc(var(--lm-cut) * 2.2)),
    linear-gradient(176deg, color-mix(in srgb, var(--lm-foil) 55%, #fff) 0%, var(--lm-foil) 44%, color-mix(in srgb, var(--lm-foil) 74%, #000) 100%);
  background-size: 300% 100%, auto, auto;
  background-position: 150% 0, 0 0, 0 0;
  background-repeat: no-repeat, repeat, no-repeat;
  /* struck up: lit along the top edge, shadowed beneath */
  filter: drop-shadow(0 -.014em 0 rgba(255,255,255,.34)) drop-shadow(0 .03em .02em rgba(0,0,0,.6));
}
.lm-dark .lm-cents { border-bottom-color: color-mix(in srgb, var(--lm-foil) 75%, transparent); }

/* The account balance. The same figure, given what a balance gets on a
   statement: ruled off twice beneath, with a turned rosette behind it. */
.lm-bank { padding: .08em .16em .2em; isolation: isolate; }
.lm-bank::before {
  content: ''; position: absolute; z-index: -1; left: 50%; top: 46%;
  width: 2.3em; height: 2.3em; transform: translate(-50%, -50%);
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100' fill='none' stroke='%23c9a55c' stroke-width='.5'%3E%3Cg id='p'%3E%3Cellipse rx='47' ry='17'/%3E%3Cellipse rx='41' ry='12'/%3E%3C/g%3E%3Cuse href='%23p' transform='rotate(15)'/%3E%3Cuse href='%23p' transform='rotate(30)'/%3E%3Cuse href='%23p' transform='rotate(45)'/%3E%3Cuse href='%23p' transform='rotate(60)'/%3E%3Cuse href='%23p' transform='rotate(75)'/%3E%3Cuse href='%23p' transform='rotate(90)'/%3E%3Cuse href='%23p' transform='rotate(105)'/%3E%3Cuse href='%23p' transform='rotate(120)'/%3E%3Cuse href='%23p' transform='rotate(135)'/%3E%3Cuse href='%23p' transform='rotate(150)'/%3E%3Cuse href='%23p' transform='rotate(165)'/%3E%3Ccircle r='48.5'/%3E%3Ccircle r='9'/%3E%3C/svg%3E");
  opacity: .42; pointer-events: none;
}
.lm-bank::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: .07em;
  border-top: .018em solid color-mix(in srgb, var(--lm-foil) 60%, transparent);
  border-bottom: .018em solid color-mix(in srgb, var(--lm-foil) 34%, transparent);
}

/* Light across the foil: .lm-lit (and the strike) sends the parked band
   across once. Used when money arrives. */
.lm-lit .lm-face > span, .lm-strike.lm-dark .lm-face > span { animation: lm-sheen 1.5s cubic-bezier(.3, .6, .3, 1) .25s both; }
@keyframes lm-sheen { from { background-position: 150% 0, 0 0, 0 0; } to { background-position: -50% 0, 0 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .lm-lit .lm-face > span, .lm-strike.lm-dark .lm-face > span { animation: none; } }

/* Struck once, as it arrives: the figure settles into the surface. */
.lm-strike .lm-face { animation: lm-strike .7s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes lm-strike {
  0%   { transform: scale(1.09); opacity: 0; filter: blur(.04em); }
  55%  { transform: scale(.985); opacity: 1; filter: none; }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .lm-strike .lm-face { animation: none; } }

/* Forced colours: an engraving that vanishes is worse than plain text. */
@media (forced-colors: active) {
  .lm .lm-face > span, .lm, .lm-inline { -webkit-text-fill-color: currentColor; color: CanvasText; background: none; filter: none; }
}

/* An amount inside a drawing (SVG text): the face only. */
.lm-svg { font-family: 'Luminary Mint', 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif; font-weight: 700; font-variant-numeric: tabular-nums lining-nums; }

/* The plain amount, for screen readers, find-in-page and copying. */
.lm-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
