claude/skills/web-frontend/assets/tokens.css
Neil Bantoc 5201aa9bd5 Add web-frontend, web-project-audit and web-project-scaffold-containerized-python skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:26:33 -08:00

210 lines
11 KiB
CSS

/* =====================================================================
web-frontend design tokens
Copy into the project (e.g. src/styles/tokens.css) and tune.
Minimum per project: --hue, --chroma, the three font tokens, and the
layout-concept comment below. Components use ONLY these tokens.
Change --hue/--chroma/--tint on :root itself. Derived tokens are computed
where they are declared, so setting --hue on a nested element does NOT
re-tint it; for a differently colored section, redeclare the tokens it uses.
Layout: <one line describing this project's layout concept>
===================================================================== */
:root {
/* ---- Identity knobs ------------------------------------------------ */
--hue: 250; /* accent hue, 0-360. Pick from the subject's world. */
--chroma: 0.15; /* accent saturation. 0.08 muted ... 0.2 vivid. */
--tint: 0.012; /* how much the neutrals lean toward --hue. */
/* ---- Neutrals (light) ---------------------------------------------- */
--bg: oklch(0.985 var(--tint) var(--hue));
--surface: oklch(1 0 0);
--surface-2: oklch(0.965 var(--tint) var(--hue)); /* wells, table headers, code */
--border: oklch(0.90 calc(var(--tint) * 1.5) var(--hue));
--border-strong: oklch(0.80 calc(var(--tint) * 2) var(--hue));
--fg: oklch(0.22 calc(var(--tint) * 2) var(--hue));
--fg-muted: oklch(0.45 calc(var(--tint) * 2) var(--hue));
--fg-subtle: oklch(0.60 calc(var(--tint) * 1.5) var(--hue));
/* ---- Accent ---------------------------------------------------------- */
--accent: oklch(0.52 var(--chroma) var(--hue));
--accent-hover:oklch(0.46 var(--chroma) var(--hue));
--accent-fg: oklch(0.99 0.01 var(--hue)); /* text on --accent */
--accent-soft: oklch(0.95 calc(var(--chroma) * 0.3) var(--hue)); /* selected rows, chips */
--accent-text: oklch(0.45 var(--chroma) var(--hue)); /* links, accent text on --bg */
--ring: oklch(0.60 var(--chroma) var(--hue) / 0.55);
/* ---- Semantic (independent of the accent) ---------------------------- */
--ok: oklch(0.55 0.13 150); --ok-soft: oklch(0.95 0.04 150);
--warn: oklch(0.68 0.15 75); --warn-soft: oklch(0.96 0.05 85);
--danger: oklch(0.55 0.19 25); --danger-soft: oklch(0.95 0.04 25);
--info: oklch(0.55 0.12 230); --info-soft: oklch(0.95 0.03 230);
/* ---- Type ------------------------------------------------------------ */
--font-display: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
/* Scale: ratio 1.2 (UI). For editorial pages raise the top steps (see comment). */
--text-xs: 0.75rem; /* 12 captions, table meta */
--text-sm: 0.875rem; /* 14 secondary text, dense UI */
--text-base: 1rem; /* 16 body */
--text-lg: 1.125rem; /* 18 lead paragraph, card titles */
--text-xl: 1.375rem; /* 22 section headings (h3) */
--text-2xl: 1.75rem; /* 28 page sections (h2) */
--text-3xl: 2.25rem; /* 36 page title (h1) in apps */
--text-4xl: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem); /* editorial hero only */
--leading-tight: 1.15; /* display, h1-h2 */
--leading-snug: 1.3; /* h3-h4, UI labels */
--leading-body: 1.6; /* paragraphs */
--tracking-tight: -0.02em; /* large display */
--tracking-label: 0.06em; /* UPPERCASE labels */
--measure: 65ch;
--weight-regular: 400;
--weight-medium: 500;
--weight-semibold: 600;
--weight-bold: 700;
/* ---- Space (4px base) ---------------------------------------------- */
--space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
--space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
--space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
--space-16: 4rem; --space-24: 6rem;
--gutter: max(16px, 4vw); /* page side padding, capped by layout */
--content-max: 72rem; /* app/site content width */
--prose-max: var(--measure);
/* ---- Shape & elevation -------------------------------------------- */
--radius-sm: 4px; /* inputs, chips, small buttons */
--radius-md: 8px; /* cards, popovers, buttons */
--radius-lg: 14px; /* modals, large media */
--radius-full: 999px; /* pills, avatars, toggles */
--shadow-raised: 0 1px 2px oklch(0.2 0.02 var(--hue) / 0.06), 0 1px 1px oklch(0.2 0.02 var(--hue) / 0.04);
--shadow-popover: 0 4px 12px oklch(0.2 0.02 var(--hue) / 0.10), 0 1px 3px oklch(0.2 0.02 var(--hue) / 0.08);
--shadow-modal: 0 24px 48px oklch(0.2 0.02 var(--hue) / 0.18), 0 4px 12px oklch(0.2 0.02 var(--hue) / 0.10);
/* ---- Motion ---------------------------------------------------------- */
--ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
--dur-fast: 120ms; /* hover, press */
--dur-base: 180ms; /* menus, toggles */
--dur-slow: 320ms; /* modals, page moments */
/* ---- Layers -------------------------------------------------------- */
--z-sticky: 10; --z-dropdown: 20; --z-modal: 40; --z-toast: 50;
color-scheme: light;
}
/* ---- Dark: same tokens, redesigned values. Two blocks so an explicit
data-theme toggle wins over the OS setting in both directions. ---- */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: oklch(0.17 calc(var(--tint) * 1.5) var(--hue));
--surface: oklch(0.21 calc(var(--tint) * 1.5) var(--hue));
--surface-2: oklch(0.245 calc(var(--tint) * 1.5) var(--hue));
--border: oklch(0.30 calc(var(--tint) * 2) var(--hue));
--border-strong: oklch(0.40 calc(var(--tint) * 2) var(--hue));
--fg: oklch(0.95 calc(var(--tint) * 1) var(--hue));
--fg-muted: oklch(0.74 calc(var(--tint) * 1.5) var(--hue));
--fg-subtle: oklch(0.60 calc(var(--tint) * 1.5) var(--hue));
--accent: oklch(0.70 calc(var(--chroma) * 0.85) var(--hue));
--accent-hover:oklch(0.76 calc(var(--chroma) * 0.85) var(--hue));
--accent-fg: oklch(0.18 0.02 var(--hue));
--accent-soft: oklch(0.30 calc(var(--chroma) * 0.4) var(--hue));
--accent-text: oklch(0.78 calc(var(--chroma) * 0.8) var(--hue));
--ring: oklch(0.72 var(--chroma) var(--hue) / 0.6);
--ok: oklch(0.72 0.14 150); --ok-soft: oklch(0.30 0.05 150);
--warn: oklch(0.80 0.14 80); --warn-soft: oklch(0.32 0.05 80);
--danger: oklch(0.70 0.17 25); --danger-soft: oklch(0.30 0.06 25);
--info: oklch(0.72 0.11 230); --info-soft: oklch(0.30 0.05 230);
--shadow-raised: 0 1px 2px oklch(0 0 0 / 0.4);
--shadow-popover: 0 6px 16px oklch(0 0 0 / 0.45), 0 0 0 1px var(--border);
--shadow-modal: 0 24px 56px oklch(0 0 0 / 0.55), 0 0 0 1px var(--border);
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--bg: oklch(0.17 calc(var(--tint) * 1.5) var(--hue));
--surface: oklch(0.21 calc(var(--tint) * 1.5) var(--hue));
--surface-2: oklch(0.245 calc(var(--tint) * 1.5) var(--hue));
--border: oklch(0.30 calc(var(--tint) * 2) var(--hue));
--border-strong: oklch(0.40 calc(var(--tint) * 2) var(--hue));
--fg: oklch(0.95 calc(var(--tint) * 1) var(--hue));
--fg-muted: oklch(0.74 calc(var(--tint) * 1.5) var(--hue));
--fg-subtle: oklch(0.60 calc(var(--tint) * 1.5) var(--hue));
--accent: oklch(0.70 calc(var(--chroma) * 0.85) var(--hue));
--accent-hover:oklch(0.76 calc(var(--chroma) * 0.85) var(--hue));
--accent-fg: oklch(0.18 0.02 var(--hue));
--accent-soft: oklch(0.30 calc(var(--chroma) * 0.4) var(--hue));
--accent-text: oklch(0.78 calc(var(--chroma) * 0.8) var(--hue));
--ring: oklch(0.72 var(--chroma) var(--hue) / 0.6);
--ok: oklch(0.72 0.14 150); --ok-soft: oklch(0.30 0.05 150);
--warn: oklch(0.80 0.14 80); --warn-soft: oklch(0.32 0.05 80);
--danger: oklch(0.70 0.17 25); --danger-soft: oklch(0.30 0.06 25);
--info: oklch(0.72 0.11 230); --info-soft: oklch(0.30 0.05 230);
--shadow-raised: 0 1px 2px oklch(0 0 0 / 0.4);
--shadow-popover: 0 6px 16px oklch(0 0 0 / 0.45), 0 0 0 1px var(--border);
--shadow-modal: 0 24px 56px oklch(0 0 0 / 0.55), 0 0 0 1px var(--border);
color-scheme: dark;
}
/* =====================================================================
Base layer — sensible defaults built on the tokens.
===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font-family: var(--font-body);
font-size: var(--text-base);
line-height: var(--leading-body);
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
font-family: var(--font-display);
line-height: var(--leading-tight);
font-weight: var(--weight-semibold);
text-wrap: balance;
margin: 0;
}
h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); line-height: var(--leading-snug); }
h4 { font-size: var(--text-lg); line-height: var(--leading-snug); }
p { margin: 0; text-wrap: pretty; max-width: var(--prose-max); }
small, .text-muted { color: var(--fg-muted); }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }
a { color: var(--accent-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--fg); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.label { /* uppercase eyebrow / column label */
font-size: var(--text-xs); font-weight: var(--weight-semibold);
letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--fg-muted);
}
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important; scroll-behavior: auto !important;
}
}
/* Editorial pages: widen the top of the scale.
:root {
--text-xl: 1.5rem; --text-2xl: 2.25rem; --text-3xl: 3rem;
--text-4xl: clamp(3rem, 1.5rem + 6vw, 6.5rem);
}
*/