/* Results pages: reading levels, verdicts, explanation popups, charts, print. */

:root {
  /* Series colours follow the provider everywhere. Checked with the palette validator:
     distinct for colour-blind readers and at least 3:1 against the white chart surface. */
  --series-twilio: #2a6fbb;
  --series-telnyx: #c8621a;
  --series-telnyx-hd: #00a085;
  --chart-grid: #e7e7e7;
  --chart-axis: #c2c2c2;
}

/* --- reading levels ------------------------------------------------------------------- */

body[data-level="summary"] .lv-explained,
body[data-level="summary"] details.technical {
  display: none;
}

.results-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}

.levels legend {
  float: left;
  margin-right: 1rem;
  padding: 0;
  font-weight: 600;
}

.levels label {
  cursor: pointer;
}

.results-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
}

.result-section {
  margin: 0 0 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-section > h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.result-section h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.05rem;
}

.result-section h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.95rem;
}

.notice.conditions {
  background: var(--accent-soft);
  border-color: #c5dcf2;
}

/* --- the summary ---------------------------------------------------------------------- */

.hero {
  margin: 0.25rem 0 0.25rem;
  line-height: 1.15;
}

.hero-figure {
  font-size: 3.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hero-text {
  font-size: 1.25rem;
  color: var(--ink-soft);
}

.summary-lines {
  margin: 1rem 0;
  padding-left: 1.2rem;
}

.summary-lines li {
  margin: 0.45rem 0;
  max-width: 62rem;
}

.scorecard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.75rem;
}

.score-tile {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.score-tile.wide {
  grid-column: span 2;
}

/* Rankings can name two or three detection types: let those wrap inside the tile. */
.score-tile.wide .verdict {
  white-space: normal;
  border-radius: 0.9rem;
}

/* A part the test left out: one plain line, no figures. */
p.not-included {
  margin-bottom: 0.25rem;
  font-weight: 650;
}

.score-tile h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.score-verdict {
  margin: 0;
  font-size: 1.05rem;
}

.score-basis {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* A verdict is always words. The frame differs per outcome so it does not rest on colour. */
.verdict {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 999px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface);
}

.verdict.twilio {
  border-color: var(--series-twilio);
  box-shadow: inset 4px 0 0 var(--series-twilio);
}

.verdict.telnyx {
  border-color: var(--series-telnyx);
  box-shadow: inset 4px 0 0 var(--series-telnyx);
}

.verdict.tie,
.verdict.no_data {
  border-style: dashed;
  color: var(--ink-soft);
  font-weight: 600;
}

.verdict-line {
  margin: 0.25rem 0 1rem;
  max-width: 62rem;
}

.verdict-line > span:last-child {
  display: block;
  margin-top: 0.5rem;
}

/* --- explanation popups ------------------------------------------------------------------ */

.help {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 0.15rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: 0.1em;
  cursor: pointer;
}

.help:hover,
.help:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.help-pop {
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 2rem));
  overflow: auto;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(22, 32, 43, 0.25);
  font-size: 0.95rem;
  font-weight: 400;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.help-pop::backdrop {
  background: rgba(22, 32, 43, 0.25);
}

.help-pop h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.help-parts {
  margin: 0;
}

.help-parts dt {
  margin-top: 0.75rem;
  font-weight: 650;
}

.help-parts dd {
  margin: 0.15rem 0 0;
}

.help-pop details,
.help-entry details {
  margin: 0.9rem 0;
  color: var(--ink-soft);
}

.help-entry {
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}

.help-entry > summary {
  font-weight: 600;
  cursor: pointer;
}

.glossary dt {
  margin-top: 0.85rem;
  font-weight: 650;
}

.glossary dd {
  margin: 0.1rem 0 0;
  max-width: 56rem;
}

/* --- tables of figures ------------------------------------------------------------------- */

.table.metrics th[scope="row"],
.table.compat th[scope="row"],
.table.ranking td,
.print-page .table th[scope="row"],
.call-page .table th[scope="row"],
.compare-page .table th[scope="row"],
.result-section .table th[scope="row"] {
  text-transform: none;
  letter-spacing: 0;
  font-size: inherit;
  color: var(--ink);
  font-weight: 600;
  white-space: normal;
}

.table.ranking td {
  font-weight: 400;
}

.meaning {
  display: block;
  max-width: 34rem;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.basis {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-faint);
}

.table td.none,
.table td.cell.none {
  color: var(--ink-faint);
}

.table.compat td.pass strong {
  color: var(--ok);
}

.table.compat td.fail strong {
  color: var(--bad);
}

.table-scroll {
  overflow-x: auto;
}

/* Wide enough for the player to keep its play button; on a narrow screen the grid scrolls sideways. */
.results-grid th[scope="row"] {
  min-width: 16rem;
}

