/*
  THEME FILE: the only file to edit to change the look of the whole site.
  Every colour, font, radius, spacing step and shadow lives here as a variable.
  base.css, wp.css and the tool scripts read these variables and contain no colours of their own.

  Look: "Timing Tower" (v2, 4 Dec 2026). Every test is a lap: the site is a live timing screen
  for your own devices. One ground for everyone, black glass, because the scene is a desk or a
  phone in a dim room where the screen is the only light. Light is state: things light up only
  while live or once measured. Colour lives only in readings and the one action, always beside a
  word: purple your best, green works or improved, yellow check, red fault (red is used for
  nothing else). The one lit action is white.

  Contrast checked (WCAG 2.2, 4 Dec 2026) on the ground and every surface:
  text 14.7 to 18.2:1, muted text 6.6 to 8.2:1, faint labels 4.6:1 or more on --surface-2 and below,
  green 8.2:1 or more, yellow 10.8:1 or more, red 5.3:1 or more, purple text 4.5:1 or more,
  dark text on the white action 18.2:1. Purple fill (--best) is for fills only (4.3:1 on the ground).

  Fonts, all SIL Open Font License 1.1, served from our own /assets/fonts/ (no request to Google):
  Anybody (italic variable, width 50 to 150, weight 100 to 900) for readings, headings, nav and brand;
  Schibsted Grotesk for text; Martian Mono only for typed text and code.
  Downloaded from Google Fonts on 4 Dec 2026 with the owner's OK. Licence: fonts/OFL.txt.
*/

