@popcorn245/cornfield 0.35.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/cornfield.js CHANGED
@@ -106,7 +106,7 @@ async function sync(flags) {
106
106
 
107
107
  async function validate(flags) {
108
108
  const { config, derivers } = await setup(flags);
109
- const { errors, warnings } = await validateRepo({ config, derivers });
109
+ const { errors, warnings, notes } = await validateRepo({ config, derivers });
110
110
  warnings.forEach((w) => console.warn(` warning: ${w}`));
111
111
  if (errors.length) {
112
112
  console.error(`\nValidation failed with ${plural(errors.length, 'error')}:`);
@@ -114,7 +114,9 @@ async function validate(flags) {
114
114
  console.error('');
115
115
  return 1;
116
116
  }
117
- console.log(`\nValid: the schema holds, ${config.topology} matches the code, and every proposal checks out.\n`);
117
+ console.log(`\nValid: the schema holds, ${config.topology} matches the code, and every proposal checks out.`);
118
+ (notes || []).forEach((n) => console.log(n));
119
+ console.log('');
118
120
  return 0;
119
121
  }
120
122
 
package/core/contrast.js CHANGED
@@ -23,6 +23,7 @@ import path from 'node:path';
23
23
  import { fileURLToPath } from 'node:url';
24
24
  import { MAX_MIX_DEPTH, readColor, over, toHex, luminance, ratio, splitTop } from './color.js';
25
25
  import { MAX_THEME_BYTES, cssProblems, withoutComments } from './theme.js';
26
+ import { NODE_THEMES } from './schema.js';
26
27
  import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, markOpacity } from '../explorer/diff-marks.js';
27
28
  import { lightColor } from '../explorer/theme-model.js';
28
29
 
@@ -479,6 +480,98 @@ function colorsIn(text, depth) {
479
480
  return out;
480
481
  }
481
482
 
483
+ // ===========================================================================
484
+ // The map's colours (CF review F48): node fills and labels, against the ground
485
+ // Its own block: the pairs above are fixed lists, these depend on the tokens a theme sets (a kind, its group, the outline).
486
+ // ===========================================================================
487
+
488
+ /** The `--corn-map-group-*` a node type can sit in (explorer/scene.js `groupOf`): its own name, the house for a floor and a room, cloud or web for an outside system */
489
+ const MAP_GROUPS_OF = (type) => (type === 'floor' || type === 'room' ? ['house'] : type === 'external' ? ['cloud', 'web'] : [type]);
490
+ /** A node's outline and label are drawn on the map's own canvas: a fill under 3:1 needs the outline (WCAG 1.4.11) to be seen */
491
+ export const MAP_FILL_MIN = MIN_UI;
492
+ /** "a" or "an", for the type named after it (an atom, an app, a table) */
493
+ const anOf = (word) => (/^[aeiou]/i.test(word) ? 'an' : 'a');
494
+ /** What a map colour token holds: a colour, `auto` (the map keeps its own), or a problem naming why it cannot be read */
495
+ function mapToken(props, name) {
496
+ if (!props.has(name)) return { auto: true };
497
+ const raw = expand(`var(${name})`, props);
498
+ if ('problem' in raw) return { problem: raw.problem };
499
+ if (!raw.text.trim() || raw.text.trim().toLowerCase() === 'auto') return { auto: true };
500
+ const c = resolveColor(props, name);
501
+ return isColor(c) ? { color: c } : { problem: c.problem };
502
+ }
503
+ /** The worst ratio of a colour (composited over the ground) against each ground the page can show, with the colour it was worked out on */
504
+ function worstOnGrounds(c, grounds) {
505
+ let worst = null;
506
+ for (const { color: ground, image } of grounds) {
507
+ const fg = over(c, ground);
508
+ const r = ratio(luminance(fg), luminance(ground));
509
+ if (!worst || r < worst.ratio) worst = { ratio: r, fgValue: toHex(fg), bgValue: toHex(ground), image };
510
+ }
511
+ return worst;
512
+ }
513
+ /**
514
+ * The map's pairs for one page state: for each node type, its fill (the kind's token, else its group's, else the node's own colour from
515
+ * core/schema.js, deepened for the light ground) against the ground; the outline carries a fill under 3:1 when it is itself 3:1 against
516
+ * the fill and the ground; the label colour against the ground and against its halo. Always the same findings in the same order
517
+ * (checkSheets lines the two system settings up by position).
518
+ */
519
+ function mapFindings(props, theme, mode, grounds) {
520
+ const out = [];
521
+ if (!grounds.length) return out;
522
+ const base = { theme, mode };
523
+ const ground = grounds[0].color;
524
+ const stroke = mapToken(props, '--corn-map-stroke');
525
+ const widthText = props.has('--corn-map-stroke-width') ? substitute(props.get('--corn-map-stroke-width'), props) : '1.5px';
526
+ const strokeOn = isColor(stroke.color) && !(Number.parseFloat(widthText) === 0);
527
+ for (const type of Object.keys(NODE_THEMES)) {
528
+ for (const group of MAP_GROUPS_OF(type)) {
529
+ const names = [`--corn-map-node-${type}`, `--corn-map-group-${group}`];
530
+ let name = null;
531
+ let fill = null;
532
+ let problem = null;
533
+ for (const n of names) {
534
+ const t = mapToken(props, n);
535
+ if (t.problem) { name = n; problem = t.problem; break; }
536
+ if (t.color) { name = n; fill = t.color; break; }
537
+ }
538
+ const label = type === 'external' ? `${type}, in the ${group} group` : type;
539
+ if (problem) { out.push({ ...base, fg: name, bg: GROUND, min: MAP_FILL_MIN, kind: 'ui', use: `the fill of ${anOf(label)} ${label} node`, problem }); continue; }
540
+ const own = !fill;
541
+ if (own) { name = names[0]; fill = readColor(mode === 'light' ? lightColor(NODE_THEMES[type].color) : NODE_THEMES[type].color); }
542
+ const shown = own ? `${name}, auto: the node's own colour` : name;
543
+ const f = worstOnGrounds(fill, grounds);
544
+ const finding = { ...base, fg: name, bg: GROUND, min: MAP_FILL_MIN, kind: 'ui', use: `the fill of ${anOf(label)} ${label} node`, fgValue: f.fgValue, bgValue: f.bgValue, ratio: f.ratio, ...(f.image ? { groundImage: true } : {}) };
545
+ if (f.ratio >= MAP_FILL_MIN || !strokeOn) {
546
+ out.push(f.ratio >= MAP_FILL_MIN ? finding : { ...finding, fg: shown, use: `the fill of ${anOf(label)} ${label} node; set --corn-map-stroke, an outline at ${MAP_FILL_MIN}:1 on the fill and on the ground, or a deeper fill` });
547
+ continue;
548
+ }
549
+ // Under 3:1: acceptable only when the outline is itself 3:1 against both the fill and the ground
550
+ const onGround = worstOnGrounds(stroke.color, grounds);
551
+ const onFill = ratio(luminance(over(stroke.color, over(fill, ground))), luminance(over(fill, ground)));
552
+ const weakest = onGround.ratio <= onFill ? { r: onGround.ratio, on: '--corn-ground', value: onGround.bgValue } : { r: onFill, on: name, value: toHex(over(fill, ground)) };
553
+ out.push({ ...base, fg: '--corn-map-stroke', bg: weakest.on, min: MAP_FILL_MIN, kind: 'ui', use: `the outline that carries the fill of ${anOf(label)} ${label} node, which is ${fmt(f.ratio)} on its own`, fgValue: onGround.fgValue, bgValue: weakest.value, ratio: weakest.r });
554
+ }
555
+ }
556
+ // Labels are text: the colour against the ground, and against the halo under it (the halo is the ground's own colour at `auto`)
557
+ const label = mapToken(props, '--corn-map-label');
558
+ const haloTok = mapToken(props, '--corn-map-label-halo');
559
+ const labelColor = label.color || (label.problem ? null : readColor(mode === 'light' ? lightColor('#f8fafc') : '#f8fafc'));
560
+ if (label.problem) out.push({ ...base, fg: '--corn-map-label', bg: GROUND, min: MIN_TEXT, kind: 'text', use: 'a node\'s label', problem: label.problem }, { ...base, fg: '--corn-map-label', bg: '--corn-map-label-halo', min: MIN_TEXT, kind: 'text', use: 'a node\'s label', problem: label.problem });
561
+ else {
562
+ const name = label.color ? '--corn-map-label' : '--corn-map-label (auto)';
563
+ const w = worstOnGrounds(labelColor, grounds);
564
+ out.push({ ...base, fg: name, bg: GROUND, min: MIN_TEXT, kind: 'text', use: 'a node\'s label on the ground', fgValue: w.fgValue, bgValue: w.bgValue, ratio: w.ratio, ...(w.image ? { groundImage: true } : {}) });
565
+ if (haloTok.problem) out.push({ ...base, fg: name, bg: '--corn-map-label-halo', min: MIN_TEXT, kind: 'text', use: 'a node\'s label on its halo', problem: haloTok.problem });
566
+ else {
567
+ const bg = haloTok.color ? over(haloTok.color, ground) : ground;
568
+ const fgc = over(labelColor, bg);
569
+ out.push({ ...base, fg: name, bg: '--corn-map-label-halo', min: MIN_TEXT, kind: 'text', use: 'a node\'s label on its halo', fgValue: toHex(fgc), bgValue: toHex(bg), ratio: ratio(luminance(fgc), luminance(bg)) });
570
+ }
571
+ }
572
+ return out;
573
+ }
574
+
482
575
  /** Pair results for one page state: one per pair, the worst over the ground and the ground image */
483
576
  function checkState(props, theme, mode) {
484
577
  const out = [];
@@ -508,6 +601,7 @@ function checkState(props, theme, mode) {
508
601
  const { image, ...rest } = worst;
509
602
  out.push({ ...finding, ...rest, ...(image ? { groundImage: true } : {}) });
510
603
  }
604
+ out.push(...mapFindings(props, theme, mode, grounds)); // the map's node fills and labels (their block above)
511
605
  out.push(...diffMapFindings(props, theme, mode, grounds, isColor(g) ? over(g, canvas) : null));
512
606
  return out;
513
607
  }
@@ -594,7 +688,7 @@ export function checkSheets(themes) {
594
688
  /** The pairs under their minimum: { fails, unresolved } */
595
689
  export function contrastProblems(themes) {
596
690
  const all = checkSheets(themes);
597
- return { fails: all.filter((f) => f.ratio !== undefined && f.ratio < f.min), unresolved: all.filter((f) => f.problem) };
691
+ return { fails: all.filter((f) => f.ratio !== undefined && f.ratio < f.min), unresolved: all.filter((f) => f.problem), total: all.length };
598
692
  }
599
693
 
600
694
  const fmt = (r) => `${(Math.floor(r * 100) / 100).toFixed(2)}:1`;
@@ -648,17 +742,26 @@ export function themesToCheck(config) {
648
742
  return themes;
649
743
  }
650
744
 
745
+ /** The one line `validate` prints about the check (docs/theming.md#the-contrast-check): how many pairs, which themes, both levels, and what held */
746
+ export function contrastSummary(themes, total, failed = 0, unchecked = 0) {
747
+ const named = themes.length - 1;
748
+ const what = `${total} pairs of the standard theme${named > 0 ? ` and ${named} named theme${named > 1 ? 's' : ''}` : ''}, in light and dark`;
749
+ const rest = [failed ? `${failed} under their minimum` : '', unchecked ? `${unchecked} that could not be worked out` : ''].filter(Boolean).join(', ');
750
+ return `theme contrast: ${what}: ${rest ? rest : `all at or above their minimum (${MIN_TEXT}:1 for text, ${MIN_UI}:1 for the parts of the interface and the map's fills)`}.`;
751
+ }
752
+
651
753
  /**
652
754
  * The contrast check of a repo, for `cornfield validate`: every pair under its minimum is an error (a warning with
653
755
  * `theme.contrast: 'warn'`), and a pair that could not be worked out is a warning naming the token and why.
654
756
  * @param {{ root: string, theme?: { css?: string|null, names?: Record<string,string>, fonts?: string[], contrast?: string } }} config
655
- * @returns {{ errors: string[], warnings: string[] }}
757
+ * @returns {{ errors: string[], warnings: string[], summary?: string }} `summary`: the one line of what was checked (absent when there was nothing to read)
656
758
  */
657
759
  export function checkThemeContrast(config) {
658
760
  const themes = themesToCheck(config);
659
761
  if (!themes) return { errors: [], warnings: [] };
660
- const { fails, unresolved } = contrastProblems(themes);
762
+ const { fails, unresolved, total } = contrastProblems(themes);
661
763
  const lines = fails.map((f) => `theme contrast: ${describeFinding(f)}`);
662
764
  const warnings = unresolved.map((f) => `theme contrast: ${describeFinding(f)}`);
663
- return (config.theme || {}).contrast === 'warn' ? { errors: [], warnings: [...lines, ...warnings] } : { errors: lines, warnings };
765
+ const summary = contrastSummary(themes, total, fails.length, unresolved.length);
766
+ return (config.theme || {}).contrast === 'warn' ? { errors: [], warnings: [...lines, ...warnings], summary } : { errors: lines, warnings, summary };
664
767
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module core/map-tokens
3
+ *
4
+ * The map's non-colour tokens, as `cornfield validate` reads them: `--corn-map-font`, `--corn-map-edge-width` and `--corn-map-glow`. The
5
+ * map reads each with the same parser (explorer/map-style.js `readMapTokens`), and one it cannot read is drawn as if it were `auto`; this
6
+ * says so before the theme ships, as a warning naming the token, the theme, the level and what it may hold (docs/theming.md, The map).
7
+ */
8
+
9
+ import { expand, resolveProps, themesToCheck } from './contrast.js';
10
+ import { EDGE_WIDTH_TOKEN, FONT_TOKEN, GLOW_TOKEN, MAX_EDGE_WIDTH, MAX_GLOW, readMapTokens } from '../explorer/map-style.js';
11
+
12
+ const WANTS = {
13
+ [FONT_TOKEN]: ['font', 'a list of font families (quoted names or plain words, at most 8; no url(), and no punctuation but commas and quotes)'],
14
+ [EDGE_WIDTH_TOKEN]: ['edgeWidth', `a width in px over 0 and at most ${MAX_EDGE_WIDTH}`],
15
+ [GLOW_TOKEN]: ['glow', `a factor from 0 (no glow) to ${MAX_GLOW}`],
16
+ };
17
+
18
+ /**
19
+ * One warning per map token a theme sets to something the map cannot use (once per theme, whichever level shows it first).
20
+ * @param {{ root: string, theme?: object }} config
21
+ * @returns {string[]}
22
+ */
23
+ export function mapTokenWarnings(config) {
24
+ const themes = themesToCheck(config);
25
+ if (!themes) return [];
26
+ const out = [];
27
+ for (const { theme, sheets, name } of themes) {
28
+ const said = new Set();
29
+ for (const mode of ['light', 'dark']) {
30
+ const props = resolveProps(sheets, { mode, system: mode, name });
31
+ const read = (token) => { if (!props.has(token)) return 'auto'; const r = expand(`var(${token})`, props); return 'text' in r ? r.text.trim() : ''; };
32
+ const got = readMapTokens(read);
33
+ for (const [token, [key, wants]] of Object.entries(WANTS)) {
34
+ const raw = read(token);
35
+ if (said.has(token) || raw.toLowerCase() === 'auto' || got[key] !== null) continue;
36
+ said.add(token);
37
+ const who = theme === 'standard' ? 'the standard theme' : `named theme "${theme}"`;
38
+ out.push(`theme: ${token} in ${who} (${mode}) is "${raw.slice(0, 60)}${raw.length > 60 ? '…' : ''}", which the map cannot use, so it draws as auto: write ${wants}, or auto.`);
39
+ }
40
+ }
41
+ }
42
+ return out;
43
+ }
package/core/strings.js CHANGED
@@ -55,8 +55,10 @@ export const STRINGS = Object.freeze({
55
55
  startRun: 'Start a run',
56
56
  copySpec: 'Copy Spec',
57
57
  // The hint, loading and errors
58
- hintInspect: 'Tap node to inspect live spec',
59
- hintDrag: 'Drag nodes to move • Double-tap to inspect',
58
+ hintInspect: 'Click a node to see what it is',
59
+ hintInspectTouch: 'Tap a node to see what it is',
60
+ hintDrag: 'Drag nodes to move • Double-click to inspect',
61
+ hintDragTouch: 'Drag nodes to move • Double-tap to inspect',
60
62
  hintDataFlow: 'Data flow: browser → servers → API → tables → services → outside',
61
63
  loading: 'Loading topology.json …',
62
64
  errorTitle: 'The map could not be loaded',
package/core/validate.js CHANGED
@@ -24,6 +24,7 @@ import { deriveTopology } from './derive.js';
24
24
  import { missingPaths, planSync } from './sync.js';
25
25
  import { repoPaths, repoReader } from './repo.js';
26
26
  import { checkThemeContrast } from './contrast.js';
27
+ import { mapTokenWarnings } from './map-tokens.js';
27
28
  import { BRAND_IMAGE_KEYS, brandAssetFile } from './brand.js';
28
29
  import { MAX_THEME_BYTES, cssProblems, cssUrls, themeAssetFile, themeFileUrl, themeFiles, themeIconFileProblems, themeUrlTarget } from './theme.js';
29
30
 
@@ -252,10 +253,10 @@ export function readTopology(config) {
252
253
  /**
253
254
  * Everything `cornfield validate` checks.
254
255
  * @param {{ config: object, derivers: { deriver: object, options?: object }[], topology?: object|null }} opts
255
- * @returns {Promise<{ errors: string[], warnings: string[], derived: object|null }>}
256
+ * @returns {Promise<{ errors: string[], warnings: string[], derived: object|null, notes: string[] }>}
256
257
  */
257
258
  export async function validateRepo({ config, derivers, topology = readTopology(config) }) {
258
- if (!topology) return { errors: [`${config.topology} is missing: run cornfield sync to make it.`], warnings: [], derived: null };
259
+ if (!topology) return { errors: [`${config.topology} is missing: run cornfield sync to make it.`], warnings: [], derived: null, notes: [] };
259
260
  const errors = validateTopology(topology);
260
261
  try {
261
262
  errors.push(...missingPaths(topology, repoPaths(config.root)));
@@ -264,6 +265,7 @@ export async function validateRepo({ config, derivers, topology = readTopology(c
264
265
  }
265
266
  let derived = null;
266
267
  const warnings = [];
268
+ const notes = []; // what held, for a pass to say (the contrast check's one line)
267
269
  try {
268
270
  derived = await deriveTopology({ root: config.root, config, derivers, map: topology });
269
271
  warnings.push(...derived.warnings);
@@ -282,6 +284,8 @@ export async function validateRepo({ config, derivers, topology = readTopology(c
282
284
  const contrast = checkThemeContrast(config);
283
285
  errors.push(...contrast.errors);
284
286
  warnings.push(...contrast.warnings);
287
+ if (contrast.summary) notes.push(contrast.summary);
288
+ warnings.push(...mapTokenWarnings(config)); // a map font, line width or glow the map cannot read draws as auto
285
289
  errors.push(...validateCloudNodes(topology, config.root));
286
290
  errors.push(...validateProposalFiles(topology, path.join(config.root, config.proposals), config.root));
287
291
  const io = repoReader(config.root);
@@ -293,5 +297,5 @@ export async function validateRepo({ config, derivers, topology = readTopology(c
293
297
  errors.push(`Deriver "${deriver.name}" could not check the map: ${err.message}`);
294
298
  }
295
299
  }
296
- return { errors, warnings, derived };
300
+ return { errors, warnings, derived, notes };
297
301
  }
@@ -117,7 +117,7 @@ h1, h2, h3, p { margin: 0; }
117
117
 
118
118
  /* Search: the field with its key hint (a desktop's), an icon on a phone */
119
119
  .hx-search { display: none; align-items: center; gap: var(--corn-space-3); width: 260px; min-width: 120px; height: 32px; padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-3); }
120
- .hx-search:focus-within { border-color: var(--corn-focus); outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
120
+ .hx-search:focus-within { border-color: var(--corn-focus); outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
121
121
  .hx-search-icon { flex: none; }
122
122
  .hx-search-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); outline: none; user-select: text; }
123
123
  .hx-search-input::placeholder { color: var(--corn-text-3); }
@@ -130,13 +130,13 @@ h1, h2, h3, p { margin: 0; }
130
130
  .hx-work { display: inline-flex; align-items: center; gap: var(--corn-space-2); height: 32px; padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 600; white-space: nowrap; }
131
131
  .hx-work:hover { background: var(--corn-surface-3); color: var(--corn-text); }
132
132
  .hx-work[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); }
133
- .hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: var(--corn-ground); color: var(--corn-warn); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); }
133
+ .hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: var(--corn-ground); color: var(--corn-warn); font-size: var(--corn-text-2xs); }
134
134
 
135
135
  /* The account button: the initial of who is signed in (a menu glyph when nobody is) */
136
136
  .hx-account-btn { display: inline-flex; align-items: center; gap: var(--corn-space-3); height: 32px; padding: 0 var(--corn-space-2) 0 var(--corn-space-1); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); }
137
137
  .hx-account-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
138
138
  .hx-account-btn[aria-expanded="true"] { border-color: var(--corn-accent-text); }
139
- .hx-avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-xs); font-weight: 700; }
139
+ .hx-avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--corn-radius-pill); background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-xs); font-weight: 700; }
140
140
  .hx-avatar:empty::before { content: "\2630"; }
141
141
 
142
142
  /* The account menu: a panel under the button */
@@ -224,7 +224,7 @@ h1, h2, h3, p { margin: 0; }
224
224
  white-space: nowrap;
225
225
  }
226
226
  .hx-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
227
- .hx-btn:focus-visible, .hx-toggle-row:focus-visible, .hx-textbtn:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
227
+ .hx-btn:focus-visible, .hx-toggle-row:focus-visible, .hx-textbtn:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
228
228
  .hx-btn--active, .hx-btn--active:hover { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); box-shadow: var(--corn-shadow-sm); }
229
229
  .hx-btn--quiet { font-weight: 500; color: var(--corn-text-3); }
230
230
  .hx-btn--icon { width: 28px; height: 28px; padding: 0; justify-content: center; font-size: var(--corn-text-base); }
@@ -237,7 +237,7 @@ h1, h2, h3, p { margin: 0; }
237
237
  padding: var(--corn-space-1) var(--corn-space-3) var(--corn-space-1) var(--corn-space-6);
238
238
  border-radius: var(--corn-radius-sm);
239
239
  border: var(--corn-border) solid var(--corn-line);
240
- background: color-mix(in srgb, var(--corn-ground) 80%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 8px center;
240
+ background: color-mix(in srgb, var(--corn-ground) 80%, transparent);
241
241
  color: var(--corn-text);
242
242
  font: inherit;
243
243
  font-size: var(--corn-text-sm);
@@ -286,7 +286,7 @@ h1, h2, h3, p { margin: 0; }
286
286
  .hx-toggle-row.is-off .hx-dot { transform: scale(0.75); opacity: 0.4; }
287
287
  .hx-toggle-name { font-size: var(--corn-text-xs); font-weight: 500; color: var(--corn-text-2); }
288
288
  .hx-toggle-row.is-off .hx-toggle-name { color: var(--corn-text-3); text-decoration: line-through; }
289
- .hx-count { padding: calc(var(--corn-space-1) / 2) var(--corn-space-2); border-radius: var(--corn-radius-xs); background: var(--corn-surface-3); color: var(--corn-text-2); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); }
289
+ .hx-count { padding: calc(var(--corn-space-1) / 2) var(--corn-space-2); border-radius: var(--corn-radius-xs); background: var(--corn-surface-3); color: var(--corn-text-2); font-size: var(--corn-text-2xs); }
290
290
  .hx-toggle-row.is-off .hx-count { background: color-mix(in srgb, var(--corn-ground) 40%, transparent); color: var(--corn-text-3); }
291
291
  .hx-tick { font-size: var(--corn-text-sm); font-weight: 700; color: var(--corn-ok); }
292
292
  .hx-toggle-row.is-off .hx-tick { color: var(--corn-text-3); }
@@ -325,7 +325,7 @@ h1, h2, h3, p { margin: 0; }
325
325
  .hx-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--corn-scrim); backdrop-filter: blur(calc(var(--corn-blur) / 4)); }
