/* ==========================================================================
   Northwatch website: lab results page only (results.html)
   Loaded after css/site.css. Uses the shared tokens and nothing else:
   white and grays only, hairlines, 4px radius at most, no shadows.
   No signal colors on this page.
   ========================================================================== */

/* ---------- Small heading above a table inside a section ----------------- */

.sub-head {
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-h3);
}

/* ---------- Comparison table: start, best so far, target -----------------
   A .data-table with a row header column and three number columns.
   The "Best so far" column (third) is lifted with the panel gray. */

.compare-table { min-width: 36rem; }
.compare-table tbody th { width: 40%; font-weight: 400; color: var(--nw-white); }
.compare-table .num { font-size: var(--fs-body); }
.compare-table thead .num { font-size: var(--fs-micro); }
.compare-table th:nth-child(3),
.compare-table td:nth-child(3) { background: var(--nw-panel); padding-left: var(--sp-5); }
.compare-table td:nth-child(2) { color: var(--nw-white); }
.compare-table td:nth-child(4) { color: var(--nw-white); }
.compare-table td.is-none { color: var(--nw-quiet); }

/* ---------- Plain hairline list ------------------------------------------
   Two of these sit side by side: what the numbers show and do not show.

   <h3 class="list-head">What they show</h3>
   <ul class="plain-list"><li>...</li></ul> */

.list-head {
  margin-bottom: var(--sp-5);
  font-size: var(--fs-h3);
}
.plain-list { border-top: 1px solid var(--nw-quiet); }
.plain-list li {
  padding: var(--sp-5) 0;
  border-bottom: var(--nw-hairline);
  color: var(--nw-white);
  max-width: 38rem;
}
.section--panel .plain-list li { border-bottom-color: var(--nw-line); }

/* ---------- Formula line -------------------------------------------------- */

.formula {
  padding: var(--sp-5) 0;
  border-top: var(--nw-hairline);
  border-bottom: var(--nw-hairline);
  color: var(--nw-white);
  font-family: var(--nw-mono);
  font-size: var(--fs-h4);
  line-height: 1.5;
}

/* ---------- Score chart ---------------------------------------------------
   Drawn by js/results.js as inline SVG, at the real width of the plot box so
   the type stays the same size on every screen. White and grays only.

   <figure class="score-chart" data-results-chart>
     <div class="score-chart__head"> title + legend </div>
     <div class="score-chart__plot" data-results-chart-plot></div>
     <p class="score-chart__message" data-results-chart-message hidden>...</p>
     <figcaption class="figure-caption">...</figcaption>
   </figure> */

.score-chart { border-top: var(--nw-hairline); padding-top: var(--sp-5); }

.score-chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-6);
  margin-bottom: var(--sp-5);
}
.score-chart__title,
.score-chart__legend {
  color: var(--nw-quiet);
  font-family: var(--nw-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}
.score-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  letter-spacing: 0.08em;
}
.score-chart__legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.score-chart__key { flex: none; width: 0.5625rem; height: 0.5625rem; }
.score-chart__key--kept { background: var(--nw-white); }
.score-chart__key--reverted { border: 1px solid var(--nw-quiet); }
.score-chart__key--line { width: 1.25rem; height: 0; border-top: 1px solid var(--nw-quiet); }

.score-chart__plot { min-height: 20rem; }
.score-chart__plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.nw-results-failed .score-chart__plot,
.score-chart.is-failed .score-chart__plot { display: none; }

.score-chart__message {
  padding: var(--sp-5);
  border: var(--nw-hairline);
  border-radius: var(--nw-radius);
  color: var(--nw-white);
  max-width: 42rem;
}
.score-chart .figure-caption { max-width: 46rem; }