@font-face {
  font-family: "Anybody"; font-style: italic; font-weight: 100 900; font-stretch: 50% 150%; font-display: swap;
  src: url("fonts/anybody-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Anybody"; font-style: italic; font-weight: 100 900; font-stretch: 50% 150%; font-display: swap;
  src: url("fonts/anybody-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Martian Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/martian-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Martian Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/martian-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Ground and surfaces: black glass, ranked by light */
  --bg: #07080a;
  --surface: #0e1013;
  --surface-2: #15181c;
  --surface-3: #1d2126;
  --border: #262a31;
  --border-strong: #3a3f48;
  --glass-edge: rgba(244, 244, 242, 0.06);

  /* Text */
  --text: #f4f4f2;
  --text-muted: #a2a6ad;
  --text-faint: #7d828a;
  --selection: rgba(183, 92, 245, 0.38);

  /* The one lit action and live state: white light */
  --accent: #f4f4f2;
  --accent-strong: #ffffff;
  --accent-soft: rgba(244, 244, 242, 0.1);
  --on-accent: #07080a;
  --link: #f4f4f2;
  --link-line: rgba(244, 244, 242, 0.45);

  /* Status: always beside a word */
  --best: #a63cf0;
  --best-text: #b75cf5;
  --ok: #19d36b;
  --ok-soft: rgba(25, 211, 107, 0.12);
  --warn: #f5d10b;
  --warn-soft: rgba(245, 209, 11, 0.12);
  --bad: #ff5a5f;
  --bad-soft: rgba(255, 90, 95, 0.12);
  --led-off: #1a1c20;
  --mask-on: #000;
  --print-ink: #000;

  /* Meter (level bar and graphs) */
  --meter-track: #15181c;
  --meter-low: #19d36b;
  --meter-mid: #f5d10b;
  --meter-high: #ff5a5f;
  --graph-line: #19d36b;
  --graph-grid: #1d2126;

  /* Type */
  --font-display: "Anybody", "Schibsted Grotesk", system-ui, sans-serif;
  --font-body: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --display-stretch: 62%;
  --display-stretch-wide: 80%;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.75rem, 1.4rem + 1.2vw, 2.375rem);
  --text-2xl: clamp(2.75rem, 1.9rem + 3.8vw, 4.75rem);
  --text-reading: clamp(5.5rem, 3rem + 10vw, 12rem);
  --leading: 1.6;
  --weight-bold: 650;
  --weight-display: 850;
  --tracking-display: -0.01em;
  --tracking-caps: 0.14em;

  /* Shape: cut corners and slanted ends instead of rounded boxes */
  --cut: 14px;
  --cut-sm: 8px;
  --slant: 12px;
  --radius-sm: 2px;
  --radius: 2px;
  --radius-lg: 2px;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3.5rem;
  --space-8: 5.5rem;
  --page-width: 80rem;
  --text-width: 44rem;
  --header-h: 3.5rem;
  --rev-h: 6px;

  /* Depth and motion */
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 6px 12px rgba(0, 0, 0, 0.45), 0 22px 48px rgba(0, 0, 0, 0.6);
  --inner-light: inset 0 1px 0 rgba(244, 244, 242, 0.05);
  --sheen: linear-gradient(90deg, #14161a, #0d0e11);
  --sheen-lit: linear-gradient(90deg, #1d2126, #121418);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 160ms;

  color-scheme: dark;
}

/*
  Layout and components. Uses only variables from theme.css.
  Do not put colours, fonts or shadows here: change them in theme.css.

  Shapes: panels have cut corners and buttons and rows have slanted ends. The shape is drawn on a
  ::before layer with clip-path, so focus outlines on the element itself are never clipped.
*/

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-color: var(--border-strong) var(--bg); background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  caret-color: var(--accent);
  accent-color: var(--accent);
}
::selection { background: var(--selection); color: var(--text); }

img, svg, canvas, video { display: block; max-width: 100%; }

a { color: var(--link); text-decoration-line: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Display voice: heavy condensed italic for headings, readings, nav and actions */
h1, h2, .brand, .site-nav a, .btn, .bignum, .pad .big, .stat dd, .tool-card strong, .steps li::marker, .key, .chip, .seg button, .badge {
  font-family: var(--font-display);
  font-style: italic;
  font-stretch: var(--display-stretch);
}

h1, h2, h3 { line-height: 1.1; margin: 0 0 var(--space-3); text-wrap: balance; }
h1 { font-size: var(--text-2xl); font-weight: var(--weight-display); letter-spacing: var(--tracking-display); line-height: 0.94; text-transform: uppercase; margin-bottom: var(--space-4); }
h2 { font-size: var(--text-xl); font-weight: 820; letter-spacing: 0.005em; line-height: 1; text-transform: uppercase; margin-top: var(--space-8); }
h3 { font-family: var(--font-body); font-size: var(--text-lg); font-weight: var(--weight-bold); margin-top: var(--space-5); }
p, ul, ol { margin: 0 0 var(--space-4); }
strong { font-weight: var(--weight-bold); }

.skip-link {
  position: absolute; left: var(--space-3); top: -4rem; z-index: 200;
  background: var(--accent); color: var(--on-accent); font-weight: var(--weight-bold);
  padding: var(--space-2) var(--space-4); text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

.wrap { width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 0 clamp(var(--space-4), 3vw, var(--space-6)); }

/* Rev lights: a strip of LEDs across the top of every page. Dark until something is live. */
.rev { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; height: var(--rev-h); padding: 0 clamp(var(--space-4), 3vw, var(--space-6)); margin-top: var(--space-2); max-width: var(--page-width); margin-inline: auto; }
.rev i { display: block; background: var(--led-off); transform: skewX(-18deg); }
.rev i.is-g { background: var(--ok); }
.rev i.is-y { background: var(--warn); }
.rev i.is-p { background: var(--best); }
.rev i.is-r { background: var(--bad); }

/* Header */
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-5); min-height: var(--header-h); padding-top: var(--space-2); padding-bottom: var(--space-2); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 880; font-size: 1.5rem; line-height: 1; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text); text-decoration: none; }
.brand::before {
  content: ""; width: 20px; height: 14px; flex: none; transform: skewX(-18deg);
  background:
    linear-gradient(var(--accent), var(--accent)) 0 100% / 4px 45% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 8px 100% / 4px 72% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 16px 100% / 4px 100% no-repeat;
}
.brand:hover { color: var(--text); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.site-nav a {
  position: relative; color: var(--text-muted); text-decoration: none; padding: var(--space-2) 0;
  font-size: 1.0625rem; font-weight: 760; text-transform: uppercase; letter-spacing: 0.06em; font-stretch: var(--display-stretch-wide);
}
.site-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 240ms var(--ease); }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"]::after { transform: none; }

/* Breadcrumb */
.breadcrumb { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-5) 0 var(--space-4); }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); }

main { padding-bottom: var(--space-8); }
.page-intro { max-width: 60rem; margin-bottom: var(--space-5); }
.lead { font-size: var(--text-lg); line-height: 1.5; color: var(--text-muted); margin-bottom: var(--space-3); max-width: 38em; }
.prose { max-width: var(--text-width); }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }

