/* ==========================================================================
   typography.css — font loading + base text + type scale utilities
   --------------------------------------------------------------------------
   Milestone 1 · Foundation scaffold

   Layer role: `base` (Phase 6 §5.2).
   Phase 1 §2 — the complete type scale is exposed as global utilities. No
   per-heading styling yet; that is component/page work for Milestone 2+.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Self-hosted fonts (Phase 6 §9 · Phase R8.75) — variable TTF files live in
   fonts/: Manrope-VariableFont_wght.ttf and Inter-VariableFont_opsz,wght.ttf
   (variable); IBM Plex Mono has only static faces, so Regular (400) and
   SemiBold (600) cover the weights the design uses. Not loaded from any
   third-party CDN, in line with the Phase 6 CSP (default-src 'self').
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-variable.ttf") format("truetype-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-variable.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Base body text — Phase 1 §2.1 Body style */
body {
  font-family: var(--font-body);
  font-size: var(--text-body-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  color: var(--color-body);
}

/* --------------------------------------------------------------------------
   Responsive size resolution — Phase 1 §2.1 defines desktop/tablet/mobile
   sizes. Laptop (1024–1279) reuses the desktop sizes; 1280 is reserved for
   layout density (Phase 1 §4.1). Each --text-*-current alias resolves at the
   nearest breakpoint; the scale utilities read only the alias.
   -------------------------------------------------------------------------- */
:root {
  --text-display-current:       var(--text-display-mobile);
  --text-h1-current:            var(--text-h1-mobile);
  --text-h2-current:            var(--text-h2-mobile);
  --text-h3-current:            var(--text-h3-mobile);
  --text-h4-current:            var(--text-h4-mobile);
  --text-h5-current:            var(--text-h5-mobile);
  --text-body-large-current:    var(--text-body-large-mobile);
  --text-body-current:          var(--text-body-mobile);
  --text-small-current:         var(--text-small-mobile);
  --text-caption-current:       var(--text-caption-mobile);
  --text-button-current:        var(--text-button-mobile);
  --text-label-current:         var(--text-label-mobile);
  --text-stat-current:          var(--text-stat-mobile);
}

@media (min-width: 768px) {
  :root {
    --text-display-current:       var(--text-display-tablet);
    --text-h1-current:            var(--text-h1-tablet);
    --text-h2-current:            var(--text-h2-tablet);
    --text-h3-current:            var(--text-h3-tablet);
    --text-h4-current:            var(--text-h4-tablet);
    --text-h5-current:            var(--text-h5-tablet);
    --text-body-large-current:    var(--text-body-large-tablet);
    --text-body-current:          var(--text-body-tablet);
    --text-small-current:         var(--text-small-tablet);
    --text-caption-current:       var(--text-caption-tablet);
    --text-button-current:        var(--text-button-tablet);
    --text-label-current:         var(--text-label-tablet);
    --text-stat-current:          var(--text-stat-tablet);
  }
}

@media (min-width: 1024px) {
  :root {
    --text-display-current:       var(--text-display);
    --text-h1-current:            var(--text-h1);
    --text-h2-current:            var(--text-h2);
    --text-h3-current:            var(--text-h3);
    --text-h4-current:            var(--text-h4);
    --text-h5-current:            var(--text-h5);
    --text-body-large-current:    var(--text-body-large);
    --text-body-current:          var(--text-body);
    --text-small-current:         var(--text-small);
    --text-caption-current:       var(--text-caption);
    --text-button-current:        var(--text-button);
    --text-label-current:         var(--text-label);
    --text-stat-current:          var(--text-stat);
  }
}

/* --------------------------------------------------------------------------
   Type scale utilities — Phase 1 §2.1. Global-only; components compose these
   rather than restyling heading elements directly.
   -------------------------------------------------------------------------- */
.u-display {
  font-family: var(--font-heading);
  font-size: var(--text-display-current);
  font-weight: var(--weight-bold);
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-display);
}

.u-h1 {
  font-family: var(--font-heading);
  font-size: var(--text-h1-current);
  font-weight: var(--weight-bold);
  line-height: var(--lh-h1);
  letter-spacing: var(--tracking-h1);
}

.u-h2 {
  font-family: var(--font-heading);
  font-size: var(--text-h2-current);
  font-weight: var(--weight-bold);
  line-height: var(--lh-h2);
  letter-spacing: var(--tracking-h2);
}

.u-h3 {
  font-family: var(--font-heading);
  font-size: var(--text-h3-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-h3);
  letter-spacing: var(--tracking-h3);
}

.u-h4 {
  font-family: var(--font-heading);
  font-size: var(--text-h4-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-h4);
  letter-spacing: var(--tracking-h4);
}

.u-h5 {
  font-family: var(--font-heading);
  font-size: var(--text-h5-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-h5);
  letter-spacing: var(--tracking-h5);
}

.u-body-large {
  font-family: var(--font-body);
  font-size: var(--text-body-large-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body-large);
  letter-spacing: var(--tracking-body-large);
}

.u-body {
  font-family: var(--font-body);
  font-size: var(--text-body-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-body);
}

.u-small {
  font-family: var(--font-body);
  font-size: var(--text-small-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-small);
  letter-spacing: var(--tracking-small);
}

.u-caption {
  font-family: var(--font-body);
  font-size: var(--text-caption-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-caption);
  letter-spacing: var(--tracking-caption);
}

.u-button {
  font-family: var(--font-heading);
  font-size: var(--text-button-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-button);
  letter-spacing: var(--tracking-button);
}

.u-label {
  font-family: var(--font-body);
  font-size: var(--text-label-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-label);
  letter-spacing: var(--tracking-label);
}

/* Numeric styles — Phase 1 §2.2 (IBM Plex Mono, tabular figures) */
.u-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.u-stat {
  font-size: var(--text-stat-current);
  font-weight: var(--weight-regular);
  line-height: var(--lh-h1);
}

.u-data {
  font-size: var(--text-data);
  font-weight: var(--weight-regular);
}

.u-micro {
  font-size: var(--text-micro);
  font-weight: var(--weight-regular);
}

/* Text measure — Phase 1 §2.3 */
.u-measure {
  max-width: var(--measure);
}
