testsAndMisc/bucket_catch/packages/frontend/src/index.css
Krzysztof kuhy Rudnicki a7596d0442
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
bucket_catch: introduce a real design-token system, fix reversed gradients
Fixes every violation in DESIGN_AUDIT_TODO.md's bucket_catch frontend
section. The app previously had no shared tokens at all (index.css was a
12-line reset) and 19 hardcoded hex colors duplicated independently
across 6 *.module.css files.

New :root token block in index.css: bg gradient stops, a drag-state
gradient, the indigo/pink accent pair collapsed to one canonical
--gradient-accent direction, text/surface colors, success/error, 2
consolidated muted-gray roles (down from 4 unrelated shades), a 4px
spacing scale, and a radius scale. All 6 component files migrated onto it.

Fixes the real reversed-gradient-stop bug the audit named
(PuzzleResult.module.css .grade was pink->indigo vs every other heading's
indigo->pink) plus a second instance of the same bug the audit's prose
didn't cite by line number (ModeSelect.module.css .puzzleStart button) --
both now reference --gradient-accent so this class of bug can't recur.
Also fixes: .preset's border contrast (was under 3:1), cardDesc's
sub-16px font-size, 4 buttons' off-ratio padding (now exact 2x), 2 large
icons' full-contrast rendering next to muted text (now dimmed), the
explicitly-cited off-grid spacing values, and ModeSelect's gridInput
background color which had drifted from its DropZone sibling's.

Verified: 145/145 tests at 100% coverage (CSS-only, confirms no
functional regression), a real vite build succeeds, re-verified identical
in an isolated worktree at HEAD, and pixel-checked the production build
via a headless-Chrome screenshot (gradient direction now matches between
heading and button; preset chip borders clearly visible).
`npm run lint` (tsc -b + eslint) was already broken on a clean checkout
before this change (1 pre-existing tsc error in vite.config.ts, 46
pre-existing eslint errors in untouched test/lib files) -- confirmed via
an isolated worktree at the parent commit, left alone as out of scope.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 19:18:12 +02:00

86 lines
2.6 KiB
CSS

/* Design tokens — the shared source of truth every *.module.css file
should reference instead of its own hardcoded hex literals. Previously
absent entirely (rule 4), which is how the same page-background/heading
gradients ended up copy-pasted verbatim across 4 files, one of them with
the gradient stops reversed (PuzzleResult.module.css, and ModeSelect's
puzzleStart button — same bug, two spots). */
:root {
/* Page background (3-stop gradient) */
--bg-1: #0f0c29;
--bg-2: #302b63;
--bg-3: #24243e;
--bg-gradient: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
/* Drag-over state (DropZone only) */
--bg-drag-1: #1a1560;
--bg-drag-2: #4a3f9e;
--bg-drag-3: #3a3868;
--bg-drag-gradient: linear-gradient(
135deg,
var(--bg-drag-1),
var(--bg-drag-2),
var(--bg-drag-3)
);
/* Accent pair. --gradient-accent is the ONE canonical direction
(indigo -> pink) for every heading/primary-button gradient in the
app — always use this token, never write the stops out by hand. */
--color-indigo: #818cf8;
--color-indigo-rgb: 129, 140, 248;
--color-pink: #f472b6;
--color-pink-rgb: 244, 114, 182;
--gradient-accent: linear-gradient(90deg, var(--color-indigo), var(--color-pink));
--color-indigo-light: #a5b4fc;
--color-indigo-lighter: #c7d2fe;
--color-pink-light: #f9a8d4;
--color-pink-lighter: #e879f9;
--color-text: #e0e7ff;
--color-text-rgb: 224, 231, 255;
/* Raised-surface fill (cards, file rows, the puzzle grid) — one base
color at different opacities/solidity, not independent literals. */
--surface-rgb: 30, 27, 75;
--surface: rgba(var(--surface-rgb), 0.7);
--surface-solid: rgb(var(--surface-rgb));
--color-success: #34d399;
--color-error: #f87171;
/* Muted grays — was 4 unrelated shades (rule 2); collapsed to 2 named,
semantically distinct roles: body-adjacent secondary text, and a
slightly darker tertiary/caption tone. (Borders get their own token
below, since one of them needed a contrast fix rule 7 flagged.) */
--muted-text: #94a3b8;
--muted-faint: #6b7280;
--muted-border: #4b5563;
/* Spacing scale (4px base) */
--space-1: 4px;
--space-2: 8px;
--space-3: 16px;
--space-4: 24px;
--space-5: 32px;
--space-6: 40px;
/* Corner radius scale */
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 16px;
--radius-pill: 999px;
}
*, *::before, *::after {
box-sizing: border-box;
}
html, body, #root {
margin: 0;
padding: 0;
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg-1);
color: var(--color-text);
}