/*
 * Mamore UI v2 — typography.
 *
 * Two families, one scale. The family is a token, so a missing webfont falls
 * back to the self-hosted Poppins already shipped and nothing else changes.
 *
 * The rule that matters most in this product: FIGURES ARE TABULAR. A finance
 * screen, an incident list and a KPI row are read by comparing digits in
 * columns, and proportional numerals make that comparison unreliable. Every
 * number in the interface uses --font-variant-numeric: tabular-nums.
 *
 * Loaded after base.css and before app.css, so the scale applies to markup that
 * has no explicit size while legacy class-qualified rules still win.
 */

:root {
  --font-variant-numeric: tabular-nums;
  --font-variant-numeric-proportional: proportional-nums;
}

/* ------------------------------------------------------------------ headings
 * Tight tracking on the display sizes only. Body text keeps the browser
 * default, because negative tracking is a display-type technique and applied to
 * 14px body copy it hurts legibility. */
.h-display-xl, .h-display-l, .h-h1, .h-h2 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.h-display-xl { font-size: var(--text-display-xl); line-height: var(--lh-display-xl); font-weight: var(--weight-display-xl); }
.h-display-l  { font-size: var(--text-display-l);  line-height: var(--lh-display-l);  font-weight: var(--weight-display-l); }
.h-h1         { font-size: var(--text-h1);         line-height: var(--lh-h1);         font-weight: var(--weight-h1); }
.h-h2         { font-size: var(--text-h2);         line-height: var(--lh-h2);         font-weight: var(--weight-h2); }
.h-h3         { font-size: var(--text-h3);         line-height: var(--lh-h3);         font-weight: var(--weight-h3); font-family: var(--font-display); color: var(--text-primary); }

/* --------------------------------------------------------------------- body */
.t-body-l  { font-size: var(--text-body-l);  line-height: var(--lh-body-l); }
.t-body    { font-size: var(--text-body);    line-height: var(--lh-body); }
.t-body-s  { font-size: var(--text-body-s);  line-height: var(--lh-body-s); }
.t-caption { font-size: var(--text-caption); line-height: var(--lh-caption); font-weight: var(--weight-caption); }
.t-micro   { font-size: var(--text-micro);   line-height: var(--lh-micro);   font-weight: var(--weight-micro); }

/*
 * The eyebrow: the small uppercase label that sits above a heading. It is a
 * typographic component rather than a colour, and it is the one place a small
 * amount of brand colour is allowed, because it is always paired with a
 * full-size heading that carries the actual meaning.
 */
.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  line-height: var(--lh-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ------------------------------------------------------------------- colour */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-danger    { color: var(--tone-danger); }
.text-warning   { color: var(--tone-warning); }
.text-success   { color: var(--tone-success); }
.text-info      { color: var(--tone-info); }

/* ----------------------------------------------------------------- numerics
 * Applied by default to every figure in the product. --font-variant-numeric is
 * a token so a theme could opt out, but both themes want tabular figures. */
.figure,
.num,
.metric-value,
td.num,
th.num,
.is-money {
  font-variant-numeric: var(--font-variant-numeric);
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Money reads as money: the currency code is always present (never a bare
 * symbol), and the digits are tabular so columns align.
 *
 * `nowrap` is what guarantees a figure and its currency never separate onto two
 * lines -- but it is a MINIMUM, not a maximum. A figure that cannot fit its
 * column must break inside the figure, and `nowrap` forbids exactly that, so it
 * pushed the whole page sideways at 1440px. Normal wrapping still refuses to
 * split at a space; `overflow-wrap: anywhere` is what supplies the break INSIDE
 * the otherwise-unbreakable run, and it only takes effect once the line has no
 * other option. Where the card is wide enough to hold the figure whole, nothing
 * changes and no break is taken. */
.is-money {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* A large KPI figure. Optical sizing: big numbers need slightly tighter
 * tracking or they look loose on a wide screen. */
.figure-xl {
  font-family: var(--font-display);
  font-size: var(--text-display-xl);
  line-height: var(--lh-display-xl);
  font-weight: var(--weight-display-xl);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.figure-l {
  font-family: var(--font-display);
  font-size: var(--text-display-l);
  line-height: var(--lh-display-l);
  font-weight: var(--weight-display-l);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- weight */
.w-regular { font-weight: 400; }
.w-medium  { font-weight: 500; }
.w-semibold{ font-weight: 600; }
.w-bold    { font-weight: 700; }
.w-extrabold { font-weight: 800; }

/* ---------------------------------------------------------------- alignment */
.text-start   { text-align: left; }
.text-end     { text-align: right; }
.text-center  { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
