/* A worked figure with its working beside it: the declaration on a sheet at the left, the figure in the middle with its
   caption beneath, the readings in a column at the right. Rules, not cards. Mathematics is set as mathematics. */
:root {
  --paper: #f1f2f4;
  --sheet: #f9fafb;
  --ink: #14181f;
  --muted: #5c6572;
  --rule: #d2d6dc;
  --field: #ffffff;
  --negative: #c2185b;
  --positive: #1b66b3;
  --warn: #8a5a00;
  --surface: #e3e6ea;
  --mesh: #8f98a5;
  --ray: #a86b00;
  --rider: #1e7a4c;
  --math: "STIX Two Text", "Cambria Math", "Latin Modern Roman", "Times New Roman", serif;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --data: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1015;
    --sheet: #12161d;
    --ink: #e7eaee;
    --muted: #8d97a5;
    --rule: #272e39;
    --field: #0a0d11;
    --negative: #ff6b96;
    --positive: #63adff;
    --warn: #e0b060;
    --surface: #1a2029;
    --mesh: #4a5565;
    --ray: #f0c869;
    --rider: #74dba3;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 13px/1.5 var(--text); }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
[hidden] { display: none !important; }

#app {
  height: 100%; display: grid;
  grid-template: "bar bar bar" auto "declare figure measured" minmax(0, 1fr) / 348px minmax(0, 1fr) 304px;
}

#bar {
  grid-area: bar; display: flex; align-items: baseline; gap: 28px; padding: 13px 20px 11px;
  border-bottom: 1px solid var(--rule); background: var(--sheet);
}
#bar h1 { font-size: 15px; font-weight: 650; letter-spacing: -0.005em; }
#presets { display: flex; gap: 22px; flex-wrap: wrap; }
#share { margin-left: auto; }

button {
  font: inherit; color: var(--muted); background: none; border: 0; padding: 0 0 3px; cursor: pointer;
  border-bottom: 1.5px solid transparent;
}
button:hover { color: var(--ink); }
button[aria-pressed="true"], button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
button.quiet {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px;
  padding: 0; border: 0;
}
button.quiet:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }

#declare, #measured { background: var(--sheet); padding: 18px 20px 28px; overflow-y: auto; }
#declare { grid-area: declare; border-right: 1px solid var(--rule); }
#measured { grid-area: measured; border-left: 1px solid var(--rule); }
h2 { font-size: 13px; font-weight: 650; margin-bottom: 10px; }
h3 {
  font-size: 12px; font-weight: 600; color: var(--muted); margin: 20px 0 8px; padding-top: 12px;
  border-top: 1px solid var(--rule); display: flex; align-items: baseline; justify-content: space-between;
}
h3 button { font-weight: 400; }

.line { font: italic 15px/1.5 var(--math); margin-bottom: 8px; }
.line sub, .line sup { font-size: 0.7em; }
.note { color: var(--muted); max-width: 44ch; }
.hint { color: var(--muted); font-size: 12px; margin-top: 18px; }
code { font: 11.5px var(--data); }

.row { display: grid; align-items: center; gap: 8px; margin-bottom: 4px; }
.row.parameter { grid-template-columns: 46px 72px 1fr; }
.row.definition { grid-template-columns: 46px 1fr 16px; }
.row.field { grid-template-columns: 46px 1fr; }
.row.wide { grid-template-columns: 64px 1fr; }
.row label, .row .name { font: italic 14px var(--math); }
input[type="text"], input[type="number"] {
  width: 100%; min-width: 0; font: 12px var(--data); color: var(--ink); background: var(--field);
  border: 1px solid var(--rule); border-radius: 2px; padding: 4px 6px;
}
input[type="text"]:focus, input[type="number"]:focus { border-color: var(--ink); outline: none; }
input.name { font: italic 14px var(--math); border-color: transparent; background: none; padding-left: 0; }
input.name:hover { border-color: var(--rule); }
input[type="range"] { width: 100%; min-width: 0; accent-color: var(--ink); }
.row .remove { color: var(--muted); border: 0; padding: 0; font-size: 14px; line-height: 1; }
details { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--rule); }
summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.refusal { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--warn); color: var(--warn); overflow-wrap: anywhere; }

#figure { grid-area: figure; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-width: 0; }
#view { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view:active { cursor: grabbing; }
#caption { padding: 0 24px 12px; color: var(--muted); font-size: 12px; min-height: 30px; }
#caption b { color: var(--ink); font-weight: 600; }
#caption i { font: italic 13.5px var(--math); color: var(--ink); }
#caption .key { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin: 0 5px 0 12px; }
#tracing { margin-left: 12px; }
#transport {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; padding: 12px 24px 14px;
  border-top: 1px solid var(--rule);
}
#time { flex: 1 1 160px; align-self: center; }
#clock { font: 12px var(--data); min-width: 62px; font-variant-numeric: tabular-nums; }
#channels { display: flex; gap: 20px; flex-wrap: wrap; }

#readout { display: grid; gap: 14px; }
#readout div { display: grid; gap: 2px; }
#readout dt { color: var(--muted); font-size: 12px; }
#readout dd { font: 13px var(--data); font-variant-numeric: tabular-nums; }
#readout dd.headline { font: 600 26px/1.15 var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#readout dd.negative { color: var(--negative); }
#readout dd.positive { color: var(--positive); }
#readout dd.withheld { font: 13px/1.5 var(--text); color: var(--warn); }
#readout small { display: block; color: var(--muted); font: 11.5px var(--data); margin-top: 2px; }
#readout em { font: 12px var(--text); font-style: normal; color: var(--warn); margin-left: 8px; }
#readout em.good { color: var(--muted); }
.unit { display: flex; align-items: baseline; gap: 6px; color: var(--muted); margin-top: 18px; }
.unit input { width: 76px; }
#standing { padding-left: 16px; color: var(--muted); font-size: 12px; display: grid; gap: 7px; }
.colophon { color: var(--muted); font-size: 11.5px; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--rule); }
#unsupported { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--paper); }

@media (max-width: 980px) {
  html, body { height: auto; }
  #app { height: auto; grid-template: "bar" auto "figure" auto "measured" auto "declare" auto / minmax(0, 1fr); }
  #bar { flex-wrap: wrap; gap: 10px 20px; padding: 12px 16px 10px; }
  #presets { gap: 16px; order: 3; flex-basis: 100%; }
  #figure { grid-template-rows: 58vh auto auto; }
  #caption, #transport { padding-left: 16px; padding-right: 16px; }
  #declare, #measured { border: 0; border-top: 1px solid var(--rule); padding: 18px 16px 24px; overflow: visible; }
}
