From 9c4a749d463c78f4af51a7b04104f6c03b20fa99 Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 12:38:28 +0200 Subject: [PATCH 1/6] feat: add design tokens and cascade layers --- apps/web/src/styles/layers.css | 2 + apps/web/src/styles/tokens.css | 220 +++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 apps/web/src/styles/layers.css create mode 100644 apps/web/src/styles/tokens.css diff --git a/apps/web/src/styles/layers.css b/apps/web/src/styles/layers.css new file mode 100644 index 0000000..c3d012f --- /dev/null +++ b/apps/web/src/styles/layers.css @@ -0,0 +1,2 @@ +/* Cascade order: later layers take priority over earlier layers. */ +@layer reset, base, components, utilities; \ No newline at end of file diff --git a/apps/web/src/styles/tokens.css b/apps/web/src/styles/tokens.css new file mode 100644 index 0000000..6551b4e --- /dev/null +++ b/apps/web/src/styles/tokens.css @@ -0,0 +1,220 @@ +:root { + /* Brand */ + --color-brand-primary: #e86a1c; + --color-brand-primary-hover: #cc5b14; + --color-brand-primary-active: #b84f0d; + --color-brand-accent-soft: #fff4e8; + + /* Backgrounds and surfaces */ + --color-bg-page: #fbf0de; + --color-bg-subtle: #f7ead8; + + --color-surface: #ffffff; + --color-surface-raised: #fff9f2; + --color-surface-muted: #f7f0e7; + + /* Text */ + --color-text-primary: #0f172a; + --color-text-secondary: #5f6b7a; + --color-text-muted: #667085; + --color-text-inverse: #ffffff; + --color-text-accent: var(--color-brand-primary); + + /* Icons */ + --color-icon-primary: #1e293b; + --color-icon-secondary: #64748b; + --color-icon-muted: #94a3b8; + + /* Borders and dividers */ + --color-border-subtle: #f1e4d5; + --color-border-default: #e6d3bf; + --color-border-strong: #cfb69b; + --color-border-divider: #ebdccb; + + --color-border-input: #dcc7af; + --color-border-input-hover: #cdae8f; + + --color-outline-soft: #f3e7da; + --color-outline-strong: #c8ad91; + + /* Interactive surfaces */ + --color-surface-hover: #fff1e3; + --color-surface-selected: #ffe0c2; + --color-surface-pressed: #fbd2ae; + --color-selected-hover: color-mix( + in srgb, + var(--color-brand-primary-active) 90%, + var(--color-text-primary) + ); + --color-selected-active: color-mix( + in srgb, + var(--color-brand-primary-active) 80%, + var(--color-text-primary) + ); + + /* Choice controls */ + --color-choice-border: #a66a4a; + --color-choice-border-hover: #8f5438; + + /* Focus */ + --color-focus-ring: #b84f0d; + + /* Disabled */ + --color-disabled-surface: #f3eae1; + --color-disabled-border: #e4d6c8; + --color-disabled-text: #85776a; + + /* Success */ + --color-feedback-success: #237a45; + --color-feedback-success-surface: #e9f8ee; + --color-feedback-success-border: #bee6c8; + + /* Warning */ + --color-feedback-warning: #8a5a00; + --color-feedback-warning-surface: #fff6e1; + --color-feedback-warning-border: #f0d9a4; + + /* Error */ + --color-feedback-error: #b42318; + --color-feedback-error-surface: #fdecec; + --color-feedback-error-border: #f4b8b8; + --color-feedback-error-hover: color-mix( + in srgb, + var(--color-feedback-error) 88%, + var(--color-text-primary) + ); + --color-feedback-error-active: color-mix( + in srgb, + var(--color-feedback-error) 78%, + var(--color-text-primary) + ); + --color-feedback-error-surface-pressed: color-mix( + in srgb, + var(--color-feedback-error-surface) 80%, + var(--color-feedback-error) + ); + + /* Info */ + --color-feedback-info: #1d4ed8; + --color-feedback-info-surface: #eaf2ff; + --color-feedback-info-border: #c7daff; + + /* Text selection */ + --color-selection-bg: #ffd6b5; + --color-selection-text: var(--color-text-primary); + + /* Spacing */ + --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; + + /* Font families */ + --font-family-base: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + sans-serif; + + --font-family-heading: var(--font-family-base); + + /* Font sizes */ + --font-size-xs: 0.75rem; + --font-size-sm: 0.875rem; + --font-size-md: 1rem; + --font-size-lg: 1.125rem; + --font-size-xl: 1.25rem; + --font-size-2xl: clamp(1.5rem, 1.35rem + 0.6vw, 1.875rem); + --font-size-3xl: clamp(1.875rem, 1.6rem + 1vw, 2.5rem); + --font-size-4xl: clamp(2.25rem, 1.9rem + 1.5vw, 3rem); + + /* Font weights */ + --font-weight-regular: 400; + --font-weight-medium: 500; + --font-weight-semibold: 600; + --font-weight-bold: 700; + + /* Line heights */ + --line-height-tight: 1.2; + --line-height-snug: 1.35; + --line-height-normal: 1.5; + --line-height-relaxed: 1.7; + + /* Letter spacing */ + --letter-spacing-tight: -0.02em; + --letter-spacing-normal: 0; + --letter-spacing-wide: 0.04em; + + /* Border radii */ + --radius-sm: 0.25rem; + --radius-md: 0.5rem; + --radius-lg: 0.75rem; + --radius-xl: 1rem; + --radius-full: 9999px; + + /* Shadows */ + --color-shadow: var(--color-text-primary); + --shadow-sm: + 0 1px 2px color-mix(in srgb, var(--color-shadow) 6%, transparent); + --shadow-md: + 0 4px 12px color-mix(in srgb, var(--color-shadow) 8%, transparent); + --shadow-lg: + 0 10px 24px color-mix(in srgb, var(--color-shadow) 12%, transparent); + + /* Border widths */ + --border-width-thin: 1px; + --border-width-medium: 2px; + --border-width-thick: 3px; + + /* Icon sizes */ + --icon-size-sm: 1rem; + --icon-size-md: 1.25rem; + --icon-size-lg: 1.5rem; + --icon-size-xl: 2rem; + + /* Page layout */ + --page-padding-inline: clamp(1rem, 3vw, 2rem); + --container-max-width: 75rem; + + /* Control sizes */ + --control-height-sm: 2.25rem; + --control-height-md: 2.75rem; + --control-height-lg: 3.25rem; + + /* Minimum interactive target */ + --target-size-min: 2.75rem; + + /* Opacity */ + --opacity-muted: 0.7; + --opacity-disabled: 0.5; + + /* Backdrop */ + --color-backdrop: color-mix(in srgb, var(--color-text-primary) 45%, transparent); + + /* Motion */ + --duration-fast: 120ms; + --duration-normal: 200ms; + --duration-slow: 300ms; + + --ease-standard: cubic-bezier(0.2, 0, 0, 1); + --ease-in: cubic-bezier(0.4, 0, 1, 1); + --ease-out: cubic-bezier(0, 0, 0.2, 1); + + /* Layering */ + --z-dropdown: 100; + --z-sticky: 200; + --z-overlay: 300; + --z-modal: 400; + + /* Icon stroke widths */ + --icon-stroke-thin: 1.5; + --icon-stroke-default: 2; + --icon-stroke-strong: 2.5; +} \ No newline at end of file From 6ec0aeb7e82c5f5ddfe2d0d2fa06383ebabbaa66 Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 12:40:11 +0200 Subject: [PATCH 2/6] feat: add global reset and base styles --- apps/web/src/styles/base.css | 102 +++++++++++++++++++++++++++++++++ apps/web/src/styles/resets.css | 74 ++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 apps/web/src/styles/base.css create mode 100644 apps/web/src/styles/resets.css diff --git a/apps/web/src/styles/base.css b/apps/web/src/styles/base.css new file mode 100644 index 0000000..2318904 --- /dev/null +++ b/apps/web/src/styles/base.css @@ -0,0 +1,102 @@ +@layer base { + /* Global page defaults */ + html { + color-scheme: light; + } + + body { + font-family: var(--font-family-base); + font-size: var(--font-size-md); + font-weight: var(--font-weight-regular); + line-height: var(--line-height-normal); + color: var(--color-text-primary); + background-color: var(--color-bg-page); + } + + /* Headings */ + h1, + h2, + h3, + h4, + h5, + h6 { + font-family: var(--font-family-heading); + font-weight: var(--font-weight-semibold); + line-height: var(--line-height-tight); + } + + h1, + h2, + h3 { + letter-spacing: var(--letter-spacing-tight); + } + + h1 { + font-size: var(--font-size-4xl); + } + + h2 { + font-size: var(--font-size-3xl); + } + + h3 { + font-size: var(--font-size-2xl); + } + + h4 { + font-size: var(--font-size-xl); + } + + h5 { + font-size: var(--font-size-lg); + } + + h6 { + font-size: var(--font-size-md); + } + + /* Links */ + a { + color: var(--color-text-accent); + text-decoration-thickness: from-font; + text-underline-offset: 0.15em; + } + + a:hover { + color: var(--color-brand-primary-hover); + } + + /* Keyboard focus */ + :focus-visible { + outline: var(--border-width-medium) solid var(--color-focus-ring); + outline-offset: 2px; + } + + /* Placeholder text */ + ::placeholder { + color: var(--color-text-muted); + opacity: 1; + } + + /* Text emphasis */ + strong, + b { + font-weight: var(--font-weight-semibold); + } + + small { + font-size: var(--font-size-sm); + } + + /* Text selection */ + ::selection { + color: var(--color-selection-text); + background-color: var(--color-selection-bg); + } + + /* Dividers */ + hr { + border: 0; + border-top: var(--border-width-thin) solid var(--color-border-divider); + } +} \ No newline at end of file diff --git a/apps/web/src/styles/resets.css b/apps/web/src/styles/resets.css new file mode 100644 index 0000000..ae8b0db --- /dev/null +++ b/apps/web/src/styles/resets.css @@ -0,0 +1,74 @@ +@layer reset { + /* Use predictable box sizing */ + *, + *::before, + *::after { + box-sizing: border-box; + } + + /* Ensure the page can fill the viewport */ + html { + min-height: 100%; + } + + body { + margin: 0; + min-height: 100dvh; + } + + /* Keep media within its container */ + img, + picture, + video, + canvas { + display: block; + max-width: 100%; + } + + /* Preserve media aspect ratio */ + img, + picture, + video { + height: auto; + } + + /* Remove inline SVG baseline spacing */ + svg { + display: block; + } + + /* Inherit surrounding form typography */ + button, + input, + select, + textarea { + font: inherit; + color: inherit; + } + + /* Prevent long text from overflowing */ + p, + h1, + h2, + h3, + h4, + h5, + h6 { + overflow-wrap: anywhere; + } + + /* Remove default content margins */ + h1, + h2, + h3, + h4, + h5, + h6, + p, + figure, + blockquote, + dl, + dd { + margin: 0; + } +} \ No newline at end of file From 52826f5a75627acba454971cf9fb0b1ed78a27d5 Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 12:40:53 +0200 Subject: [PATCH 3/6] feat: add shared style utilities and wire global styles --- apps/web/src/main.tsx | 9 +- apps/web/src/styles.css | 19 --- apps/web/src/styles/utilities.css | 205 ++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 20 deletions(-) delete mode 100644 apps/web/src/styles.css create mode 100644 apps/web/src/styles/utilities.css diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index 2d61927..df4c45f 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -1,8 +1,15 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; + + +import "./styles/layers.css" +import "./styles/resets.css" +import "./styles/tokens.css" +import "./styles/base.css" +import "./styles/utilities.css" + import { App } from './App'; -import './styles.css'; createRoot(document.getElementById('root')!).render( diff --git a/apps/web/src/styles.css b/apps/web/src/styles.css deleted file mode 100644 index 837c4bb..0000000 --- a/apps/web/src/styles.css +++ /dev/null @@ -1,19 +0,0 @@ -:root { - font-family: system-ui; - color-scheme: light dark; -} -body { - margin: 0; -} -header, -nav { - display: flex; - gap: 1rem; -} -header, -main { - padding: 1rem; -} -a { - color: inherit; -} diff --git a/apps/web/src/styles/utilities.css b/apps/web/src/styles/utilities.css new file mode 100644 index 0000000..1322e36 --- /dev/null +++ b/apps/web/src/styles/utilities.css @@ -0,0 +1,205 @@ +@layer utilities { + /* Page container */ + .container { + width: 100%; + max-width: var(--container-max-width); + margin-inline: auto; + padding-inline: var(--page-padding-inline); + } + + /* Display */ + .block { + display: block; + } + + .flex { + display: flex; + } + + .inline-flex { + display: inline-flex; + } + + .grid { + display: grid; + } + + .hidden { + display: none; + } + + /* Flex direction */ + .flex-row { + flex-direction: row; + } + + .flex-col { + flex-direction: column; + } + + .flex-wrap { + flex-wrap: wrap; + } + + /* Flex behavior */ + .flex-1 { + flex: 1 1 0%; + } + + .shrink-0 { + flex-shrink: 0; + } + + .grow { + flex-grow: 1; + } + + /* Alignment */ + .items-start { + align-items: flex-start; + } + + .items-center { + align-items: center; + } + + .items-end { + align-items: flex-end; + } + + .justify-start { + justify-content: flex-start; + } + + .justify-center { + justify-content: center; + } + + .justify-between { + justify-content: space-between; + } + + .justify-end { + justify-content: flex-end; + } + + /* Gaps */ + .gap-1 { + gap: var(--space-1); + } + + .gap-2 { + gap: var(--space-2); + } + + .gap-3 { + gap: var(--space-3); + } + + .gap-4 { + gap: var(--space-4); + } + + .gap-6 { + gap: var(--space-6); + } + + .gap-8 { + gap: var(--space-8); + } + + .gap-10 { + gap: var(--space-10) + } + + .gap-12 { + gap: var(--space-12) + } + + .gap-16 { + gap: var(--space-16) + } + + /* Sizing */ + .w-full { + width: 100%; + } + + .h-full { + height: 100%; + } + + .min-w-0 { + min-width: 0; + } + + .min-h-0 { + min-height: 0; + } + + /* Overflow */ + .overflow-hidden { + overflow: hidden; + } + + .overflow-auto { + overflow: auto; + } + + /* Text alignment */ + .text-left { + text-align: left; + } + + .text-center { + text-align: center; + } + + .text-right { + text-align: right; + } + + /* Text colors */ + .text-default { + color: var(--color-text-primary); + } + + .text-secondary { + color: var(--color-text-secondary); + } + + .text-muted { + color: var(--color-text-muted); + } + + .text-accent { + color: var(--color-text-accent); + } + + /* Font weights */ + .font-medium { + font-weight: var(--font-weight-medium); + } + + .font-semibold { + font-weight: var(--font-weight-semibold); + } + + .font-bold { + font-weight: var(--font-weight-bold); + } + + /* Accessibility */ + .sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + white-space: nowrap; + border: 0; + clip: rect(0, 0, 0, 0); + clip-path: inset(50%); + } +} \ No newline at end of file From 7d80b462e943075e1baf06d613f065cb15c3737e Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 12:41:17 +0200 Subject: [PATCH 4/6] test: add visual style verification pages --- .../styles/style_tests/ColorAndStateTest.tsx | 525 +++++++++++++ .../style_tests/FoundationStressTest.tsx | 698 ++++++++++++++++++ .../style_tests/LayoutUtilitiesTest.tsx | 393 ++++++++++ .../src/styles/style_tests/StyleTestSuite.tsx | 18 + .../src/styles/style_tests/TypographyTest.tsx | 252 +++++++ 5 files changed, 1886 insertions(+) create mode 100644 apps/web/src/styles/style_tests/ColorAndStateTest.tsx create mode 100644 apps/web/src/styles/style_tests/FoundationStressTest.tsx create mode 100644 apps/web/src/styles/style_tests/LayoutUtilitiesTest.tsx create mode 100644 apps/web/src/styles/style_tests/StyleTestSuite.tsx create mode 100644 apps/web/src/styles/style_tests/TypographyTest.tsx diff --git a/apps/web/src/styles/style_tests/ColorAndStateTest.tsx b/apps/web/src/styles/style_tests/ColorAndStateTest.tsx new file mode 100644 index 0000000..136d487 --- /dev/null +++ b/apps/web/src/styles/style_tests/ColorAndStateTest.tsx @@ -0,0 +1,525 @@ +const palette = [ + { + name: "Brand Primary", + token: "--color-brand-primary", + }, + { + name: "Brand Primary Hover", + token: "--color-brand-primary-hover", + }, + { + name: "Brand Primary Active", + token: "--color-brand-primary-active", + }, + { + name: "Brand Accent Soft", + token: "--color-brand-accent-soft", + }, + { + name: "Page Background", + token: "--color-bg-page", + }, + { + name: "Subtle Background", + token: "--color-bg-subtle", + }, + { + name: "Surface", + token: "--color-surface", + }, + { + name: "Raised Surface", + token: "--color-surface-raised", + }, + { + name: "Muted Surface", + token: "--color-surface-muted", + }, +]; + +const interactiveStates = [ + { + name: "Hover", + token: "--color-surface-hover", + }, + { + name: "Selected", + token: "--color-surface-selected", + }, + { + name: "Pressed", + token: "--color-surface-pressed", + }, +]; + +const feedbackStates = [ + { + name: "Success", + color: "--color-feedback-success", + surface: "--color-feedback-success-surface", + border: "--color-feedback-success-border", + }, + { + name: "Warning", + color: "--color-feedback-warning", + surface: "--color-feedback-warning-surface", + border: "--color-feedback-warning-border", + }, + { + name: "Error", + color: "--color-feedback-error", + surface: "--color-feedback-error-surface", + border: "--color-feedback-error-border", + }, + { + name: "Info", + color: "--color-feedback-info", + surface: "--color-feedback-info-surface", + border: "--color-feedback-info-border", + }, +]; + +const borders = [ + { + name: "Subtle", + token: "--color-border-subtle", + }, + { + name: "Default", + token: "--color-border-default", + }, + { + name: "Strong", + token: "--color-border-strong", + }, + { + name: "Divider", + token: "--color-border-divider", + }, + { + name: "Input", + token: "--color-border-input", + }, + { + name: "Input Hover", + token: "--color-border-input-hover", + }, +]; + +function ColorAndStateTest() { + return ( +
+
+
+

Color & State Test

+ +

+ Tests the application palette, semantic states, borders, focus, + disabled colors, and common text/background combinations. +

+
+ + {/* Core palette */} +
+

Core Palette

+ +
+ {palette.map(({ name, token }) => ( +
+
+ +
+ {name} + {token} +
+
+ ))} +
+
+ +
+ + {/* Common text pairings */} +
+

Text & Surface Pairings

+ +

+ These combinations are closer to how colors will actually appear + in the interface. +

+ +
+
+ Page background +

Primary text

+

Secondary text

+

Muted text

+
+ +
+ Standard surface +

Primary text

+

Secondary text

+

Muted text

+
+ +
+ Raised surface +

Primary text

+

Secondary text

+

Muted text

+
+
+
+ + {/* Brand contrast */} +
+

Brand Contrast

+ +

+ Inspect inverse text carefully here, especially at smaller text + sizes. +

+ +
+

Primary Brand Surface

+ +

+ This is ordinary inverse body text displayed against the primary + brand color. +

+ + + This smaller text makes insufficient contrast easier to notice. + +
+
+ +
+ + {/* Interactive states */} +
+

Interactive Surfaces

+ +
+ {interactiveStates.map(({ name, token }) => ( +
+ {name} + {token} +
+ ))} +
+
+ + {/* Feedback */} +
+

Feedback States

+ +
+ {feedbackStates.map(({ name, color, surface, border }) => ( +
+ {name} + +

+ This is an example {name.toLowerCase()} message with normal + body text. +

+ + + Check the text, surface, and border as a complete state. + +
+ ))} +
+
+ + {/* Borders */} +
+

Borders & Outlines

+ +
+ {borders.map(({ name, token }) => ( +
+ {name} + {token} +
+ ))} + +
+ Soft outline + --color-outline-soft +
+ +
+ Strong outline + --color-outline-strong +
+
+
+ + {/* Icons */} +
+

Icon Colors

+ +
+ + + + + + + +
+
+ + {/* Disabled */} +
+

Disabled State

+ +
+ Disabled example +
+
+ + {/* Focus */} +
+

Keyboard Focus

+ +

+ Use Tab rather than clicking so that the global{" "} + :focus-visible treatment appears. +

+ +
+ + + + + Focusable link +
+ +
+ Focus ring token + --color-focus-ring +
+
+
+
+ ); +} + +function IconSample({ + label, + color, +}: { + label: string; + color: string; +}) { + return ( +
+ + + {label} +
+ ); +} + +export default ColorAndStateTest; \ No newline at end of file diff --git a/apps/web/src/styles/style_tests/FoundationStressTest.tsx b/apps/web/src/styles/style_tests/FoundationStressTest.tsx new file mode 100644 index 0000000..8a4f17d --- /dev/null +++ b/apps/web/src/styles/style_tests/FoundationStressTest.tsx @@ -0,0 +1,698 @@ +import { useState, type CSSProperties } from "react"; + +const panelStyle: CSSProperties = { + padding: "var(--space-4)", + backgroundColor: "var(--color-surface)", + border: "var(--border-width-thin) solid var(--color-border-default)", + borderRadius: "var(--radius-md)", +}; + +function FoundationStressTest() { + const [moved, setMoved] = useState(false); + + return ( +
+
+
+

Foundation Stress Test

+ +

+ Tests responsive behavior, reset edge cases, token scales, native + controls, layering, and motion. +

+ +

+ Resize from a narrow mobile viewport to a wide desktop while + reviewing this page. +

+
+ + {/* Responsive typography */} +
+

Responsive Foundation

+ +

+ Large type and page padding use clamp(). They should + scale smoothly without becoming too small or too large. +

+ +
+
+ 2XL responsive text +
+ +
+ 3XL responsive text +
+ +
+ 4XL responsive text +
+
+ +
+ This box should remain inside the responsive page container at all + viewport widths. +
+
+ +
+ + {/* Responsive media */} +
+

Responsive Media

+ +

+ The image is much wider than the page and should scale down without + overflowing. +

+ +
+ Orange responsive media test +
+ +
+

SVG as a UI icon

+ +

+ Unlike responsive media, a UI icon normally keeps its intended + size rather than shrinking with surrounding flex content. +

+ +
+ + + + + + +

+ This icon should stay the same size even when the viewport + becomes narrow. +

+
+
+
+ +
+ + {/* Text overflow */} +
+

Extreme Text Wrapping

+ +
+

+ This ordinary sentence should wrap naturally inside a narrow + container. +

+ +

+ extraordinarilylongcontinuousstringdesignedtotestwhethertheresetpreventstextfromoverflowingitscontainer +

+
+
+ +
+ + {/* Native controls */} +
+

Native Controls

+ +

+ These are intentionally mostly unstyled. They should inherit the + global font and text color without the reset breaking native + behavior. +

+ +
+ + + + + + + +