Add colour tokens, dark mode and drop gradients

- Colour tokens in index.css named by role (ink, body, muted, link,
  brand, action, surface, tint, danger), used everywhere instead of hex
- Dark mode: follows the system, a header toggle (site and admin)
  overrides it and is remembered; set before first paint in index.html
- Data colours go through src/lib/color.ts: withAlpha for tints,
  accentText (lighter on dark) for text in an accent, readableOn for
  text on one, so an admin's pale colour still reads
- Migration 040 drops events.gradient: a card is its photo or plain,
  with its colour as the border; other decorative gradients are solid
- The countdown and a hero event without a photo mix their colour
  toward ink behind white text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:42:59 -05:00
parent ee61568911
commit c74ad746f5
70 changed files with 829 additions and 596 deletions

View file

@ -64,7 +64,7 @@ import {
/* One card per section. scroll-mt clears the sticky "Jump to" bar
below lg, and leaves a little air above the card on desktop. */
const CARD = "mt-6 scroll-mt-16 rounded-2xl border border-[#138ba0]/20 bg-white p-5 lg:scroll-mt-6";
const CARD = "mt-6 scroll-mt-16 rounded-2xl border border-brand/20 bg-surface p-5 lg:scroll-mt-6";
const sectionId = (name) => `section-${slugify(name)}`;
@ -225,8 +225,8 @@ export default function EntityEdit() {
return () => window.removeEventListener("beforeunload", warn);
}, [dirty]);
if (!manifest) return <p className="text-[#4a6b72]">No such thing to edit.</p>;
if (loading || !form) return <p className="text-[#4a6b72]">Loading…</p>;
if (!manifest) return <p className="text-muted">No such thing to edit.</p>;
if (loading || !form) return <p className="text-muted">Loading…</p>;
/* ── Heading ───────────────────────────────────────────────── */
@ -356,13 +356,13 @@ export default function EntityEdit() {
<button
type="button"
onClick={() => leave(`/admin/${manifest.key}`)}
className="text-sm text-[#4a6b72] hover:text-[#0f7183]"
className="text-sm text-muted hover:text-link"
>
← {manifest.label}
</button>
)}
<h1 className="mt-2 text-3xl font-bold text-[#0f7183]">
<h1 className="mt-2 text-3xl font-bold text-link">
{isNew ? `New ${manifest.singular}` : heading}
</h1>
@ -385,13 +385,13 @@ export default function EntityEdit() {
{singleton ? (
updatedAt && (
<div className={CARD}>
<p className="text-sm text-[#4a6b72]">Last saved {updatedAt}</p>
<p className="text-sm text-muted">Last saved {updatedAt}</p>
</div>
)
) : autoId ? (
!isNew && (
<div id="section-url-id" className={CARD}>
<p className="text-sm text-[#4a6b72]">
<p className="text-sm text-muted">
{manifest.idLabel} #{form.id}
{form.updated_at && <> · last saved {form.updated_at}</>}
</p>
@ -421,7 +421,7 @@ export default function EntityEdit() {
}}
/>
{!isNew && form.updated_at && (
<p className="mt-2 text-xs text-[#4a6b72]">
<p className="mt-2 text-xs text-muted">
Last saved {form.updated_at}
</p>
)}
@ -431,8 +431,8 @@ export default function EntityEdit() {
{/* Field groups */}
{groups.map((group) => (
<section key={group.legend} id={sectionId(group.legend)} className={CARD}>
<h2 className="text-lg font-semibold text-[#26454c]">{group.legend}</h2>
{group.note && <p className="mt-1 text-sm text-[#4a6b72]">{group.note}</p>}
<h2 className="text-lg font-semibold text-body">{group.legend}</h2>
{group.note && <p className="mt-1 text-sm text-muted">{group.note}</p>}
<div className="mt-4">
<FieldGrid>
{group.fields.map((field) => (
@ -470,7 +470,7 @@ export default function EntityEdit() {
</div>
{/* Sticky action bar */}
<div className="fixed inset-x-0 bottom-0 border-t border-[#138ba0]/20 bg-white/95 backdrop-blur">
<div className="fixed inset-x-0 bottom-0 border-t border-brand/20 bg-white/95 backdrop-blur">
<div className="mx-auto flex max-w-5xl flex-wrap items-center gap-4 px-6 py-3">
{canWrite ? (
<>
@ -478,7 +478,7 @@ export default function EntityEdit() {
type="button"
onClick={save}
disabled={saving || !dirty}
className="rounded-full bg-[#0f7183] px-6 py-2 font-semibold text-white transition-colors hover:bg-[#0b5c6a] disabled:bg-[#4a6b72]/25"
className="rounded-full bg-action px-6 py-2 font-semibold text-white transition-colors hover:bg-action-hover disabled:bg-muted/25"
>
{saving ? "Saving…" : isNew ? "Create" : "Save changes"}
</button>
@ -486,27 +486,27 @@ export default function EntityEdit() {
<button
type="button"
onClick={remove}
className="rounded-full border border-[#b3261e]/40 px-4 py-2 text-sm font-medium text-[#b3261e] transition-colors hover:bg-[#fdf3f2]"
className="rounded-full border border-danger/40 px-4 py-2 text-sm font-medium text-danger transition-colors hover:bg-danger-tint"
>
Delete
</button>
)}
</>
) : (
<span className="text-sm text-[#4a6b72]">
<span className="text-sm text-muted">
Read-only: your account can view this but not change it.
</span>
)}
{dirty && !saving && (
<span className="text-sm text-[#4a6b72]">Unsaved changes</span>
<span className="text-sm text-muted">Unsaved changes</span>
)}
{message && (
<span
role="status"
className={`flex items-center gap-2 text-sm ${
message.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"
message.tone === "ok" ? "text-link" : "text-danger"
}`}
>
{message.text}
@ -514,7 +514,7 @@ export default function EntityEdit() {
<button
type="button"
onClick={load}
className="rounded-full border border-[#b3261e]/40 px-3 py-1 text-xs font-medium"
className="rounded-full border border-danger/40 px-3 py-1 text-xs font-medium"
>
Reload
</button>