/* m.css · built by tools/build.mjs from m/src — edit the sources there, not this file */
/* Mereframe Components · m.css
   The design language of mereframe.com, the Mereframe Bench and Lensfield (Portrait), as one library.

   Paper and ink. One rounded surface per subject on thin gutters, its solid ground taken from the photograph on show.
   Google Sans Flex, the Bricolage wordmark, Material Symbols Rounded. Material 3 Expressive springs and connected groups.

   The rules it keeps, everywhere:
   · no gradients and no glows: solid tonal surfaces only (a flat scrim over a photograph is fine);
   · soft and rounded, never hard or sharp-edged;
   · a control never grows, moves or reveals text on hover, and a press answers with shape, never with size;
   · hints live in tooltips, never inline;
   · nothing is printed on a photograph except the names of a comparison's halves; captions sit under it, like a print's label;
   · selection is ink. A hue appears only where it means something.

   Layers, lowest first: m.base (tokens, theme, elements, type), m.layout, m.components, m.utilities.
   Your own CSS, unlayered, wins over all four without a fight. */

@layer m.base, m.layout, m.components, m.utilities;

@font-face { font-family: 'GSF'; src: url(fonts/gsf.woff2?v=474f68fa) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Brico'; src: url(fonts/brico.woff2?v=69feab2b) format('woff2'); font-weight: 400 700; font-display: block; }
@font-face { font-family: 'Sym'; src: url(fonts/sym.woff2?v=842f9149) format('woff2'); font-weight: 400 600; font-display: block; }
@font-face { font-family: 'Plex Mono'; src: url(fonts/mono.woff2?v=bb87500e) format('woff2'); font-weight: 400; font-display: swap; }
/* Each face's stand-in while it loads: a local font drawn to the same width and line, so a paragraph breaks where it
   will break in the real face and nothing moves when that arrives (measured with fontTools: GSF at 450 sets 5.8% wider
   than Arial, Brico at 620 2.3% narrower, Plex Mono 9.1% wider than Consolas). Arimo and Liberation Sans are Arial's
   metrics on Linux; a Mac without Consolas falls through to ui-monospace, which is Plex Mono's width already. */
@font-face { font-family: 'GSF fallback'; src: local('Arial'), local('Arimo'), local('Liberation Sans'); size-adjust: 106%; ascent-override: 91.1%; descent-override: 27%; line-gap-override: 0%; }
@font-face { font-family: 'Brico fallback'; src: local('Arial'), local('Arimo'), local('Liberation Sans'); size-adjust: 97.7%; ascent-override: 95.2%; descent-override: 27.6%; line-gap-override: 0%; }
@font-face { font-family: 'Plex Mono fallback'; src: local('Consolas'); size-adjust: 109.1%; ascent-override: 94%; descent-override: 25.2%; line-gap-override: 0%; }

/* The photograph's tones. Registered, so when a surface takes a new photograph the whole scheme blends to it instead of
   cutting. Every surface reads them; on neutral surfaces they are paper and ink. */
@property --g { syntax: '<color>'; inherits: true; initial-value: #ECE9E1; }
@property --g2 { syntax: '<color>'; inherits: true; initial-value: #E2DED4; }
@property --tile { syntax: '<color>'; inherits: true; initial-value: #F6F4EF; }
@property --ink { syntax: '<color>'; inherits: true; initial-value: #121211; }
@property --ink2 { syntax: '<color>'; inherits: true; initial-value: #61615D; }
@property --primary { syntax: '<color>'; inherits: true; initial-value: #D8D3C7; }
@property --onp { syntax: '<color>'; inherits: true; initial-value: #121211; }

/* ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   BASE · tokens, theme, elements, type
   ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */
@layer m.base {
  :root {
    color-scheme: light;

    /* Neutrals, Day then Night. Eighteen is 18 % grey, the grey a light meter aims for: secondary words on paper.
       Night steps clearly from the page to a panel, a card and a control (each a little lighter), and its quiet words
       read at 8 : 1 on a panel: the Bench's warm dark, never blue-black. */
    --paper: light-dark(#F6F4EF, #121211);
    --paper2: light-dark(#ECE9E1, #21211E);
    --paper3: light-dark(#E2DED4, #373632);
    --ink0: light-dark(#121211, #F2F0EA);
    --eighteen: light-dark(#61615D, #B8B6AE);
    --faint: light-dark(#A09E96, #7A7972);          /* disabled and decoration, never words to read */
    --night: #0A0A0B;                              /* the darkroom: a stage that judges pictures, in both themes */
    --line: light-dark(rgba(18, 18, 17, .12), rgba(246, 244, 239, .17));
    --wash: light-dark(rgba(18, 18, 17, .06), rgba(246, 244, 239, .09));
    --menu: light-dark(#E9E5DC, #302F2C);
    --menu-on: light-dark(#D8D3C7, #44433E);
    --tip: light-dark(#2E2E2B, #E9E5DC);
    --on-tip: light-dark(#F6F4EF, #121211);
    --dial: light-dark(#1F1F1D, #2E2E2B);
    --ok: light-dark(#2B7A4B, #5DBB83);
    --warn: light-dark(#875A00, #F0C36A);
    --danger: light-dark(#B3261E, #F2B8B5);
    --rec: #E5392F;                                /* recording, and nothing else */
    --scrim: rgba(10, 10, 11, .42);
    --shadow: 0 10px 30px light-dark(rgba(18, 18, 17, .18), rgba(0, 0, 0, .55)), 0 2px 6px light-dark(rgba(18, 18, 17, .1), rgba(0, 0, 0, .4));

    /* Type. The site's sizes: fluid from a 360 px phone to a 2560 px screen. */
    --ff: 'GSF', 'GSF fallback', 'Google Sans', Roboto, 'Segoe UI', system-ui, Arial, sans-serif;
    --ff-brand: 'Brico', 'Brico fallback', var(--ff);
    --ff-mono: 'Plex Mono', 'Plex Mono fallback', ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
    --t-display: clamp(46px, min(6.3vw, 10.6vh), 210px);
    --t-h1: clamp(50px, 5.4vw + 12px, 168px);
    --t-h2: clamp(38px, 3.6vw + 16px, 132px);
    --t-h3: clamp(28px, 1.6vw + 14px, 64px);
    --t-h4: clamp(21px, .8vw + 15px, 38px);
    --t-lead: clamp(18px, .7vw + 11px, 32px);
    --t-body: clamp(17px, .42vw + 13px, 26px);
    --t-small: clamp(15px, .3vw + 12px, 20px);
    --t-eyebrow: clamp(15px, .5vw + 10.5px, 22px);
    --t-note: clamp(13px, .18vw + 11.5px, 16px);

    /* Controls. A page of words uses these; .compact (an instrument, an editor) makes them tighter. */
    --ctl: 48px; --ctl-sm: 40px; --ctl-lg: 60px; --ctl-fs: 16px; --ctl-fs-sm: 14.5px;

    /* Layout and shape */
    --gut: clamp(8px, .8vw, 18px);                 /* between surfaces */
    --rp: clamp(28px, 2.4vw, 52px);                /* a panel */
    --rc: clamp(22px, 1.8vw, 40px);                /* a card on a panel */
    --r-art: clamp(14px, 1.2vw, 24px);             /* a photograph */
    --px: clamp(20px, 4.4vw, 140px);               /* a panel's sides */
    --py: clamp(48px, 5.6vw, 140px);               /* a panel's top and foot */
    --maxw: 2240px;
    --hdr: 64px;

    /* Durations, few on purpose: a colour or a hint; a state (hover, a check, a press); a shape changing or a ground
       blending (the tone's own .42 s); a surface arriving or a page settling. A spring keeps its shape at any of them. */
    --dur-quick: .15s; --dur-short: .25s; --dur-mid: .42s; --dur-long: .62s;

    /* Motion. Material 3 Expressive springs, sampled from the film's spring() as CSS easings. */
    --ease: cubic-bezier(.2, 0, 0, 1);
    --ease-in: cubic-bezier(.3, 0, .8, .15);
    --morph: cubic-bezier(.2, 1.3, .3, 1);
    --spring: linear(0, .0461, .1546, .2911, .4327, .5653, .6814, .7776, .8539, .9118, .9538, .9828, 1.0016, 1.0126, 1.0181, 1.0199, 1.0193, 1.0172, 1.0146, 1.0117, 1.0091, 1.0067, 1.0047, 1.0031, 1);
    --spring-s: linear(0, .042, .1436, .2752, .4157, .5509, .6722, .7751, .8582, .9223, .9692, 1.0015, 1.022, 1.0333, 1.038, 1.0379, 1.035, 1.0303, 1.025, 1.0197, 1.0147, 1.0104, 1.0069, 1.0041, 1);
    --spring-cap: linear(0, .027, .096, .1917, .3015, .4157, .5274, .6315, .7248, .8057, .8736, .9286, .9716, 1.0039, 1.0267, 1.0418, 1.0504, 1.054, 1.0538, 1.0509, 1.0462, 1.0405, 1.0344, 1.0282, 1.0224, 1.017, 1.0123, 1.0084, 1.0051, 1.0025, 1.0005, .999, 1);
  }

  /* Neutral tones. Declared again on every themed scope, so a Night panel on a Day page resolves them for itself. */
  :root, [data-theme] {
    --g: light-dark(#ECE9E1, #21211E);
    --g2: light-dark(#E2DED4, #373632);
    --tile: light-dark(#F6F4EF, #2B2B28);
    --ink: light-dark(#121211, #F2F0EA);
    --ink2: light-dark(#61615D, #B8B6AE);
    --primary: #D8D3C7;
    --onp: #121211;
  }
  /* a themed scope starts from its own paper: a surface inside it (a panel, a card) sets its own */
  [data-theme] { --here: var(--paper); --tone: var(--paper2); }
  [data-theme=light] { color-scheme: light; color: var(--ink); }
  [data-theme=dark] { color-scheme: dark; color: var(--ink); }
  [data-theme=system] { color-scheme: light dark; color: var(--ink); }

  /* A photograph's ground: class `tone`, and its seed as --h (hue, degrees) and --c (chroma, 0.04 to 0.16). m.js
     ground(el, url) reads them off a picture; tools/photos.py writes them for every photo in assets/photos.
     The formulas are the film's dayTones() and nightTones(): a pale ground, ink of the same hue, the camera's accents. */
  .tone {
    --C: clamp(.04, var(--c, .08), .16);
    --g: light-dark(oklch(.915 min(calc(var(--C) * .42), .055) var(--h)), oklch(.265 min(calc(var(--C) * .55), .075) var(--h)));
    --g2: light-dark(oklch(.86 min(calc(var(--C) * .6), .075) var(--h)), oklch(.35 min(calc(var(--C) * .55), .07) var(--h)));
    --tile: light-dark(oklch(.955 min(calc(var(--C) * .25), .03) var(--h)), oklch(.31 min(calc(var(--C) * .5), .06) var(--h)));
    --ink: light-dark(oklch(.27 min(calc(var(--C) * .5), .07) var(--h)), oklch(.96 min(calc(var(--C) * .25), .03) var(--h)));
    --ink2: light-dark(oklch(.45 min(calc(var(--C) * .4), .05) var(--h)), oklch(.84 min(calc(var(--C) * .3), .04) var(--h)));
    --primary: oklch(.83 min(calc(var(--C) * .55), .085) var(--h));
    --onp: oklch(.3 min(calc(var(--C) * .5), .07) var(--h));
    color: var(--ink);
    transition: --g var(--dur-mid) var(--ease), --g2 var(--dur-mid) var(--ease), --tile var(--dur-mid) var(--ease), --ink var(--dur-mid) var(--ease), --ink2 var(--dur-mid) var(--ease), --primary var(--dur-mid) var(--ease), --onp var(--dur-mid) var(--ease);
  }

  /* An instrument or an editor: the same language, tighter (the Bench's and Lensfield's sizes). */
  .compact {
    --ctl: 40px; --ctl-sm: 32px; --ctl-lg: 52px; --ctl-fs: 14.5px; --ctl-fs-sm: 13px;
    --t-body: 15px; --t-small: 13.5px; --t-note: 13px; --t-eyebrow: 14px;
    --rp: clamp(22px, 1.75vw, 32px); --rc: 20px; --r-art: 14px; --gut: clamp(8px, .75vw, 14px);
  }

}

@layer m.base {
  /* ── elements */
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr) + 12px); background: var(--paper); interpolate-size: allow-keywords; }
  body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink); font: 400 var(--t-body)/1.45 var(--ff); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-synthesis: none; overflow-x: clip; --here: var(--paper); --tone: var(--paper2); }
  h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, pre { margin: 0; }
  h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: 480; text-wrap: balance; overflow-wrap: break-word; }
  p, li, dd, figcaption, blockquote { text-wrap: pretty; }
  ul, ol { margin: 0; padding: 0; }
  ul[class], ol[class] { list-style: none; }
  img, svg, video, canvas, picture { display: block; max-width: 100%; }
  img { height: auto; -webkit-user-drag: none; }
  a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: from-font; }
  button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
  button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  button:disabled, [aria-disabled=true] { cursor: default; }
  [hidden] { display: none !important; }
  b, strong { font-weight: 600; }
  small { font-size: .86em; }
  hr { height: 1px; margin: 0; border: 0; background: var(--line); }
  code, kbd, samp, pre { font-family: var(--ff-mono); font-size: .9em; }
  :focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
  [tabindex="-1"]:focus { outline: none; }
  ::selection { background: color-mix(in srgb, var(--ink) 18%, transparent); }
  ::placeholder { color: var(--ink2); opacity: 1; }
  * { scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--ink) 22%, transparent) transparent; }
  dialog { color: inherit; }

  /* the icons: Material Symbols Rounded, written as their names (<span class="ms">arrow_forward</span>) */
  .ms { font-family: 'Sym'; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
    display: inline-block; flex: none; width: 1em; height: 1em; overflow: hidden; font-feature-settings: 'liga'; font-variation-settings: 'FILL' 0, 'wght' 400; user-select: none; -webkit-user-select: none; }
  .ms.f, .ms[data-fill] { font-variation-settings: 'FILL' 1, 'wght' 500; }
  .ms.b { font-variation-settings: 'FILL' 0, 'wght' 600; }

  /* type */
  .display { font: 480 var(--t-display)/.98 var(--ff); letter-spacing: -.032em; }
  .h1 { font: 480 var(--t-h1)/1 var(--ff); letter-spacing: -.022em; }
  .h2 { font: 480 var(--t-h2)/1.04 var(--ff); letter-spacing: -.02em; }
  .h3 { font: 480 var(--t-h3)/1.1 var(--ff); letter-spacing: -.015em; }
  .h4 { font: 500 var(--t-h4)/1.18 var(--ff); letter-spacing: -.008em; }
  :is(.display, .h1, .h2, .h3, .h4) { text-wrap: balance; overflow-wrap: break-word; hyphens: manual; }
  .lead { font: 420 var(--t-lead)/1.35 var(--ff); color: var(--ink2); max-width: 24em; text-wrap: pretty; }
  .body { font: 400 var(--t-body)/1.45 var(--ff); max-width: 32em; text-wrap: pretty; }
  :is(.display, .h1, .h2, .h3, .h4) + :is(.body, .lead) { margin-top: clamp(14px, 1.4vw, 30px); }
  .body + .body { margin-top: .8em; }
  .small { font-size: var(--t-small); line-height: 1.45; }
  .eyebrow { display: block; font: 500 var(--t-eyebrow)/1.25 var(--ff); letter-spacing: .01em; color: var(--ink2); margin: 0 0 clamp(12px, 1.1vw, 22px); }
  .note { font: 450 var(--t-note)/1.4 var(--ff); color: var(--ink2); text-wrap: pretty; }
  .muted { color: var(--ink2); }
  .num { font-variant-numeric: tabular-nums; }
  .mono { font-family: var(--ff-mono); }
  .wordmark { font: 500 1em/1 var(--ff-brand); letter-spacing: -.032em; }
  .big-num { display: block; font: 480 clamp(40px, 2.6vw + 16px, 96px)/1 var(--ff); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

  /* prose: a calm reading column, about 68 characters */
  .prose { max-width: 68ch; font: 400 clamp(17px, .25vw + 14.5px, 21px)/1.62 var(--ff); overflow-wrap: break-word; }
  .prose > * + * { margin-top: 1em; }
  .prose :is(h2, h3) { margin-top: 1.9em; font: 480 clamp(26px, .9vw + 19px, 42px)/1.15 var(--ff); letter-spacing: -.012em; }
  .prose h3 { font-size: clamp(21px, .5vw + 16px, 28px); font-weight: 500; letter-spacing: -.005em; }
  .prose :is(h2, h3) + * { margin-top: .55em; }
  .prose :is(ul, ol) { padding-left: 1.3em; }
  .prose li + li { margin-top: .4em; }
  .prose li::marker { color: var(--ink2); }
  .prose a { text-decoration-color: color-mix(in oklab, currentColor 40%, transparent); }
  @media (hover: hover) { .prose a:hover { text-decoration-color: currentColor; } }
  .prose blockquote { margin-block: 1.6em; padding-left: clamp(18px, 1.6vw, 28px); border-left: 3px solid var(--ink); font: 450 clamp(21px, .7vw + 15px, 32px)/1.35 var(--ff); letter-spacing: -.01em; }
  .prose blockquote cite { display: block; margin-top: .7em; font: 450 var(--t-note)/1.4 var(--ff); font-style: normal; color: var(--ink2); }
  .prose :not(pre) > code { padding: .08em .38em; border-radius: 6px; background: var(--tone); font-size: .86em; overflow-wrap: anywhere; }
  .prose figure { margin-block: 2em; }
  .prose hr { margin-block: 2.4em; }
  .prose strong { font-weight: 600; }

  .vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip { position: fixed; left: 12px; top: 12px; translate: 0 calc(-100% - 24px); z-index: 300; padding: 12px 20px; border-radius: 24px; background: var(--ink); color: var(--tile); font: 500 15px/1.2 var(--ff); text-decoration: none; transition: translate var(--dur-short) var(--ease); }
  .skip:focus { translate: 0 0; }
}

/* ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   LAYOUT · the page of panels, and the arrangements inside them
   ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */
@layer m.layout {
  /* the page: rounded panels on paper, a gutter apart; .bleed runs edge to edge */
  .page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gut); padding: 0 var(--gut) var(--gut); }
  .page > * { min-width: 0; }
  .panel { position: relative; border-radius: var(--rp); background: var(--g); color: var(--ink); padding: var(--py) var(--px); overflow: clip; --here: var(--g); --tone: var(--g2); }
  .panel > .in, .bleed > .in, .in { width: 100%; max-width: var(--maxw); margin-inline: auto; }
  .panel.tight { padding-block: clamp(32px, 3.6vw, 88px); }
  .panel.flush { padding: 0; }
  .panel.paper { background: var(--tile); --here: var(--tile); --tone: var(--g); }
  .panel.night { background: var(--night); color: #F2F0EA; --ink: #F2F0EA; --ink2: rgba(242, 240, 234, .64); --here: var(--night); --tone: #1F1F1D; }
  .bleed { position: relative; margin-inline: calc(-1 * var(--gut)); background: var(--g); color: var(--ink); --here: var(--g); --tone: var(--g2); }
  .surface { background: var(--here); color: var(--ink); }

  .stack { display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap, 16px); }
  .stack.fill { align-items: stretch; }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 10px); }
  .cluster.end { justify-content: flex-end; }
  .cluster.between { justify-content: space-between; }
  .row { display: flex; align-items: center; gap: var(--gap, 10px); min-width: 0; }
  .grow { flex: 1 1 auto; min-width: 0; }
  .center { text-align: center; margin-inline: auto; justify-items: center; align-items: center; }

  /* grids: auto-fill to a minimum width, or a fixed count that steps down at narrower widths */
  .grid { display: grid; gap: var(--gap, var(--gut)); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 300px)), 1fr)); }
  .grid.fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 300px)), 1fr)); }
  .cols-2, .cols-3, .cols-4, .cols-5 { display: grid; gap: var(--gap, var(--gut)); grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .cols-2 { --n: 2; } .cols-3 { --n: 3; } .cols-4 { --n: 4; } .cols-5 { --n: 5; }
  @media (max-width: 1200px) { .cols-5 { --n: 3; } .cols-4 { --n: 2; } }
  @media (max-width: 1000px) { .cols-3, .cols-5 { --n: 2; } }
  @media (max-width: 640px) { .cols-2, .cols-3, .cols-4, .cols-5 { --n: 1; } }

  /* split: words and a picture, side by side; on a phone the words come first */
  .split { display: grid; grid-template-columns: minmax(0, var(--a, 1fr)) minmax(0, var(--b, 1fr)); gap: clamp(28px, 5vw, 150px); align-items: center; }
  .split.top { align-items: start; }
  @media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .split > .first { order: -1; } }

  /* flank: the site's first view, words either side of one subject (a phone, a picture), then a phone's single column */
  .flank { display: grid; column-gap: clamp(28px, 4.2vw, 140px); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1.2fr); grid-template-areas: ". mid ." "a mid b" "l mid r" ". mid ."; }
  .flank > [data-area=mid] { grid-area: mid; align-self: center; }
  .flank > [data-area=a] { grid-area: a; align-self: end; text-align: right; }
  .flank > [data-area=b] { grid-area: b; align-self: end; text-align: left; }
  .flank > [data-area=l] { grid-area: l; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
  .flank > [data-area=r] { grid-area: r; display: flex; flex-direction: column; align-items: flex-start; }
  @media (max-width: 900px), (max-aspect-ratio: 5/6) {
    .flank { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "a" "b" "l" "mid" "r"; justify-items: center; text-align: center; row-gap: 0; }
    .flank > [data-area=a], .flank > [data-area=b] { text-align: center; }
    .flank > :is([data-area=l], [data-area=r]) { align-items: center; text-align: center; }
    .flank > [data-area=mid] { margin-block: 20px; }
  }

  .sticky { position: sticky; top: calc(var(--hdr) + var(--sticky-gap, 24px)); }
  .scroll-x { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .scroll-x::-webkit-scrollbar { display: none; }
}

/* ── actions/button */
@layer m.components {
  /* ── Button: M3 tonal by default; ink is the one main action. A press answers with shape; nothing grows. ── */
  .btn { --bg: var(--tone); --fg: var(--ink); --h: var(--ctl);
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--h); --bpx: calc(var(--h) * .46); padding: 0 calc(var(--bpx) + var(--press-w, 0px)); border: 0; border-radius: calc(var(--h) / 2);
    background: var(--bg); color: var(--fg); font: 500 var(--ctl-fs)/1.1 var(--ff); white-space: nowrap; text-decoration: none; cursor: pointer; vertical-align: middle;
    transition: background-color var(--dur-short) var(--ease), color var(--dur-short) var(--ease), box-shadow var(--dur-short) var(--ease), border-radius var(--dur-mid) var(--morph), padding var(--dur-mid) var(--spring); }
  @media (hover: hover) { .btn:hover:not(:disabled, [aria-disabled=true]) { background: color-mix(in oklab, var(--bg), var(--fg) 8%); } }
  .btn:active:not(:disabled, [aria-disabled=true]) { border-radius: calc(var(--h) * .29); }
  .btn:disabled, .btn[aria-disabled=true] { opacity: .42; cursor: default; }
  .btn .ms { font-size: calc(var(--ctl-fs) * 1.375); margin-inline: -2px; }
  .btn .go { transition: translate var(--dur-mid) var(--spring); }
  @media (hover: hover) { .btn:hover .go { translate: 3px 0; } }
  .btn[data-variant=ink], .btn[aria-pressed=true] { --bg: var(--ink); --fg: var(--tile); }
  .btn[data-variant=primary] { --bg: var(--primary); --fg: var(--onp); }
  .btn[data-variant=outline] { --bg: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--ink) 30%, transparent); }
  .btn[data-variant=text] { --bg: transparent; --bpx: 14px; }
  .btn[data-variant=paper] { --bg: var(--tile); }
  .btn[data-variant=danger] { --fg: var(--danger); }
  .btn[data-variant=danger-ink] { --bg: var(--danger); --fg: light-dark(#fff, #1C1C1A); }
  .btn[data-size=sm] { --h: var(--ctl-sm); --bpx: 16px; font-size: var(--ctl-fs-sm); }
  .btn[data-size=sm] .ms { font-size: 20px; }
  .btn[data-size=lg] { --h: var(--ctl-lg); --bpx: 28px; font-size: calc(var(--ctl-fs) + 2px); gap: 10px; }
  .btn[data-size=xl] { --h: clamp(60px, 2.4vw + 34px, 96px); --bpx: calc(var(--h) * .42); font-size: clamp(17px, .4vw + 13px, 24px); gap: 12px; }
  .btn[data-size=xl] .ms { font-size: 1.4em; }
  .btn.wide { display: flex; width: 100%; }
  /* busy: the label keeps its room (nothing moves), a ring turns in its place */
  .btn[aria-busy=true] { color: transparent; pointer-events: none; }
  .btn[aria-busy=true]::after { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in oklab, var(--fg) 24%, transparent); border-top-color: var(--fg); animation: m-spin .8s linear infinite; }
  @media (max-width: 560px) { .btn:not(.keep) { max-width: 100%; white-space: normal; text-align: center; line-height: 1.2; padding-block: 10px; } }
}

/* ── actions/icon-button */
@layer m.components {
  /* ── Icon button: transparent, tonal or ink; pressed or open takes the tone ── */
  .ib { --bg: transparent; --fg: var(--ink); --s: 44px;
    position: relative; display: inline-grid; place-items: center; flex: none; width: calc(var(--s) + 2 * var(--press-w, 0px)); height: var(--s); padding: 0; border: 0; border-radius: calc(var(--s) / 2);
    background: var(--bg); color: var(--fg); text-decoration: none; cursor: pointer; transition: background-color var(--dur-short) var(--ease), color var(--dur-short) var(--ease), border-radius var(--dur-mid) var(--morph), width var(--dur-mid) var(--spring); }
  @media (hover: hover) { .ib:hover:not(:disabled) { background: color-mix(in oklab, var(--bg), var(--fg) 8%); } }
  .ib:active:not(:disabled) { border-radius: calc(var(--s) * .32); }
  .ib:disabled, .ib[aria-disabled=true] { opacity: .34; cursor: default; }
  .ib .ms { font-size: calc(var(--s) * .5); }
  .ib[aria-pressed=true], .ib[aria-expanded=true] { --bg: var(--tone); }
  .ib[data-variant=tonal] { --bg: var(--tone); }
  .ib[data-variant=ink], .ib[data-variant=toggle][aria-pressed=true] { --bg: var(--ink); --fg: var(--tile); }
  .ib[data-variant=paper] { --bg: var(--tile); }
  .ib[data-variant=scrim] { --bg: rgba(18, 18, 20, .5); --fg: #fff; }
  .ib[data-size=sm] { --s: 36px; } .ib[data-size=xs] { --s: 28px; } .ib[data-size=lg] { --s: 56px; } .ib[data-size=xl] { --s: 72px; }
  .ib[data-size=xs] .ms { font-size: 18px; }
}

/* ── actions/group */
@layer m.components {
  /* ── Connected button group (M3 Expressive): tight inner corners; the chosen one goes round and takes the ink.
        Buttons with aria-pressed / aria-checked / aria-selected / aria-current, or radios and checkboxes in labels. ── */
  .seg { --h: var(--ctl); --rs: calc(var(--h) / 2); --ri: max(6px, calc(var(--h) * .2)); display: inline-flex; gap: 2px; min-width: 0; max-width: 100%; vertical-align: middle; }
  .seg > :is(button, label, a) { position: relative; flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 calc(var(--h) * .38);
    border: 0; border-radius: var(--ri); background: var(--tone); color: var(--ink); font: 500 var(--ctl-fs)/1.1 var(--ff); white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: border-radius var(--dur-mid) var(--spring), background-color var(--dur-short) var(--ease), color var(--dur-short) var(--ease); }
  .seg > :first-child { border-radius: var(--rs) var(--ri) var(--ri) var(--rs); }
  .seg > :last-child { border-radius: var(--ri) var(--rs) var(--rs) var(--ri); }
  .seg > :only-child { border-radius: var(--rs); }
  @media (hover: hover) { .seg > :is(button, label, a):hover:not(:disabled, [aria-pressed=true], [aria-checked=true], [aria-selected=true], [aria-current=page], [aria-current=true], .on, :has(:checked)) { background: color-mix(in oklab, var(--tone), var(--ink) 7%); } }
  .seg > :is([aria-pressed=true], [aria-checked=true], [aria-selected=true], [aria-current=page], [aria-current=true], .on, :has(:checked)) { border-radius: var(--rs); background: var(--ink); color: var(--tile); } @media (hover: hover) { .seg > :is([aria-pressed=true], [aria-checked=true], [aria-selected=true], [aria-current=page], [aria-current=true], .on, :has(:checked)):hover { border-radius: var(--rs); background: var(--ink); color: var(--tile); } }
  .seg > :disabled, .seg > :has(:disabled) { opacity: .42; cursor: default; }
  .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
  /* segments touch, so the ring is drawn inside each, in its own words' colour: it shows on the chosen one as on the rest */
  .seg > :is(button, a):focus-visible, .seg > label:has(:focus-visible) { outline: 3px solid currentColor; outline-offset: -3px; }
  .seg .ms { font-size: calc(var(--h) * .46); }
  .seg small { font-weight: 400; opacity: .72; }
  .seg[data-size=sm] { --h: var(--ctl-sm); } .seg[data-size=sm] > * { font-size: var(--ctl-fs-sm); padding-inline: 14px; }
  .seg[data-size=lg] { --h: var(--ctl-lg); } .seg[data-size=lg] > * { font-size: calc(var(--ctl-fs) + 1px); }
  .seg[data-size=xl] { --h: clamp(58px, 1.8vw + 36px, 84px); --ri: 12px; } .seg[data-size=xl] > * { font-size: clamp(16px, .45vw + 11px, 24px); gap: 10px; }
  .seg.wide { display: flex; width: 100%; }
  .seg.icons > * { flex: none; width: var(--h); padding: 0; }
  .seg.icons.wide > * { flex: 1 1 0; width: auto; }   /* wide icons share the row instead of standing square */
  .seg.vertical { flex-direction: column; }
  .seg.vertical > * { justify-content: flex-start; border-radius: var(--ri); }
  .seg.vertical > :first-child { border-radius: var(--rs) var(--rs) var(--ri) var(--ri); }
  .seg.vertical > :last-child { border-radius: var(--ri) var(--ri) var(--rs) var(--rs); }
  @media (max-width: 520px) {
    .seg.stack-sm { flex-direction: column; display: flex; width: 100%; }
    .seg.stack-sm > * { justify-content: flex-start; border-radius: var(--ri); }
    .seg.stack-sm > :first-child { border-radius: var(--rs) var(--rs) var(--ri) var(--ri); }
    .seg.stack-sm > :last-child { border-radius: var(--ri) var(--ri) var(--rs) var(--rs); }
  }
}

/* ── actions/link */
@layer m.components {
  /* ── Links: an arrow link, and the Bench's bridge (a row that goes somewhere) ── */
  .link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); text-underline-offset: .22em; }
  @media (hover: hover) { .link:hover { text-decoration-color: currentColor; } }
  .link .ms { font-size: 1.15em; transition: translate var(--dur-mid) var(--spring); }
  @media (hover: hover) { .link:hover .ms { translate: 3px 0; } }
  .bridges { display: grid; gap: 6px; }
  .bridge { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 12px 8px 20px; border: 0; border-radius: 26px; background: var(--tone); color: var(--ink);
    font: 500 var(--ctl-fs)/1.25 var(--ff); text-align: left; text-decoration: none; cursor: pointer; transition: background-color var(--dur-quick) var(--ease); }
  .bridge::after { content: 'arrow_forward'; content: 'arrow_forward' / ''; flex: none; font: 22px/1 'Sym'; display: inline-block; width: 1em; transition: translate var(--dur-mid) var(--spring); }
  @media (hover: hover) { .bridge:hover { background: color-mix(in oklab, var(--tone), var(--ink) 7%); } }
  @media (hover: hover) { .bridge:hover::after { translate: 3px 0; } }
  .bridge small { display: block; margin-top: 2px; font-weight: 400; font-size: .86em; color: var(--ink2); }
}

/* ── navigation/nav */
@layer m.components {
  /* ── Nav: links on a row; the current one carries the ink pill, which glides to the next on a spring (m-nav).
        Without the script the current link wears the ink itself. ── */
  .nav { position: relative; display: flex; align-items: center; gap: 2px; min-width: 0; isolation: isolate; }
  .nav > :is(a, button) { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; height: 40px; padding: 0 18px; border: 0; border-radius: 20px; background: transparent; color: var(--ink);
    font: 500 15.5px/1 var(--ff); text-decoration: none; white-space: nowrap; cursor: pointer; transition: color var(--dur-short) var(--ease), background-color var(--dur-short) var(--ease); }
  @media (hover: hover) { .nav > :is(a, button):hover:not([aria-current=page], [aria-current=true]) { background: color-mix(in oklab, var(--ink) 6%, transparent); } }
  .nav > :is([aria-current=page], [aria-current=true]) { color: var(--tile); }
  .nav > :is(a, button):focus-visible { outline: 3px solid currentColor; outline-offset: -3px; }   /* pages 2 px apart: the ring inside, on the pill too */
  .nav:not(:has(> .pill)) > :is([aria-current=page], [aria-current=true]) { background: var(--ink); }
  .nav > .pill, .tabs > .pill { position: absolute; left: 0; top: 50%; z-index: -1; height: 40px; width: 0; margin-top: -20px; border-radius: 20px; background: var(--ink); pointer-events: none; opacity: 0;
    transition: translate var(--dur-long) var(--spring), width var(--dur-long) var(--spring), opacity var(--dur-short) var(--ease); }
  body > .hdr .nav > .pill { view-transition-name: m-pill; }
  .nav .ms { font-size: 20px; }
  .nav .badge { margin-left: 2px; }
  .nav[data-size=sm] > :is(a, button) { height: 34px; padding: 0 14px; font-size: 14.5px; } .nav[data-size=sm] > .pill { height: 34px; margin-top: -17px; }
  .nav.tonal > :is([aria-current=page], [aria-current=true]) { color: var(--ink); }
  .nav.tonal > .pill, .nav.tonal:not(:has(> .pill)) > [aria-current] { background: var(--tone); }
  .nav[data-variant=tonal] > :is([aria-current=page], [aria-current=true]) { color: var(--ink); }
  .nav[data-variant=tonal] > .pill, .nav[data-variant=tonal]:not(:has(> .pill)) > [aria-current] { background: var(--tone); }
  /* underline: the pill thins to an ink line under the current link (a page's own sections, under its title); the
     script sizes the pill, so the line's height and place are held here */
  .nav[data-variant=underline] { gap: 4px; }
  .nav[data-variant=underline] > :is(a, button) { padding-inline: 12px; border-radius: 12px; }
  .nav[data-variant=underline] > :is([aria-current=page], [aria-current=true]) { color: var(--ink); }
  .nav[data-variant=underline] > .pill { top: auto; bottom: 0; height: 2px !important; margin-top: 0 !important; border-radius: 1px; }
  .nav[data-variant=underline]:not(:has(> .pill)) > [aria-current] { background: none; box-shadow: inset 0 -2px var(--ink); border-radius: 0; }
}

/* ── navigation/toc */
@layer m.components {
  /* ── Table of contents: a sticky list; the section on screen carries the tone (m-nav spy) ── */
  .toc { display: grid; gap: 2px; align-content: start; }
  .toc .group, .toc > h2 { margin: 14px 0 6px 14px; font: 500 13.5px/1.3 var(--ff); color: var(--ink2); }
  .toc .group:first-child, .toc > h2:first-child { margin-top: 0; }
  .toc a { display: block; padding: 9px 14px; border-radius: 18px; color: var(--ink2); font: 450 15px/1.3 var(--ff); text-decoration: none; transition: background-color var(--dur-short) var(--ease), color var(--dur-short) var(--ease); }
  @media (hover: hover) { .toc a:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); } }
  .toc a:is([aria-current=true], [aria-current=page], [aria-current=location]) { background: var(--tone); color: var(--ink); font-weight: 500; }
  .toc a.sub { padding-left: 28px; font-size: 14px; }
  .toc a .ms { font-size: 18px; vertical-align: -4px; margin-right: 6px; }
  /* a link that leads with its icon keeps the icon in a column of its own, so a second line hangs under the words,
     never under the icon */
  .toc a:has(> .ms:first-child) { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: start; }
  .toc a:has(> .ms:first-child) > .ms:first-child { margin: 0; height: 1.3em; display: grid; place-items: center; vertical-align: 0; }
  /* numbered: each top entry counted in front of it, quietly (a book's contents, a long essay's parts) */
  .toc[data-variant=numbered] { counter-reset: toc; }
  .toc[data-variant=numbered] > a:not(.sub) { counter-increment: toc; display: grid; grid-template-columns: 2.1em minmax(0, 1fr); column-gap: 4px; }
  .toc[data-variant=numbered] > a:not(.sub)::before { content: counter(toc, decimal-leading-zero); content: counter(toc, decimal-leading-zero) / ''; color: var(--ink2); font-variant-numeric: tabular-nums; }
  .toc[data-variant=numbered] > a.sub { padding-left: calc(14px + 2.1em + 4px); }
  /* rule: the entries stand on a hairline; the one being read marks its stretch of it in ink, and, where the browser
     ties it to the scroll, the line fills a step of ink as the page is read */
  .toc[data-variant=rule] { position: relative; gap: 0; }
  .toc[data-variant=rule]::before, .toc[data-variant=rule]::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: var(--line); }
  .toc[data-variant=rule] :is(.group, h2) { margin-left: 18px; }
  .toc[data-variant=rule] a { position: relative; padding-left: 18px; border-radius: 0 16px 16px 0; }
  .toc[data-variant=rule] a.sub { padding-left: 32px; }
  .toc[data-variant=rule] a:is([aria-current=true], [aria-current=page], [aria-current=location]) { background: none; }
  .toc[data-variant=rule] a:is([aria-current=true], [aria-current=page], [aria-current=location])::after { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; z-index: 1; width: 2px; border-radius: 1px; background: var(--ink); }
  .toc[data-variant=rule]::after { background: color-mix(in oklab, var(--ink) 30%, transparent); transform-origin: 50% 0; scale: 1 0; }
  @supports (animation-timeline: scroll()) { .toc[data-variant=rule]::after { animation: m-toc-read linear both; animation-timeline: scroll(root); } }
  @keyframes m-toc-read { to { scale: 1 1; } }
  /* small: a tight list for a narrow side */
  .toc[data-size=sm] a { padding: 6px 12px; border-radius: 15px; font-size: 13.5px; }
  .toc[data-size=sm] a.sub { padding-left: 24px; font-size: 13px; }
  .toc[data-size=sm] :is(.group, h2) { margin: 10px 0 4px 12px; font-size: 12.5px; }
  .toc[data-size=sm] :is(.group, h2):first-child { margin-top: 0; }
}

/* ── data/list */
@layer m.components {
  /* ── List: rows grouped into one rounded container (M3 Expressive), or plain rows on hairlines ── */
  .list { display: grid; gap: 2px; list-style: none; }
  .list > * { --r: 8px; }
  .list > :first-child { --r: 24px 24px 8px 8px; } .list > :last-child { --r: 8px 8px 24px 24px; } .list > :only-child { --r: 24px; }
  .item { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 16px 10px 14px; border-radius: var(--r, 20px); background: var(--tile); color: var(--ink); text-decoration: none; --here: var(--tile); --tone: var(--g); transition: background-color var(--dur-short) var(--ease); }
  :is(a, button, label).item { cursor: pointer; border: 0; width: 100%; text-align: left; font: inherit; }
  /* rows stand close: the ring is drawn inside the row, in its own words' colour (so it shows on the chosen row too) */
  :is(a, button).item:focus-visible, label.item:has(:focus-visible) { outline: 3px solid currentColor; outline-offset: -3px; }
  .list[data-wrap] .item .txt b { white-space: normal; overflow: visible; text-overflow: clip; text-wrap: pretty; }   /* long names whole */
  @media (hover: hover) { :is(a, button, label).item:hover { background: color-mix(in oklab, var(--tile), var(--ink) 4%); } }
  .item[aria-current=true], .item[aria-selected=true] { background: var(--ink); color: var(--tile); --ink2: color-mix(in oklab, var(--tile) 72%, transparent); }
  .item .lead-i { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 20px; background: var(--tone); }
  .item .lead-i .ms { font-size: 22px; }
  .item:is([aria-current=true], [aria-selected=true]) .lead-i { background: color-mix(in oklab, var(--tile) 16%, transparent); }
  .item .thumb { flex: none; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: var(--g2); }
  .item .txt { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
  .item .txt b { font: 500 var(--ctl-fs)/1.3 var(--ff); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .item .txt span { font: 400 var(--t-note)/1.35 var(--ff); color: var(--ink2); }
  .item .end { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; color: var(--ink2); font: 450 var(--t-note)/1 var(--ff); font-variant-numeric: tabular-nums; }
  .item > .ms:last-child { color: var(--ink2); }
  .rows { display: grid; list-style: none; }
  .rows > * { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .rows > :last-child { border-bottom: 0; }
  /* small: the same group, denser (48 px rows), for a panel or a menu-like list */
  .list[data-size=sm] > * { --r: 6px; }
  .list[data-size=sm] > :first-child { --r: 18px 18px 6px 6px; } .list[data-size=sm] > :last-child { --r: 6px 6px 18px 18px; } .list[data-size=sm] > :only-child { --r: 18px; }
  .list[data-size=sm] .item { min-height: 48px; gap: 12px; padding: 6px 12px 6px 10px; }
  .list[data-size=sm] .item .lead-i { width: 32px; height: 32px; }
  .list[data-size=sm] .item .lead-i .ms { font-size: 18px; }
  .list[data-size=sm] .item .thumb { width: 36px; height: 36px; border-radius: 10px; }
  .list[data-size=sm] .item > .avatar { --s: 32px; }
  .list[data-size=sm] .item .txt b { font-size: var(--ctl-fs-sm); }
  /* lines: no group; the rows stand on the panel with a hairline under each, and take a rounded wash when pointed at */
  .list[data-variant=lines] { gap: 0; }
  .list[data-variant=lines] > * { --r: 14px; border-bottom: 1px solid var(--line); }
  .list[data-variant=lines] > :last-child { border-bottom: 0; }
  .list[data-variant=lines] .item { background: none; padding-inline: 8px; }
  .list[data-variant=lines] .item:is([aria-current=true], [aria-selected=true]) { background: var(--ink); }
  /* select: each row picks itself with the checkbox at its start; a picked row takes a step of the ink, its box the ink */
  .list[data-variant=select] .item:has(> input:checked) { background: color-mix(in oklab, var(--tile), var(--ink) 9%); }
  @media (hover: hover) {
    .list[data-variant=lines] :is(a, button, label).item:hover { background: color-mix(in oklab, var(--ink) 5%, transparent); }
    .list[data-variant=select] .item:has(> input:checked):hover { background: color-mix(in oklab, var(--tile), var(--ink) 12%); }
  }
}

/* ── data/facts */
@layer m.components {
  /* ── Facts: what something is, line by line ── */
  .facts { display: grid; margin: 0; }
  .facts > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 2px 24px; padding: 14px 0; border-bottom: 1px solid color-mix(in oklab, var(--ink) 10%, transparent); font: 400 var(--t-body)/1.45 var(--ff); }
  .facts > div:first-child { padding-top: 0; } .facts > div:last-child { border-bottom: 0; }
  .facts dt { color: var(--ink2); } .facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .facts.sm > div, .facts[data-size=sm] > div { grid-template-columns: 7.4em minmax(0, 1fr); gap: 10px; padding: 8px 0; font-size: 13.5px; }
  @media (max-width: 560px) { .facts:not(.sm, [data-size=sm]) > div { grid-template-columns: minmax(0, 1fr); } }
  /* across: the pairs side by side, each name over its value, a hairline down its left; for a page's few facts */
  .facts[data-variant=across] { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 10em)), 1fr)); gap: 22px clamp(16px, 1.6vw, 32px); }
  .facts[data-variant=across] > div { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; padding: 2px 0 2px 16px; border: 0; box-shadow: inset 1.5px 0 var(--line); }
  .facts[data-variant=across] dt { font: 450 var(--t-note)/1.3 var(--ff); }
  .facts[data-variant=across] dd { font: 500 clamp(18px, .6vw + 13px, 28px)/1.2 var(--ff); letter-spacing: -.01em; }
  /* ledger: the values to the right in tabular figures, and a total under a firmer rule (an order, a receipt) */
  .facts[data-variant=ledger] > div { grid-template-columns: minmax(0, 1fr) auto; }
  .facts[data-variant=ledger] dd { text-align: right; }
  .facts[data-variant=ledger] > div:has(+ .facts-total) { border-bottom: 0; }
  .facts[data-variant=ledger] > .facts-total { padding-top: 14px; border-top: 1.5px solid var(--ink); }
  .facts[data-variant=ledger] > .facts-total :is(dt, dd) { color: var(--ink); font-weight: 600; }
}

