/* Evidence graphics (lib/biosequence/graphics/). Load after style.css, which holds the color, type and spacing
   tokens every rule here uses. Every size, space and radius is a token; every color a token. The drawings write no
   style attribute, so the pages' strict content policy holds: what is not an SVG attribute is here.

   Each graphic's root is a size container, so its rows put the name and value on one line and the bar on the next
   when the graphic is narrow, whatever the page's width. Place a graphic in a block, or a grid cell with a set
   width: a size container takes no width from what it holds. */

/* The data series of the result charts and the kit, in the style guide's validated order (Sequences, "Charts").
   lib/biosequence/graphics/tokens.mjs holds the same values for drawings saved as files. */
:root {
  --series-1: #1d4ed8;
  --series-2: #0891b2;
  --series-3: #b45309;
  --series-neutral: #57534e;
  --series-outside: var(--field);
}

/* ---------------------------------------------------------------- shared */

.eg-figure { display: grid; gap: var(--space-3); min-width: 0; margin: 0; }
.eg-caption { font-size: var(--text-s); line-height: var(--leading-read); color: var(--ink-2); }
.eg-table summary {
  display: inline-flex; align-items: center; min-height: 44px; cursor: pointer;
  font-size: var(--text-s); font-weight: var(--weight-medium); color: var(--pressable);
}
/* A scroll box holds what it scrolls, words for screen readers too: they are placed from it, not from the page. */
.eg-table-scroll { position: relative; overflow-x: auto; margin-top: var(--space-1); }
.eg-twin caption { padding: 0 0 var(--space-2); text-align: left; font-size: var(--text-s); font-weight: var(--weight-medium); color: var(--ink); }
.eg-mark { display: block; flex: none; }
.eg-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none;
  font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink-2);
}
.eg-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.eg-legend-mark { display: inline-flex; }
.eg-align-key, .eg-track-key, .eg-counts-key, .eg-grid-hint, .eg-dates-undated {
  margin: 0; font-size: var(--text-xs); line-height: var(--leading-ui); color: var(--ink-2);
}
.eg-align, .eg-meter, .eg-track, .eg-grid, .eg-dates, .eg-counts, .eg-pair { display: grid; gap: var(--space-3); min-width: 0; }
.eg-track, .eg-dates, .eg-pair, .eg-grid { container-type: inline-size; }

/* Rows of name, bar and value (coverage track, date line, result pair): one grid, each row a subgrid, so the bars
   line up; narrow, the name and value share a line and the bar takes the next. */
.eg-track-rows, .eg-dates-rows { display: grid; grid-template-columns: fit-content(14rem) minmax(0, 1fr) max-content; gap: var(--space-2) var(--space-3); }
.eg-pair-list { display: grid; grid-template-columns: fit-content(12rem) minmax(0, 1fr) max-content; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.eg-track-row, .eg-dates-row, .eg-pair-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; row-gap: var(--space-1); }
.eg-track-name, .eg-dates-name, .eg-pair-label { min-width: 0; font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink); overflow-wrap: break-word; }
.eg-track-value, .eg-dates-value, .eg-pair-value { font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.eg-track-bar, .eg-dates-track, .eg-pair-bar, .eg-meter-bar, .eg-counts-bar { display: block; overflow: visible; }
@container (max-width: 34rem) {
  .eg-track-rows, .eg-dates-rows { grid-template-columns: minmax(0, 1fr) max-content; }
  .eg-pair-list { grid-template-columns: max-content minmax(0, 1fr); }
  .eg-track-bar, .eg-dates-track, .eg-pair-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------------------------------------------------------------- alignment strip */

.eg-align-names { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink-2); }
.eg-align-names strong { font-weight: var(--weight-strong); color: var(--ink); }
.eg-align-body { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-3); font-family: var(--font-mono); font-size: var(--text-s); line-height: var(--leading-ui); }
.eg-align-side { display: grid; align-content: start; font-family: var(--font-sans); font-weight: var(--weight-medium); color: var(--ink-2); }
.eg-align-blocks { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); min-width: 0; }
.eg-align-block { display: grid; align-content: start; color: var(--ink); }
.eg-align-side > span, .eg-align-block > span { display: block; white-space: pre; }
.eg-align-pos { font-size: var(--text-xs); color: var(--ink-3); }
.eg-align-bars { color: var(--ink-3); }
.eg-align-differs { padding: 0; border-radius: var(--radius-s); background: var(--warn-line); color: var(--ink); font-weight: var(--weight-strong); }

/* ---------------------------------------------------------------- match meter */

.eg-meter { gap: var(--space-1); }
.eg-meter-words { margin: 0; font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink); font-variant-numeric: tabular-nums; }
.eg-meter-words strong { font-weight: var(--weight-strong); }
.eg-meter[data-state="met"] .eg-meter-words strong, .eg-meter[data-state="part"] .eg-meter-words strong { color: var(--met); }
.eg-meter[data-state="notMet"] .eg-meter-words strong { color: var(--not-met); }
.eg-meter[data-state="unclear"] .eg-meter-words strong { color: var(--review); }
.eg-meter-detail { margin: 0; font-size: var(--text-xs); line-height: var(--leading-ui); color: var(--ink-2); }

