/* ========================================
   SONDE evaluation pages
   Data-dense, deliberately plain. Uses the site's tokens so it themes with
   everything else; adds only what a measurement report needs.
   ======================================== */

.ev-page {
  --ev-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ev-good: var(--accent-teal);
  --ev-warn: #e0a03c;
  --ev-bad: #e2685f;
  --ev-rule: var(--border-glass);
}

:root[data-theme="light"] .ev-page {
  --ev-warn: #b06f10;
  --ev-bad: #c0392b;
}

/* --- hero --- */
.ev-hero {
  padding-top: 170px;
  padding-bottom: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--ev-rule);
}

.ev-acronym {
  font-family: var(--ev-mono);
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 18px;
}

.ev-acronym b { color: var(--text-heading); font-weight: 600; }

.ev-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--text-heading);
  margin-bottom: 20px;
  max-width: 20ch;
}

.ev-lede {
  max-width: 68ch;
  font-size: 1.06rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.ev-lede + .ev-lede { margin-top: 14px; }

/* --- status strip --- */
.ev-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 36px;
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ev-strip div {
  flex: 1 1 150px;
  padding: 16px 20px;
  border-right: 1px solid var(--ev-rule);
}

.ev-strip div:last-child { border-right: none; }

.ev-strip dt {
  font-family: var(--ev-mono);
  font-size: 0.68rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ev-strip dd {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-heading);
}

/* --- sections --- */
.ev-section { padding: 72px 0; border-bottom: 1px solid var(--ev-rule); }
.ev-section:last-of-type { border-bottom: none; }

.ev-h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.ev-sub {
  max-width: 70ch;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 30px;
}

/* --- the B/P/F explainer --- */
.ev-surfaces {
  display: grid;
  gap: 14px;
  max-width: 780px;
}

.ev-surface {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.ev-surface-key {
  font-family: var(--ev-mono);
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  padding-top: 3px;
}

.ev-surface-body strong {
  display: block;
  color: var(--text-heading);
  font-weight: 600;
  margin-bottom: 3px;
}

.ev-surface-body span {
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.7;
}

.ev-formula {
  margin-top: 22px;
  padding: 16px 20px;
  border-left: 2px solid var(--accent-cyan);
  background: var(--bg-card);
  font-family: var(--ev-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 2;
}

/* --- tables --- */
.ev-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.ev-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ev-table th {
  text-align: left;
  font-family: var(--ev-mono);
  font-size: 0.68rem;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-glass-hover);
  white-space: nowrap;
}

.ev-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--ev-rule);
  color: var(--text-secondary);
  vertical-align: top;
}

.ev-table tbody tr:hover { background: var(--bg-card); }

.ev-table .ev-model {
  font-family: var(--ev-mono);
  font-size: 0.84rem;
  color: var(--text-heading);
  white-space: nowrap;
}

