taxa-server 0.1.0

axum web server for taxa: reproduces the HTTP contract + serves the embedded D3 frontend.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
/* taxa — Paradigm-inspired styling.
 *
 * Two fonts, no bold:
 *   EB Garamond  — display serif for headings
 *   Space Mono   — monospace for everything else (body, labels, ui)
 * Distinctive feel comes from the universal monospace + selective serif.
 */

:root {
  --color-bg:       #ffffff;
  --color-fg:       #1a1a1a;
  --color-muted:    #7a7a7a;
  --color-line:     #1a1a1a;
  --color-line-soft: #d8d8d8;
  --color-tint:     #f5f5f5;
  --color-accent:   #00a14b;     /* default accent (override via ThemeConfig) */
  --serif:          "EB Garamond", Georgia, "Times New Roman", serif;
  --mono:           "Space Mono", "SF Mono", Menlo, Consolas, monospace;
  --header-h:       64px;
  --sub-h:          44px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%; margin: 0;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--color-fg);
  background: var(--color-bg);
}

body { display: flex; flex-direction: column; }

/* ─── Header ────────────────────────────────────────────────────────── */

header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); min-height: var(--header-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-bg);
  position: sticky; top: 0; z-index: 50;
}

.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand .logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--color-line); border-radius: 50%;
  text-decoration: none; color: var(--color-fg);
  font-size: 20px; line-height: 1;
}

#page-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-title em {
  font-style: normal;
  border-bottom: 2px solid var(--color-line);
  padding-bottom: 1px;
}
#page-title a#home-link {
  color: var(--color-fg);
  text-decoration: none;
  font-style: italic;        /* the wordmark reads as a serif italic */
}
#page-title a#home-link:hover { color: var(--color-accent); }

.header-right { display: flex; align-items: center; gap: 8px; }
.hamburger {
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--color-line);
  border-radius: 0;
  font-family: var(--mono); font-size: 16px;
  color: var(--color-fg);
  cursor: pointer;
}
.hamburger:hover { background: var(--color-tint); }
/* Dataset switcher (multi-dataset servers): sits left of the hamburger. */
#dataset-select {
  height: 36px;
  background: transparent;
  border: 1px solid var(--color-line);
  border-radius: 0;
  font-family: var(--mono); font-size: 12px;
  color: var(--color-fg);
  padding: 0 8px;
  cursor: pointer;
}
#dataset-select:hover { background: var(--color-tint); }

/* ─── Sub-header (tabs + selection summary) ─────────────────────────── */

#subheader {
  display: flex; align-items: stretch; justify-content: space-between;
  height: var(--sub-h); min-height: var(--sub-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-bg);
  position: sticky; top: var(--header-h); z-index: 49;
}

#tabs { display: flex; align-items: stretch; gap: 0; }
#tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--color-line-soft);
  font-family: var(--mono); font-size: 12px; font-weight: 400;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  cursor: pointer;
}
#tabs button:first-child { border-left: 1px solid var(--color-line-soft); }
#tabs button:hover { color: var(--color-fg); background: var(--color-tint); }
#tabs button.active {
  color: var(--color-fg);
  background: var(--color-fg);
  color: var(--color-bg);
}
#tabs button .ico { font-size: 14px; line-height: 1; }

.subheader-right {
  display: flex; align-items: center; gap: 12px;
  padding-left: 12px;
}
#selection-count { font-size: 11px; color: var(--color-muted); }

/* ─── Layout: sidebar + main ────────────────────────────────────────── */

#layout { display: flex; flex: 1; min-height: 0; }

aside#sidebar {
  width: 260px; min-width: 260px;
  padding: 18px 20px;
  border-right: 1px solid var(--color-line);
  background: var(--color-bg);
  overflow-y: auto;
}
body.sidebar-hidden aside#sidebar { display: none; }

main#content {
  flex: 1; padding: 18px 24px; overflow: auto;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--color-bg);
}