/* ── feedback/toast */
@layer m.components {
  /* ── Toast: an ink pill at the window's foot, on a spring; one at a time (m.toast) ── */
  .toasts { position: fixed; inset: auto auto calc(24px + env(safe-area-inset-bottom)) 50%; z-index: 250; display: grid; justify-items: center; gap: 8px; translate: -50% 0; width: max-content; max-width: calc(100vw - 24px); height: auto; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; pointer-events: none; }
  .toasts:empty { display: none; }
  .toast { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; max-width: 100%; padding: 6px 20px 6px 16px; border-radius: 24px; background: var(--ink0); color: var(--paper); font: 500 14.5px/1.3 var(--ff); pointer-events: auto; animation: m-toast-in var(--dur-long) var(--spring) both; }
  .toast.out { animation: m-toast-out var(--dur-short) var(--ease-in) both; }
  .toast .ms { font-size: 20px; }
  .toast .btn { --bg: transparent; --fg: var(--paper); --h: 36px; margin: 0 -10px 0 4px; padding-inline: 12px; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
  .toast[data-tone=bad] .ms { color: light-dark(#FF8A80, #B3261E); }

  /* ── detail (m.toast(text, { detail })): the news, and a line under it of where or how many ── */
  .toast[data-variant~=detail] { min-height: 56px; padding-block: 8px; border-radius: 28px; }
  .toast-text { display: grid; gap: 1px; min-width: 0; }
  .toast-text b { font-weight: 600; }
  .toast-text small { font: 400 13px/1.3 var(--ff); color: color-mix(in oklab, var(--paper) 74%, transparent); }

  /* ── progress ({ progress: true }): the time it stays, as a bar emptying along its foot; for an undo that goes
        when the toast does ── */
  .toast[data-variant~=progress] { position: relative; padding-bottom: 12px; }
  .toast-time { position: absolute; inset: auto 22px 6px; height: 3px; border-radius: 2px; background: color-mix(in oklab, var(--paper) 50%, transparent); transform-origin: 0 50%; animation: m-toast-time var(--t, 3.6s) linear both; }

  /* ── stack ({ stack: true }): a few that came close together, the newest in front and the others behind it, set back
        a step each; three at most ── */
  .toasts[data-variant=stack] { grid-template-areas: "t"; }
  .toasts[data-variant=stack] > .toast { position: relative; z-index: 3; grid-area: t; transition: transform var(--dur-mid) var(--spring), background-color var(--dur-mid) var(--ease); }
  .toasts[data-variant=stack] > .toast:nth-last-child(2) { z-index: 2; transform: translateY(-12px) scale(.94); background: color-mix(in oklab, var(--ink0), var(--paper) 24%); }
  .toasts[data-variant=stack] > .toast:nth-last-child(3) { z-index: 1; transform: translateY(-24px) scale(.88); background: color-mix(in oklab, var(--ink0), var(--paper) 44%); }
}
@keyframes m-toast-time { to { transform: scaleX(0); } }

/* ── overlays/tooltip */
@layer m.components {
  /* ── Tooltip: hints live here, never inline; dark, after a beat, never past the window's edge (m.js) ── */
  .tip { position: fixed; inset: auto; z-index: 400; max-width: min(300px, calc(100vw - 24px)); width: max-content; margin: 0; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--tip); color: var(--on-tip);
    font: 500 13px/1.35 var(--ff); letter-spacing: 0; text-align: left; white-space: normal; pointer-events: none; overflow: visible; animation: m-tip-in var(--dur-quick) var(--ease) both; }
  /* a hint fades in after its beat and fades as it goes (by transition both ways, so the way out isn't cut short) */
  .tip[popover]:popover-open { animation: none; transition: opacity var(--dur-quick) var(--ease), translate var(--dur-quick) var(--ease), display var(--dur-quick) allow-discrete, overlay var(--dur-quick) allow-discrete; }
  @starting-style { .tip[popover]:popover-open { opacity: 0; translate: 0 -4px; } }
  .tip[popover]:not(:popover-open) { opacity: 0; transition: opacity var(--dur-quick) var(--ease-in), display var(--dur-quick) allow-discrete, overlay var(--dur-quick) allow-discrete; }
  .tip kbd { margin-left: 6px; padding: 2px 6px; background: color-mix(in oklab, var(--on-tip) 16%, transparent); color: inherit; font-size: 11.5px; }
  /* ── rich (data-tip-title on the control): a tool people learn as they go; its name and key, then a line on what it
        does. Still a hint: nothing in it to press ── */
  .tip[data-variant=rich] { max-width: min(280px, calc(100vw - 24px)); padding: 10px 14px 12px; border-radius: 16px; font-weight: 400; line-height: 1.4; }
  .tip-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 3px; font: 600 13.5px/1.3 var(--ff); }
  .tip-title kbd { margin-left: 0; }
  .tip[data-variant=rich] > span { display: block; color: color-mix(in oklab, var(--on-tip) 80%, transparent); }
}

/* ── media/code */
@layer m.components {
  /* ── Keys and code: data is the sans in tabular figures; only code is monospaced ── */
  kbd { display: inline-block; min-width: 24px; padding: 4px 7px; border-radius: 8px; background: var(--tone); color: var(--ink); font: 500 12.5px/1.2 var(--ff); text-align: center; white-space: nowrap; vertical-align: middle; }
  .codeblock { position: relative; min-width: 0; border-radius: 20px; background: var(--tone); color: var(--ink); }
  .codeblock pre, pre.code { margin: 0; padding: 18px 20px; overflow-x: auto; font: 400 13.5px/1.65 var(--ff-mono); tab-size: 2; white-space: pre; }
  .codeblock > .copy { position: absolute; top: 8px; right: 8px; }
  .codeblock:has(> .copy) > pre { padding-right: 56px; }   /* lines end before the copy button, not under it */
  .codeblock .k { color: var(--ink); } .codeblock .a { color: var(--ink2); } .codeblock .s { color: light-dark(#7A5520, #E5C48F); } .codeblock .c { color: var(--ink2); } .codeblock .p { color: var(--ink2); }
  .term { min-width: 0; border-radius: var(--rc); background: var(--night); color: #E6E4DD; overflow: hidden; }
  .term-bar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px 0 22px; border-bottom: 1px solid rgba(255, 255, 255, .1); font: 450 13.5px/1 var(--ff); color: rgba(255, 255, 255, .62); }
  .term-bar .ms { font-size: 18px; }
  .term-bar .ib { --fg: rgba(255, 255, 255, .8); margin-left: auto; }
  .term pre { margin: 0; padding: 18px 22px 22px; overflow-x: auto; font: 400 13.5px/1.75 var(--ff-mono); }
  .term .c { color: rgba(255, 255, 255, .5); } .term .s { color: #E5C48F; } .term .k { color: #fff; } .term .p { color: rgba(255, 255, 255, .5); }
  /* the file's name over its code, its copy button at the head's end */
  .code-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 2px 6px 2px 18px; border-bottom: 1px solid var(--line); color: var(--ink2); font: 450 13px/1.3 var(--ff-mono); }
  .code-head > .ms { font-size: 18px; }
  .code-head > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
  .code-head > .ib { margin-left: auto; }
  /* lines and diff: each line its own block (a span, or an ins or del), so it can carry a number, a sign, a wash;
     the column is as wide as the longest line, so a wash runs the whole width as the code scrolls */
  .codeblock:is([data-variant=lines], [data-variant=diff]) pre { display: grid; grid-template-columns: minmax(max-content, 1fr); padding-inline: 0; white-space: normal; }
  .codeblock:is([data-variant=lines], [data-variant=diff]) pre > :is(span, ins, del) { min-height: 1lh; padding-inline: 0 20px; white-space: pre; text-decoration: none; }
  .codeblock[data-variant=lines] pre { counter-reset: code-ln; }
  .codeblock[data-variant=lines] pre > span { counter-increment: code-ln; }
  .codeblock[data-variant=lines] pre > span::before { content: counter(code-ln); content: counter(code-ln) / ''; display: inline-block; width: 3.4em; padding-right: 1.2em; text-align: right; color: var(--ink2); opacity: .72; -webkit-user-select: none; user-select: none; }
  .codeblock[data-variant=diff] pre > :is(span, ins, del)::before { content: ''; display: inline-block; width: 2.6em; text-align: center; -webkit-user-select: none; user-select: none; }
  .codeblock[data-variant=diff] pre > ins { background: color-mix(in oklab, var(--ok) 15%, transparent); }
  /* on a changed line's wash the quiet words are a step darker, so they keep their contrast (AA) in Day */
  .codeblock[data-variant=diff] pre > :is(ins, del) :is(.a, .c, .p) { color: color-mix(in oklab, var(--ink2), var(--ink) 45%); }
  .codeblock[data-variant=diff] pre > del { background: color-mix(in oklab, var(--danger) 13%, transparent); }
  .codeblock[data-variant=diff] pre > ins::before { content: '+'; content: '+' / ''; color: var(--ok); }
  .codeblock[data-variant=diff] pre > del::before { content: '−'; content: '−' / ''; color: var(--danger); }
  .codeblock pre:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: inherit; }
}

/* ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */
@layer m.utilities {
  .w-full { width: 100%; } .h-full { height: 100%; }
  .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .balance { text-wrap: balance; } .pretty { text-wrap: pretty; }
  .tnum { font-variant-numeric: tabular-nums; } .t-right { text-align: right; } .t-center { text-align: center; }
  .mt-auto { margin-top: auto; } .ml-auto { margin-left: auto; }
  .mt-s { margin-top: 10px; } .mt-m { margin-top: clamp(16px, 1.6vw, 28px); } .mt-l { margin-top: clamp(28px, 3vw, 56px); } .mt-xl { margin-top: clamp(40px, 5vw, 96px); }
  .gap-s { --gap: 8px; } .gap-m { --gap: 16px; } .gap-l { --gap: clamp(24px, 2.4vw, 44px); }
  @media (max-width: 900px) { .hide-narrow { display: none !important; } }
  @media (min-width: 901px) { .hide-wide { display: none !important; } }
  @media (max-width: 640px) { .hide-phone { display: none !important; } }
}

/* ── motion: Material 3 Expressive, as keyframes ── */
@keyframes m-spin { to { rotate: 1turn; } }
@keyframes m-ping { from { scale: .5; opacity: 1; } to { scale: 1.7; opacity: 0; } }
@keyframes m-breathe { to { opacity: .25; scale: .7; } }
@keyframes m-fade { from { opacity: 0; } }
@keyframes m-show { to { visibility: visible; } }
@keyframes m-fade-up { from { opacity: 0; translate: 0 10px; } }
@keyframes m-menu-in { from { opacity: 0; scale: .82; } 35% { opacity: 1; } }
@keyframes m-tip-in { from { opacity: 0; translate: 0 -4px; } }
@keyframes m-island-in { from { opacity: 0; scale: .9; } }
@keyframes m-rise { from { opacity: 0; translate: 0 .38em; } 22% { opacity: 1; } }
@keyframes m-slide { from { translate: -110% 0; } to { translate: 310% 0; } }
@keyframes m-toast-in { from { opacity: 0; translate: 0 24px; scale: .96; } }
@keyframes m-toast-out { to { opacity: 0; translate: 0 12px; scale: .97; } }
@keyframes m-sheet-in { from { opacity: 0; translate: 0 16px; scale: .96; } }
@keyframes m-sheet-out { to { opacity: 0; translate: 0 10px; scale: .98; } }
@keyframes m-sheet-r { from { translate: calc(100% + 2 * var(--gut)) 0; } }
@keyframes m-sheet-l { from { translate: calc(-100% - 2 * var(--gut)) 0; } }
@keyframes m-sheet-b { from { translate: 0 100%; } }
@keyframes m-wavy-dash { from { stroke-dasharray: 18 100; stroke-dashoffset: 0; } to { stroke-dasharray: 62 100; stroke-dashoffset: -38; } }

/* page turns: the header stays, its ink pill glides to the new page, the page settles (cross-document view transitions) */
@view-transition { navigation: auto; }
body > .hdr { view-transition-name: m-hdr; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease); }
::view-transition-group(m-pill) { animation-duration: .6s; animation-timing-function: var(--spring); }
::view-transition-old(root) { animation: var(--dur-short) var(--ease) both m-vt-out; }
::view-transition-new(root) { animation: var(--dur-mid) var(--ease) both m-vt-in; }
@keyframes m-vt-out { to { opacity: 0; } }
@keyframes m-vt-in { from { opacity: 0; translate: 0 10px; } }
/* the theme switch: the new theme opens as a circle from the button that chose it (m.js sets --vx and --vy) */
html[data-theme-flip]::view-transition-old(root) { animation: none; }
html[data-theme-flip]::view-transition-new(root) { animation: var(--dur-long) var(--ease) both m-theme-in; }
html[data-theme-flip]::view-transition-group(*) { animation: none; }
@keyframes m-theme-in { from { clip-path: circle(0 at var(--vx, 100%) var(--vy, 0)); } to { clip-path: circle(150vmax at var(--vx, 100%) var(--vy, 0)); } }

/* the calm version: every story still told, nothing moving that needn't (a spinner still turns, slowly) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner, .btn[aria-busy=true]::after, .chain > li[data-state=running]::before, m-loader[kind=wavy] svg, .dot.live::after { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
  .arrive .w { opacity: 1 !important; }
  @view-transition { navigation: none; }
}