326
326
  @media (min-width: 768px) { .hx-backdrop { display: none; } }
327
327
 
328
- .hx-drawer { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-surface-2); box-shadow: var(--corn-shadow-lg); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
328
+ .hx-drawer { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-line); box-shadow: var(--corn-shadow-lg); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
329
329
  .hx-drawer * { touch-action: pan-y; }
330
330
  .hx-drawer.drawer-open { pointer-events: auto; }
331
331
  /* The closed panel waits just off the right edge: its shadow would show there */
@@ -362,7 +362,7 @@ h1, h2, h3, p { margin: 0; }
362
362
  .hx-field { width: 100%; padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text-2); font-family: var(--corn-mono); font-size: var(--corn-text-xs); }
363
363
  .hx-sim-result { font-size: var(--corn-text-xs); }
364
364
  .hx-error-text { padding-top: var(--corn-space-3); color: var(--corn-bad); }
365
- .hx-ms { width: 56px; flex: none; text-align: right; font-family: var(--corn-mono); color: var(--corn-hue-fuchsia); }
365
+ .hx-ms { width: 56px; flex: none; text-align: right; color: var(--corn-hue-fuchsia); }
366
366
  .hx-file { padding: calc(var(--corn-space-1) / 2) 0; }
367
367
 
368
368
  .hx-sandbox { display: flex; flex-direction: column; gap: var(--corn-space-4); padding: var(--corn-space-5); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); }
