/**
 * utilities.css — bespoke utility layer (replaces Tailwind)
 * Only the classes actually used in the app, reproducing Tailwind's class NAMES
 * so markup stays unchanged. Colors map to semantic tokens; spacing follows the
 * Tailwind rem scale for visual parity.
 */

/* ─── Display / position ──────────────────────────────────── */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.top-6 { top: 1.5rem; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* ─── Flexbox / grid ──────────────────────────────────────── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-1 { flex: 1 1 0%; }
.flex-grow { flex-grow: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.mt-auto { margin-top: auto; }
.mr-auto { margin-right: auto; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* ─── Sizing ──────────────────────────────────────────────── */
.w-full { width: 100%; }
.h-auto { height: auto; }
.h-12 { height: 3rem; }
.h-20 { height: 5rem; }
.h-40 { height: 10rem; }
.min-h-screen { min-height: 100vh; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-full { max-width: 100%; }
.max-h-\[90vh\] { max-height: 90vh; }

/* ─── Spacing: margin ─────────────────────────────────────── */
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }  .mr-1 { margin-right: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }   .mr-2 { margin-right: 0.5rem; }  .mb-2 { margin-bottom: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }.mb-3 { margin-bottom: 0.75rem; }
.mt-4 { margin-top: 1rem; }     .mb-4 { margin-bottom: 1rem; }   .ml-4 { margin-left: 1rem; }   .mx-4 { margin-left: 1rem; margin-right: 1rem; }
.mt-6 { margin-top: 1.5rem; }   .mb-6 { margin-bottom: 1.5rem; }
.mt-8 { margin-top: 2rem; }     .mb-8 { margin-bottom: 2rem; }   .ml-8 { margin-left: 2rem; }

/* ─── Spacing: padding ────────────────────────────────────── */
.p-1 { padding: 0.25rem; } .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.p-2 { padding: 0.5rem; }  .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; } .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.p-3 { padding: 0.75rem; } .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.p-4 { padding: 1rem; }    .px-4 { padding-left: 1rem; padding-right: 1rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.p-5 { padding: 1.25rem; } .pl-5 { padding-left: 1.25rem; }
.p-6 { padding: 1.5rem; }  .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; } .pt-6 { padding-top: 1.5rem; }
.pb-10 { padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }

/* ─── Gap / stack spacing ─────────────────────────────────── */
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* ─── Typography ──────────────────────────────────────────── */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.font-normal { 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-extrabold { font-weight: 800; }
.font-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Borders / radius ────────────────────────────────────── */
.border { border: 1px solid var(--color-border); }
.border-2 { border-width: 2px; border-style: solid; border-color: var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-pill); }

/* ─── Effects ─────────────────────────────────────────────── */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-xl { box-shadow: var(--shadow-lg); }
.cursor-pointer { cursor: pointer; }
.transition-all { transition: var(--transition-base); }
.transition-colors { transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease); }
.transition-shadow { transition: box-shadow .2s var(--ease); }
.duration-200 { transition-duration: .2s; }

/* ─── Colors → semantic tokens ────────────────────────────── */
.text-white { color: #fff; }
.text-gray-300 { color: var(--color-text-dim); }
.text-gray-400 { color: var(--color-text-dim); }
.text-gray-500, .text-gray-600, .text-gray-700 { color: var(--color-text-muted); }
.text-gray-900 { color: var(--color-text); }
.text-blue-500, .text-blue-600, .text-blue-700, .text-blue-900 { color: var(--color-accent); }
.text-indigo-100, .text-indigo-500, .text-indigo-700 { color: var(--color-accent); }
.text-green-500, .text-green-600, .text-green-700, .text-green-800, .text-green-900 { color: var(--color-success); }
.text-red-500, .text-red-700 { color: var(--color-danger); }
.text-yellow-600, .text-yellow-700, .text-yellow-800 { color: var(--color-warning); }

.bg-white { background-color: var(--color-surface); }
.bg-gray-50, .bg-gray-100 { background-color: var(--color-surface-raised); }
.bg-gray-200 { background-color: var(--color-border); }
.bg-gray-700 { background-color: color-mix(in srgb, var(--color-text) 72%, var(--color-bg)); color: var(--color-bg); }
.bg-gray-900 { background-color: var(--color-text); color: var(--color-bg); }
.bg-blue-50 { background-color: color-mix(in srgb, var(--color-info) 10%, transparent); }
.bg-blue-600 { background-color: var(--color-info); color: var(--color-info-contrast); }
.bg-indigo-50 { background-color: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.bg-indigo-600 { background-color: var(--color-accent); color: var(--color-accent-contrast); }
.bg-green-50, .bg-green-100 { background-color: color-mix(in srgb, var(--color-success) 12%, transparent); }
.bg-red-50, .bg-red-100 { background-color: color-mix(in srgb, var(--color-danger) 10%, transparent); }
.bg-red-600 { background-color: var(--color-danger); color: var(--color-danger-contrast); }
.bg-yellow-50 { background-color: color-mix(in srgb, var(--color-warning) 12%, transparent); }

.border-gray-100, .border-gray-200, .border-gray-300 { border-color: var(--color-border); }
.border-blue-200 { border-color: color-mix(in srgb, var(--color-info) 40%, transparent); }
.border-green-200 { border-color: color-mix(in srgb, var(--color-success) 40%, transparent); }
.border-red-500 { border-color: var(--color-danger); }
.border-yellow-200 { border-color: color-mix(in srgb, var(--color-warning) 40%, transparent); }
.border-indigo-300, .border-indigo-600 { border-color: var(--color-accent); }

/* ─── State variants ──────────────────────────────────────── */
.hover\:bg-gray-200:hover { background-color: var(--color-border); }
.hover\:bg-gray-800:hover { background-color: color-mix(in srgb, var(--color-text) 82%, var(--color-bg)); }
.hover\:bg-blue-700:hover { background-color: color-mix(in srgb, var(--color-info) 85%, black); }
.hover\:bg-indigo-700:hover { background-color: color-mix(in srgb, var(--color-accent) 85%, black); }
.hover\:bg-red-700:hover { background-color: color-mix(in srgb, var(--color-danger) 85%, black); }
.hover\:text-gray-200:hover { color: color-mix(in srgb, var(--color-text-muted) 60%, var(--color-bg)); }
.hover\:border-indigo-300:hover { border-color: var(--color-accent); }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md); }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.focus\:outline-none:focus { outline: none; }
.focus\:z-10:focus { z-index: 10; }
.focus\:ring-2:focus, .focus\:ring-blue-500:focus, .focus\:ring-indigo-500:focus {
    outline: 2px solid color-mix(in srgb, var(--color-accent) 55%, transparent);
    outline-offset: 2px;
}
.focus\:ring-offset-2:focus { outline-offset: 2px; }
.focus\:border-indigo-500:focus { border-color: var(--color-accent); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
}
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:col-span-1 { grid-column: span 1 / span 1; }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}