/* Panels: black glass with two cut corners */
.panel { position: relative; isolation: isolate; padding: var(--space-5); }
.panel::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--glass-edge), transparent 9rem), var(--surface);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.panel.tool { padding: clamp(var(--space-4), 3vw, var(--space-6)); }
.panel + .panel { margin-top: var(--space-4); }
.dt-overlay::before { content: none; }

/* Buttons: slanted ends; the one lit action is white */
.btn {
  --btn-bg: var(--surface-3);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.875rem; padding: 0 calc(var(--space-5) + var(--slant) / 2);
  font-size: 1.1875rem; font-weight: 800; line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; text-decoration: none;
  border: 0; background: none; color: var(--text); cursor: pointer;
  transition: transform var(--dur) var(--ease);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--btn-bg);
  clip-path: polygon(var(--slant) 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%);
}
.btn:hover { --btn-bg: var(--border-strong); color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.38; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { --btn-bg: var(--surface-3); }
.btn-primary { --btn-bg: var(--accent); color: var(--on-accent); }
.btn-primary:hover { --btn-bg: var(--accent-strong); color: var(--on-accent); }
.btn-primary[disabled]:hover { --btn-bg: var(--accent); }
.btn.is-playing { --btn-bg: var(--ok); color: var(--on-accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.field { display: grid; gap: var(--space-1); font-size: var(--text-sm); min-width: 0; }
.field label { color: var(--text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
select, input[type="number"], input[type="text"], .typing-input {
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface-2); border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0;
  min-height: 2.875rem; padding: 0 var(--space-3); max-width: 100%; width: 100%;
}
select { color-scheme: dark; }
select:hover, input[type="number"]:hover, input[type="text"]:hover, .typing-input:hover { border-bottom-color: var(--text-muted); }
select:focus-visible, input:focus-visible, .typing-input:focus-visible { outline-offset: 0; border-bottom-color: var(--accent); }
select[disabled] { opacity: 0.55; }
.check { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.check input { margin-top: 0.3em; accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* Status line: a light and a sentence. The light's colour is the state; the words say it too. */
.status { position: relative; padding: var(--space-1) 0 var(--space-1) 1.75rem; font-size: var(--text-sm); color: var(--text); margin: var(--space-4) 0 0; min-height: 1.75rem; }
.status::before { content: ""; position: absolute; left: 0.2rem; top: 0.45rem; width: 0.55rem; height: 1rem; background: var(--led-off); box-shadow: inset 0 0 0 1px var(--border-strong); transform: skewX(-18deg); }
.status[data-state="ok"]::before { background: var(--ok); box-shadow: none; }
.status[data-state="warn"]::before { background: var(--warn); box-shadow: none; }
.status[data-state="bad"]::before { background: var(--bad); box-shadow: none; }
.status strong { color: inherit; }

/* Tool layout */
.tool { display: grid; gap: var(--space-5); }
.tool-controls { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .tool-controls { grid-template-columns: 1fr auto; align-items: end; } }

/* Level meter: segmented like a rev light */
.meter { position: relative; height: 1.75rem; background: var(--meter-track); overflow: hidden; }
.meter-fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--meter-low) 0 60%, var(--meter-mid) 60% 85%, var(--meter-high) 85% 100%);
  -webkit-mask: repeating-linear-gradient(90deg, var(--mask-on) 0 10px, transparent 10px 13px);
  mask: repeating-linear-gradient(90deg, var(--mask-on) 0 10px, transparent 10px 13px);
  clip-path: inset(0 100% 0 0);
}
.meter-peak { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--text); left: 0; opacity: 0; }
.is-live .meter-peak { opacity: 0.85; }
.meter-scale { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; margin-top: var(--space-1); }

.graph { width: 100%; height: 120px; background: var(--bg); }

/* Readings: no boxes, a hairline above each, the number in the display face */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--space-4) var(--space-5); margin: 0; }
.stat { min-width: 0; padding-top: var(--space-2); border-top: 1px solid var(--border); }
.stat dt { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.35; }
.stat dd { margin: var(--space-1) 0 0; font-size: 1.5rem; font-weight: 780; line-height: 1.08; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

audio { width: 100%; color-scheme: dark; }

/* Error decoder: a red tint, cut corners */
.decoder::before { background: var(--bad-soft); }
.decoder h2 { margin-top: 0; font-size: var(--text-lg); }
.decoder code { font-family: var(--font-mono); font-size: var(--text-xs); background: var(--surface-3); padding: 0 var(--space-1); }
.decoder ol { padding-left: 1.25rem; }

/* How it works */
.how { margin-top: var(--space-6); }
.how h2 { margin-top: 0; font-size: var(--text-lg); font-stretch: var(--display-stretch-wide); }
.how ul { padding-left: 1.25rem; margin-bottom: 0; }

.privacy-line { font-size: var(--text-sm); color: var(--text-muted); display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; }

/* Ad slot: fixed height so the page does not move when an ad loads */
.ad-slot { min-height: var(--ad-height, 280px); margin: var(--space-5) 0; }

/* Steps and FAQ */
.steps { padding-left: 2rem; }
.steps li { padding-left: var(--space-2); margin-bottom: var(--space-2); }
.steps li::marker { color: var(--text); font-weight: 860; font-size: 1.25em; }
.prose ul:not(.steps) li::marker { color: var(--text-faint); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: var(--weight-bold); list-style: none; display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 0.875rem; height: 0.875rem; margin-top: 0.45em;
  background: linear-gradient(var(--text-muted), var(--text-muted)) center / 100% 2px no-repeat, linear-gradient(var(--text-muted), var(--text-muted)) center / 2px 100% no-repeat;
  transition: transform var(--dur) var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent-strong); }
