/*****************************************************************
 *  WRENCH CHECK — public/app.css                                 *
 *  The app's own look, built ON tokens.css.                      *
 *  Every colour comes from the tokens; this file only adds       *
 *  layout and the few pieces the test needs.                     *
 *****************************************************************/

/*****************************************************************
 *  TABLE OF CONTENTS                                             *
 *  SECTION 1 — Themes: dark and high contrast (added, not        *
 *              replacing the light tokens)                       *
 *  SECTION 2 — Page frame (top bar, main column, footer)         *
 *  SECTION 3 — Forms and lists                                   *
 *  SECTION 4 — The test screen (clocks, answers, bottom bar)     *
 *  SECTION 5 — Results and score bars                            *
 *  SECTION 6 — The employer report rows                          *
 *  SECTION 7 — The certificate (screen and print)                *
 *  SECTION 8 — Small helpers                                     *
 *  SECTION 9 — Added 2026-10-13: hosted-by line, the three       *
 *              levels, the proctor's attestation box             *
 *****************************************************************/

/* WHY (2026-10-13, build): the brief says Light/Dark/High-contrast come "free" from the
   tokens file, but the tokens file on disk only has the light palette. Skins are only
   ever added, never removed, so the dark and high-contrast values are ADDED here,
   beside the light ones, switched by the reader's own system setting.               */


/*****************************************************************
 *  SECTION 1 — THEMES                                            *
 *****************************************************************/

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #12161b;       /* page background, dark */
    --surface: #1b2128;      /* cards, dark */
    --ink: #eef1f4;          /* text, dark */
    --muted: #b4bcc6;        /* secondary text, dark (AAA on the cards) */
    --line: #2f3843;         /* hairlines, dark */
    --brand: #6fb1f5;        /* THE blue, lifted for dark backgrounds */
    --brand-soft: #1d3248;
    --ok: #6fd39a;
    --ok-soft: #15291e;
    --warn: #f0c35a;
    --warn-soft: #2c2412;
    --bad: #ff9a8f;
    --bad-soft: #31191a;
    --info: #b3adff;
    --info-soft: #23213d;
  }

  .btn.primary {
    color: #0b1622;          /* dark text on the lighter dark-mode blue */
  }

  .btn.primary:hover {
    background: #8cc2f8;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: var(--ink);     /* no grey text in high contrast */
    --line: var(--ink);      /* hairlines become real lines */
  }
}


/*****************************************************************
 *  SECTION 2 — PAGE FRAME                                        *
 *****************************************************************/

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  min-height: var(--tap);
}

.brandmark svg {
  width: 22px;
  height: 22px;
  color: var(--brand);
}

.page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 16px 24px;
}

.page h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.lead {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 16px;
}

.disclaimer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 22px 16px 30px;
  max-width: 640px;
  margin: 0 auto;
}


/*****************************************************************
 *  SECTION 3 — FORMS AND LISTS                                   *
 *****************************************************************/

.field {
  margin: 0 0 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.wide {
  width: 100%;
}

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0 0;
  font-size: 16px;
  border: 1.5px solid var(--line);
  background: var(--canvas);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notice svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 3px;
}

.notice.ok   { border-color: var(--ok);   background: var(--ok-soft); }
.notice.warn { border-color: var(--warn); background: var(--warn-soft); }
.notice.bad  { border-color: var(--bad);  background: var(--bad-soft); }
.notice.info { border-color: var(--info); background: var(--info-soft); }

.plain-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.pick-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--tap);
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  margin: 0 0 8px;
  cursor: pointer;
  background: var(--surface);
}

