/* Timing figure, second visuals round: a copy of jitter.css with every prefix renamed from jt to tm; the rules of the
   three variants (how the two shares are named and placed) are at the end.
   Timing (jitter) figure (class prefix tm-): honest and attack response times, a deadline, a jitter slider, and curves
   that can be dragged to set the gap between their means. The fragment holds the default state as static SVG;
   tm.js redraws it as the controls move. */
.tm{--tm-accent:var(--link-line);max-width:640px;margin:1.5rem auto 2rem;padding:1.25rem .9rem 1rem;
  border:1px solid var(--line);border-radius:6px;color:var(--ink);container-type:inline-size}
.tm [hidden]{display:none}
.tm figcaption{border-top:1px solid var(--line);padding-top:.85rem;margin:1rem .35rem 0;font:14px/1.6 var(--sans);color:var(--muted)}
.tm.is-live .tm-if-static,.tm:not(.is-live) .tm-if-live{display:none}
.tm-sr{position:absolute;width:1px;height:1px;margin:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* Key */
.tm__key{list-style:none;display:flex;flex-wrap:wrap;gap:.2rem 1.4rem;margin:0 .35rem .55rem;padding:0;font:600 13px/1.5 var(--sans);color:var(--ink)}
.tm__key li{display:flex;align-items:center;gap:.5rem;margin:0}
.tm-sw{flex:none;display:block;width:16px;height:11px;overflow:visible}
.tm-sw--dot{width:9px;height:9px}
.tm-sw--gap{width:15px;height:9px}

/* Plot. With the script, one SVG unit is one CSS pixel; without it the default drawing is 304 wide, which fits a 360 px phone unscaled. */
.tm__plot{position:relative}
.tm__svg{display:block;width:100%;height:auto;margin:0 auto;overflow:visible}
.tm:not(.is-live) .tm__svg{max-width:304px;margin-left:0}
.tm__svg text{font:12px var(--sans);fill:var(--ink)}
.tm__svg .tm-label{font-weight:600}
.tm__svg .tm-tick-label{font:11px var(--mono);fill:var(--muted)}
.tm-axis{fill:none;stroke:var(--muted);stroke-width:1.2}
.tm-tick{fill:none;stroke:var(--muted);stroke-width:1}
.tm-curve{fill:none;stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}
.tm-curve--honest,.tm-sw .tm-curve--honest{stroke:var(--ink)}
.tm-curve--attack{stroke:var(--tm-accent)}
.tm-area{stroke:none}
.tm-area--honest{fill:var(--ink);fill-opacity:.1}
.tm-area--attack{fill:var(--tm-accent);fill-opacity:.18}
.tm-hit{stroke:none}
.tm-hit--flag{fill:var(--ink);fill-opacity:.86}
.tm-hit--pass{fill:var(--tm-accent)}
.tm-deadline{fill:none;stroke:var(--ink);stroke-width:1.3;stroke-dasharray:4 3}
.tm-gap{fill:none;stroke:var(--ink);stroke-width:1.2;stroke-linecap:round}
.tm-pin{fill:var(--ink);stroke:var(--paper);stroke-width:1.5}
.tm:not(.is-live) .tm-pin{display:none}
/* The curve or line under the pointer, being dragged, or whose handle has the focus, is drawn a little heavier. */
.tm-curve.is-hot{stroke-width:2.25}
.tm-deadline.is-hot{stroke-width:1.9}

/* The curves and the deadline line are dragged on the plot. touch-action is set on the whole plot: Chrome does not
   honour it on a shape inside the SVG. Vertical scrolling and pinch zoom still start here. */
.tm.is-live .tm__svg{touch-action:pan-y pinch-zoom}
.tm.is-live .tm__svg.is-over,.tm.is-dragging,.tm.is-dragging .tm-range{cursor:ew-resize}
.tm.is-dragging .tm__svg{user-select:none;-webkit-user-select:none}

/* Under the plot: the axis name, and the way back to the defaults. */
.tm__under{display:flex;align-items:baseline;justify-content:space-between;gap:0 1rem;margin:0 .35rem 0 calc(.35rem + 6px)}
.tm:not(.is-live) .tm__under{max-width:calc(304px - 12px)}
.tm-axis-name{font:11.5px/1.5 var(--sans);color:var(--muted)}
.tm-reset{flex:none;margin:-.25rem -.4rem;padding:.25rem .4rem;border:0;border-radius:2px;background:none;font:12px/1.5 var(--mono);color:var(--ink);cursor:pointer;
  text-decoration:underline;text-decoration-color:var(--tm-accent);text-decoration-thickness:1px;text-underline-offset:.25em;-webkit-tap-highlight-color:transparent}
.tm-reset:hover{text-decoration-thickness:2px}
.tm-reset:focus-visible{outline-offset:0}
.tm-reset[aria-disabled="true"]{color:var(--muted);text-decoration-color:var(--line);cursor:default}
.tm-reset[aria-disabled="true"]:hover{text-decoration-thickness:1px}

/* Sliders. Both rows share one grid, so the two tracks have the same length. */
.tm__ctls{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:0 1rem;margin:.35rem .35rem 0}
.tm__ctl{grid-column:1/-1;display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"name range val";align-items:center;gap:0 1rem}
@supports (grid-template-columns:subgrid){.tm__ctl{grid-template-columns:subgrid}}
.tm:not(.is-live) .tm__ctl{padding:.2rem 0}
.tm-ctl__name{grid-area:name;font:600 13px/1.4 var(--sans);color:var(--ink)}
.tm.is-live .tm-ctl__name{cursor:pointer}
.tm-ctl__note{font-weight:400;color:var(--soft)}
.tm-ctl__val{grid-area:val;min-width:9.5ch;text-align:right}
.tm-num{font:15px/1.4 var(--mono);color:var(--ink);white-space:nowrap;font-variant-numeric:tabular-nums}
.tm-range{grid-area:range;-webkit-appearance:none;appearance:none;display:block;width:100%;height:44px;margin:0;padding:0;border:0;background:transparent;
  color:var(--tm-accent);cursor:pointer;touch-action:pan-y;-webkit-tap-highlight-color:transparent}
.tm-range::-webkit-slider-runnable-track{height:2px;border-radius:1px;background:var(--muted)}
.tm-range::-moz-range-track{height:2px;border-radius:1px;background:var(--muted)}
.tm-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;box-sizing:border-box;width:20px;height:20px;margin-top:-9px;border-radius:50%;
  background:currentColor;border:2px solid var(--paper)}
