/* DRAFT layer "defxn-direction" for the mech kit, version 2 (2026-11-22). Layer: app (a review sheet over dist/defxn-mech.css).
   For: the owner, to see the .mx- parts in the 2026-11-22 direction before the rules move into src/mech.css.

   Version 1 of this file made every part a flat graphite plate. The owner refused it the same day: "the mech lost its
   cel shaded feel, hard surfaced but still in our direction. we need to upgrade it, not entirely wipe it." Version 1 is
   superseded by this file and is not loaded anywhere.

   So this layer changes NO primitive's construction. The cut plate, its top and left bevel, the rail under it, the dark
   well, the lit strip, the ring hub and the thin outline all stay as dist/defxn-mech.css builds them. It changes four things:
     1. the mech colour mixes, so the cel faces read in the teal direction: bone plates, graphite rails, deep wells,
        ink outlines. Each mix is still made from theme roles only.
     2. a hard shadow with no blur under each standing part: one more flat cel tone, and the part stands off the ground.
     3. type: the real weights of FXN Basalt (display 700 on a key, display 600 on a title, sans 600 on a label).
        Mono stays for exact values only.
     4. the one dominant key: the full cream face (the complement, law 73) over a wide lit strip.

   How it outranks the kit. The kit declares its mixes in a :where() rule (no weight) on the root and on every .mx- part.
   The token rule below names the theme attribute, so it wins on the root and on every part. Every other rule starts with
   :where([data-theme="defxn-teal"]): no added weight, so a rule has the weight of the kit rule it follows and wins by
   coming later. The kit's state rules (selected, pressed, checked, disabled) carry more weight and still win.
   The attribute is matched without :root, so the layer also works where the theme is set on a wrapper element. */

/* 1. Colour mixes. Roles only: --text-strong is cream, --text-muted is warm steel, --surface is graphite, --depth is the
   deep teal, --text-inverse is the darkest ink. */
[data-theme="defxn-teal"],
[data-theme="defxn-teal"] :where([class^="mx-"], [class*=" mx-"]) {
  /* plate: a bone face, a cream bevel on its top and left, a steel shade on its bottom and right */
  --mx-plate: color-mix(in oklab, hsl(var(--text-strong)) 45%, hsl(var(--text-muted)));
  --mx-plate-hi: hsl(var(--text-strong));
  --mx-plate-lo: color-mix(in oklab, hsl(var(--text-muted)) 70%, hsl(var(--surface)));
  /* rail: graphite, lighter than the ground so the base of a plate reads as a second face */
  --mx-rail: color-mix(in oklab, hsl(var(--text-muted)) 28%, hsl(var(--surface)));
  --mx-rail-hi: color-mix(in oklab, hsl(var(--text-muted)) 42%, hsl(var(--surface)));
  /* well: deeper than the ground, so an inset reads as cut into the page */
  --mx-well: color-mix(in oklab, hsl(var(--depth)) 78%, hsl(var(--text-inverse)));
  --mx-well-edge: color-mix(in oklab, hsl(var(--text-muted)) 22%, hsl(var(--depth)));
  /* line: the darkest ink, for a crisp outline round every face */
  --mx-line: hsl(var(--text-inverse));
}

/* 2. The hard shadow. --mx-under is the last layer of a part's shadow list, so it shows only below the rail's outline.
   The stacked card keeps its own --mx-under (the two plates behind it), so it is left out here. */
:where([data-theme="defxn-teal"]) :where(.mx-key, .mx-tab, .mx-keycap, .mx-version, .mx-return-chip, .mx-jump-link,
  .mx-accordion > summary, .mx-action-footer) {
  --mx-under: 0 calc(var(--mx-rail-h) + 4px) 0 0 color-mix(in oklab, var(--mx-line) 50%, transparent);
}
:where([data-theme="defxn-teal"]) :where(.mx-card:not(.mx-card--stacked), .mx-tile, .mx-field, .mx-chip, .mx-stats,
  .mx-callout, .mx-key--inset) {
  --mx-under: 0 4px 0 0 color-mix(in oklab, var(--mx-line) 50%, transparent);
}
/* a floating part stands higher: a longer shadow, drawn narrower than the part */
:where([data-theme="defxn-teal"]) :where(.mx-pop, .mx-tooltip, .mx-menu, .mx-listbox, .mx-dialog, .mx-toast) {
  --mx-under: 0 14px 0 -4px color-mix(in oklab, var(--mx-line) 50%, transparent);
}

/* 3. Type. font-synthesis: none on every part: a weight the face does not have is never drawn as a fake bold. */
:where([data-theme="defxn-teal"]) :where([class^="mx-"], [class*=" mx-"]) { font-synthesis: none; }
:where([data-theme="defxn-teal"]) .mx-label { font-family: var(--font-sans); font-weight: 600; letter-spacing: .2em; }
:where([data-theme="defxn-teal"]) .mx-title { font-weight: 600; letter-spacing: 0; }
:where([data-theme="defxn-teal"]) .mx-text { color: hsl(var(--text)); }
:where([data-theme="defxn-teal"]) .mx-key { font-family: var(--font-display); font-weight: 700; }
:where([data-theme="defxn-teal"]) .mx-key--sm { font-family: var(--font-sans); font-weight: 600; letter-spacing: .12em; }
:where([data-theme="defxn-teal"]) .mx-text-action { font-weight: 600; }
:where([data-theme="defxn-teal"]) .mx-text-action--sm { font-family: var(--font-sans); letter-spacing: .12em; }

/* 4. The dominant key: the one cream face on a view. Every other key is bone. Its strip is the light, drawn wide. */
:where([data-theme="defxn-teal"]) .mx-key--dominant {
  --mx-face: var(--mx-complement);
  --mx-lift-to: var(--mx-light-hi);
  --mx-strip: var(--mx-light);
  --mx-strip-w: 56%;
}