.faq details > :not(summary) { color: var(--text-muted); }

/* Test lists: tower rows with a slanted end, not a grid of cards */
.tool-group { margin-top: var(--space-8); }
.tool-group h2 { margin-top: 0; }
.tool-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.tool-card {
  position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr auto; align-items: center; align-content: center; gap: 2px var(--space-4);
  height: 100%; min-height: 3.75rem; padding: var(--space-2) calc(var(--slant) + var(--space-4)) var(--space-2) var(--space-4);
  color: var(--text); text-decoration: none;
}
.tool-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sheen);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%);
}
.tool-card::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 0.625rem; height: 1.75rem; background: var(--led-off); box-shadow: inset 0 0 0 1px var(--border); transform: skewX(-18deg); }
a.tool-card:hover { color: var(--text); }
a.tool-card:hover::before { background: var(--sheen-lit); }
a.tool-card:hover::after { background: var(--accent); box-shadow: none; }
.tool-card[data-state="best"]::after { background: var(--best); box-shadow: none; }
.tool-card[data-state="ok"]::after { background: var(--ok); box-shadow: none; }
.tool-card[data-state="warn"]::after { background: var(--warn); box-shadow: none; }
.tool-card[data-state="bad"]::after { background: var(--bad); box-shadow: none; }
.tool-card strong { display: block; grid-column: 1; font-size: 1.375rem; font-weight: 820; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.01em; }
.tool-card > span { grid-column: 1; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.4; }
.tool-card[aria-disabled="true"] { opacity: 0.5; }
.badge { display: inline-block; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: var(--surface-3); color: var(--text-muted); padding: 0 var(--space-2); margin-left: var(--space-2); vertical-align: middle; }

/* Related tests */
.related { margin-top: var(--space-8); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-6) 0; font-size: var(--text-sm); color: var(--text-muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-bottom: var(--space-3); }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }
.site-footer p { margin: 0; }

