/* ONE shared optical-centring rule set for every button-like control (owner, repeatedly: "upper-centred text in a ton of buttons").
 *
 * Why labels sat high (measured per family in docs/reports/button-centring.md, not guessed):
 *  1. Blink splits line-height leading with floor(): a fractional line-height (13.2 px on an 11 px label whose content area is
 *     14 px) moves the baseline up by up to 1 px, and every legacy pill used 1.2 / 1.45 / 1.5. Fix: line-height = the font's own
 *     rounded ascent + descent (so no leading at all, the baseline lands on the box's real centre, and a fallback glyph font
 *     in the label cannot stretch the line either).
 *  2. Inter's cap-box centre sits 0.0 - 0.4 px off its (rounded) ascent/descent centre, with a sign that changes with the font
 *     size. Fix: an asymmetric padding-block of exactly 2e = cap - (ascent - descent) moves the label by e, so the baseline
 *     lands on the real-valued cap-centre and only the final whole-pixel snap (|err| <= 0.5) is left.
 * Nothing here needs CSS text-box (Safari < 18.2, Chrome < 133, Firefox ignore it): only round() (Chrome 125, Safari 15.4,
 * Firefox 118); older engines keep the plain declarations below it (line-height 1.21, 3 px padding).
 *
 * Inter metrics (hhea, em): ascent .96875, descent .2412, cap height .7275. A label whose ink is not a cap box (glyph-only
 * controls: x, minus, arrows, planet glyphs) sets --ctl-ink to its own ink centre above the baseline (default cap / 2).
 */
html:not(#o){--ctl-pad-y:3px;--ctl-ink:.36375em}   /* base vertical padding; ink-box centre above the baseline (cap / 2 for text) */
@supports selector(:has(a)){
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],input[type=button],input[type=submit],
    .chip,.o-pill,.o-tab,.o-menu-item,.dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas)){
    line-height:1.21!important;
    padding-block:var(--ctl-pad-y)!important}
}
@supports (line-height:calc(round(.5em,1px))) and selector(:has(a)){
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],input[type=button],input[type=submit],
    .chip,.o-pill,.o-tab,.o-menu-item,.dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas)){
    --ctl-z:var(--osiris-chrome-zoom,1);
    --ctl-ad:calc(round(.96875em * var(--ctl-z), 1px) / var(--ctl-z) - round(.2412em * var(--ctl-z), 1px) / var(--ctl-z));
    line-height:normal!important;
    padding-block-start:calc(var(--ctl-pad-y) + max(0px, 2 * var(--ctl-ink) - var(--ctl-ad)))!important;
    padding-block-end:calc(var(--ctl-pad-y) + max(0px, var(--ctl-ad) - 2 * var(--ctl-ink)))!important}
}
/* --ctl-ad (gate 10.15): the normal line box is the font's ascent and descent each rounded to whole RENDERED pixels, so the
   cap-centre correction uses those rounded values too, rounded at the chrome zoom (UI Scale x Text Size, ui-scale.css):
   round(m * z, 1px) / z. With the unrounded .7275em the 12 / 14 px labels sat 0.6 / 0.9 px low at 100 % (button_centring),
   and the unzoomed round() before 046aa014 put them up to 1 px high at 115 %; this one stays within +-0.5 px at 90-130 %. */
/* line-height:normal (owner 2026-10-12, text still high): the round(.96875em,1px) line-height was computed in unzoomed px,
   so under Text Size / UI Scale zoom (and browser zoom) it no longer matched the font's own rounded line box and Blink floored
   the leftover leading upward (33/54 labels 0.5-1 px high at 115 %). normal = the font's own box at the rendered size. */
/* Children keep their own font's exact line box (no leading), and glyph children (.gl, .lg-g, .ctl-sym) a zero-height one: a
   bigger-font glyph or a smaller arrow must not stretch the line box and push the label off the control's centre. */
@supports (line-height:calc(round(.5em,1px))) and selector(:has(a)){
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],.chip,.o-pill,.o-tab,.o-menu-item,
    .dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas)) :is(span,i,b,em,strong,small,sup,sub,u),
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],.chip,.o-pill,.o-tab,.o-menu-item,
    .dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas))::after,
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],.chip,.o-pill,.o-tab,.o-menu-item,
    .dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas))::before{
    line-height:normal}
  html:not(#o):not(#o):not(#o):not(#o) :is(button,[role=button],[role=tab],[role=menuitem],[role=option],.chip,.o-pill,.o-tab,.o-menu-item,
    .dmo-pill,.rb-family,.rb-sub,.rb-variant,.cast-go,.icon-sb-item):not(:has(> svg,> img,> canvas)) :is(.gl,.lg-g,.ctl-sym){line-height:0}
}
/* Glyph-only controls centre by their own ink: --ctl-ink = ink-box centre in em above the baseline (measured on the default glyph
   fonts, docs/reports/button-centring.md; a user-chosen glyph font moves these by a fraction of a pixel). */
html:not(#o) .rail-fly-close{--ctl-ink:.281em}
html:not(#o) .da-close{--ctl-ink:.298em}
html:not(#o) .houses-org-remove{--ctl-ink:.271em}
html:not(#o) .dmo-pill.dmo-gpill{--ctl-ink:.322em}
html:not(#o) .scale-rst{--ctl-ink:.434em}
html:not(#o) .dmo-pill.dmo-quiet:is([title="Previous range"],[title="Next range"]){--ctl-ink:.343em}
html:not(#o) :is(.cr-prev,.cr-next){--ctl-ink:.296em}
html:not(#o) .wc-grip{--ctl-ink:.425em}
html:not(#o) .o-pill--icon{--ctl-ink:.349em}
html:not(#o) #zoom-reset{--ctl-ink:.29em}
html:not(#o) .o-pill.map-icon{--ctl-ink:.29em}
html:not(#o) .o-pill.map-icon[aria-label="Reset view"]{--ctl-ink:.44em}
html:not(#o) .swt-btn:is([aria-label="Zoom timeline out"],[aria-label="Zoom timeline in"]){--ctl-ink:.26em}
/* Timeline height buttons (block glyphs U+2581 / U+2582 / U+2585): the ink is a bar resting on the baseline, far below the cap centre. */
html:not(#o) .swt-btn[data-size=collapsed]{--ctl-ink:-.171em}
html:not(#o) .swt-btn[data-size=compact]{--ctl-ink:-.091em}
html:not(#o) .swt-btn[data-size=expanded]{--ctl-ink:.125em}
