/* tailwind-mini.css
 *
 * Hand-rolled subset of Tailwind utilities — just the classes that
 * templates actually use, audited via:
 *
 *   grep -rohE 'class="[^"]*"' backend/app/templates/
 *
 * Replaces `<script src="https://cdn.tailwindcss.com">` from base.html.
 * The play CDN is a ~400 KB synchronous script that compiles utility
 * CSS in the browser on every page load — a 1-2 s render-blocking
 * cost that makes tab switches feel like 2-3 s. With this file in
 * place that cost disappears: the browser just reads the CSS.
 *
 * Spacing scale follows Tailwind defaults (0.25 rem per step), so
 * existing class names render visually identical. If a future template
 * uses a class that isn't here, the page will visually regress (the
 * class is a no-op) — add it below.
 */

/* ── Preflight subset: border-box reset ───────────────────────────────
 * Tailwind's Preflight applies `box-sizing: border-box` to every
 * element. When we replaced the play CDN with this hand-rolled file
 * the reset was dropped, which left the browser default
 * `box-sizing: content-box`. The visible symptom: any element with
 * `width: 100%` AND horizontal padding overflows its container by
 * (padding-left + padding-right), producing a phantom horizontal
 * scrollbar. `.co-page` (width: 100% + padding: 56px 40px) was the
 * trigger. Restoring the reset matches Tailwind's documented
 * defaults and the expectation every utility class is authored
 * against. Border-box is also the convention every other modern
 * CSS framework ships with — there is no reason to diverge.
 */
*,
::before,
::after {
  box-sizing: border-box;
}

/* ── layout / display ─────────────────────────────────────────────── */

.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.grid         { display: grid; }
.hidden       { display: none; }

.flex-1       { flex: 1 1 0%; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }

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

.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }

/* ── gap (Tailwind: gap-N == 0.25 rem * N) ────────────────────────── */

.gap-0  { gap: 0;       }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem;  }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem;    }
.gap-5  { gap: 1.25rem; }
.gap-6  { gap: 1.5rem;  }
.gap-8  { gap: 2rem;    }

.gap-x-6 { column-gap: 1.5rem; }
.gap-y-2 { row-gap: 0.5rem; }

/* ── grid templates ───────────────────────────────────────────────── */

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── margin / padding ─────────────────────────────────────────────── */

.mt-1  { margin-top: 0.25rem;  }
.mt-2  { margin-top: 0.5rem;   }
.mt-3  { margin-top: 0.75rem;  }
.mt-4  { margin-top: 1rem;     }
.mt-6  { margin-top: 1.5rem;   }
.mt-8  { margin-top: 2rem;     }
.mt-10 { margin-top: 2.5rem;   }
.mt-12 { margin-top: 3rem;     }
.mt-16 { margin-top: 4rem;     }
.mt-20 { margin-top: 5rem;     }

.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem;   }

.ml-3    { margin-left: 0.75rem; }
.ml-auto { margin-left: auto;    }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-4   { padding: 1rem;    }
.p-5   { padding: 1.25rem; }
.p-10  { padding: 2.5rem;  }
.p-0   { padding: 0;       }

.pt-6  { padding-top: 1.5rem; }
.py-3  { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.px-5  { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6  { padding-left: 1.5rem;  padding-right: 1.5rem;  }

.space-y-2 > * + * { margin-top: 0.5rem; }

/* ── sizing ───────────────────────────────────────────────────────── */

.h-3\.5    { height: 0.875rem; }
.h-4       { height: 1rem; }
.h-full    { height: 100%; }
.h-screen  { height: 100vh; }

.w-3\.5    { width: 0.875rem; }
.w-4       { width: 1rem; }

.min-h-full { min-height: 100%; }
.min-w-0    { min-width: 0; }

.max-w-md   { max-width: 28rem; }
.max-w-xl   { max-width: 36rem; }
.max-w-2xl  { max-width: 42rem; }
.max-w-3xl  { max-width: 48rem; }

/* ── borders ──────────────────────────────────────────────────────── */

.border-0  { border-width: 0; }
.border-t  { border-top-width: 1px;    border-top-style: solid; }
.border-b  { border-bottom-width: 1px; border-bottom-style: solid; }
.border-r  { border-right-width: 1px;  border-right-style: solid; }

/* ── colour helpers ───────────────────────────────────────────────── */

.bg-white { background-color: #ffffff; }

/* ── typography ───────────────────────────────────────────────────── */

.text-center      { text-align: center; }
.font-medium      { font-weight: 500; }
.truncate         { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }

/* ── input / overflow helpers ─────────────────────────────────────── */

.outline-none     { outline: 2px solid transparent; outline-offset: 2px; }
.overflow-auto    { overflow: auto; }
.overflow-hidden  { overflow: hidden; }
.resize-none      { resize: none; }

/* ── empty-state utilities (Tailwind's empty: prefix) ─────────────── */

.empty\:border-0:empty { border-width: 0; }
.empty\:hidden:empty   { display: none; }
.empty\:p-0:empty      { padding: 0; }

/* ── focus utilities (Tailwind's focus: prefix) ───────────────────── */

.focus\:bg-\[var\(--co-canvas\)\]:focus { background-color: var(--co-canvas); }

/* ── arbitrary values (Tailwind's `[…]` bracket syntax) ───────────── */

.text-\[15px\]                 { font-size: 15px; }
.text-\[var\(--co-near-black\)\] { color: var(--co-near-black); }
.text-\[var\(--co-slate\)\]    { color: var(--co-slate); }

.bg-\[var\(--co-canvas\)\]     { background-color: var(--co-canvas); }
.bg-\[var\(--co-stone\)\]      { background-color: var(--co-stone); }

.border-\[var\(--co-hairline\)\] { border-color: var(--co-hairline); }

.w-\[44\%\]                    { width: 44%; }

/* ── md: breakpoint (Tailwind default: min-width 768px) ───────────── */

@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\:grid-cols-\[1\.4fr_1fr\] { grid-template-columns: 1.4fr 1fr; }
  .md\:gap-x-12   { column-gap: 3rem; }
  .md\:items-end  { align-items: flex-end; }
  .md\:text-right { text-align: right; }
}