@media (max-width: 700px) {
  .site-header .wrap { padding-right: 0; }
  .site-nav {
    flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; column-gap: var(--space-4);
    padding-right: var(--space-4); -webkit-mask: linear-gradient(90deg, var(--mask-on) 85%, transparent); mask: linear-gradient(90deg, var(--mask-on) 85%, transparent);
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { font-size: 0.9375rem; white-space: nowrap; min-height: 2.75rem; display: inline-flex; align-items: center; padding: 0; }
  .site-footer a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}
@media (max-width: 480px) {
  .panel { padding: var(--space-4); }
  .btn { flex: 1 1 auto; }
  .stat dd { font-size: 1.3125rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Shared tool parts ---------- */
.dt-overlay { position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; }
.dt-overlay-on, .dt-overlay-on body { overflow: hidden; }
.overlay-hint {
  position: absolute; left: 50%; bottom: var(--space-5); transform: translateX(-50%);
  background: var(--surface-3); color: var(--text); padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm); box-shadow: var(--shadow-lg); white-space: nowrap; max-width: calc(100% - 2rem);
  overflow: hidden; text-overflow: ellipsis; transition: opacity 400ms var(--ease);
}
.overlay-hint.is-faded { opacity: 0; }

/* Reaction and click pads. Go is the reading moment: the pad lights green. Too soon is a fault. */
.pad {
  display: grid; place-items: center; text-align: center; min-height: 14rem; padding: var(--space-5);
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--border-strong);
  user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer;
}
.pad[data-state="wait"] { background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--warn); }
.pad[data-state="go"] { background: var(--ok); color: var(--on-accent); box-shadow: none; }
.pad[data-state="go"] .muted { color: var(--on-accent); }
.pad[data-state="early"] { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.pad .big { font-size: var(--text-2xl); font-weight: 880; line-height: 1; text-transform: uppercase; }

.bignum { font-size: clamp(3rem, 2.2rem + 4vw, 5.5rem); font-weight: 880; line-height: 0.95; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); padding: 2px; }
.seg button { font-size: 1.0625rem; font-weight: 760; text-transform: uppercase; letter-spacing: 0.04em; border: 0; background: transparent; color: var(--text-muted); padding: var(--space-2) var(--space-4); cursor: pointer; min-height: 2.5rem; transition: color var(--dur) var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th, table.data td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-muted); font-weight: 500; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
table.data td { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Keyboard */
.kb { display: grid; gap: 4px; overflow-x: auto; padding-bottom: var(--space-2); }
.kb-row { display: flex; gap: 4px; }
.key {
  flex: 0 0 auto; width: calc(var(--u, 1) * 2.6rem); height: 2.6rem; display: grid; place-items: center;
  font-size: 0.9375rem; font-weight: 760; background: var(--surface-2); color: var(--text-muted);
  box-shadow: inset 0 -2px 0 var(--surface-3); white-space: nowrap;
}
.key.is-done { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 -2px 0 var(--ok); }
.key.is-down, .key.is-down.is-done { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.kb-gap { flex: 0 0 auto; width: 1rem; }

/* Mouse and gamepad */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { padding: var(--space-1) var(--space-3); background: var(--surface-2); color: var(--text-muted); font-size: 1.0625rem; font-weight: 760; text-transform: uppercase; letter-spacing: 0.03em; }
.chip.is-on { background: var(--accent); color: var(--on-accent); }
.chip.is-done { background: var(--ok-soft); color: var(--ok); }
.chip.is-bad { background: var(--bad-soft); color: var(--bad); }

.stick { width: 9rem; height: 9rem; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); position: relative; }
.stick-dot { position: absolute; left: 50%; top: 50%; width: 1rem; height: 1rem; margin: -0.5rem 0 0 -0.5rem; border-radius: 50%; background: var(--accent); }
.stick-dead { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px dashed var(--text-faint); transform: translate(-50%, -50%); }
.bar { height: 0.75rem; background: var(--meter-track); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); }

.area { position: relative; width: 100%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; touch-action: none; }
.target { position: absolute; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); transform: translate(-50%, -50%); cursor: crosshair; }

.swatch-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatch { width: 2.75rem; height: 2.75rem; border: 1px solid var(--border-strong); border-radius: 0; cursor: pointer; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }

.typing-text { font-family: var(--font-mono); font-size: var(--text-lg); line-height: 1.8; background: var(--surface-2); padding: var(--space-4); user-select: none; color: var(--text-muted); }
.typing-text .ok { color: var(--ok); }
.typing-text .bad { color: var(--bad); background: var(--bad-soft); }
.typing-text .cur { box-shadow: inset 2px 0 0 var(--accent); color: var(--text); }
.typing-input { font-family: var(--font-mono); font-size: var(--text-base); padding: var(--space-3); }

.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: var(--space-4) var(--space-5); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
video.preview { width: 100%; max-height: 70vh; background: var(--bg); object-fit: contain; }
.mirror { transform: scaleX(-1); }