@@ -381,7 +381,7 @@ h1, h2, h3, p { margin: 0; }
381
381
  .hx-chip--warning { background: var(--corn-warn); }
382
382
  .hx-chip--danger, .hx-chip--success, .hx-chip--warning { color: var(--corn-ground); }
383
383
 
384
- .hx-drawer-foot { display: flex; align-items: stretch; gap: var(--corn-space-3); flex: none; padding: var(--corn-space-4) var(--corn-space-5) calc(var(--corn-space-4) + env(safe-area-inset-bottom, 0px)); border-top: var(--corn-border) solid var(--corn-surface-2); }
384
+ .hx-drawer-foot { display: flex; align-items: stretch; gap: var(--corn-space-3); flex: none; padding: var(--corn-space-4) var(--corn-space-5) calc(var(--corn-space-4) + env(safe-area-inset-bottom, 0px)); border-top: var(--corn-border) solid var(--corn-line-soft); }
385
385
  .hx-open { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: var(--corn-space-2); min-height: 36px; padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-sm); font-weight: 600; text-align: center; text-decoration: none; transition: background 0.15s; }
386
386
  .hx-open:hover { background: var(--corn-accent-hover); }
387
387
 
@@ -392,7 +392,7 @@ h1, h2, h3, p { margin: 0; }
392
392
  .hx-proposal-empty { padding: var(--corn-space-3) calc(var(--corn-space-1) / 2); font-size: var(--corn-text-sm); }
