/**
 * Challenge page presentation.   SPEC.md §12.5 (:1419)
 *
 * Reasonable and unremarkable. The page should read as a routine check, not
 * as an incident — generic by default, no site branding, because at fleet
 * scale per-site assets are per-site work (§12.5:1423).
 *
 * Nothing here imitates a login. No credential fields, no payment mentions,
 * no borrowed branding: this page asks for nothing, and must not teach
 * anyone that a page like this is a normal place to type a password
 * (§12.5:1431).
 *
 * prefers-color-scheme rather than a stored preference, since a static file
 * has no state to remember one in (§12.5:1433).
 */

:root {
  --wprjs-bg: #f6f7f9;
  --wprjs-card: #ffffff;
  --wprjs-ink: #1f2328;
  --wprjs-muted: #57606a;
  --wprjs-line: #d8dee4;
  --wprjs-accent: #4a6fa5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wprjs-bg: #14171a;
    --wprjs-card: #1c2024;
    --wprjs-ink: #e6edf3;
    --wprjs-muted: #9198a1;
    --wprjs-line: #30363d;
    --wprjs-accent: #6e8fc4;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wprjs-bg);
  color: var(--wprjs-ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  padding: 24px;
}

.wprjs-card {
  width: 100%;
  max-width: 27rem;
  background: var(--wprjs-card);
  border: 1px solid var(--wprjs-line);
  border-radius: 10px;
  padding: 28px 26px;
  text-align: center;
}

/* The site's own name, above everything (#4). Written in by challenge.js —
   the page is static, so PHP cannot know it. */
.wprjs-host {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--wprjs-ink);
  word-break: break-word;
}
.wprjs-host:empty { display: none; }

h1 { margin: 0 0 6px; font-size: 1.17rem; font-weight: 600; }
#wprjs-note { margin: 0; color: var(--wprjs-muted); font-size: 0.94rem; }

/* Only ever shown after a long wait, so it must not reserve space before
   then — a card that changes height on load reads as a glitch. */
.wprjs-slow {
  margin: 16px 0 0;
  color: var(--wprjs-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.wprjs-slow[hidden] { display: none; }
.wprjs-slow a { color: var(--wprjs-accent); }

.wprjs-status {
  margin: 16px 0 0;
  color: var(--wprjs-muted);
  font-size: 0.94rem;
  min-height: 1.4em;
}

/* Indeterminate, never a percentage. The search is probabilistic — the next
   nonce might be the winner or might not — so a bar that stalled at 90%
   would read worse than honest movement (§11.6.2:1052). */
.wprjs-bar {
  margin: 20px auto 0;
  height: 4px;
  width: 100%;
  border-radius: 2px;
  background: var(--wprjs-line);
  overflow: hidden;
}
.wprjs-bar span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 2px;
  background: var(--wprjs-accent);
  animation: wprjs-slide 1.15s ease-in-out infinite;
}
@keyframes wprjs-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(365%); }
}

/* A real control, not a styled div: focusable, keyboard-operable, labelled
   (§11.6.3:1044). */
.wprjs-go, .wprjs-retry {
  margin-top: 20px;
  font: inherit;
  color: var(--wprjs-ink);
  background: var(--wprjs-card);
  border: 1px solid var(--wprjs-line);
  border-radius: 7px;
  padding: 9px 17px;
  cursor: pointer;
}
.wprjs-go:hover, .wprjs-retry:hover { border-color: var(--wprjs-accent); }
.wprjs-go:focus-visible, .wprjs-retry:focus-visible {
  outline: 2px solid var(--wprjs-accent);
  outline-offset: 2px;
}

body[data-wprjs="success"] h1::before { content: "✓ "; color: #2da44e; }

@media (prefers-reduced-motion: reduce) {
  .wprjs-bar span { animation-duration: 3s; }
}