.tab { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tab.active { display: flex; }

.placeholder { color: var(--color-muted); }
.muted       { color: var(--color-muted); font-size: 11px; }

/* ─── Sidebar selection UI ──────────────────────────────────────────── */

.picker-label {
  display: block;
  margin: 0 0 6px 0;
  font-size: 11px;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mode-tabs   { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 16px; }
/* Size-by has 6 metrics — too cramped on one row. Split into two
   stacked rows of 3 buttons each; collapse the inner horizontal
   border so they read as one connected grid. */
.metric-pickers { margin-bottom: 16px; }
.metric-pickers .mode-tabs { margin-bottom: 0; }
.metric-pickers .mode-tabs + .mode-tabs { margin-top: -1px; }

/* Treemap filter widgets — same monospace look as the picker buttons so the
   filter section reads as continuous with the controls above it. */
/* The filter labels get extra top-margin so each filter group sits
   in a visually distinct band — ~1.4× the inter-picker spacing. */
.picker-label.filter { margin-top: 22px; }
/* The first filter label sits right after the Levels picker (a bare
   .mode-tabs, not wrapped in .metric-pickers). Give that boundary an
   extra-large gap to set the whole filter section apart from the
   bucket/size/levels controls above. Margins collapse, so 82px wins
   against the .mode-tabs margin-bottom (16px). */
.mode-tabs + .picker-label.filter { margin-top: 82px; }

.ent-combo input {
  width: 100%; box-sizing: border-box;
  padding: 6px 8px;
  font-family: var(--mono); font-size: 10.5px;
  background: transparent; color: var(--color-muted);
  border: 1px solid var(--color-line-soft);
}
.age-range {
  display: flex; align-items: center; gap: 6px; margin-bottom: 16px;
}
.age-range input {
  flex: 1; min-width: 0; box-sizing: border-box;
  padding: 6px 8px;
  font-family: var(--mono); font-size: 10.5px;
  background: transparent; color: var(--color-muted);
  border: 1px solid var(--color-line-soft);
}
.age-sep { color: var(--color-muted); font-family: var(--mono); }

/* Clear-X overlay inside filter text inputs. Positioned absolutely so
   it floats above the input's right edge without disturbing layout.
   Hidden by default; the JS toggles [hidden] based on input value. */
.input-clear-wrap { position: relative; display: block; }
.age-range .input-clear-wrap { flex: 1; min-width: 0; }
.age-range .input-clear-wrap input { width: 100%; }
.input-clear-wrap input { padding-right: 22px; }
.input-clear-wrap .input-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; padding: 0 4px;
  font-family: var(--mono); font-size: 13px; line-height: 1;
  color: var(--color-muted); cursor: pointer;
}
.input-clear-wrap .input-clear:hover { color: var(--color-fg); }

.mode-tabs button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--color-line-soft);
  /* Collapse the shared border with the neighbor to the right and below by
     overlapping 1px, so every edge reads as a single 1px line whether the row
     is full-width or wrapped onto multiple lines (no doubled seams, no
     missing/clipped right edge on per-row last cells). */
  margin: 0 -1px -1px 0;
  position: relative;
  padding: 6px 4px;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--color-muted);
  letter-spacing: 0.02em; text-transform: lowercase;
  cursor: pointer;
}
/* Mcap-filter chips contain unit suffixes (M/B/T) that lose meaning
   when lowercased — opt them out of the .mode-tabs lowercase rule. */
.mode-tabs[data-group="mcap-filter"] button { text-transform: none; }
.mode-tabs button:hover    { color: var(--color-fg); }
.mode-tabs button.active   { background: var(--color-fg); color: var(--color-bg); border-color: var(--color-fg); z-index: 1; }
.mode-tabs button:disabled {
  color: var(--color-line-soft); cursor: not-allowed; background: transparent;
}
.mode-tabs button:disabled:hover { color: var(--color-line-soft); }

/* Treemap bounding-knob sliders (branch cap / leaf cap / lookahead). */
.bounding-controls { margin-top: 22px; }
.slider-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.slider-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--color-accent); }
/* Editable number readout — override the global block/full-width #mode-body input
   so it stays a compact inline box beside the slider. */
.slider-row input.slider-val {
  display: inline-block; width: 4.5ch; margin: 0; padding: 2px 4px;
  font-family: var(--mono); font-size: 11px; color: var(--color-fg);
  text-align: right;
  border: 1px solid var(--color-line-soft); border-radius: 3px;
  background: var(--color-bg);
}
.slider-row input.slider-val:focus { outline: none; border-color: var(--color-accent); }
/* Hide the spin buttons (we have the slider for nudging). */
.slider-row input.slider-val::-webkit-inner-spin-button,
.slider-row input.slider-val::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.reset-bounds {
  margin-top: 4px; padding: 5px 10px; width: 100%;
  font-family: var(--mono); font-size: 11px; color: var(--color-muted);
  background: transparent; border: 1px solid var(--color-line-soft); border-radius: 3px;
  cursor: pointer; letter-spacing: 0.03em;
}
.reset-bounds:hover { background: var(--color-tint); color: var(--color-fg); }