393
393
  .hx-proposal-item { display: flex; flex-direction: column; align-items: flex-start; gap: var(--corn-space-1); width: 100%; padding: var(--corn-space-3) var(--corn-space-3); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text); text-align: left; font-size: var(--corn-text-xs); }
394
394
  button.hx-proposal-item:hover { background: var(--corn-surface-3); }
395
- button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
395
+ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
396
396
  .hx-proposal-item.is-current { border-color: var(--corn-added-text); background: color-mix(in srgb, var(--corn-added) 12%, transparent); }
397
397
  .hx-proposal-item.is-broken { opacity: 0.8; cursor: default; }
398
398
  .hx-proposal-title { font-size: var(--corn-text-sm); font-weight: 600; color: var(--corn-text); overflow-wrap: anywhere; }
@@ -404,7 +404,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
404
404
  .hx-proposal-bar.is-error { border-color: color-mix(in srgb, var(--corn-removed) 50%, transparent); }
405
405
  .hx-proposal-message { color: var(--corn-text-2); }
406
406
  .hx-proposal-bar.is-error .hx-proposal-message { color: var(--corn-bad); }
407
- .hx-proposal-chip:focus-visible, .hx-proposal-mode:focus-visible, .hx-seg-btn:focus-visible, .hx-change-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
407
+ .hx-proposal-chip:focus-visible, .hx-proposal-mode:focus-visible, .hx-seg-btn:focus-visible, .hx-change-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
408
408
  .hx-proposal-summary { margin-top: var(--corn-space-2); color: var(--corn-text-2); line-height: 1.45; }
