/* === UTILITIES — Not Average ====================================== */
/* Minimal, token-driven utility layer. Load AFTER design-tokens.css. */
/* No hardcoded colors/spacings — everything via var(--*).            */

/* --- LAYOUT: CONTAINERS ------------------------------------------- */
.container,
.container-wide,
.container-narrow {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--container-px);
  position: relative;
}
.container        { max-width: var(--container-max); }
.container-wide   { max-width: var(--container-max-wide); }
.container-narrow { max-width: var(--container-max-narrow); }

/* --- DISPLAY ------------------------------------------------------ */
.block        { display: block; }
.inline-block { display: inline-block; }
.inline       { display: inline; }
.hidden       { display: none; }

.flex     { display: flex; }
.grid     { display: grid; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-center  { justify-content: center; }
.justify-start   { justify-content: flex-start; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }

/* --- GRID COLUMNS ------------------------------------------------- */
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --- GAP SCALE ---------------------------------------------------- */
.gap-0  { gap: var(--space-0); }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-5  { gap: var(--space-5); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-20 { gap: var(--space-20); }

/* --- MARGIN TOP --------------------------------------------------- */
.mt-0  { margin-top: var(--space-0); }
.mt-1  { margin-top: var(--space-1); }
.mt-2  { margin-top: var(--space-2); }
.mt-3  { margin-top: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }
.mt-20 { margin-top: var(--space-20); }

/* --- MARGIN BOTTOM ------------------------------------------------ */
.mb-0  { margin-bottom: var(--space-0); }
.mb-1  { margin-bottom: var(--space-1); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-3  { margin-bottom: var(--space-3); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }
.mb-20 { margin-bottom: var(--space-20); }

/* --- VERTICAL MARGIN --------------------------------------------- */
.my-0  { margin-block: var(--space-0); }
.my-2  { margin-block: var(--space-2); }
.my-4  { margin-block: var(--space-4); }
.my-6  { margin-block: var(--space-6); }
.my-8  { margin-block: var(--space-8); }
.my-12 { margin-block: var(--space-12); }
.my-16 { margin-block: var(--space-16); }
.my-20 { margin-block: var(--space-20); }

/* --- PADDING ------------------------------------------------------ */
.py-0  { padding-block: var(--space-0); }
.py-2  { padding-block: var(--space-2); }
.py-4  { padding-block: var(--space-4); }
.py-6  { padding-block: var(--space-6); }
.py-8  { padding-block: var(--space-8); }
.py-12 { padding-block: var(--space-12); }
.py-16 { padding-block: var(--space-16); }
.py-20 { padding-block: var(--space-20); }

.px-0  { padding-inline: var(--space-0); }
.px-2  { padding-inline: var(--space-2); }
.px-4  { padding-inline: var(--space-4); }
.px-6  { padding-inline: var(--space-6); }
.px-8  { padding-inline: var(--space-8); }

.pt-section { padding-top: var(--section-y); }
.pb-section { padding-bottom: var(--section-y); }
.py-section { padding-block: var(--section-y); }
.pt-section-lg { padding-top: var(--section-y-lg); }
.pb-section-lg { padding-bottom: var(--section-y-lg); }

/* --- TEXT ALIGNMENT ---------------------------------------------- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* --- TEXT SIZES (tokens) ----------------------------------------- */
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }
.text-4xl  { font-size: var(--text-4xl); }
.text-5xl  { font-size: var(--text-5xl); }
.text-6xl  { font-size: var(--text-6xl); }
.text-7xl  { font-size: var(--text-7xl); }
.text-8xl  { font-size: var(--text-8xl); }

/* --- TEXT COLORS (opt-in; do NOT shadow global defaults) --------- */
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-text-muted); }
.text-subtle  { color: var(--color-text-subtle); }
.text-white   { color: var(--color-text); }
.text-inverse { color: var(--color-text-inverse); }

/* --- FONT WEIGHT ------------------------------------------------- */
.font-regular  { font-weight: var(--weight-regular); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }
.font-black    { font-weight: var(--weight-black); }

/* --- FONT FAMILY ------------------------------------------------- */
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); letter-spacing: var(--tracking-wider); }

/* --- LINE HEIGHT ------------------------------------------------- */
.leading-tight   { line-height: var(--leading-tight); }
.leading-snug    { line-height: var(--leading-snug); }
.leading-normal  { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* --- MAX-WIDTH --------------------------------------------------- */
.max-w-sm   { max-width: 400px; }
.max-w-md   { max-width: 640px; }
.max-w-lg   { max-width: var(--container-max-narrow); }
.max-w-xl   { max-width: 1024px; }
.max-w-full { max-width: 100%; }

/* --- BORDERS ----------------------------------------------------- */
.border-t          { border-top: 1px solid var(--color-border); }
.border-b          { border-bottom: 1px solid var(--color-border); }
.border-accent     { border-color: var(--color-border-accent); }
.border-l-accent   { border-left: 2px solid var(--color-accent); padding-left: var(--space-6); }

/* --- POSITION ---------------------------------------------------- */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }

/* --- SCREEN READER ONLY ----------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- ACCENT BAR (small 2px green animated underline) ------------- */
.accent-bar {
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--duration-base) var(--ease-out);
}
.accent-bar:hover,
a:hover > .accent-bar,
button:hover > .accent-bar {
  width: 48px;
}

@media (prefers-reduced-motion: reduce) {
  .accent-bar { transition: none; }
}

/* ==================================================================
   RESPONSIVE: tablet (<=900px) collapses 3/4-col grids to 2.
   ================================================================== */
@media (max-width: 900px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==================================================================
   RESPONSIVE: mobile (<=600px) collapses all multi-col grids to 1.
   ================================================================== */
@media (max-width: 600px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}