/* SVG parts */
.sc-grid { stroke: var(--nw-line); stroke-width: 1; shape-rendering: crispEdges; }
.sc-axis { stroke: var(--nw-quiet); stroke-width: 1; shape-rendering: crispEdges; }
.sc-break { stroke: var(--nw-line); stroke-width: 1; stroke-dasharray: 2 4; shape-rendering: crispEdges; }
.sc-carried { fill: none; stroke: var(--nw-quiet); stroke-width: 1; shape-rendering: crispEdges; }
.sc-drop { stroke: var(--nw-line); stroke-width: 1; stroke-dasharray: 2 3; shape-rendering: crispEdges; }
.sc-point--kept { fill: var(--nw-white); stroke: var(--nw-white); stroke-width: 1; }
.sc-point--reverted { fill: var(--nw-black); stroke: var(--nw-quiet); stroke-width: 1.25; }
.sc-tick, .sc-value, .sc-axis-title, .sc-note {
  font-family: var(--nw-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  fill: var(--nw-quiet);
}
.sc-value { fill: var(--nw-quiet); }
.sc-value--kept { fill: var(--nw-white); font-weight: 500; }
.sc-axis-title { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.sc-note { font-size: 11px; }

/* ---------- Round by round table -------------------------------------------
   From 1100px it is a normal table. The four number columns are the same
   width so they read evenly, and their headings may wrap.
   Below 1100px there is no room for seven columns, so each round becomes a
   block: round and verdict on one line, the idea under it, then the numbers
   with their names. Caught and false alarms always sit side by side, and
   nothing scrolls sideways. js/site.js writes the data-label names. */

#rounds-table thead th { white-space: normal; vertical-align: bottom; }

@media (min-width: 1100px) {
  #rounds-table .data-table { table-layout: fixed; }
  #rounds-table th:nth-child(1) { width: 5rem; text-align: left; }
  #rounds-table td:nth-child(2), #rounds-table th:nth-child(2) { width: 10.5rem; }
  #rounds-table th:nth-child(n+4), #rounds-table td:nth-child(n+4) { width: 7.5rem; }
  #rounds-table th:last-child, #rounds-table td:last-child { width: 8.25rem; padding-right: var(--sp-3); }
}

@media (max-width: 1099.98px) {
  #rounds-table { overflow-x: visible; }
  #rounds-table .data-table, #rounds-table tbody { display: block; min-width: 0; }
  #rounds-table thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  #rounds-table tbody tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: var(--sp-4);
    align-items: start;
    padding: var(--sp-5) 0;
    border-bottom: var(--nw-hairline);
  }
  #rounds-table tbody tr.is-best { padding-inline: var(--sp-4); background: var(--nw-panel); }
  #rounds-table tbody th, #rounds-table tbody td {
    display: block; padding: 0; border: 0; background: none; text-align: left; white-space: normal;
  }
  #rounds-table tbody th { grid-column: 1 / 3; font-family: var(--nw-mono); font-weight: 500; }
  #rounds-table tbody th::before { content: "Round "; }
  #rounds-table tbody td:nth-child(2) { grid-column: 3 / -1; justify-self: end; }
  #rounds-table tbody td:nth-child(3) { grid-column: 1 / -1; margin-top: var(--sp-3); font-size: var(--fs-body); max-width: 38rem; }
  #rounds-table tbody td:nth-child(n+4) { grid-column: span 2; align-self: end; margin-top: var(--sp-4); font-size: var(--fs-body); }
  #rounds-table tbody td:nth-child(n+4)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: var(--sp-1);
    color: var(--nw-quiet);
    font-size: var(--fs-micro);
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: normal;
  }
}
@media (min-width: 560px) and (max-width: 1099.98px) {
  #rounds-table tbody td:nth-child(n+4) { grid-column: span 1; }
}

@media print {
  .sc-point--reverted { fill: #fff; }
}

/* On small screens the comparison table fits the screen without sideways
   scrolling: cells may wrap and the type steps down one size. */
@media (max-width: 599.98px) {
  .compare-table { min-width: 0; }
  .compare-table th, .compare-table td { padding-right: var(--sp-3); }
  .compare-table tbody th { width: 28%; font-size: var(--fs-small); }
  .compare-table .num { font-size: var(--fs-small); white-space: normal; }
  .compare-table thead th { white-space: normal; letter-spacing: 0.06em; }
  .compare-table th:nth-child(3),
  .compare-table td:nth-child(3) { padding-left: var(--sp-3); }
}