/* ---------------------------------------------------------------- coverage track */

.eg-track-query { margin: 0; font-size: var(--text-s); font-weight: var(--weight-medium); line-height: var(--leading-ui); color: var(--ink); }
.eg-track-tick, .eg-dates-year { font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- claim chart grid */

.eg-grid-scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.eg-grid-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-s); line-height: var(--leading-ui); }
.eg-grid-table th, .eg-grid-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line-faint); text-align: center; vertical-align: middle; }
.eg-grid-table thead th { vertical-align: bottom; background: var(--soft); font-weight: var(--weight-medium); color: var(--ink); }
.eg-grid-table .eg-grid-corner, .eg-grid-table .eg-grid-feature, .eg-grid-table .eg-grid-foot th { position: sticky; left: 0; z-index: 1; text-align: left; white-space: nowrap; }
.eg-grid-feature { background: var(--card); font-weight: var(--weight-regular); }
.eg-grid-corner { z-index: 2; }
.eg-grid-id { font-weight: var(--weight-strong); color: var(--ink); }
.eg-grid-desc { color: var(--ink-2); }
.eg-grid-reference { min-width: 7rem; }
.eg-grid-label { display: block; white-space: nowrap; }
.eg-grid-date { display: block; font-size: var(--text-xs); font-weight: var(--weight-regular); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.eg-grid-cell { padding: var(--space-1); background: var(--card); white-space: nowrap; }
.eg-grid-cell[data-state="met"], .eg-grid-cell[data-state="part"] { background: var(--met-tint); }
.eg-grid-cell[data-state="notMet"] { background: var(--not-met-tint); }
.eg-grid-cell[data-state="unclear"] { background: var(--review-tint); }
.eg-grid-cell .eg-mark { display: inline-block; vertical-align: middle; }
.eg-grid-value { margin-left: var(--space-1); vertical-align: middle; font-weight: var(--weight-medium); color: var(--not-met); font-variant-numeric: tabular-nums; }
.eg-grid-open { box-shadow: inset 0 0 0 2px var(--pressable); }
.eg-grid-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-width: 44px; min-height: 44px;
  margin: 0; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-s); background: none; color: inherit; font: inherit; cursor: pointer;
}
.eg-grid-button .eg-grid-value { margin-left: 0; }
.eg-grid-button:hover { background: var(--chip-hover); }
.eg-grid-foot th, .eg-grid-foot td { border-bottom: 0; background: var(--soft); font-weight: var(--weight-medium); color: var(--ink); }
.eg-grid-foot td { font-variant-numeric: tabular-nums; white-space: nowrap; }
@container (max-width: 34rem) {
  .eg-grid-desc { display: block; }
}

/* ---------------------------------------------------------------- date line */

.eg-dates-head .eg-dates-name, .eg-dates-head .eg-dates-value { min-height: 0; }

/* ---------------------------------------------------------------- counts strip */

.eg-counts-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-4) var(--space-5); margin: 0; padding: 0; list-style: none; }
.eg-counts-item { display: grid; align-content: start; gap: var(--space-1); min-width: 0; }
.eg-counts-value { font-size: var(--text-xl); font-weight: var(--weight-strong); line-height: var(--leading-tight); color: var(--ink); font-variant-numeric: tabular-nums; }
.eg-counts-words { font-size: var(--text-s); line-height: var(--leading-ui); color: var(--ink-2); }
.eg-counts-bar { margin-top: var(--space-1); }

/* ---------------------------------------------------------------- case path */

.eg-path { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); margin: 0; padding: 0; list-style: none; }
.eg-path-item { display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.eg-path-words { display: grid; }
.eg-path-name { font-size: var(--text-s); font-weight: var(--weight-medium); line-height: var(--leading-ui); color: var(--ink); }
.eg-path-item[data-state="current"] .eg-path-name { font-weight: var(--weight-strong); color: var(--pressable); }
.eg-path-item[data-state="todo"] .eg-path-name { color: var(--ink-2); }
.eg-path-detail { font-size: var(--text-xs); line-height: var(--leading-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- result pair */

.eg-pair-measure { margin: 0; font-size: var(--text-s); font-weight: var(--weight-medium); line-height: var(--leading-ui); color: var(--ink); }
.eg-pair-row:first-child .eg-pair-label { font-weight: var(--weight-strong); }

/* ---------------------------------------------------------------- case path as tabs */

/* The case screen's tabs (case-path.mjs, option `tab`): each step a 44 px button, the one shown on a tint. */
.eg-path-tabs { gap: 0 var(--space-1); }
.eg-path-tab {
  display: flex; align-items: center; gap: var(--space-2); min-height: 44px; margin: 0; padding: var(--space-1) var(--space-3);
  border: 0; border-radius: var(--radius-s); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.eg-path-tab:hover { background: var(--chip-hover); }
.eg-path-tab[aria-selected="true"] { background: var(--brand-tint); }
