:root {
  --ui-font-weight-light: 300;
  --ui-font-weight-regular: 400;
  --ui-font-weight-control: 500;
  --ui-font-weight-emphasis: 600;
}

/*
 * Cap legacy component weights through one final typography layer. Text-entry
 * controls are intentionally excluded so their established input weight stays
 * unchanged while surrounding labels, controls, and presentation text slim down.
 */
:root body #app.app-shell :where(*:not(input):not(textarea):not([contenteditable="true"]):not([contenteditable="true"] *)) {
  font-weight: var(--ui-font-weight-regular) !important;
}

:root body #app.app-shell :where(
  button,
  a[href],
  select,
  option,
  label,
  legend,
  summary,
  th,
  dt,
  [role="button"],
  [role="tab"],
  [role="menuitem"],
  [role="option"]
),
:root body #app.app-shell :where(
  button,
  a[href],
  select,
  option,
  label,
  legend,
  summary,
  th,
  dt,
  [role="button"],
  [role="tab"],
  [role="menuitem"],
  [role="option"]
) :where(*:not(input):not(textarea):not([contenteditable="true"]):not([contenteditable="true"] *)) {
  font-weight: var(--ui-font-weight-control) !important;
}

:root body #app.app-shell :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  strong,
  b,
  [role="heading"]
),
:root body #app.app-shell :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  strong,
  b,
  [role="heading"]
) :where(*:not(input):not(textarea):not([contenteditable="true"]):not([contenteditable="true"] *)) {
  font-weight: var(--ui-font-weight-emphasis) !important;
}

:root body #app.app-shell :where(
  .login-title-subline,
  .paper-home-name
) {
  font-weight: var(--ui-font-weight-light) !important;
}