409
409
 
410
410
  /* Before / Diff / After */
@@ -460,7 +460,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
460
460
  .hx-player .hx-close { width: 28px; height: 28px; font-size: var(--corn-text-sm); }
461
461
  .hx-player-title { flex: 1; }
462
462
  .hx-player-speed { flex: none; height: 28px; padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); cursor: pointer; }
463
- .hx-player-speed:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 1px; }
463
+ .hx-player-speed:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-offset) / 2); }
464
464
  .hx-player-text { margin: 0; min-height: 2.8em; font-size: var(--corn-text-base); line-height: 1.4; color: var(--corn-text); user-select: text; }
465
465
  .hx-player-count { color: var(--corn-accent-text); font-weight: 600; white-space: nowrap; }
466
466
  .hx-player-controls { display: flex; gap: var(--corn-space-3); }
@@ -490,7 +490,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
490
490
  .hx-whatif-field { display: flex; align-items: center; gap: var(--corn-space-3); color: var(--corn-text-2); }
491
491
  .hx-whatif-field > select, .hx-whatif-field > .hx-whatif-input { flex: 1; min-width: 0; }
492
492
  .hx-whatif-input, .hx-whatif-field select, .hx-whatif select { padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); user-select: text; }
493
- .hx-whatif-input:focus, .hx-whatif-field select:focus { outline: var(--corn-focus-width) solid var(--corn-edit-text); outline-offset: 1px; }
493
+ .hx-whatif-input:focus, .hx-whatif-field select:focus { outline: var(--corn-focus-width) solid var(--corn-edit-text); outline-offset: calc(var(--corn-focus-offset) / 2); }
494
494
  .hx-whatif-help { margin: 0; font-size: var(--corn-text-xs); }
495
495
  .hx-whatif-pair { margin: 0; }
496
496
  .hx-whatif-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); }
@@ -521,7 +521,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
521
521
  .hx-review-form[hidden] { display: none; }
522
522
  .hx-review-label { color: var(--corn-text-3); font-size: var(--corn-text-xs); }
523
523
  .hx-review-note { width: 100%; min-height: 44px; resize: vertical; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); line-height: 1.4; user-select: text; }
524
- .hx-review-note:focus { outline: var(--corn-focus-width) solid var(--corn-added-text); outline-offset: 1px; }
524
+ .hx-review-note:focus { outline: var(--corn-focus-width) solid var(--corn-added-text); outline-offset: calc(var(--corn-focus-offset) / 2); }
525
525
  .hx-review-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2) var(--corn-space-3); }
526
526
  .hx-btn--approve { border-color: color-mix(in srgb, var(--corn-added) 50%, transparent); color: var(--corn-added-text); }
527
527
  .hx-btn--approve:hover { background: color-mix(in srgb, var(--corn-added) 20%, transparent); color: var(--corn-added-text); }
