/* Avakode Hub — scene «demurragecheck» (assets/js/scenes/demurragecheck.js): the invoice read against the rule, the rule with
   its day ruler, the request for waiver (lane 4.1). Loaded by inc/scenes.php on a family page whose stage is this scene.
   Classes: .dc-* only; the common parts (.sc-head, .sc-sample, .sc-panel, .sc-stamp), the stage, the rail and the caption
   are scene.css. No absolute positioning of panels: a grid, so nothing meets at any width; the tag of a lit row has its
   room in the row (the right end of a wide table, a second line below 1100px), the timeline only shows it. */

/* The height of the stage before the module arrives = the height it takes (e2e: ≤ 4px apart at 1440, 1024, 768, 390).
   --stage-h: the window > 720px; --stage-h-narrow: the window ≤ 720px (rail on top, one column). */
/* Measured on the final frame (figure height at window widths 360–1500): 614px from 933px up (the right column of 340px fixes
   the height of the two-column layout, so it does not move between 960 and 1500); the one-column layout is taller and
   follows the wrapping of the letter: 1050px at 721-932; the window <= 720: 1172 at 390, 1105 at 430, 1045 above 470. */
.hub-scene[data-scene="demurragecheck"] { --stage-h: 614px; --stage-h-narrow: 1172px; }
@media (min-width: 721px) and (max-width: 932px) {
  .hub-scene[data-scene="demurragecheck"] { --stage-h: 1050px; }
}
@media (min-width: 401px) and (max-width: 470px) {
  .hub-scene[data-scene="demurragecheck"] { --stage-h-narrow: 1105px; }
}
@media (min-width: 471px) and (max-width: 720px) {
  .hub-scene[data-scene="demurragecheck"] { --stage-h-narrow: 1045px; }
}

.dc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 28px; align-items: start; }
.dc-table { position: relative; grid-column: 1; grid-row: 1 / span 2; }
.dc-rule { grid-column: 2; grid-row: 1; padding: 12px 14px 14px; }
.dc-letter { position: relative; grid-column: 2; grid-row: 2; margin-top: 30px; padding: 14px 16px 16px; }

/* the invoice: one row per item the rule requires; a flagged row has a second line, its tag */
.dc-cols, .dc-row { display: grid; grid-template-columns: minmax(0, 32%) minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 10px; }
.dc-cols { padding-top: 0; padding-bottom: 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dc-row { position: relative; border-top: 1px solid var(--line); }
.dc-row.is-last { border-bottom: 1px solid var(--line); }
/* the head is upper-case; a paragraph of the rule is not («541.7(a)», not «541.7(A)») */
.dc-cite { text-transform: none; }
.dc-row > span { position: relative; }
.dc-item { color: var(--fg-2); }
.dc-val { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dc-val.is-none { color: var(--muted); }
.dc-row > .dc-hot {
  position: absolute; inset: 0; border-left: 2px solid var(--signal); border-radius: 4px;
  background: rgba(124, 92, 252, .16); pointer-events: none;
}
.dc-row > .dc-tag { grid-column: 3; justify-self: end; white-space: nowrap; font-size: 11px; letter-spacing: .04em; color: var(--signal-hot); }
.dc-beam {
  position: absolute; left: 0; right: 0; top: -12px; height: 24px; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(124, 92, 252, .22) 40%, var(--signal) 50%, rgba(124, 92, 252, .22) 60%, transparent);
}

/* the rule: the 30-day allowance as a ruler of 42 day marks (day 0 = the last charged day, day 41 = the invoice date);
   the days over the allowance are a band, grown from the 30 mark by the timeline */
.dc-rule-line { margin: 0 0 12px; font-size: 12px; line-height: 1.45; color: var(--fg-2); }
.dc-rule-line b { font-weight: 500; color: var(--fg); }
.dc-ends { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dc-ruler { position: relative; }
.dc-ticks { display: flex; justify-content: space-between; height: 16px; }
.dc-ticks i { display: block; width: 1px; height: 100%; background: var(--fg-2); opacity: .5; }
.dc-over {
  position: absolute; left: calc(100% * 30 / 41); right: 0; top: 0; height: 16px; transform-origin: 0 50%;
  background: rgba(124, 92, 252, .32); border-right: 2px solid var(--signal);
}
.dc-limit { position: absolute; left: calc(100% * 30 / 41); top: -3px; bottom: -3px; width: 1px; background: var(--signal-hot); }
.dc-limit-label { width: calc(100% * 30 / 41); margin-top: 5px; text-align: right; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--signal-hot); }
.dc-days-count { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; color: var(--fg-2); font-size: 11px; }
.dc-days-num { min-width: 7ch; font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--signal-hot); }

/* the letter */
.dc-letter-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.dc-letter-line em { font-style: normal; font-size: 10.5px; color: var(--signal-hot); white-space: nowrap; }
.dc-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--signal); }
.dc-total span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
.dc-total b { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--signal-hot); }
.dc-window { margin-top: 8px; font-size: 11px; color: var(--fg-2); }
.dc-fly {
  position: absolute; left: 0; top: 0; display: flex; gap: 14px; padding: 5px 10px; white-space: nowrap; pointer-events: none;
  border: 1px solid var(--signal); border-radius: 4px; background: #1A1430; color: var(--fg); opacity: 0;
}
.dc-fly b { font-weight: 500; color: var(--signal-hot); }

/* the tag of a lit row stands at the right end of its row while the table is wide; narrower (the longest tag is ~210px), it
   becomes a second line of the row (the room is reserved, the timeline shows it) */
@container (max-width: 1099px) {
  .dc-cols, .dc-row { grid-template-columns: minmax(0, 38%) minmax(0, 1fr); padding: 7px 10px; }
  .dc-row > .dc-tag { grid-column: 1 / -1; justify-self: start; white-space: normal; }
}

/* one column when the stage is narrow (by its own width, not the window's): the invoice, the rule, the letter */
@container (max-width: 900px) {
  .dc-grid { grid-template-columns: minmax(0, 1fr); }
  .dc-table, .dc-rule, .dc-letter { grid-column: 1; grid-row: auto; }
  .dc-rule { margin-top: 18px; }
}

@container (max-width: 560px) {
  .dc-cols, .dc-row { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); padding: 6px 8px; }
  .dc-total b { font-size: 18px; }
}
