/* adia:attribute-api/text — global presentational TEXT attributes.
   [text-align] [weight] [color] [transform] [truncate]. Moved verbatim out
   of typography.css (v0.6.48 foundation reorg, ADR-0035); imported by the
   typography.css barrel at its original cascade position. */

/* ═══════════════════════════════════════════════════════════
   GLOBAL PRESENTATIONAL ATTRIBUTES
   Work on any element. Attribute-driven, not class-based.

   PRECEDENCE (ADR-0038): these attributes are the `utilities` layer
   (currently unlayered, → a named `utilities` layer in migration step 6),
   which sits ABOVE the `components` layer in cascade order. So
   [weight="bold"] on a component like <text-ui> now OVERRIDES the
   component's own font-weight rule — utilities win over components by layer,
   on any element. Before the @layer migration (step 5) these LOST to
   component @scope by proximity; that limitation is retired. The full set of
   component×property honorings (39: 25 color · 10 weight · 3 text-align ·
   1 transform) is enumerated by scripts/qa/cascade-component-attr-sweep.mjs.
   ═══════════════════════════════════════════════════════════ */

/* Text alignment */
[text-align="left"] {
  text-align: left;
}
[text-align="center"] {
  text-align: center;
}
[text-align="right"] {
  text-align: right;
}

/* Font weight — six steps matching --a-weight-* tokens */
[weight="thin"] {
  --a-weight: var(--a-weight-thin);
  font-weight: var(--a-weight);
} /* 100 — hairline, display only */
[weight="light"] {
  --a-weight: var(--a-weight-light);
  font-weight: var(--a-weight);
} /* 300 — light UI emphasis */
[weight="normal"] {
  --a-weight: var(--a-weight-normal);
  font-weight: var(--a-weight);
} /* 400 */
[weight="medium"] {
  --a-weight: var(--a-weight-medium);
  font-weight: var(--a-weight);
} /* 500 */
[weight="semibold"] {
  --a-weight: var(--a-weight-semibold);
  font-weight: var(--a-weight);
} /* 600 */
[weight="bold"] {
  --a-weight: var(--a-weight-bold);
  font-weight: var(--a-weight);
} /* 700 */

/* Text color. button-ui is EXCLUDED: it re-purposes [color] as a semantic
   FILL (color="danger|info|success|warning" → colored background + contrasting
   label via its own --button-fg, since the variant="danger"→color="danger"
   migration). Without the exclusion this utility (utilities layer > components)
   overrides the button's label color to the fill hue → invisible text on the
   fill. button-ui is the only filled control that does this and is NOT among
   the color honorings (cascade-component-attr-sweep.mjs). `:where(button-ui)`
   keeps specificity at (0,1,0) so the real text honorings are unaffected. */
[color]:not(:where(button-ui)) {
  color: var(--a-fg);
}
[color="text"] {
  --a-fg: var(--a-canvas-text);
}
[color="text-strong"] {
  --a-fg: var(--a-fg-strong);
}
[color="subtle"] {
  --a-fg: var(--a-fg-subtle);
}
[color="muted"] {
  --a-fg: var(--a-fg-muted);
}
[color="accent"] {
  --a-fg: var(--a-accent);
}
[color="success"] {
  --a-fg: var(--a-success);
}
[color="warning"] {
  --a-fg: var(--a-warning);
}
[color="danger"] {
  --a-fg: var(--a-danger);
}
[color="info"] {
  --a-fg: var(--a-info);
}

/* Text transform */
[transform="uppercase"] {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
[transform="lowercase"] {
  text-transform: lowercase;
}
[transform="capitalize"] {
  text-transform: capitalize;
}
[transform="none"] {
  text-transform: none;
}

/* Truncation */
[truncate] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