@@ -566,8 +566,9 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
566
566
  .hx-proposal-counts { display: flex; grid-column: 1 / -1; order: 2; align-items: center; flex-wrap: wrap; column-gap: var(--corn-space-2); }
567
567
  .hx-proposal-chip, .hx-proposal-mode { min-height: 44px; }
568
568
  .hx-proposal-mode { display: inline-flex; align-items: center; gap: var(--corn-space-2); padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); color: var(--corn-text); font-size: var(--corn-text-sm); font-weight: 600; }
569
- .hx-proposal-mode::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 var(--corn-border-strong) var(--corn-border-strong) 0; transform: translateY(-2px) rotate(45deg); }
570
- .hx-proposal-mode[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
569
+ /* A chevron drawn from an image and the text colour: a thick --corn-border-strong cannot turn it into a heart (the borders it used to be drawn with) */
570
+ .hx-proposal-mode::after { content: ""; width: 10px; height: 10px; background: currentColor; -webkit-mask: var(--hx-chevron) no-repeat center / contain; mask: var(--hx-chevron) no-repeat center / contain; }
571
+ .hx-proposal-mode[aria-expanded="true"]::after { transform: rotate(180deg); }
571
572
  .hx-seg, .hx-review { grid-column: 1 / -1; order: 3; }
572
573
  .hx-proposal-bar:not([data-mode-open="true"]) .hx-seg { display: none; }
573
574
  .hx-seg-btn { flex: 1; height: 44px; font-size: var(--corn-text-md); }
@@ -591,7 +592,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
591
592
  .hx-mockup-state--changed { color: var(--corn-warn); font-weight: 600; }
592
593
  .hx-mockup-state--missing { color: var(--corn-bad); }
593
594
  .hx-mockup-dialog { position: fixed; z-index: 60; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: var(--corn-space-3); width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: var(--corn-space-4) var(--corn-space-4) var(--corn-space-4); border-radius: var(--corn-radius-lg); border: var(--corn-border) solid var(--corn-line); background: var(--corn-ground); color: var(--corn-text); box-shadow: var(--corn-shadow), 0 0 0 100vmax var(--corn-scrim); }
594
- .hx-mockup-dialog:focus { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
595
+ .hx-mockup-dialog:focus { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
595
596
  .hx-mockup-head { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-4); }
596
597
  .hx-mockup-title { margin: 0; font-size: var(--corn-text-base); font-weight: 600; color: var(--corn-text); }
597
598
  .hx-mockup-stage { min-height: 0; overflow: auto; display: flex; justify-content: center; border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-mockup-ground); }
@@ -614,11 +615,11 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
614
615
  @media (max-width: 767px) {
615
616
  .hx-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; }
616
617
  .hx-dock > * { pointer-events: auto; }
617
- .hx-dock > .hx-sheet { position: relative; top: auto; left: auto; right: auto; bottom: auto; width: 100%; max-width: none; margin: 0; transform: none; border-radius: var(--corn-radius-lg) var(--corn-radius-lg) 0 0; border-bottom: 0; box-shadow: 0 -8px 24px color-mix(in srgb, var(--corn-shadow-color) 70%, transparent); overscroll-behavior: contain; animation: hx-sheet-in 0.2s ease-out; --sheet-pb: var(--corn-space-3); }
618
+ .hx-dock > .hx-sheet { position: relative; top: auto; left: auto; right: auto; bottom: auto; width: 100%; max-width: none; margin: 0; transform: none; border-radius: var(--corn-radius-lg) var(--corn-radius-lg) 0 0; border-bottom: 0; box-shadow: var(--corn-shadow-sheet); overscroll-behavior: contain; animation: hx-sheet-in 0.2s ease-out; --sheet-pb: var(--corn-space-3); }
618
619
  .hx-dock > .hx-sheet[data-sheet-last]:not(.hx-drawer), .hx-dock > .hx-drawer[data-sheet-last][data-sheet-state="peek"] { padding-bottom: calc(var(--sheet-pb) + env(safe-area-inset-bottom, 0px)); }
619
620
  .hx-sheet-handle { display: flex; flex: none; align-items: center; justify-content: center; width: 100%; height: 22px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; }
620
621
  .hx-sheet-handle span { width: 40px; height: 5px; border-radius: var(--corn-radius-pill); background: var(--corn-surface-3); }
621
- .hx-sheet-handle:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: -2px; border-radius: var(--corn-radius); }
622
+ .hx-sheet-handle:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); border-radius: var(--corn-radius); }
622
623
  .hx-backdrop { display: none; }
623
624
  .hx-stage[data-sheet-open="drawer"] .hx-backdrop:not([hidden]) { display: block; }
624
625
 
@@ -711,16 +712,16 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
711
712
  Text only a screen reader reads (the heading, the map's keys, the announcer); a focus ring on everything that
712
713
  takes the focus, the map included (the more specific rings above still win where they are set). */
713
714
  .hx-sr-only { position: absolute !important; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
714
- :where(button, a[href], summary, select, textarea, [tabindex]):focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
715
- #graph-canvas:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: -3px; }
715
+ :where(button, a[href], summary, select, textarea, [tabindex]):focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
716
+ #graph-canvas:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); }
716
717
  .hx-drawer-title:focus { outline: none; }
717
- .hx-drawer-title:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
718
+ .hx-drawer-title:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
718
719
 
719
720
  /* ---- the issues and PRs panel (forge-panel.js, CF-07) -------------------------------------------
720
721
  A slide-over from the left from 768px (the node panel is the one from the right), a bottom sheet in #sheet-dock below.
721
722
  Closed, it is inert (forge-panel.js), and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
722
723
  .hx-forge { --hx-forge-status-w: 56px; }
723
- .hx-forge { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-surface-2); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
724
+ .hx-forge { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-line); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
724
725
  .hx-forge * { touch-action: pan-y; }
725
726
  .hx-forge.forge-open { pointer-events: auto; }
726
727
  .hx-forge:not(.forge-open) { box-shadow: none; }
@@ -743,7 +744,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
743
744
  }
744
745
  .hx-forge-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--corn-space-4); padding: calc(var(--corn-space-5) + var(--corn-space-1)) var(--corn-space-5); overflow-y: auto; user-select: text; font-size: var(--corn-text-sm); }
745
746
  @media (min-width: 640px) { .hx-forge-body { padding: var(--corn-space-6) calc(var(--corn-space-5) + var(--corn-space-1)); } }
746
- .hx-forge-head { display: flex; align-items: center; gap: var(--corn-space-3); padding-bottom: var(--corn-space-3); border-bottom: var(--corn-border) solid var(--corn-surface-2); }
747
+ .hx-forge-head { display: flex; align-items: center; gap: var(--corn-space-3); padding-bottom: var(--corn-space-3); border-bottom: var(--corn-border) solid var(--corn-line-soft); }
747
748
  .hx-forge-head .hx-drawer-title { flex: 1; min-width: 0; }
748
749
  .hx-forge-status, .hx-forge-rate { font-size: var(--corn-text-xs); line-height: 1.5; }
749
750
  .hx-forge-controls { display: flex; flex-direction: column; gap: var(--corn-space-3); padding: var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius); background: var(--corn-surface-2); } /* the Filter chip's box */
@@ -753,7 +754,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
753
754
  .hx-forge-tab { flex: none; display: inline-flex; align-items: baseline; gap: var(--corn-space-1); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-3); border: 0; border-bottom: var(--corn-border-strong) solid transparent; background: none; white-space: nowrap; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; }
754
755
  .hx-forge-tab:hover { color: var(--corn-text); }
755
756
  .hx-forge-tab[aria-pressed="true"] { border-bottom-color: var(--corn-accent); color: var(--corn-text); font-weight: 600; }
756
- .hx-forge-tab:focus-visible, .hx-forge-chip:focus-visible, .hx-forge-back:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: -2px; }
757
+ .hx-forge-tab:focus-visible, .hx-forge-chip:focus-visible, .hx-forge-back:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); }
757
758
  .hx-forge-count { color: var(--corn-text-3); font-size: var(--corn-text-xs); font-weight: 500; }
