/* ============================================================
   UTILITY CLASSES — Single-purpose helpers
   ============================================================ */

/* ── Layout ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--section-padding-x);
}
.container-sm  { max-width: var(--container-sm);  margin-inline: auto; padding-inline: var(--section-padding-x); }
.container-md  { max-width: var(--container-md);  margin-inline: auto; padding-inline: var(--section-padding-x); }
.container-lg  { max-width: var(--container-lg);  margin-inline: auto; padding-inline: var(--section-padding-x); }
.container-2xl { max-width: var(--container-2xl); margin-inline: auto; padding-inline: var(--section-padding-x); }

/* ── Section Wrappers ────────────────────────────────────── */
.section        { padding-block: var(--section-padding-y); }
.section-sm     { padding-block: clamp(2rem, 3vw, 3rem); }
.section-lg     { padding-block: clamp(4rem, 8vw, 8rem); }
.section-bg     { background-color: var(--color-bg-subtle); }
.section-dark   { background-color: var(--color-neutral-900); color: var(--color-neutral-50); }
.section-brand  { background-color: var(--color-brand); color: var(--color-on-brand); }

/* ── Display ─────────────────────────────────────────────── */
.d-block        { display: block; }
.d-inline       { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex         { display: flex; }
.d-inline-flex  { display: inline-flex; }
.d-grid         { display: grid; }
.d-none         { display: none; }

/* ── Flex Utilities ──────────────────────────────────────── */
.flex-row        { flex-direction: row; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-nowrap     { flex-wrap: nowrap; }
.flex-1          { flex: 1 1 0%; }
.flex-auto       { flex: 1 1 auto; }
.flex-none       { flex: none; }
.flex-shrink-0   { flex-shrink: 0; }
.flex-grow-1     { flex-grow: 1; }

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

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

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

/* ── Gap ─────────────────────────────────────────────────── */
.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); }

/* ── Grid Utilities ──────────────────────────────────────── */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 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)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12{ grid-template-columns: repeat(12, minmax(0, 1fr)); }

.col-span-1  { grid-column: span 1; }
.col-span-2  { grid-column: span 2; }
.col-span-3  { grid-column: span 3; }
.col-span-4  { grid-column: span 4; }
.col-span-full { grid-column: 1 / -1; }

/* Auto-fit responsive grids */
.grid-auto-sm  { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid-auto-md  { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-auto-lg  { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

/* ── Spacing — Margin ────────────────────────────────────── */
.m-0   { margin: 0; }
.m-auto{ margin: auto; }
.mx-auto { margin-inline: auto; }
.mt-0  { margin-top: 0; }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

/* ── Spacing — Padding ───────────────────────────────────── */
.p-0  { padding: 0; }
.p-2  { padding: var(--space-2); }
.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }
.px-8 { padding-inline: var(--space-8); }
.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); }

/* ── Typography ──────────────────────────────────────────── */
.text-xs    { font-size: var(--font-size-xs); }
.text-sm    { font-size: var(--font-size-sm); }
.text-base  { font-size: var(--font-size-base); }
.text-md    { font-size: var(--font-size-md); }
.text-lg    { font-size: var(--font-size-lg); }
.text-xl    { font-size: var(--font-size-xl); }
.text-2xl   { font-size: var(--font-size-2xl); }
.text-3xl   { font-size: var(--font-size-3xl); }
.text-4xl   { font-size: var(--font-size-4xl); }
.text-5xl   { font-size: var(--font-size-5xl); }

