/* ════════════════════════════════════════════════════════════
   TRMNL 303 — Utilities
   Spacing, text, layout utility classes.
   ════════════════════════════════════════════════════════════ */

/* ── Spacing: margin-bottom ── */
.mb-xs  { margin-bottom: var(--space-xs); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* Legacy spacing aliases */
.mb-section    { margin-bottom: 1.5rem; }
.mb-content    { margin-bottom: 2rem; }
.mb-subsection { margin-bottom: 1.75rem; }
.mb-half       { margin-bottom: 0.5rem; }
.mb-quarter    { margin-bottom: 0.25rem; }

/* ── Spacing: margin-top ── */
.mt-xs  { margin-top: var(--space-xs); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

/* Legacy spacing aliases */
.mt-section    { margin-top: 1.5rem; }
.mt-content    { margin-top: 1.25rem; }
.mt-content-lg { margin-top: 2rem; }

/* ── Spacing: padding ── */
.p-xs  { padding: var(--space-xs); }
.p-sm  { padding: var(--space-sm); }
.p-md  { padding: var(--space-md); }
.p-lg  { padding: var(--space-lg); }
.p-xl  { padding: var(--space-xl); }

/* ── Flexbox ── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.flex-end-col  { display: flex; flex-direction: column; align-items: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.justify-center { justify-content: center; }

/* ── Gap ── */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ── Grid ── */
.grid          { display: grid; }
.grid-2        { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3        { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4        { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-auto     { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-md); }

/* Legacy grid aliases */
.grid-factors  { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.domain-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.metrics-grid  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 2rem; }

/* ── Text ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.text-mono   { font-family: var(--font-mono); }
.text-sans   { font-family: var(--font-sans); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-bullish   { color: var(--bullish); }
.text-bearish   { color: var(--bearish); }
.text-warning   { color: var(--warning); }

.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.uppercase     { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }

/* Legacy text */
.muted-text    { color: var(--text-muted); font-size: var(--text-xs); letter-spacing: 0.05em; }
.muted-text-sm { color: var(--text-muted); font-size: var(--text-sm); }
.muted-text-md { color: var(--text-secondary); font-size: var(--text-sm); }

/* ── Misc ── */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }
