/* The reading speed test (tools/speed-test-page.mjs). Built on blog.css: its colours, type and buttons. */
.rt { --rt-error: #a3261c; }
@media (prefers-color-scheme: dark) { .rt { --rt-error: #ffb4ab; } }

.rt-head { padding-bottom: 24px; }
.rt-head .rt-from { margin-top: 14px; font-size: 14px; color: var(--ink-3); }

.rt-card {
  margin: 0;
  padding: 28px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
@media (max-width: 479px) { .rt-card { padding: 24px 20px; } }
.rt-card-head { margin: 0 0 12px; font: 600 22px/1.25 var(--font-serif); letter-spacing: -0.01em; }
.rt-card-head:focus, .rt-passage-head:focus { outline: none; }
.rt-note { margin: 0 0 14px; max-width: 60ch; font-size: 16px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.rt-warn { color: var(--ink); }
/* blog.css styles .btn for links; a <button> also needs the browser's own border taken off */
.rt button.btn { border: 0; cursor: pointer; }
/* on a touch screen a tapped spot stays "hovered", so the hover tint would stick to whatever lands under the finger */
@media (hover: none) { .rt .btn-quiet:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); } }
.rt-go { margin-top: 8px; }
@media (max-width: 479px) { .rt-go { width: 100%; } }
/* a long button label wraps onto two lines on a phone instead of running out of the card */
.rt-wrap { white-space: normal; text-align: center; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; }

/* the passage reads like a book page, under a line that says the clock is running; the line stays at the top of the
   screen while the reader scrolls, so the clock is never out of sight */
.rt-timing {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin: -10px 0 14px;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.rt-timing-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.rt-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.rt-link {
  min-height: 44px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  background: none;
  font: 500 14px/1 var(--font-ui);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.rt-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.rt-passage-head { margin: 0 0 16px; font: 600 24px/1.25 var(--font-serif); letter-spacing: -0.012em; }
.rt-passage { max-width: 62ch; }
.rt-passage p:last-child { margin-bottom: 1.4em; }

/* the questions */
.rt-q { margin: 0 0 22px; padding: 0; border: 0; }
.rt-q legend { margin: 0 0 4px; padding: 0; font: 600 17px/1.4 var(--font-ui); }
.rt-q-num { color: var(--ink-3); }
.rt-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 8px;
  padding: 0 14px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 16px;
  cursor: pointer;
}
@media (hover: hover) { .rt-opt:hover { background: var(--accent-soft); } }
.rt-opt input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.rt-opt:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.rt-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.rt-q[aria-invalid] .rt-opt { box-shadow: inset 0 0 0 1px var(--rt-error); }
.rt-msg { margin: 0 0 8px; min-height: 0; font-size: 15px; line-height: 1.45; color: var(--rt-error); }
.rt-msg:empty { display: none; }
.rt-status { margin-top: 14px; color: var(--ink-2); }

/* the result */
.rt-big { margin: 6px 0 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rt-wpm { font: 600 64px/1 var(--font-serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.rt-unit { font-size: 18px; color: var(--ink-2); }
.rt-score { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.rt-says { margin: 0; max-width: 60ch; font-size: 16px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.rt-care {
  margin: 14px 0 0;
  max-width: 60ch;
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--rt-error) 9%, transparent);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
.rt-sub { margin: 24px 0 6px; font: 600 15px/1.3 var(--font-ui); color: var(--ink); }
.rt-times { margin: 0; padding: 0; list-style: none; }
.rt-times li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.rt-times li:last-child { border-bottom: 1px solid var(--line); }
.rt-times b { font-weight: 600; color: var(--ink); white-space: nowrap; }

.rt-scale { margin: 26px 0 8px; }
.rt-labels { position: relative; height: 20px; margin: 8px 0 0; font: 13px/20px var(--font-ui); color: var(--ink-2); }
.rt-labels-top { margin: 0 0 8px; }
.rt-label { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.rt-label[data-edge='start'] { transform: none; }
.rt-label[data-edge='end'] { transform: translateX(-100%); }
.rt-label-you { font-weight: 600; color: var(--ink); }
.rt-track { position: relative; height: 10px; border-radius: 999px; background: var(--line-strong); }
.rt-band { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--accent) 38%, transparent); }
.rt-tick { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ink-3); }
.rt-you {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface);
  transform: translate(-50%, -50%);
}
.rt-key { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font: 13px/1.4 var(--font-ui); color: var(--ink-3); }
.rt-key-band { flex: none; width: 18px; height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 38%, transparent); }

.rt-speed { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.rt-speed-head { margin: 0 0 8px; font: 600 19px/1.3 var(--font-serif); }
.rt-small { margin: 8px 0 18px; font-size: 14px; line-height: 1.45; color: var(--ink-3); }
.rt-how { margin: 0 0 10px; max-width: 60ch; }
.rt-how:first-of-type { margin-top: 22px; }
.rt-how a { color: inherit; }
.rt-after { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }

/* the explanation and questions under the test */
.rt-info { margin-top: 8px; }
.rt-info h2:first-child { margin-top: 2em; }
.rt-faq { margin-top: 40px; }