#mode-body label {
  display: block; margin-bottom: 12px;
  font-size: 11px; color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#mode-body select, #mode-body input, #mode-body textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 6px 8px;
  font-family: var(--mono); font-size: 12px;
  border: 1px solid var(--color-line-soft);
  border-radius: 0; background: var(--color-bg);
  color: var(--color-fg);
}
#mode-body select:focus,
#mode-body input:focus,
#mode-body textarea:focus {
  outline: none; border-color: var(--color-line);
}
#mode-body textarea { font-family: var(--mono); resize: vertical; }

/* ─── Viz panel controls (above each chart) ─────────────────────────── */

.viz-controls {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  padding: 0 0 12px 0; margin-bottom: 12px;
  border-bottom: 1px solid var(--color-line-soft);
  font-size: 12px;
}
.viz-controls label {
  display: flex; align-items: center; gap: 6px;
  color: var(--color-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.viz-controls select, .viz-controls input {
  padding: 4px 6px;
  font-family: var(--mono); font-size: 12px;
  color: var(--color-fg);
  border: 1px solid var(--color-line-soft);
  border-radius: 0;
  background: var(--color-bg);
  max-width: 320px;
}
/* Colormap dropdown (map view) — custom because each row shows a gradient preview. */
.cmap-dd { position: relative; margin-bottom: 16px; }
.cmap-cur {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 5px 8px; background: var(--color-bg); color: var(--color-fg);
  border: 1px solid #cfcfcf; cursor: pointer; font-family: var(--mono); font-size: 12px;
}
.cmap-caret { margin-left: auto; opacity: 0.6; }
.cmap-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  background: var(--color-bg); border: 1px solid #cfcfcf; border-top: none;
  max-height: 280px; overflow-y: auto;
}
.cmap-opt {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer;
  font-family: var(--mono); font-size: 12px;
}
.cmap-opt:hover { background: rgba(0, 0, 0, 0.06); }
.cmap-swatch { display: inline-block; width: 64px; height: 12px; border: 1px solid #cfcfcf; flex: 0 0 auto; }

.tip {
  position: absolute; padding: 6px 9px;
  background: var(--color-fg); color: var(--color-bg);
  font-family: var(--mono); font-size: 11px;
  border-radius: 0; pointer-events: none; z-index: 10;
}
.tip .tip-title { margin-bottom: 3px; }
/* Title row holds the node name on the left (room for a right-side tag later). */
.tip .tip-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 3px;
}
.tip .tip-title-row .tip-title { margin-bottom: 0; }
.tip table.tip-table {
  border-collapse: collapse;
  /* Header row + four column alignment, no borders. Door open to
     adding framing later by styling td borders. */
}
.tip table.tip-table td {
  padding: 0 12px 0 0;
  vertical-align: top;
  line-height: 1.35;
}
.tip table.tip-table td:nth-child(2) { text-align: right; }   /* value */
.tip table.tip-table td:nth-child(3) {
  text-align: right;
  opacity: 0.65;                                              /* % all muted */
}
.tip table.tip-table td:nth-child(4) {
  text-align: right; padding-right: 0;
  opacity: 0.65;                                              /* % parent muted */
}
.tip table.tip-table tr.tip-header td {
  opacity: 0.5;
  font-size: 10px;
  letter-spacing: 0.03em;
  padding-bottom: 2px;
}
.err { color: #c00; }
#content { position: relative; }
.radio-group { display: inline-flex; gap: 4px; }
.radio-group label { font-size: 11px; gap: 4px; text-transform: none; letter-spacing: 0; }

/* ─── Viz canvases ──────────────────────────────────────────────────── */

#sc-canvas, #ts-canvas { min-height: 450px; }
#tm-canvas {
  flex: 1; min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);     /* white — gaps between cells are parent's color, not dark */
}

/* ─── Treemap breadcrumb ────────────────────────────────────────────── */

#tm-breadcrumb {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  display: flex; align-items: center; gap: 4px;
  min-height: 22px;
  color: var(--color-muted);
}
#tm-breadcrumb .bc-link  { color: var(--color-fg); cursor: pointer; text-decoration: none; border-bottom: 1px solid transparent; }
#tm-breadcrumb .bc-link:hover { border-bottom-color: var(--color-fg); }
#tm-breadcrumb .bc-sep   { color: var(--color-muted); padding: 0 2px; }
#tm-breadcrumb .bc-here  { color: var(--color-fg); }

/* ─── Global entity search box (subheader-right) ────────────────────── */