758
759
  .hx-forge-count[hidden] { display: none; }
759
760
  /* The status line and the Filter chip; the focus is put on the title (a heading, tabindex -1) when the panel opens, so it shows no ring */
@@ -773,7 +774,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
773
774
  .hx-forge-limits > legend { padding: 0 0 var(--corn-space-1); }
774
775
  .hx-forge-select, .hx-forge-input { width: 100%; min-width: 0; padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); font-weight: 400; text-transform: none; letter-spacing: 0; user-select: text; }
775
776
  .hx-forge-input::placeholder { color: var(--corn-text-3); }
776
- .hx-forge-input:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
777
+ .hx-forge-input:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
777
778
  .hx-forge-notice { padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-warn); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); color: var(--corn-text-2); line-height: 1.5; }
778
779
 
779
780
  .hx-forge-list, .hx-forge-checks, .hx-forge-files { display: flex; flex-direction: column; gap: var(--corn-space-1); margin: 0; padding: 0; list-style: none; }
@@ -814,7 +815,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
814
815
  .hx-forge-step { display: flex; flex-direction: column; gap: var(--corn-space-1); }
815
816
  .hx-forge-startspec { flex: none; align-self: center; }
816
817
  .hx-forge-notice--ok { border-color: var(--corn-ok); }
817
- .hx-confirm-scrim { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: var(--corn-space-5); background: color-mix(in srgb, var(--corn-ground) 60%, transparent); }
818
+ .hx-confirm-scrim { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: var(--corn-space-5); background: var(--corn-scrim); }
818
819
  .hx-confirm-scrim[hidden] { display: none; }
819
820
  .hx-confirm { display: flex; flex-direction: column; gap: var(--corn-space-3); width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: var(--corn-space-5); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-lg); box-shadow: var(--corn-shadow-lg); font-size: var(--corn-text-sm); user-select: text; }
820
821
  .hx-confirm-title { margin: 0; font-size: var(--corn-text-lg); font-weight: 700; color: var(--corn-text); }
@@ -824,7 +825,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
824
825
  .hx-confirm-checks { display: flex; flex-direction: column; gap: var(--corn-space-1); margin: 0; padding: 0; list-style: none; }
825
826
  .hx-confirm-label { margin: 0; color: var(--corn-text-3); }
826
827
  .hx-confirm-pre { margin: 0; max-height: 140px; overflow: auto; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: var(--corn-text-xs)/1.5 var(--corn-mono); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
827
- .hx-confirm-pre:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
828
+ .hx-confirm-pre:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
828
829
  .hx-confirm-note { margin: 0; color: var(--corn-text-2); line-height: 1.5; }
829
830
  .hx-confirm-actions { display: flex; justify-content: flex-end; gap: var(--corn-space-3); }
830
831
  .hx-tokens-list { display: flex; flex-direction: column; gap: var(--corn-space-2); margin: 0; padding: 0; list-style: none; }
@@ -846,7 +847,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
846
847
  .hx-forge-work-filters[hidden], .hx-forge-filters[hidden] { display: none; }
847
848
  .hx-forge-toggle { display: inline-flex; align-items: center; gap: var(--corn-space-2); min-height: 24px; color: var(--corn-text-2); font-size: var(--corn-text-sm); }
848
849
  .hx-forge-toggle input { accent-color: var(--corn-accent-text); }
849
- .hx-forge-toggle input:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
850
+ .hx-forge-toggle input:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
850
851
  .hx-forge-group { display: flex; flex-direction: column; gap: var(--corn-space-1); margin: 0 0 var(--corn-space-3); list-style: none; }
851
852
  .hx-forge-gtitle { margin: 0; font-size: var(--corn-text-sm); font-weight: 700; color: var(--corn-text); overflow-wrap: anywhere; }
852
853
  .hx-forge-gout { margin-left: var(--corn-space-1); }
@@ -855,7 +856,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
855
856
  .hx-forge-why { font-size: var(--corn-text-xs); overflow-wrap: anywhere; }
856
857
  .hx-forge-notes, .hx-forge-confirm { display: flex; flex-direction: column; gap: var(--corn-space-3); }
857
858
  .hx-forge-preview { width: 100%; min-height: 12em; resize: vertical; padding: var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font-family: var(--corn-mono); font-size: var(--corn-text-xs); line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; user-select: text; }
858
- .hx-forge-preview:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
859
+ .hx-forge-preview:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
859
860
  .hx-forge-actions { display: flex; flex-wrap: wrap; gap: var(--corn-space-3); }
860
861
  .hx-forge-msg { padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); color: var(--corn-text-2); line-height: 1.5; overflow-wrap: anywhere; }
861
862
  .hx-forge-msg--bad { border-color: var(--corn-warn); }
@@ -968,7 +969,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
968
969
  .hx-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--corn-space-2); }
