/* Cloud Ping Test. Tokens, header, footer and the sidebar come from the site stylesheet. */
.narrow.wide { max-width: 1040px; }
main [hidden] { display: none !important; }
.muted code, .notes code { font-family: var(--mono); font-size: .9em; }

/* Index: one card per provider. */
.cp-grid { list-style: none; margin: 20px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.cp-card {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.cp-card:hover { border-color: var(--c, var(--accent)); transform: translateY(-1px); }
.cp-card-name { font-weight: 700; font-size: 16px; }
.cp-card-meta { font-size: 13px; }
.cp-thanks h2 { font-size: 15px; margin: 24px 0 4px; }
.cp-thanks p { margin: 0; }

/* Provider switcher. */
.cp-providers { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 18px; }
.cp-providers a {
  padding: 4px 11px; border-radius: 999px; font-size: 13.5px; text-decoration: none;
  color: var(--text); background: var(--panel); border: 1px solid var(--line);
}
.cp-providers a:hover { border-color: var(--c, var(--accent)); }
.cp-providers a[aria-current] { background: var(--c, var(--accent)); border-color: transparent; color: #fff; font-weight: 600; }

/* Controls and status. */
.cp-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cp-toggle { min-width: 96px; padding: 8px 16px; font-weight: 600; }
.cp-toggle.primary { background: var(--accent); color: #fff; border-color: transparent; }
.cp-toggle:disabled { opacity: .5; cursor: default; }
/* Takes the spare room and shrinks (wrapping its own text) rather than pushing the controls onto a new line. */
.cp-status { flex: 1 1 14em; min-width: 0; margin: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cp-check { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 14px; cursor: pointer; }
.cp-export { display: inline-flex; gap: 6px; }
.cp-export button { padding: 6px 12px; font-size: 14px; }
.cp-export-status, .cp-trim { margin: 8px 0 0; font-size: 14px; }
.cp-export-status.ok { color: var(--ok); }
.cp-export-status.error { color: var(--err); }
.cp-best { margin: 10px 0 0; font-size: 15px; }
.cp-best code { font-family: var(--mono); font-size: .9em; color: var(--muted); }

/* The table. */
/* Scrolls both ways, at most a screen tall, so the sticky column headings stay in view over long lists. */
.cp-scroll {
  margin: 14px 0 18px; overflow: auto; max-height: calc(100vh - var(--top-h, 53px) - 32px);
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.cp-table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.cp-table th, .cp-table td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.cp-table tbody tr:last-child td { border-bottom: 0; }
/* Row hover: a see-through layer over every cell, so the coloured latency cells darken too instead of losing their colour. */
.cp-table tbody tr:hover td { background-image: linear-gradient(color-mix(in srgb, var(--text) 8%, transparent), color-mix(in srgb, var(--text) 8%, transparent)); }
.cp-table th { position: sticky; top: 0; z-index: 1; background: var(--head); font-size: 12.5px; }
/* # and Region stay put while the round columns scroll sideways: # has a fixed width so Region knows
   where to stick. Sticky cells need their own background; the heading cells sit above both directions. */
.cp-table th:nth-child(1), .cp-table td:nth-child(1) { position: sticky; left: 0; box-sizing: border-box; width: 44px; min-width: 44px; max-width: 44px; }
.cp-table th:nth-child(2), .cp-table td:nth-child(2) { position: sticky; left: 44px; box-shadow: inset -1px 0 0 var(--line); }
.cp-table td:nth-child(-n+2) { z-index: 1; background-color: var(--panel); }
.cp-table th:nth-child(-n+2) { z-index: 2; }
.cp-table th button {
  font: inherit; font-weight: 700; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em;
}
.cp-table th button:hover { color: var(--text); }
/* A column per round (app.js), hidden with "Show each round" unticked. */
.cp-table th.round { font-weight: 700; color: var(--muted); }
.cp-table th.round + th.round, .cp-table td.round + td.round { border-left: 1px solid var(--line); }
/* A heavier rule between the stats and the first round. */
.cp-table td[data-k="max"] + td.round, .cp-table th:has(button[data-sort="max"]) + th.round { border-left: 2px solid var(--line); }
.cp-no-rounds .round { display: none; }
.cp-table th[aria-sort="ascending"] button::after { content: " ▲"; color: var(--text); }
.cp-table th[aria-sort="descending"] button::after { content: " ▼"; color: var(--text); }
.cp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cp-table code { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.cp-table td.stat { font-weight: 600; }
/* Heat: --hue runs from 130 (fastest, green) to 0 (slowest, red); set by app.js. */
.cp-table td.heat { background: hsl(var(--hue) 70% 88%); color: #1b2230; }
.cp-table td.fail { color: var(--err); font-weight: 600; }
/* The region being pinged (app.js): a faint grey pulse and a thin bar on its row, and a spinner in
   its cell of the round under way. Heat-coloured cells keep their colour. */
.cp-table tr.cp-active td { transition: background-color .2s; }
.cp-table tr.cp-active td:not(.heat) { background: color-mix(in srgb, var(--text) 2%, var(--panel)); animation: cp-pulse 1.6s ease-in-out infinite; }
.cp-table tr.cp-active td:first-child { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--muted) 50%, transparent); }
.cp-table td.pending { color: transparent; position: relative; }
.cp-table td.pending::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 10px; height: 10px; margin-top: -6px;
  border: 1.5px solid color-mix(in srgb, var(--muted) 15%, transparent); border-top-color: color-mix(in srgb, var(--muted) 60%, transparent); border-radius: 50%;
  animation: cp-spin .9s linear infinite;
}
@keyframes cp-pulse { 50% { background-color: color-mix(in srgb, var(--text) 5%, var(--panel)); } }
@keyframes cp-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .cp-table tr.cp-active td:not(.heat), .cp-table td.pending::after { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .cp-table td.heat { background: hsl(var(--hue) 45% 24%); color: var(--text); }
}

.notes { padding-left: 18px; margin: 0 0 10px; }
.notes li + li { margin-top: 4px; }
.notes strong { color: var(--text); font-weight: 600; }
.cp-missing { margin-top: 8px; }

@media (max-width: 560px) {
  .cp-table th, .cp-table td { padding: 6px 8px; }
  .cp-table td.pending::after { right: 8px; }
}
