/* ==========================================================================
   AJIT BAN — TYPOGRAPHY SYSTEM
   Reusable type classes. All sizes flow from tokens via clamp().

   PHASE 5 — the type is the design. Four voices with deliberate contrast:
     · DISPLAY  — Fraunces, variable expressive serif (the graphic voice)
     · HEADING  — Fraunces, smaller editorial headings
     · BODY     — Manrope, modern grotesk
     · METADATA — IBM Plex Mono, the "archive" technical voice
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------------
   DISPLAY — the oversized graphic voice
   --------------------------------------------------------------------- */
.display-xl,
.display-lg,
.display-md {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  font-optical-sizing: auto;
  text-wrap: balance;
}

.display-xl { font-size: var(--text-display-xl); }
.display-lg { font-size: var(--text-display-lg); }
.display-md { font-size: var(--text-display-md); }

/* ---------------------------------------------------------------------
   HEADINGS
   --------------------------------------------------------------------- */
.heading-xl,
.heading-lg,
.heading-md {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-heading);
  font-optical-sizing: auto;
}

.heading-xl { font-size: var(--text-heading-xl); }
.heading-lg { font-size: var(--text-heading-lg); }
.heading-md { font-size: var(--text-heading-md); }

.heading-sm {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

/* Editorial italic accent inside display + headings */
.display-xl em,
.display-lg em,
.display-md em,
.heading-xl em,
.heading-lg em,
.heading-md em {
  font-style: italic;
  font-weight: 380;
}

/* ---------------------------------------------------------------------
   BODY
   --------------------------------------------------------------------- */
.body-lg {
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.body {
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
}

.body-sm {
  font-size: var(--text-body-sm);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
}

.body-strong { color: var(--color-text); }

/* ---------------------------------------------------------------------
   METADATA — mono + labels (the "archive" voice)
   --------------------------------------------------------------------- */
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.metadata,
.technical-label {
  font-family: var(--font-mono);
  font-size: var(--text-metadata);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.technical-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.technical-label::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.caption {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
}

/* Large archive numerals — index numbers used as graphic architecture */
.archive-number {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--text-archive);
  line-height: 0.8;
  letter-spacing: -0.04em;
  font-feature-settings: "lnum";
  color: transparent;
  -webkit-text-stroke: 1px var(--color-line-strong);
}

/* ---------------------------------------------------------------------
   TYPOGRAPHIC UTILITIES
   --------------------------------------------------------------------- */
.text-accent { color: var(--color-accent); }
.text-muted  { color: var(--color-text-muted); }
.text-faint  { color: var(--color-text-faint); }
.text-steel  { color: var(--color-steel); }

.t-display { font-family: var(--font-display); font-weight: var(--display-weight); }
.t-italic  { font-style: italic; }
.t-sans    { font-family: var(--font-sans); }
.t-mono    { font-family: var(--font-mono); }

/* Outlined display type — the "ghost" graphic treatment */
.t-outline {
  color: transparent;
  -webkit-text-stroke: 1px var(--color-line-strong);
}

.t-outline--accent {
  color: transparent;
  -webkit-text-stroke: 1px var(--color-accent-line);
}

/* Oversized word/short line used as a graphic element */
.t-oversize {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--text-display-xl);
  line-height: 0.82;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
}

/* Flipped / vertical technical text */
.t-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: var(--tracking-label);
}

.numbered {
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-variant-numeric: lining-nums tabular-nums;
}

.measure-narrow { max-width: 38ch; }
.measure      { max-width: 62ch; }
.measure-wide { max-width: 78ch; }

.align-center { text-align: center; }

/* ---------------------------------------------------------------------
   TEXT MASKS — clip a line, translate the inner span (motion primitives)
   Paired with the centralised motion system: `.is-inview` resolves them.
   --------------------------------------------------------------------- */
.t-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em; /* protect descending glyphs from the clip */
}

.t-mask > span {
  display: block;
}

html.has-motion .t-mask > span {
  transform: translateY(110%);
  transition: transform var(--motion-slow) var(--ease-expressive);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform;
}

html.has-motion .t-mask.is-inview > span,
html.has-motion .is-inview .t-mask > span {
  transform: translateY(0);
}

/* ---------------------------------------------------------------------
   EDITORIAL STATEMENT — the typographic "quiet moment"
   --------------------------------------------------------------------- */
.statement {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(2.5rem, 6.4vw, 6rem);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  max-width: 22ch;
  margin: var(--space-6) 0;
}

.statement em {
  font-style: italic;
  color: var(--color-text);
  position: relative;
}

.statement em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.08em;
  height: 0.045em;
  background: var(--color-accent);
  opacity: 0.55;
}

/* Serif numerals for editorial figures */
.serif-num {
  font-family: var(--font-display);
  font-feature-settings: "lnum";
}

/* ---------------------------------------------------------------------
   REDUCED MOTION — masks resolve instantly
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .t-mask > span {
    transform: none;
    transition: none;
  }
}