.results-grid th[scope="row"] audio {
  display: block;
  width: 100%;
  min-width: 14rem;
  height: 2rem;
  margin-top: 0.4rem;
}

.results-grid td.cell {
  min-width: 9.5rem;
  vertical-align: top;
}

.mistake {
  display: block;
  margin-top: 0.2rem;
  font-weight: 650;
}

.mistake::before {
  content: "✗ ";
}

.table.recordings audio {
  width: 100%;
  min-width: 15rem;
  height: 2.25rem;
}

.table.timeline td.data {
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--ink-soft);
}

details.technical,
details.table-view {
  margin-top: 1rem;
}

details.technical > summary,
details.table-view > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.cards.contenders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1rem;
}

.card.contender h4 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.facts.stacked {
  display: block;
}

.facts.stacked dt {
  margin-top: 0.6rem;
}

.facts.stacked dd {
  margin: 0.1rem 0 0;
}

.staff-session {
  margin: 1rem 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.read-aloud.small {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.75rem;
}

.chip {
  white-space: nowrap;
  font-size: 0.85rem;
}

.chip .verdict {
  padding: 0.05rem 0.45rem;
  font-size: 0.82rem;
}

.chip-key {
  color: var(--ink-soft);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- charts ------------------------------------------------------------------------------ */

/* A provider's name beside its colour key stays in the text colour; the key carries the identity. */
.who:has(.key) {
  color: var(--ink);
  white-space: nowrap;
}

.key {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  border-radius: 2px;
  vertical-align: -0.05em;
}

.key.line {
  height: 2px;
  width: 1rem;
  vertical-align: 0.25em;
}

.key.spread {
  height: 2px;
  width: 1.2rem;
  vertical-align: 0.25em;
  background: var(--ink);
}

.s-twilio {
  fill: var(--series-twilio);
  background: var(--series-twilio);
}

.s-telnyx {
  fill: var(--series-telnyx);
  background: var(--series-telnyx);
}

.s-telnyx_hd {
  fill: var(--series-telnyx-hd);
  background: var(--series-telnyx-hd);
}

.chart-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1rem 2rem;
}

.chart-box {
  margin: 0;
}

.chart-box.wide {
  max-width: 44rem;
}

.chart-box figcaption {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.chart {
  display: block;
  width: 100%;
  max-width: 44rem;
  height: auto;
  background: var(--surface);
  font-family: var(--font);
}

.chart text {
  fill: #666666;
  font-size: 11px;
}

.chart .c-title,
.chart .c-label,
.chart .c-value {
  fill: var(--ink);
  font-size: 12px;
}

.chart .c-title {
  font-weight: 650;
}

.chart .c-tick {
  font-variant-numeric: tabular-nums;
}

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

.chart .c-axis {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart .c-mark,
.chart .c-dot,
.chart .c-ref {
  cursor: default;
  outline: none;
}

.chart .c-mark:hover,
.chart .c-mark:focus-visible,
.chart .c-dot:hover,
.chart .c-dot:focus-visible {
  filter: brightness(1.2);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.chart .c-ref line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.chart .c-ref text {
  fill: var(--ink);
  font-size: 10.5px;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
}

.chart .c-ref:focus-visible line,
.chart .c-ref:hover line {
  stroke-width: 3;
}

.chart .c-spread {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.chart .c-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .c-line.s-twilio {
  stroke: var(--series-twilio);
}

.chart .c-line.s-telnyx {
  stroke: var(--series-telnyx);
}

.chart .c-line.s-telnyx_hd {
  stroke: var(--series-telnyx-hd);
}

.chart .c-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.chart-tip {
  position: absolute;
  z-index: 20;
  max-width: 20rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
}

/* --- print ------------------------------------------------------------------------------- */

/* On a narrow screen a wide table scrolls inside its card instead of widening the page. */
.result-section,
.print-page,
.compare-page,
.call-page .card {
  overflow-x: auto;
}

/* Results tables have many columns: long column names wrap instead of pushing the table past its card. */
.result-section .table th.num,
.print-page .table th.num {
  white-space: normal;
}

@media (max-width: 40rem) {
  .score-tile.wide {
    grid-column: auto;
  }
}

@media print {
  .no-print,
  .results-bar,
  .help,
  .help-pop,
  .chart-tip,
  audio,
  form {
    display: none !important;
  }

  .result-section,
  .card,
  .score-tile {
    border-color: #999;
    break-inside: avoid;
  }

  .result-section {
    padding: 0.5rem 0;
    border: 0;
    border-top: 1px solid #999;
    border-radius: 0;
  }

  .hero-figure {
    font-size: 2.5rem;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .s-twilio,
  .s-telnyx,
  .s-telnyx_hd,
  .verdict {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