.pick-row input {
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.pick-row:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.sitting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sitting-row:first-child {
  border-top: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
}

.chip-row.centered {
  justify-content: center;
}

.link-box {
  word-break: break-all;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  margin: 10px 0 0;
  background: var(--canvas);
}


/*****************************************************************
 *  SECTION 4 — THE TEST SCREEN                                   *
 *  Clocks at the top, the question, four big answers, and the    *
 *  Lock-in button in the bottom half of the phone screen.        *
 *****************************************************************/

.clock-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.clock {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.clock-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.clock-time {
  display: block;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.clock.running-low .clock-time {
  color: var(--bad);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.question-prompt {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 16px;
}

.answer-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  margin: 0 0 10px;
  text-align: left;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.answer-button .answer-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1.5px solid var(--muted);
}

.answer-button .answer-mark svg {
  width: 16px;
  height: 16px;
  visibility: hidden;
}

.answer-button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 700;
}

.answer-button[aria-pressed="true"] .answer-mark {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.answer-button[aria-pressed="true"] .answer-mark svg {
  visibility: visible;
}

.answer-button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* the space under the answers so the fixed bar never covers the last one */
.bottom-bar-spacer {
  height: 120px;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.bottom-bar .btn {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
}

.bottom-bar-inner {
  max-width: 880px;
  margin: 0 auto;
}

.bottom-bar-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 6px 0 0;
}


/*****************************************************************
 *  SECTION 5 — RESULTS AND SCORE BARS                            *
 *****************************************************************/

.big-score {
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0;
}

.unit-line {
  margin: 0 0 12px;
}

.unit-line-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.score-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--canvas);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 4px;
}

.score-bar-fill {
  height: 100%;
  background: var(--brand);
}


/*****************************************************************
 *  SECTION 6 — THE EMPLOYER REPORT ROWS                          *
 *****************************************************************/

.report-row h3 {
  font-size: 16px;
  margin: 6px 0 10px;
}

.answer-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0 0 8px;
  font-size: 14px;
}

.answer-line strong {
  font-size: 16px;
}

.why-box {
  background: var(--canvas);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 8px 0;
}

.row-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}

.row-facts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-facts svg {
  width: 14px;
  height: 14px;
}

.flag-area {
  margin-top: 10px;
}


/*****************************************************************
 *  SECTION 7 — THE CERTIFICATE                                   *
 *****************************************************************/

.certificate {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  margin: 0 0 16px;
}

.certificate .cert-kind {
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.certificate .cert-name {
  font-size: 28px;
  font-weight: 700;
  margin: 14px 0 4px;
}

.certificate .cert-line {
  font-size: 16px;
  margin: 4px 0;
}

.certificate .cert-units {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  font-size: 14px;
}

.certificate .cert-code {
  font-family: Consolas, 'SF Mono', ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
}

@media print {
  .topbar,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .certificate {
    border: 2px solid #171c22;
  }
}


/*****************************************************************
 *  SECTION 8 — SMALL HELPERS                                     *
 *****************************************************************/

/* WHY (2026-10-13, build): the tokens file makes .btn.sm 36px tall, but the brief says
   EVERY tap target is at least 44x44. This lifts small buttons back to 44 here. */
.btn.sm {
  min-height: var(--tap);
}

/* a link dressed as a button reads as a button: no underline */
a.btn {
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (min-width: 760px) {
  .page {
    padding: 24px 24px 32px;
  }

  .answer-line {
    grid-template-columns: 1fr 1fr;
  }
}


/*****************************************************************
 *  SECTION 9 — ADDED 2026-10-13                                  *
 *  9a. the "Hosted free by ..." line under every page (hidden    *
 *      while the setting is empty)                               *
 *  9b. the three levels on the front page                        *
 *  9c. the proctor's attestation box on the report               *
 *****************************************************************/

/* ---- 9a. hosted-by line ---- */

.hosted-by {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.hosted-by a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}


/* ---- 9b. the three levels ---- */

/* WHY (2026-10-13, sandbox browser check): on a 300px-wide phone the long chip
   "Online, proctored by the employer" would not wrap and pushed the cards 10px past the
   screen edge. One column that may shrink, and chips inside a level card may wrap. */
.level-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 12px 0 0;
}

.level-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.level-card .chip {
  white-space: normal;
}

.level-card h3 {
  font-size: 18px;
  margin: 8px 0 4px;
}

.level-card p {
  margin: 4px 0;
}

.level-ask {
  margin-top: 12px;
}


/* ---- 9c. the attestation box ---- */

.attest-statement {
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0 12px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 14px;
}

.check-line input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}
