/* The month-end pile (sections/pile.js). One month plays twice as you scroll: before, each day's invoices land on
   the accountant's pile until month end; now, each night they go straight from Florisoft into Xero and no pile forms.
   Example numbers only. Without JS: the caption and the two summary lines. */

.mp { --mp-paper: #fbfbfa; --mp-edge: #d9d9d6; --mp-desk: var(--ui-line); width: min(var(--wall), 100%); margin-top: 4rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mp { --mp-paper: #e9e9e6; --mp-edge: #9a9a96; } }
:root[data-theme="dark"] .mp { --mp-paper: #e9e9e6; --mp-edge: #9a9a96; }

.mp-track { position: relative; }
.mp.live .mp-track { height: 460vh; }
.mp-stage { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 1.5rem; padding: 1.5rem 0; }
.mp.live .mp-stage { position: sticky; top: 0; height: 100svh; box-sizing: border-box; padding: 5.5rem 0 2rem; }

.mp-head { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }
.mp-tag { font: 500 0.6875rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mp-title { margin-top: 0.75rem; font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; min-height: 2.1em; }
.mp-title b { font-weight: 600; color: var(--muted); }
.mp-count { text-align: right; font-variant-numeric: tabular-nums; }
.mp-count .n { display: block; font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 600; letter-spacing: -0.04em; line-height: 0.9; }
.mp-count .l { display: block; margin-top: 0.5rem; font: 500 0.6875rem/1.3 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* the desk, seen from above at an angle */
.mp-scene { position: relative; min-height: 0; perspective: 1800px; overflow: hidden; }
.mp-plane {
  position: absolute; left: 50%; top: 64%; width: 1000px; height: 520px; transform-style: preserve-3d;
  transform: translate(-50%, -50%) scale(var(--s, 1)) rotateX(57deg) rotateZ(-24deg);
}
.mp-spot { position: absolute; width: 150px; height: 110px; margin: -55px 0 0 -75px; border: 1px solid var(--mp-desk); border-radius: 6px; }
.mp-spot.desk { border-style: dashed; }
.mp-spot.xero { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.mp-spot.src { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.mp-label {
  position: absolute; left: 0; top: calc(100% + 14px); width: 260px; font: 500 clamp(15px, calc(8px / var(--s, 1)), 24px)/1.3 var(--font-mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.mp-label small { display: block; margin-top: 4px; font-size: clamp(12px, calc(6.5px / var(--s, 1)), 19px); color: var(--muted); letter-spacing: 0.08em; }
.mp-wire { position: absolute; left: 245px; top: 260px; width: 510px; height: 1px; background: var(--mp-desk); transform-origin: left; }
.mp-run { position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #ff5a3c; box-shadow: 0 0 0 6px rgba(255, 90, 60, 0.16); opacity: 0; }

.mp-sheet {
  position: absolute; left: 0; top: 0; width: 110px; height: 76px; margin: -38px 0 0 -55px; box-sizing: border-box;
  background: var(--mp-paper); border: 1px solid var(--mp-edge); border-radius: 1px; padding: 9px 10px; opacity: 0;
  font: 500 8px/1 var(--font-mono); letter-spacing: 0.06em; color: #6b6b6b;
  background-image: linear-gradient(#cfcfcb, #cfcfcb), linear-gradient(#e2e2de, #e2e2de), linear-gradient(#e2e2de, #e2e2de), linear-gradient(#e2e2de, #e2e2de);
  background-size: 34px 2px, 70px 2px, 56px 2px, 22px 2px; background-repeat: no-repeat;
  background-position: 66px 10px, 10px 30px, 10px 40px, 78px 58px;
  backface-visibility: hidden; will-change: transform, opacity;
}

/* the month */
.mp-ghost { background: none; border: 1px dashed var(--muted); opacity: 0; will-change: auto; }
.mp-shadow { position: absolute; left: 0; top: 0; width: 220px; height: 170px; margin: -85px 0 0 -110px; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ink) 22%, transparent), transparent); }

.mp-cal { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 3px; }
.mp-cal i {
  position: relative; display: block; height: 30px; border-top: 2px solid var(--ui-line); font: 500 10px/1 var(--font-mono); font-style: normal;
  color: var(--muted); padding-top: 7px; text-align: center; transition: border-color 200ms, color 200ms;
}
.mp-cal i.on { border-color: var(--ink); color: var(--ink); }
.mp-cal i.run::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #ff5a3c; }
.mp-cal i:nth-child(odd):not(.on) { color: transparent; }

.mp-fallback { margin-top: 1rem; color: var(--muted); }
.mp.live .mp-fallback, .mp.still .mp-fallback { display: none; }

@media (max-width: 700px) {
  .mp.live .mp-stage { padding: 4.5rem 0 1.5rem; gap: 1rem; }
  .mp-count { text-align: left; }
  .mp-cal { gap: 1px; }
  .mp-cal i { font-size: 8px; height: 22px; }
  .mp-cal i:not(:first-child):not(:last-child) { color: transparent; }
}