/* Refresh rate cells and motion blur lanes */
.rr-cells { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.rr-cells i { display: block; aspect-ratio: 1; background: var(--surface-2); }
.rr-cells i.on { background: var(--ok); }
.mb-lanes { display: grid; gap: var(--space-3); }
.mb-lane { position: relative; height: 6rem; background: var(--surface-2); overflow: hidden; }
.mb-label { position: absolute; left: var(--space-3); top: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); z-index: 1; font-variant-numeric: tabular-nums; }
.mb-obj { position: absolute; top: 2rem; left: 0; width: 96px; height: 3.5rem; will-change: transform; }
.mb-lanes[data-shape="card"] .mb-obj { background: var(--surface); border: 3px solid var(--text); display: grid; place-items: center; font-weight: var(--weight-bold); color: var(--text); font-size: var(--text-lg); }
.mb-lanes[data-shape="bars"] .mb-obj { background: repeating-linear-gradient(90deg, var(--text) 0 6px, transparent 6px 12px); }
.mb-lanes[data-shape="bars"] .mb-obj span { visibility: hidden; }
.mb-lanes[data-shape="line"] .mb-obj { width: 6px; background: var(--text); }
.mb-lanes[data-shape="line"] .mb-obj span { display: none; }

/* Full device check: print only the report */
@media print {
  body.print-report * { visibility: hidden; }
  body.print-report [id="fdc-report"], body.print-report [id="fdc-report"] * { visibility: visible; color: var(--print-ink); }
  body.print-report [id="fdc-report"] { position: absolute; left: 0; top: 0; width: 100%; }
  body.print-report [id="fdc-report"] .btn-row { display: none; }
}
.fdc-box { display: grid; place-items: center; text-align: center; min-height: 9rem; padding: var(--space-4); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border-strong); user-select: none; -webkit-user-select: none; }
.fdc-video { width: 100%; max-width: 28rem; aspect-ratio: 4 / 3; background: var(--bg); object-fit: cover; transform: scaleX(-1); }
[id="fdc-actions"] { margin-top: var(--space-4); }

/*
  WordPress parts: the home stage and timing tower, block markup and the Rank Math breadcrumb,
  styled to match base.css. Uses only variables from theme.css; no colours here.
*/

/* Page head: the title is printed by the theme, the lead is the first block of the page. */
.page-intro { margin: var(--space-6) 0 var(--space-3); }
.page-intro.is-home { margin-top: var(--space-6); }
.entry > .lead:first-child { margin-bottom: var(--space-6); }
.entry > :last-child { margin-bottom: 0; }

