/*
 * Website & Internet Speed — page layout only.
 *
 * Everything shared lives in /tools/tools.css: tokens, header, footer, buttons,
 * the URL row, cards, states and the toast. This file adds only the pieces that
 * are specific to showing two measurements side by side, and it introduces no
 * colour of its own — every value below is a token, so both themes follow
 * automatically.
 */

.url-form { margin-top: 26px; }

.url-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fog-500);
}

/* .url-row, .url-input, .url-hint and .url-error are shared primitives in
   tools.css — every tool that takes a URL uses the same control. */

/* ------------------------------------------------------------- options */

.opt-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 18px;
}

.opt-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.opt-group legend {
  padding: 0;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fog-500);
}
.opt-actions { display: flex; align-items: flex-end; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/*
 * A radio that looks like a chip.
 *
 * The input stays in the accessibility tree and keeps arrow-key group
 * behaviour; it is only visually replaced. Hiding it with display:none would
 * take it out of the tab order and break both.
 */
.chip { position: relative; display: inline-flex; }
.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--ink-600);
  border-radius: 999px;
  background: var(--ink-800);
  font-size: 13px;
  font-weight: 500;
  color: var(--fog-300);
}
.chip input:checked + span {
  border-color: var(--brand-500);
  color: var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 10%, var(--ink-800));
}
.chip input:focus-visible + span {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}
.chip-note { font-size: 11.5px; color: var(--fog-500); }
.chip input:checked + span .chip-note { color: inherit; }

/* ------------------------------------------------------------------ states */

/* The empty, loading and error states, identical to the Health Checker and the
   Website Analyzer. This page used these classes but never had their styles,
   so its error messages and loading spinner rendered as plain text (K7). */

.empty {
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  background: var(--ink-800);
  padding: clamp(18px, 3.5vw, 26px);
}
.empty h3 { font-size: 17px; }
.empty p { margin-top: 8px; max-width: 76ch; font-size: 13.5px; color: var(--fog-300); }

.loading {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  background: var(--ink-800);
  padding: 20px 22px;
}
.spinner {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--ink-500);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
.loading-title { font-size: 14.5px; font-weight: 600; color: var(--fog-50); }
.loading-note { margin-top: 3px; font-size: 12.5px; color: var(--fog-500); }

.error-card {
  border: 1px solid color-mix(in srgb, var(--fail-500) 35%, var(--ink-600));
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--fail-500) 6%, var(--ink-850));
  padding: clamp(18px, 3.5vw, 26px);
}
.error-kind { font-size: 16px; font-weight: 600; color: var(--fog-50); }
.error-message {
  margin-top: 8px;
  max-width: 76ch;
  font-size: 14px;
  color: var(--fog-100);
  overflow-wrap: anywhere;
}
.error-help { margin-top: 8px; max-width: 76ch; font-size: 13px; color: var(--fog-500); }
.error-card .actions { margin-top: 18px; }

/* -------------------------------------------------------------- blocks */

.section { padding-block: clamp(22px, 4vw, 34px); }

/*
 * The two measurements are separate cards on purpose.
 *
 * The whole point of this tool is that a website's speed and a visitor's
 * connection are different things. Putting them in one panel — or worse, one
 * combined number — would undo that.
 */
.result-block {
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  background: var(--ink-800);
  padding: clamp(18px, 3vw, 26px);
}
.result-block + .result-block { margin-top: 18px; }

.block-head { margin-bottom: 18px; }
.block-head h3 { font-size: clamp(17px, 2.6vw, 21px); }
.block-sub { margin-top: 4px; font-size: 13px; color: var(--fog-500); }

.block-title {
  margin-top: 26px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fog-500);
}

/* --------------------------------------------------------------- score */

.score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
}

.score-dial {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 3px solid var(--ink-600);
}
.score-dial[data-grade='Good'] { border-color: var(--pass-500); }
.score-dial[data-grade='Needs work'] { border-color: var(--warn-500); }
.score-dial[data-grade='Poor'] { border-color: var(--fail-500); }

.score-value { font-size: 32px; font-weight: 700; line-height: 1; color: var(--fog-50); }
.score-max { margin-top: 2px; font-size: 11px; color: var(--fog-500); }

.score-meta { min-width: 0; flex: 1 1 260px; }

/* Google PageSpeed Insights: Mobile and Desktop side by side, stacked when narrow.
   Each column reuses the score row, metric grid and key/value styles below. */
.psi-grid {
  display: grid;
  gap: clamp(16px, 3vw, 28px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}
.psi-grid .metric-grid { margin-top: 14px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.psi-grid .kv-grid { margin-top: 12px; }
.score-grade { font-size: 15px; font-weight: 600; color: var(--fog-50); }
.score-label { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--fog-500); }

.cat-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.cat-row { display: grid; gap: 4px; }
.cat-line { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.cat-name { color: var(--fog-300); }
.cat-points { color: var(--fog-500); }
.cat-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--ink-700);
  overflow: hidden;
}
.cat-fill { display: block; height: 100%; background: var(--brand-500); }