.font-normal   { font-weight: var(--font-weight-normal); }
.font-medium   { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold     { font-weight: var(--font-weight-bold); }
.font-extrabold{ font-weight: var(--font-weight-extrabold); }

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

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

.tracking-tight   { letter-spacing: var(--letter-spacing-tight); }
.tracking-normal  { letter-spacing: var(--letter-spacing-normal); }
.tracking-wide    { letter-spacing: var(--letter-spacing-wide); }
.tracking-wider   { letter-spacing: var(--letter-spacing-wider); }
.tracking-widest  { letter-spacing: var(--letter-spacing-widest); }

.uppercase   { text-transform: uppercase; }
.lowercase   { text-transform: lowercase; }
.capitalize  { text-transform: capitalize; }
.normal-case { text-transform: none; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Color Utilities ─────────────────────────────────────── */
.text-primary   { color: var(--color-brand); }
.text-secondary { color: var(--color-accent); }
.text-muted     { color: var(--color-text-muted); }
.text-subtle    { color: var(--color-text-subtle); }
.text-inverse   { color: var(--color-text-inverse); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-error     { color: var(--color-error); }
.text-info      { color: var(--color-info); }

.bg-primary     { background-color: var(--color-brand); color: var(--color-on-brand); }
.bg-secondary   { background-color: var(--color-accent); color: var(--color-on-accent); }
.bg-subtle      { background-color: var(--color-bg-subtle); }
.bg-muted       { background-color: var(--color-bg-muted); }
.bg-surface     { background-color: var(--color-surface); }
.bg-dark        { background-color: var(--color-neutral-900); color: var(--color-neutral-50); }
.bg-success     { background-color: var(--color-success-bg); }
.bg-warning     { background-color: var(--color-warning-bg); }
.bg-error       { background-color: var(--color-error-bg); }
.bg-info        { background-color: var(--color-info-bg); }

/* ── Border Utilities ────────────────────────────────────── */
.border         { border: 1px solid var(--color-border); }
.border-strong  { border: 1px solid var(--color-border-strong); }
.border-brand   { border: 1px solid var(--color-brand-border); }
.border-t       { border-top: 1px solid var(--color-border); }
.border-b       { border-bottom: 1px solid var(--color-border); }
.border-none    { border: none; }

.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-2xl  { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ── Shadow Utilities ────────────────────────────────────── */
.shadow-xs  { box-shadow: var(--shadow-xs); }
.shadow-sm  { box-shadow: var(--shadow-sm); }
.shadow-md  { box-shadow: var(--shadow-md); }
.shadow-lg  { box-shadow: var(--shadow-lg); }
.shadow-xl  { box-shadow: var(--shadow-xl); }
.shadow-none{ box-shadow: none; }

/* ── Width / Height ──────────────────────────────────────── */
.w-full   { width: 100%; }
.w-auto   { width: auto; }
.w-screen { width: 100vw; }
.h-full   { height: 100%; }
.h-auto   { height: auto; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }

/* ── Position ────────────────────────────────────────────── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.inset-0  { inset: 0; }

/* ── Overflow ────────────────────────────────────────────── */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* ── Opacity ─────────────────────────────────────────────── */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ── Pointer Events ──────────────────────────────────────── */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* ── Cursor ──────────────────────────────────────────────── */
.cursor-pointer  { cursor: pointer; }
.cursor-default  { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* ── Object Fit ──────────────────────────────────────────── */
.object-cover   { object-fit: cover; }
.object-contain { object-fit: contain; }
.object-center  { object-position: center; }

/* ── Aspect Ratio ────────────────────────────────────────── */
.aspect-square  { aspect-ratio: 1 / 1; }
.aspect-video   { aspect-ratio: 16 / 9; }
.aspect-4-3     { aspect-ratio: 4 / 3; }
.aspect-3-2     { aspect-ratio: 3 / 2; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0-5) var(--space-2-5);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.5;
  white-space: nowrap;
}
.badge-primary  { background: var(--color-primary-100); color: var(--color-primary-700); }
.badge-secondary{ background: var(--color-secondary-100); color: var(--color-secondary-700); }
.badge-success  { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning  { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error    { background: var(--color-error-bg); color: var(--color-error); }
.badge-neutral  { background: var(--color-neutral-100); color: var(--color-neutral-700); }

/* ── Tag ─────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}
.tag:hover {
  border-color: var(--color-brand-border);
  color: var(--color-brand);
  background: var(--color-brand-subtle);
}

/* ── Prose (rich text content) ───────────────────────────── */
.prose {
  max-width: 70ch;
  color: var(--color-text);
  line-height: var(--line-height-relaxed);
}
.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}
.prose p  { margin-bottom: var(--space-4); }
.prose ul { list-style: disc; padding-left: var(--space-6); margin-bottom: var(--space-4); }
.prose ol { list-style: decimal; padding-left: var(--space-6); margin-bottom: var(--space-4); }
.prose li { margin-bottom: var(--space-2); }
.prose a  { color: var(--color-brand); }
.prose blockquote {
  border-left: 4px solid var(--color-brand);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-text-muted);
}
.prose code {
  background: var(--color-bg-muted);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}
.prose pre {
  background: var(--color-neutral-900);
  color: var(--color-neutral-100);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.875em;
}
.prose img {
  border-radius: var(--radius-lg);
  margin-block: var(--space-6);
}
.prose table {
  margin-bottom: var(--space-6);
}
.prose th, .prose td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  text-align: left;
}
.prose th {
  background: var(--color-bg-subtle);
  font-weight: var(--font-weight-semibold);
}

/* ── Responsive Visibility ───────────────────────────────── */
@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}
@media (min-width: 1024px) {
  .hide-desktop { display: none !important; }
  .show-mobile-only { display: none !important; }
}
@media (max-width: 1023px) {
  .show-desktop-only { display: none !important; }
}

/* ── Image Placeholder ───────────────────────────────────── */
.img-placeholder {
  background: var(--color-bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.img-placeholder::after {
  content: attr(data-label);
  position: absolute;
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
}

/* ── Overlay ─────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
}
.overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgb(0 0 0 / 0.7));
}

/* ── Transition Utilities ────────────────────────────────── */
.transition-fast   { transition: all var(--transition-fast); }
.transition-base   { transition: all var(--transition-base); }
.transition-slow   { transition: all var(--transition-slow); }
.transition-colors { transition: color var(--transition-base), background-color var(--transition-base), border-color var(--transition-base); }

/* ── Hover Effects ───────────────────────────────────────── */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Gradient Text ───────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-secondary-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Eyebrow / Label ─────────────────────────────────────── */
.eyebrow {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: var(--space-3);
}

/* ── Section Header ──────────────────────────────────────── */
.section-header {
  max-width: 640px;
  margin-bottom: var(--space-12);
}
.section-header.centered {
  text-align: center;
  margin-inline: auto;
}
.section-header h2 {
  margin-bottom: var(--space-4);
}
.section-header p {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
}