.tm-range::-moz-range-thumb{box-sizing:border-box;width:20px;height:20px;border-radius:50%;background:currentColor;border:2px solid var(--paper)}
.tm-range:focus{outline:none}
.tm-range:focus-visible::-webkit-slider-thumb{outline:3px solid var(--signal);outline-offset:2px}
.tm-range:focus-visible::-moz-range-thumb{outline:3px solid var(--signal);outline-offset:2px}
.tm-range.is-quiet:focus-visible::-webkit-slider-thumb{outline:none}
.tm-range.is-quiet:focus-visible::-moz-range-thumb{outline:none}

/* The handle of each curve: a range input laid over the time axis, its thumb on the curve's mean. It takes the focus
   and the arrow keys; the pointer passes through it to the plot, which drags the whole curve. tm.js sets left,
   width, and top (through the CSSOM, which a strict style-src policy allows). */
.tm-knob{position:absolute;left:0;top:0;width:100%;pointer-events:none}
.tm-knob::-webkit-slider-runnable-track{background:transparent}
.tm-knob::-moz-range-track{background:transparent}
.tm-knob::-webkit-slider-thumb{width:16px;height:16px;margin-top:-7px}
.tm-knob::-moz-range-thumb{width:16px;height:16px}
.tm-knob--honest{color:var(--ink)}
.tm-knob--attack{color:var(--tm-accent)}

/* Numbers. Values are mono in fixed-width slots, so nothing moves as they change. */
.tm__stats{display:grid;grid-template-columns:repeat(3,minmax(0,auto));justify-content:space-between;gap:0 1rem;margin:.5rem .35rem 0;padding:.75rem 0 0;border-top:1px solid var(--line)}
.tm-stat{display:flex;flex-direction:column;justify-content:space-between;gap:.15rem;margin:0}
.tm-stat dt{display:flex;align-items:center;gap:.45rem;font:13px/1.4 var(--sans);color:var(--soft)}
.tm-stat dd{margin:0;min-width:9.5ch}