969
970
  .hx-row { display: flex; align-items: center; gap: var(--corn-space-4); width: 100%; min-height: 36px; padding: var(--corn-space-3) var(--corn-space-4); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); color: var(--corn-text); font: inherit; text-align: left; }
970
971
  .hx-row:hover { background: var(--corn-accent-soft); }
971
- .hx-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
972
+ .hx-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
972
973
  .hx-row-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
973
974
  .hx-row-meta { flex: none; font-size: var(--corn-text-sm); color: var(--corn-text-3); font-variant-numeric: tabular-nums; }
974
975
  .hx-drawer .hx-mockup-list { margin: var(--corn-space-3) 0 0; }
@@ -1008,6 +1009,29 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
1008
1009
  .hx-more-btn { display: block; margin-top: var(--corn-space-1); min-height: 0; padding: 0; font-size: var(--corn-text-sm); }
1009
1010
  @media (max-width: 767px) { .hx-more-btn { min-height: 44px; } }
1010
1011
 
1012
+ /* ==== the chrome contract (CF review F46, F49, F54, F55): what a flat brand reaches, and what never clips or moves ================ */
1013
+ /* The phone search field's magnifier: an image taken from the text colour (it was a fixed grey picture); the mode caret's chevron */
1014
+ :root { --hx-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E");
1015
+ --hx-magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E"); }
1016
+ .hx-mobile-search::before { content: ""; position: absolute; top: 50%; left: calc(var(--corn-space-3) + 8px); width: 14px; height: 14px; transform: translateY(-50%); background: var(--corn-text-3); -webkit-mask: var(--hx-magnifier) no-repeat center / contain; mask: var(--hx-magnifier) no-repeat center / contain; pointer-events: none; z-index: 1; }
1017
+ /* A brand wordmark that does not fit leaves the logo (header-fit.js measures); a row that still scrolls shows it at its edge */
1018
+ .hx-header-left[data-brand-short] .hx-title { display: none; }
1019
+ .hx-header-left[data-overflow] { -webkit-mask: linear-gradient(to right, var(--corn-text) calc(100% - var(--corn-space-6)), transparent); mask: linear-gradient(to right, var(--corn-text) calc(100% - var(--corn-space-6)), transparent); }
1020
+ /* A scroll container never cuts a focus ring: a row that is tabbed to stops short of the edge by the ring's width and offset */
1021
+ .hx-forge-body, .hx-drawer-body, .hx-proposal-changes, .hx-proposal-bar, .hx-confirm, .hx-whatif-edges .hx-whatif-list, .hx-proposal-bar .hx-scenarios { scroll-padding-block: calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1)); }
1022
+ /* The Work tabs scroll sideways: a tab brought into view stops short of the edge by the strip's own padding */
1023
+ .hx-forge-tabs { scroll-padding-inline: var(--corn-space-4); }
1024
+ /* Numbers shown as data take the number face (a brand sets --corn-font-num; digits in a pixel face misread) */
1025
+ .hx-count, .hx-layers-count, .hx-forge-count, .hx-forge-lit, .hx-player-count, .hx-ms, .hx-row-meta, .hx-run-limits dd { font-family: var(--corn-font-num); font-variant-numeric: tabular-nums; }
1026
+ /* Windows high contrast (forced colours) repaints backgrounds, which would leave a masked icon the colour of the page: draw it in the text colour */
1027
+ @media (forced-colors: active) {
1028
+ .hx-mobile-search::before, .hx-proposal-mode::after { background: CanvasText; }
1029
+ }
1030
+ /* No panel, sheet or menu slides, and nothing fades or grows, for a viewer who asked for less motion */
1031
+ @media (prefers-reduced-motion: reduce) {
1032
+ .hx-drawer, .hx-forge, .hx-input, .hx-btn, .hx-dot, .hx-sheet, .hx-menu, .hx-dock > .hx-sheet { transition: none; animation: none; }
1033
+ }
1034
+
1011
1035
  /* ---- the review flow, 0.34 design review (explorer/proposal.js, review.js, scenario-ui.js) -----------------------------
1012
1036
  F08 the source chip on the bar; F11 the player's controls in a phone peek; F14 the note above the keyboard; F15 the reason
1013
1037
  Approve is off in a peek; F16 the ways on from a bad link; F21 reflow at 400% zoom and with text spacing raised. */
@@ -1015,7 +1039,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
1015
1039
  .hx-proposal-source[hidden] { display: none; }
1016
1040
  a.hx-proposal-source { min-height: 24px; } /* a link: at least the WCAG 2.5.8 target (44px on a phone, below) */
1017
1041
  a.hx-proposal-source:hover { color: var(--corn-text); text-decoration: underline; }
1018
- a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
1042
+ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
1019
1043
  .hx-proposal-source[data-corn-state="draft"] { border-color: color-mix(in srgb, var(--corn-changed) 50%, transparent); }
1020
1044
  .hx-proposal-ways { display: flex; flex-wrap: wrap; gap: var(--corn-space-2) var(--corn-space-3); margin-top: var(--corn-space-3); }
1021
1045
  .hx-proposal-ways[hidden] { display: none; }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @module explorer/focus-room
3
+ *
4
+ * A control that is tabbed to inside a strip that scrolls sideways (the Work panel's tabs) is brought fully into view, ring and all
5
+ * (CF review F54). A browser scrolls a focused control only until it is "mostly" visible, and the last tab was left a few pixels under
6
+ * the strip's edge, with its focus ring cut. `scroll-padding-inline` in explorer.css says how much room to leave; this asks for the scroll.
7
+ */
8
+
9
+ /** The strips: a scroll container whose children are tabbed to */
10
+ export const STRIP = '.hx-forge-tabs';
11
+
12
+ /** Scrolls `el` into view inside its strip, if it has one, leaving the strip's scroll-padding */
13
+ export function revealInStrip(el) {
14
+ if (!el || typeof el.closest !== 'function' || typeof el.scrollIntoView !== 'function') return false;
15
+ const strip = el.closest(STRIP);
16
+ if (!strip || el === strip) return false;
17
+ el.scrollIntoView({ block: 'nearest', inline: 'nearest' });
18
+ return true;
19
+ }
20
+
21
+ /** Listens for focus on the whole page, once. Returns how to stop. */
22
+ export function watchFocusRoom(doc = document) {
23
+ const on = (event) => revealInStrip(event.target);
24
+ doc.addEventListener('focusin', on);
25
+ return () => doc.removeEventListener('focusin', on);
26
+ }