.ev-num {
  font-family: var(--ev-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  white-space: nowrap;
}

.ev-num.is-best { color: var(--text-heading); font-weight: 600; }
.ev-dim { color: var(--text-muted); }

.ev-flag {
  display: inline-block;
  font-family: var(--ev-mono);
  font-size: 0.68rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.ev-flag.ok { color: var(--ev-good); }
.ev-flag.warn { color: var(--ev-warn); }
.ev-flag.bad { color: var(--ev-bad); }

/* --- notes / caveats --- */
.ev-note {
  margin-top: 20px;
  padding: 14px 18px;
  border: 1px dashed var(--border-glass-hover);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.75;
  max-width: 78ch;
}

.ev-caveats { list-style: none; margin-top: 10px; }

.ev-caveats li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.ev-caveats li::before {
  content: '!';
  position: absolute;
  left: 0;
  font-family: var(--ev-mono);
  color: var(--ev-warn);
}

/* --- coverage matrix --- */
.ev-matrix { border-collapse: collapse; min-width: 640px; font-size: 0.85rem; }

.ev-matrix th, .ev-matrix td {
  border: 1px solid var(--ev-rule);
  padding: 9px 10px;
  text-align: center;
}

.ev-matrix th {
  font-family: var(--ev-mono);
  font-size: 0.66rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.ev-matrix th[scope="row"] { text-align: left; color: var(--text-primary); white-space: nowrap; }

.ev-cell-filled {
  background: color-mix(in srgb, var(--accent-cyan) 16%, transparent);
  color: var(--text-heading);
  font-family: var(--ev-mono);
  font-weight: 600;
}

.ev-cell-empty { color: var(--text-muted); }

/* --- registry --- */
.ev-reg { display: grid; gap: 10px; }

.ev-reg-row {
  display: grid;
  grid-template-columns: 1fr 130px 190px;
  gap: 16px;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.ev-reg-id { font-family: var(--ev-mono); font-size: 0.86rem; color: var(--text-heading); }
.ev-reg-mod { font-size: 0.8rem; color: var(--text-muted); }

/* --- rules list (Standard) --- */
.ev-rules { counter-reset: rule; display: grid; gap: 18px; max-width: 82ch; }

.ev-rule {
  counter-increment: rule;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ev-rule);
}

.ev-rule:last-child { border-bottom: none; }

.ev-rule::before {
  content: counter(rule);
  font-family: var(--ev-mono);
  font-size: 1.1rem;
  color: var(--accent-cyan);
  padding-top: 2px;
}

.ev-rule h3 {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.ev-rule p { color: var(--text-secondary); line-height: 1.75; font-size: 0.94rem; }

.ev-rule code {
  font-family: var(--ev-mono);
  font-size: 0.82rem;
  color: var(--accent-teal);
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
}

.ev-empty { color: var(--text-muted); font-style: italic; padding: 20px 0; }

@media (max-width: 720px) {
  .ev-hero { padding-top: 140px; }
  .ev-surface { grid-template-columns: 1fr; gap: 8px; }
  .ev-reg-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------------------------------------
   SONDE wordmark
   The evaluations work carries its own name,
   so the page leads with it.
   --------------------------------------- */

.ev-brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ev-rule);
}

.ev-wordmark {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--text-heading);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ev-brand-note {
  font-family: var(--ev-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .ev-brand { gap: 6px; }
}

@media (max-width: 600px) {
  .ev-flag,
  .ev-table th { font-size: 0.72rem; }
}

/* --- trend chart ------------------------------------------------------- */

.ev-chart-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 6px;
}

.ev-chart {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.ev-chart-grid { stroke: var(--ev-rule); stroke-width: 1; }

.ev-chart-tick,
.ev-chart-label,
.ev-chart-note {
  font-family: var(--ev-mono);
  font-size: 11px;
  fill: var(--text-muted);
}

/* The label is knocked out of whatever runs behind it -- a gridline, the fit,
   or a leader on its way to some other point. Same trick the dots already use,
   and the same colour, so it follows the light-mode toggle without a second
   rule. paint-order puts the halo under the glyph rather than over it. */
.ev-chart-label {
  fill: var(--text-primary);
  font-size: 11.5px;
  paint-order: stroke fill;
  stroke: var(--bg-primary);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.ev-chart-axis {
  font-family: var(--ev-mono);
  font-size: 12px;
  fill: var(--text-secondary);
  letter-spacing: 0.6px;
}

/* The bar a learned representation has to clear, and the bar it cannot pass. */
.ev-chart-ref {
  stroke: var(--ev-bad);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  opacity: 0.85;
}

.ev-chart-ceiling {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.ev-chart-fit {
  stroke: var(--accent-cyan);
  stroke-width: 1.5;
  opacity: 0.45;
}

.ev-chart-err { stroke: var(--accent-cyan); stroke-width: 1.5; opacity: 0.5; }

.ev-chart-pt {
  fill: var(--accent-cyan);
  stroke: var(--bg-primary);
  stroke-width: 2;
}

.ev-caption {
  max-width: 76ch;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Numbers behind a picture must stay reachable without seeing the picture. */
.ev-sr {
  position: absolute;
  /* `.ev-table` sets a min-width so the visible results table keeps its columns
     legible, and min-width beats width -- so this screen-reader-only copy was
     computing to 860px on a 375px phone and dragging the whole document to
     883px. The page scrolled sideways to reveal nothing at all, because the
     thing causing it is invisible. Pre-dates the chart work; found while
     measuring it. */
  min-width: 0;
  max-width: 1px;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- two tracks -------------------------------------------------------- */

.ev-tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.ev-track {
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  background: var(--bg-card);
}

.ev-track h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.ev-track p { color: var(--text-secondary); line-height: 1.75; font-size: 0.94rem; }

.ev-track-state {
  display: inline-block;
  margin-bottom: 12px;
  font-family: var(--ev-mono);
  font-size: 0.66rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.ev-track-state.live { color: var(--ev-good); }
.ev-track-state.pending { color: var(--ev-warn); }

.ev-headline {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-heading);
  max-width: 26ch;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .ev-track { padding: 18px; }
}

/* Leader line from a point to a label that proximity alone does not tie to it.
   In the crowded middle of the size chart this line is the only thing saying
   which model a label names, so it is drawn to be followed, not merely to be
   faint -- but still one hairline, because seven of them share a small space. */
.ev-chart-leader {
  /* Measured, not chosen by eye. This line is the only thing tying seven of
     the twelve labels to their dots, so it has to clear WCAG 1.4.11's 3:1 for
     a graphical object you need in order to read the content. --text-muted at
     0.6 composites to 2.19:1 on the dark background and 2.23:1 on light --
     visibly a hairline, but below the bar and genuinely hard to follow.
     --text-secondary at 0.7 measures 4.1:1 dark, and stays lighter than the
     label text so the line still reads as connective tissue, not as data.
     non-scaling-stroke because the SVG scales down on narrow viewports: at
     390px a 1px stroke renders about 0.66px and the load-bearing element
     thins out exactly where the chart is already hardest to read. */
  stroke: var(--text-secondary);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
}

/* --- results, plain ------------------------------------------------------
   A reader wants the number and the thing it has to beat. The full grid of
   baselines, intervals and null tests lives on the technical record. */

.ev-result {
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-md);
  padding: 28px 30px;
  background: var(--bg-card);
  margin-bottom: 22px;
}

.ev-result-title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 10px;
}

.ev-result-plain {
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 0.95rem;
  max-width: 68ch;
  margin-bottom: 24px;
}

.ev-rows { display: flex; flex-direction: column; gap: 7px; }

.ev-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) 1fr 52px;
  align-items: center;
  gap: 16px;
}

.ev-row-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.ev-row-model {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-row-sub {
  font-family: var(--ev-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.ev-bar {
  position: relative;
  height: 22px;
  border-radius: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--ev-rule);
  overflow: hidden;
}

.ev-bar-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 2px 0 0 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.ev-row-val {
  font-family: var(--ev-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The no-model comparisons. Present, and visibly not competitors. */
.ev-row.is-ref { margin-top: 10px; }
.ev-row.is-ref .ev-row-model { color: var(--text-muted); font-style: italic; }
.ev-row.is-ref .ev-row-val { color: var(--text-muted); }
.ev-row.is-ref .ev-bar { border-style: dashed; }
.ev-row.is-ref .ev-bar-fill {
  background: repeating-linear-gradient(
    -45deg, var(--text-muted), var(--text-muted) 2px,
    transparent 2px, transparent 6px);
  opacity: 0.65;
}

.ev-result-check {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--ev-rule);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 72ch;
}

.ev-tick { color: var(--ev-good); font-weight: 600; }
.ev-cross { color: var(--ev-bad); font-weight: 600; }

.ev-result-foot {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.ev-task-id {
  font-family: var(--ev-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  margin: -6px 0 14px;
}

/* --- coverage, plain ----------------------------------------------------- */

.ev-cov {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.ev-cov-item {
  border: 1px solid var(--ev-rule);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: var(--bg-card);
}

.ev-cov-item.is-empty { opacity: 0.62; }

.ev-cov-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ev-cov-name { font-size: 0.98rem; color: var(--text-heading); }

.ev-cov-what {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.65;
}

@media (max-width: 720px) {
  .ev-result { padding: 20px; }
  .ev-row { grid-template-columns: minmax(104px, 1fr) 1.4fr 42px; gap: 10px; }
  .ev-row-model { font-size: 0.82rem; white-space: normal; }
}

/* --- sub-navigation ------------------------------------------------------
   The programme is several pages deep. Without a way across them the summary
   page has to carry everything, which is how it grew too long to read. */

.ev-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--ev-rule);
}

.ev-subnav a {
  font-family: var(--ev-mono);
  font-size: 0.72rem;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--ev-rule);
  border-radius: 2px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ev-subnav a:hover {
  color: var(--text-heading);
  border-color: var(--border-glass-hover);
  background: var(--button-secondary-hover);
}

/* --- collapsible detail --------------------------------------------------
   Everything a careful reader wants and a first-time reader does not. The page
   is a visual summary; this is where the prose that used to crowd it lives. */

.ev-more {
  margin-top: 18px;
  border-top: 1px solid var(--ev-rule);
}

.ev-more > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0 4px;
  font-family: var(--ev-mono);
  font-size: 0.74rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 9px;
}

.ev-more > summary::-webkit-details-marker { display: none; }

.ev-more > summary::before {
  content: "+";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--accent-cyan);
  transition: transform 0.2s ease;
}

.ev-more[open] > summary::before { content: "−"; }
.ev-more > summary:hover { color: var(--text-primary); }

.ev-more-body {
  padding: 10px 0 6px;
  max-width: 74ch;
}

.ev-more-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 14px;
}

.ev-more-body p:last-child { margin-bottom: 0; }
.ev-more-body strong { color: var(--text-primary); }
.ev-more-body .ev-caveats { margin-top: 0; }

.ev-h3 {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 400;
  color: var(--text-heading);
  margin: 40px 0 10px;
}

@media (max-width: 720px) {
  .ev-subnav { gap: 5px; }
  .ev-subnav a { font-size: 0.66rem; padding: 5px 9px; }
}

/* A separated gap on a lower-is-better task is an adverse finding, not a win. */
.ev-num.is-adverse { color: var(--ev-warn); font-weight: 600; }