@container (max-width:470px){
  .tm__ctls{grid-template-columns:minmax(0,1fr) auto;margin-top:.6rem}
  .tm__ctl{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"name val" "range range"}
  .tm__ctl:not(:first-child){margin-top:.35rem}
}
/* The three numbers need about 512 px side by side; below that they stack, one per row. */
@container (max-width:530px){
  .tm__stats{grid-template-columns:1fr;padding-top:.3rem}
  .tm-stat{flex-direction:row;align-items:baseline;justify-content:space-between;gap:1rem;padding:.5rem 0;border-bottom:1px solid var(--line)}
  .tm-stat:last-child{border-bottom:0;padding-bottom:0}
  .tm-stat dd{text-align:right}
}
@media(max-width:620px){.tm{padding:1rem .55rem .85rem}}
@media print{
  .tm-range,.tm-reset,.tm-pin{display:none}
  .tm__ctl{padding:.2rem 0}
  .tm.is-live figcaption .tm-if-static{display:inline}
  .tm.is-live figcaption .tm-if-live{display:none}
}

/* ---- round of 18 Nov: shares beside the deadline, names under the handles, one slider, no table, no caption ---- */
.tm.fg{max-width:48rem;margin:2rem 0;padding:1.1rem 1.25rem 1rem}
@media(max-width:560px){.tm.fg{padding:1rem .8rem .8rem}}
.tm__svg .tm-side{font:13px var(--sans);fill:var(--soft)}
.tm__svg .tm-side tspan{font:600 13.5px var(--mono);fill:var(--ink)}
.tm__svg .tm-side--pass,.tm__svg .tm-side--pass tspan{fill:var(--tm-accent)}
.tm__svg .tm-name{font:12.5px var(--sans);fill:var(--muted)}
.tm__svg .tm-axisname{font:12px var(--sans);fill:var(--muted)}
.tm-axis-head{fill:var(--muted)}
.tm-knob--deadline{color:var(--ink)}
.tm.is-live .tm-pin{display:none}
.tm__row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:0 1rem;margin:.1rem 6px 0}
.tm__row .tm-range{grid-area:auto}
.tm__row .tm-ctl__name{grid-area:auto}
.tm__row .tm-reset{margin:0 -.4rem 0 0}
.tm:not(.is-live) .tm__row{display:none}
@media print{.tm__row{display:none}}

/* ---- second visuals round: how the two shares are named and placed. Colours match the two solid regions. ---- */
/* a and b: a phrase over its number, either side of the deadline's name */
.tm__svg .tm-side{font:13px var(--sans);fill:var(--ink)}
.tm__svg .tm-share{font:600 14px var(--mono);fill:var(--ink)}
.tm__svg .tm-side--pass,.tm__svg .tm-share--pass{fill:var(--tm-accent)}
/* b: a leader from each number to a ring inside its region */
.tm-lead{fill:none;stroke-width:1;stroke-linecap:round}
.tm-lead--flag{stroke:var(--ink)}
.tm-lead--pass{stroke:var(--tm-accent)}
.tm-dot{fill:var(--paper);stroke-width:1.5}
.tm-dot--flag{stroke:var(--ink)}
.tm-dot--pass{stroke:var(--tm-accent)}
/* c: a key under the chart, one row per region: swatch, plain phrase, number */
.tm .tm__key{list-style:none;display:grid;gap:.4rem;margin:.5rem 6px .35rem;padding:0}
.tm:not(.is-live) .tm__key{max-width:292px}
.tm .tm-key__row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline;gap:0 .6rem;margin:0;padding:0}
.tm .tm-key__sw{display:block;width:12px;height:12px;border-radius:2px;transform:translateY(1px)}
.tm .tm-key__sw--flag{background:var(--ink);opacity:.86}
.tm .tm-key__sw--pass{background:var(--tm-accent)}
.tm .tm-key__what{font:13.5px/1.4 var(--sans);color:var(--ink)}
.tm .tm-key__term{color:var(--muted);white-space:nowrap}
.tm .tm-key__num{min-width:7ch;font:600 14px/1.4 var(--mono);color:var(--ink);text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.tm .tm-key__row:last-child .tm-key__num{color:var(--tm-accent)}