#entity-search-wrap { position: relative; }
#entity-search {
  width: 240px;
  padding: 5px 9px;
  border: 1px solid var(--color-line-soft);
  background: var(--color-bg);
  font-family: var(--mono); font-size: 11px;
  color: var(--color-fg);
}
#entity-search:focus { outline: none; border-color: var(--color-fg); }
#entity-search-results {
  position: absolute; top: calc(100% + 3px); right: 0;
  width: 320px; max-height: 360px; overflow-y: auto;
  margin: 0; padding: 0; list-style: none;
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  z-index: 60;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
#entity-search-results li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-line-soft);
}
#entity-search-results li:last-child { border-bottom: none; }
#entity-search-results li:hover,
#entity-search-results li.active { background: var(--color-tint); }
#entity-search-results .sr-sym {
  font-family: var(--mono); font-size: 11px; color: var(--color-fg);
  white-space: nowrap;
}
#entity-search-results .sr-name {
  font-family: var(--serif); font-size: 13px; color: var(--color-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* In entity mode the group-view tab selector is hidden — but the search
   box must stay pinned to the right of the sub-header (not slide left into
   the gap the tabs left behind), so override the space-between. */
body.entity-mode #tabs { display: none; }
body.entity-mode #subheader { justify-content: flex-end; }

/* ─── Individual-entity split view ──────────────────────────────────── */

.entity-split {
  flex: 1; min-height: 0;
  display: flex; gap: 24px;
}
.entity-meta {
  width: 320px; min-width: 280px;
  overflow-y: auto;
  border-right: 1px solid var(--color-line-soft);
  padding-right: 20px;
}
/* Metadata hidden → chart takes the full width. */
.entity-split.meta-hidden .entity-meta { display: none; }
.entity-chart { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#ent-canvas { flex: 1; min-height: 0; position: relative; }

/* Custom metric combobox: text input + scrollable autocomplete dropdown. */
.ent-combo { position: relative; margin-bottom: 16px; }
.ent-combo ul {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto;
  margin: 0; padding: 0; list-style: none;
  background: var(--color-bg); border: 1px solid var(--color-line);
  z-index: 40; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}
.ent-combo li {
  padding: 5px 8px;
  font-family: var(--mono); font-size: 11px; color: var(--color-fg);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ent-combo li:hover,
.ent-combo li.active { background: var(--color-tint); }
.ent-combo li.current { color: var(--color-accent); }
.ent-combo li.empty { color: var(--color-muted); cursor: default; }

/* ── Shared line-plot chart classes (viz/lineplot.js) — used by both the
   individual-entity chart and the group per-branch chart. */
.lp-grid line {
  stroke: var(--color-line-soft); stroke-width: 1;
  stroke-dasharray: 2 3; shape-rendering: crispEdges;
}
.lp-area { fill: rgba(78, 121, 167, 0.13); stroke: none; }
.lp-crosshair {
  stroke: var(--color-muted); stroke-width: 1;
  stroke-dasharray: 3 3; pointer-events: none;
}
.lp-focus { fill: #fff; stroke: #4e79a7; stroke-width: 2; pointer-events: none; }
.lp-axis-label {
  font-family: var(--mono); font-size: 14px; fill: var(--color-muted);
}
.lp-canvas .tick text { font-size: 13px; fill: var(--color-fg); }
.lp-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--color-fg); color: var(--color-bg);
  padding: 5px 8px; font-family: var(--mono); font-size: 11px;
  line-height: 1.35; white-space: nowrap;
  display: flex; flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.lp-tooltip .tt-date { opacity: 0.7; font-size: 10px; }
.lp-tooltip .tt-val, .lp-tooltip .tt-ohlc { font-size: 13px; }

.ent-head { margin-bottom: 18px; }
.ent-name {
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: 24px;
  line-height: 1.15;
}
.ent-sym {
  font-family: var(--mono); font-size: 12px; color: var(--color-muted);
  margin-top: 2px;
}
.ent-sub {
  font-family: var(--serif); font-size: 14px; color: var(--color-fg);
  margin-top: 6px;
}
.ent-facts { margin: 0 0 18px; }
.ent-facts > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--color-line-soft);
}
.ent-facts dt {
  font-family: var(--mono); font-size: 10.5px; text-transform: lowercase;
  letter-spacing: 0.02em; color: var(--color-muted);
}
.ent-facts dd { margin: 0; font-family: var(--serif); font-size: 13px; text-align: right; }

.ent-metrics { width: 100%; border-collapse: collapse; }
.ent-metrics td { padding: 4px 0; border-bottom: 1px solid var(--color-line-soft); }
.ent-mlabel {
  font-family: var(--mono); font-size: 10.5px; color: var(--color-muted);
  text-transform: lowercase; letter-spacing: 0.02em;
}
.ent-mval {
  font-family: var(--mono); font-size: 12px; color: var(--color-fg);
  text-align: right;
}
.ent-asof { margin-top: 10px; }