/* MAV FIELD PORTAL — field corrections for runtime-injected lane CSS.
 *
 * WHY THIS FILE EXISTS
 * --------------------
 * `mav-live.js`, `mav-scan.js` and `mav-voice.js` inject their own stylesheets
 * from string arrays at mount time. Those sheets style controls a gloved thumb
 * has to hit, and they are not editable from this lane. This file corrects what
 * can be corrected safely from the outside.
 *
 * SPECIFICITY NOTE — why the doubled class selectors.
 * A lane's <style> is appended to <head> at mount, i.e. AFTER the shell's
 * <link>. At equal specificity the lane wins on document order. Repeating the
 * class (`.mavscan.mavscan`) raises specificity by one class without adding a
 * descendant that might not exist. It is deliberate, not a typo.
 *
 * !! NOT YET LOADED BY THE BROWSER — ONE LINE IS NEEDED FROM THE LEAD.
 * public/index.html links only /css/mav.css, and index.html belongs to
 * another lane. Add beside that link:
 *
 *     <link rel="stylesheet" href="/css/field-fixes.css">
 *
 * An @import from mav.css was tried and BACKED OUT: scripts/ergonomics-check.js
 * parses @import as a block at-rule and swallows the :root{} that follows it,
 * wiping every design token from its model (--tap went UNRESOLVED and the touch
 * -target check went red on false evidence). Wiring it that way would have made
 * the checker lie for everyone. The <link> above is the correct fix.
 *
 * HONESTY NOTE — what this file does NOT fix.
 * `scripts/ergonomics-check.js` evaluates CSS *rule by rule*, not by resolved
 * cascade. An override here cannot retract the offending declaration in the
 * lane's own source, so these corrections do NOT move the checker's score.
 * They fix the phone in the man's hand. The underlying declarations still have
 * to be changed by the owner of each lane module — see docs/FIELD-ERGONOMICS.md.
 *
 * Every colour below was measured with the checker's own colour engine
 * (`parseColor` + `contrast`). Ratios are quoted per rule. Nothing here was
 * chosen by eye.
 */

/* --- THE GLOBAL FOCUS RING, RE-ASSERTED ---------------------------------
 * mav.css already declares this at :focus-visible (0,1,0). It is repeated here
 * deliberately, and it must stay the FIRST :focus-visible rule in this file.
 *
 * Why: scripts/ergonomics-check.js identifies "the global ring" as the first
 * :focus-visible rule carrying an outline, in file order, and then measures
 * every lane against ITS specificity. This file sorts before mav.css, and
 * debrief.css:140 declares :focus-visible with only a border-color, so without
 * this rule the checker adopts the .mav-v-ta patch below (0,3,0) as the
 * baseline — which silently EXCUSES mav-voice.js stripping the ring at (0,2,0)
 * and turns a real defect into a passing check. Keeping a (0,1,0) rule here
 * holds the baseline where it belongs and lets the voice lane fail honestly.
 */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- SCAN LANE ----------------------------------------------------------
 * `.mavscan` paints color:#f5f5f5 and NO background, so in day mode it sits on
 * the page surface at 1.01:1 — the same colour as the paper. Invisible.
 *
 * The safe correction is a dark panel, NOT a light ink. `.mavscan__status`
 * declares background:#1c1c1c with no colour of its own, and `.mavscan__stage`
 * is #000; forcing the root to dark ink would put dark text on those dark
 * boxes and make the lane worse. A camera viewfinder is legitimately dark.
 *
 *   #f5f5f5 on #12161c = 16.64:1   (was 1.01:1 on the day page)
 */
.mavscan.mavscan {
  background: #12161c;
  color: #f5f5f5;
  padding: 12px;
  border-radius: 12px;
}

/* --- VOICE LANE: recording indicator ------------------------------------
 * `.mav-v-ptt.rec` is the push-to-talk button WHILE LISTENING — the one piece
 * of state that must be readable at a glance. It shipped #fff on #ff5c5c.
 *
 *   before: #fff on #ff5c5c = 3.03:1   (fails AA in both palettes)
 *   after : #fff on #991b1b = 8.31:1
 *
 * Keeping white-on-deep-red rather than dark-on-vivid-red: dark ink on #ff5c5c
 * measured only 5.99:1, which clears AA but not the sunlight standard. The
 * white ring is retained so the "armed" state still reads peripherally.
 */
.mav-v-ptt.mav-v-ptt.rec {
  background: #991b1b;
  border-color: #ffffff;
  color: #ffffff;
}

/* --- VOICE LANE: primary action ------------------------------------------
 * Shipped #fff on #ff7a1a = 2.61:1 under the dark scheme, and #fff on #c24a00
 * = 4.91:1 under light. Both are below the sunlight standard; the first is
 * below AA outright.
 *
 * Driving it from the shell tokens fixes the contrast AND makes this control
 * follow the day/night BUTTON instead of the phone's OS setting:
 *   day  : #ffffff on #854008 = 7.68:1
 *   night: #12161c on #f59e0b = 8.45:1
 */
.mav-v-btn.mav-v-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* --- VOICE LANE: focus ring on the typed field ---------------------------
 * `.mav-v-ta:focus{outline:none}` strips the shell's global ring from the one
 * control the contract calls co-equal — the field that must stay usable when
 * speech recognition fails in a dead zone. Restored at higher specificity, and
 * as :focus-visible so it does not fire on touch.
 */
.mav-v-ta.mav-v-ta:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- LANE TYPE FLOOR ------------------------------------------------------
 * 12–13px type in the live and voice lanes, read at arm's length by a man of
 * fifty-five who is not wearing his reading glasses. Raised to the 14px floor.
 * `.mav-v-chip` and `.mav-chip` carry the heard/measured honesty signal, so
 * they are the least acceptable places in the portal for the smallest type.
 */
.mav-v-chip.mav-v-chip,
.mav-role.mav-role,
.mav-when.mav-when,
.mav-chip.mav-chip {
  font-size: 14px;
}
