/* my-gui density and shape tokens (wishlist 78).
   The tokens hold the measured sizes of today, so they change nothing by themselves. The rules that read them
   only apply while <html> carries the attribute, so the default look stays exactly as measured (D538):
     data-m-density="compact | default | comfortable"   control heights, table rows, card padding
     data-m-shape="sharp | default | round"             every radius times --m-r-k (.45 / 1 / 1.6)
   An app may also set the tokens itself (e.g. --m-h: 30px) together with the attribute.
   App themes (js/themes.js, wishlist 79) write the same two attributes. */

:root {
  /* control heights: small, normal, large */
  --m-h-sm: 28px;
  --m-h: 32px;
  --m-h-lg: 40px;
  /* table rows and heads: normal, compact */
  --m-row: 44px;
  --m-row-compact: 34px;
  --m-th: 36px;
  --m-th-compact: 32px;
  /* card inner padding */
  --m-card-pad-y: 14px;
  --m-card-pad-x: 16px;
  /* radius factor */
  --m-r-k: 1;
}

:root[data-m-density="compact"] {
  --m-h-sm: 24px;
  --m-h: 28px;
  --m-h-lg: 34px;
  --m-row: 36px;
  --m-row-compact: 30px;
  --m-th: 32px;
  --m-th-compact: 28px;
  --m-card-pad-y: 10px;
  --m-card-pad-x: 12px;
}
:root[data-m-density="comfortable"] {
  --m-h-sm: 32px;
  --m-h: 38px;
  --m-h-lg: 46px;
  --m-row: 52px;
  --m-row-compact: 40px;
  --m-th: 40px;
  --m-th-compact: 36px;
  --m-card-pad-y: 18px;
  --m-card-pad-x: 20px;
}

:root[data-m-density] .m-btn { height: var(--m-h); }
:root[data-m-density] .m-btn--sm { height: var(--m-h-sm); }
:root[data-m-density] .m-btn--lg { height: var(--m-h-lg); }
:root[data-m-density] :is(.m-input, .m-select):not(textarea) { height: var(--m-h); }
:root[data-m-density] .m-seg > button { height: calc(var(--m-h) - 4px); }
:root[data-m-density] .m-seg--sm > button { height: calc(var(--m-h-sm) - 4px); }
:root[data-m-density] .m-table th { height: var(--m-th); }
:root[data-m-density] .m-table td { height: var(--m-row); }
:root[data-m-density] .m-table--compact th { height: var(--m-th-compact); }
:root[data-m-density] .m-table--compact td { height: var(--m-row-compact); }
:root[data-m-density] .m-card-head { padding: var(--m-card-pad-y) var(--m-card-pad-x) 0; }
:root[data-m-density] .m-card-body { padding: var(--m-card-pad-y) var(--m-card-pad-x) calc(var(--m-card-pad-y) + 2px); }

:root[data-m-shape="sharp"] { --m-r-k: .45; }
:root[data-m-shape="round"] { --m-r-k: 1.6; }
:root[data-m-shape] {
  --m-r-xs: calc(6px * var(--m-r-k));
  --m-r-sm: calc(8px * var(--m-r-k));
  --m-r: calc(10px * var(--m-r-k));
  --m-r-md: calc(13px * var(--m-r-k));
  --m-r-lg: calc(14px * var(--m-r-k));
  --m-r-xl: calc(20px * var(--m-r-k));
}
/* the measured radii that are numbers, not tokens, in the component files */
:root[data-m-shape] :is(.m-btn--sm, .m-seg > button, .m-mi, .m-plate) { border-radius: calc(9px * var(--m-r-k)); }
:root[data-m-shape] :is(.m-ico) { border-radius: calc(7px * var(--m-r-k)); }
:root[data-m-shape] :is(.m-seg, .m-alert) { border-radius: calc(12px * var(--m-r-k)); }
:root[data-m-shape] :is(.m-menu, .m-toast) { border-radius: calc(14px * var(--m-r-k)); }
:root[data-m-shape] .m-modal-box { border-radius: calc(20px * var(--m-r-k)); }
:root[data-m-shape] .m-seg-ind { border-radius: calc(9px * var(--m-r-k)); }
:root[data-m-shape] [data-tip]::after { border-radius: calc(8px * var(--m-r-k)); }
:root[data-m-shape][data-m-look="glass"] .m-modal-box { border-radius: calc(22px * var(--m-r-k)); }
:root[data-m-shape][data-m-look="glass"] :is(.m-topbar, .m-sidenav, .m-statusbar) { --m-look-r: calc(18px * var(--m-r-k)); }

/* the open list of a plain select (controls.css) */
:root[data-m-shape] .m-select:not([data-m-native])::picker(select) { border-radius: calc(14px * var(--m-r-k)); }