/* ------------------------------------------------------------- metrics */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-control);
  background: var(--ink-850);
  padding: 12px 14px;
}
.metric-label { font-size: 11.5px; color: var(--fog-500); }
.metric-value {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--fog-50);
  overflow-wrap: anywhere;
}
.metric-rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.metric-rating::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.metric-rating[data-rating='good'] { color: var(--pass-500); }
.metric-rating[data-rating='needs-improvement'] { color: var(--warn-500); }
.metric-rating[data-rating='poor'] { color: var(--fail-500); }
.metric-rating[data-rating='unavailable'] { color: var(--fog-500); }
.metric-note { margin-top: 7px; font-size: 11.5px; line-height: 1.5; color: var(--fog-500); }

/* An unavailable metric is dimmed but never hidden: the reason it cannot be
   measured is part of the answer. */
.metric[data-rating='unavailable'] { background: transparent; }

/* ----------------------------------------------------------- waterfall */

.waterfall { display: grid; gap: 7px; }
.wf-row {
  display: grid;
  grid-template-columns: minmax(88px, 118px) 1fr minmax(56px, auto);
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.wf-name { color: var(--fog-300); }
.wf-track { height: 10px; border-radius: 999px; background: var(--ink-700); overflow: hidden; }
.wf-bar { display: block; height: 100%; background: var(--brand-500); border-radius: 999px; }
.wf-bar[data-slow='true'] { background: var(--warn-500); }
.wf-ms { text-align: right; color: var(--fog-500); }

/* -------------------------------------------------------------- tables */

.totals-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  background: var(--ink-700);
  overflow: hidden;
}
.total-cell { background: var(--ink-800); padding: 12px 14px; }
.total-label { font-size: 11px; color: var(--fog-500); }
.total-value { margin-top: 3px; font-size: 16px; font-weight: 600; color: var(--fog-50); }

.res-table {
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  overflow: hidden;
}
/* The comparison table has three columns, not four. */
#ws-compare .res-row { grid-template-columns: minmax(0, 1.6fr) minmax(72px, auto) minmax(72px, auto); }
#ws-compare .res-row > :nth-child(4) { display: none; }

.res-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(52px, auto) minmax(66px, auto) minmax(46px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  font-size: 12.5px;
  border-top: 1px solid var(--ink-700);
}
.res-row:first-child { border-top: 0; }
.res-row.is-head {
  background: var(--ink-850);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fog-500);
}
.res-name { min-width: 0; overflow-wrap: anywhere; color: var(--fog-100); }
.res-num { text-align: right; color: var(--fog-300); }
.res-empty { padding: 14px; font-size: 13px; color: var(--fog-500); }

@media (max-width: 560px) {
  /* Four columns will not fit; the percentage is the one that can go, because
     the byte figure beside it says the same thing more precisely. */
  .res-row { grid-template-columns: minmax(0, 1.4fr) minmax(48px, auto) minmax(62px, auto); }
  .res-row > :nth-child(4) { display: none; }
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.kv {
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-control);
  background: var(--ink-850);
  padding: 10px 13px;
}
.kv-key { font-size: 11px; color: var(--fog-500); }
.kv-val { margin-top: 3px; font-size: 13.5px; color: var(--fog-50); overflow-wrap: anywhere; }

/* ----------------------------------------------------- recommendations */

.priorities {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
}
.priorities li { font-size: 13.5px; color: var(--fog-100); }
.prio-title { font-weight: 600; }
.prio-sev {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.prio-sev[data-sev='high'] { color: var(--fail-500); }
.prio-sev[data-sev='medium'] { color: var(--warn-500); }
.prio-sev[data-sev='low'] { color: var(--fog-500); }
.prio-evidence { margin-top: 3px; font-size: 12.5px; color: var(--fog-500); }
.prio-none { font-size: 13.5px; color: var(--fog-500); }

/* -------------------------------------------------------- connection */

.net-idle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13.5px;
  color: var(--fog-500);
}
.net-caveat {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--fog-500);
}

/* ----------------------------------------------------------- verdict */

.verdict-block { border-color: var(--brand-500); }
.verdict { font-size: 14.5px; line-height: 1.6; color: var(--fog-100); }

/* -------------------------------------------------------- cross links */

.cross-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.cross-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-card);
  background: var(--ink-800);
  padding: 16px 18px;
}
.cross-link h3 { font-size: 15px; }
.cross-link p { margin-top: 4px; font-size: 12.5px; color: var(--fog-500); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