/* Breadcrumb (Rank Math markup) */
.rank-math-breadcrumb { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-5) 0 0; text-transform: uppercase; letter-spacing: 0.08em; }
.rank-math-breadcrumb p { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.rank-math-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.rank-math-breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.rank-math-breadcrumb .separator { color: var(--text-faint); }
.rank-math-breadcrumb .last { color: var(--text); }

/* Help text sections are block groups */
.wp-block-group__inner-container > :last-child { margin-bottom: 0; }
.wp-block-list { margin-top: 0; }
.faq .wp-block-details > :last-child { margin-bottom: var(--space-4); }

/* ---------- Home stage: H1 and lead, live screen telemetry, the timing tower ---------- */
.stage {
  display: grid; grid-template-columns: 1fr; grid-template-areas: "copy" "live" "tower";
  gap: var(--space-5); padding-top: var(--space-5);
}
.stage-copy { grid-area: copy; min-width: 0; }
.stage h1 { font-size: clamp(2.5rem, 1.9rem + 2.6vw, 3.75rem); margin-bottom: var(--space-3); }
.stage .lead { font-size: var(--text-base); margin: 0; max-width: 30em; }

.stage-live { grid-area: live; min-width: 0; display: grid; align-content: start; }
.live-label { margin: 0; font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.live-reading {
  margin: 0; display: flex; align-items: baseline; gap: var(--space-2);
  font-family: var(--font-display); font-style: italic; font-stretch: var(--display-stretch);
  font-weight: 900; line-height: 0.8; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.live-hz { font-size: clamp(5.5rem, 24vw, 8.5rem); padding-right: 0.06em; }
.live-hz:empty::before { content: "000"; color: var(--led-off); }
.live-unit { font-size: clamp(1.75rem, 1.2rem + 2vw, 3.5rem); color: var(--text-muted); font-weight: 820; }
.live-trace { width: 100%; height: clamp(72px, 12vh, 200px); margin: var(--space-3) 0 var(--space-2); }
.live-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-5); }
.live-stats div { border-top: 1px solid var(--border); padding-top: var(--space-1); min-width: 0; }
.live-stats dt { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.3; }
.live-stats dd { margin: var(--space-1) 0 0; font-family: var(--font-display); font-style: italic; font-stretch: var(--display-stretch); font-weight: 780; font-size: 1.25rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.live-stats dd[data-state="ok"] { color: var(--ok); }
.live-stats dd[data-state="warn"] { color: var(--warn); }

.stage-action { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
.btn-start { min-height: 3.75rem; font-size: 1.75rem; font-weight: 880; padding: 0 calc(var(--space-7) + var(--slant)); --slant: 18px; }
.stage-best { margin: 0; font-size: var(--text-sm); color: var(--text-muted); max-width: 24rem; }
.stage-best strong { color: var(--best-text); font-family: var(--font-display); font-style: italic; font-stretch: var(--display-stretch); font-size: 1.25rem; }

/* Timing tower: rows dark until measured; a reading lights its row and ranks it */
.tower { grid-area: tower; list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; align-content: start; }
.tower-row a {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 2.25rem 1fr auto 0.625rem; align-items: center; gap: var(--space-3);
  min-height: 3.25rem; padding: 0 calc(var(--slant) + var(--space-3)) 0 var(--space-3);
  color: var(--text-muted); text-decoration: none;
}
.tower-row a::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sheen);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%);
}
.tower-row a::after { content: ""; width: 0.625rem; height: 1.75rem; background: var(--led-off); box-shadow: inset 0 0 0 1px var(--border); transform: skewX(-18deg); }
.tower-pos, .tower-name, .tower-read { font-family: var(--font-display); font-style: italic; font-stretch: var(--display-stretch); }
.tower-pos { font-size: 1.125rem; font-weight: 760; color: var(--text-faint); }
.tower-name { font-size: 1.5rem; font-weight: 820; text-transform: uppercase; line-height: 1; color: var(--text); }
.tower-read { font-size: 1rem; font-weight: 600; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tower-row a:hover { color: var(--text); }
.tower-row a:hover::before { background: var(--sheen-lit); }
.tower-row a:hover::after { background: var(--accent); box-shadow: none; }
.tower-row.is-lit a::before { background: var(--sheen-lit); }
.tower-row.is-lit .tower-pos { color: var(--text); }
.tower-row.is-lit .tower-read { font-size: 1.375rem; font-weight: 820; color: var(--text); }
.tower-row[data-state="ok"] a::after { background: var(--ok); box-shadow: none; }
.tower-row[data-state="warn"] a::after { background: var(--warn); box-shadow: none; }
.tower-row[data-state="bad"] a::after { background: var(--bad); box-shadow: none; }
.tower-row[data-state="best"] a::after { background: var(--best); box-shadow: none; }
.tower-row[data-state="best"] .tower-read { color: var(--best-text); }

@media (min-width: 900px) {
  .stage {
    grid-template-columns: minmax(19rem, 1fr) minmax(0, 2fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "copy live" "tower live";
    column-gap: clamp(2.5rem, 5vw, 5.5rem); row-gap: var(--space-5);
    padding-top: var(--space-6);
  }
  .stage-live { grid-template-rows: auto auto minmax(110px, 1fr) auto auto; height: 100%; }
  .live-hz { font-size: var(--text-reading); }
  .live-trace { height: 100%; min-height: 110px; max-height: 260px; contain: size; }
  .live-stats { max-width: 40rem; }
}

@media (max-width: 899px) {
  .stage { gap: var(--space-4); padding-top: var(--space-4); }
  .live-trace { height: clamp(56px, 9vh, 120px); margin: var(--space-2) 0; }
  .live-stats { margin-bottom: var(--space-4); }
}
@media (max-width: 480px) {
  .stage .lead { font-size: 1rem; }
  .btn-start { width: 100%; font-size: 1.5rem; }
  .live-stats dd { font-size: 1.0625rem; }
  .tower-name { font-size: 1.3125rem; }
}

/* ---------- Home groups: the heading and its line on the left, tower rows on the right ---------- */
.tool-group { scroll-margin-top: var(--space-4); }
@media (min-width: 900px) {
  .home .tool-group > .wp-block-group__inner-container {
    display: grid; grid-template-columns: minmax(19rem, 1fr) minmax(0, 2fr); grid-template-rows: auto auto 1fr;
    column-gap: clamp(2.5rem, 5vw, 5.5rem);
  }
  .home .tool-group > .wp-block-group__inner-container > * { grid-column: 1; }
  .home .tool-group > .wp-block-group__inner-container > .tool-grid { grid-column: 2; grid-row: 1 / span 3; }
}
.home .tool-group p.muted { max-width: 24rem; }
