feat: Add complete Agentic Compaction & Pipeline System

- Context Compaction System with token counting and summarization
- Deterministic State Machine for flow control (no LLM decisions)
- Parallel Execution Engine (up to 12 concurrent sessions)
- Event-Driven Coordination via Event Bus
- Agent Workspace Isolation (tools, memory, identity, files)
- YAML Workflow Integration (OpenClaw/Lobster compatible)
- Claude Code integration layer
- Complete demo UI with real-time visualization
- Comprehensive documentation and README

Components:
- agent-system/: Context management, token counting, subagent spawning
- pipeline-system/: State machine, parallel executor, event bus, workflows
- skills/: AI capabilities (LLM, ASR, TTS, VLM, image generation, etc.)
- src/app/: Next.js demo application

Total: ~100KB of production-ready TypeScript code
This commit is contained in:
Z User
2026-03-03 12:40:47 +00:00
Unverified
parent 63a8b123c9
commit 2380d33861
152 changed files with 51569 additions and 817 deletions

View File

@@ -0,0 +1,842 @@
/**
* Component Styles — Production-Ready UI Components
*
* This file provides complete component implementations using the design token system.
* All components include full state coverage and accessibility features.
*
* Location: {project_path}/skills/frontend-design/examples/css/components.css
*
* Dependencies: tokens.css must be imported first
*/
/* Import design tokens */
@import './tokens.css';
/* ============================================
BUTTONS
============================================ */
/* Base button styles */
.btn {
/* Layout */
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--spacing-2);
/* Sizing */
height: var(--button-height-md);
padding-inline: var(--spacing-6);
/* Typography */
font-size: var(--font-size-base);
font-weight: var(--font-weight-medium);
line-height: 1;
text-decoration: none;
white-space: nowrap;
/* Appearance */
border: 1px solid transparent;
border-radius: var(--radius-sm);
cursor: pointer;
user-select: none;
/* Transitions */
transition: var(--transition-colors), var(--transition-transform);
/* Accessibility */
position: relative;
}
.btn:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
}
/* Primary button */
.btn-primary {
background-color: var(--primary);
color: var(--primary-foreground);
box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
background-color: var(--primary-hover);
box-shadow: var(--shadow-md);
}
.btn-primary:active:not(:disabled) {
background-color: var(--primary-active);
transform: translateY(1px);
box-shadow: var(--shadow-xs);
}
/* Secondary button */
.btn-secondary {
background-color: var(--secondary);
color: var(--secondary-foreground);
box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
background-color: var(--secondary-hover);
}
.btn-secondary:active:not(:disabled) {
background-color: var(--secondary-active);
transform: translateY(1px);
}
/* Outline button */
.btn-outline {
background-color: transparent;
color: var(--text);
border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
background-color: var(--surface-hover);
border-color: var(--border-strong);
}
.btn-outline:active:not(:disabled) {
background-color: var(--surface-subtle);
}
/* Ghost button */
.btn-ghost {
background-color: transparent;
color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
background-color: var(--surface-hover);
}
.btn-ghost:active:not(:disabled) {
background-color: var(--surface-subtle);
}
/* Danger button */
.btn-danger {
background-color: var(--danger);
color: var(--danger-foreground);
}
.btn-danger:hover:not(:disabled) {
background-color: oklch(from var(--danger) calc(l - 0.05) c h);
}
/* Button sizes */
.btn-sm {
height: var(--button-height-sm);
padding-inline: var(--spacing-4);
font-size: var(--font-size-sm);
}
.btn-lg {
height: var(--button-height-lg);
padding-inline: var(--spacing-8);
font-size: var(--font-size-lg);
}
/* Icon-only button */
.btn-icon {
padding: 0;
width: var(--button-height-md);
}
.btn-icon.btn-sm {
width: var(--button-height-sm);
}
.btn-icon.btn-lg {
width: var(--button-height-lg);
}
/* Disabled state */
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
/* Loading state */
.btn-loading {
position: relative;
color: transparent;
pointer-events: none;
}
.btn-loading::after {
content: '';
position: absolute;
width: 1rem;
height: 1rem;
border: 2px solid currentColor;
border-right-color: transparent;
border-radius: var(--radius-full);
animation: spin 0.6s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* ============================================
INPUTS & FORMS
============================================ */
/* Input base */
.input {
/* Layout */
display: flex;
width: 100%;
height: var(--input-height-md);
padding-inline: var(--spacing-4);
/* Typography */
font-size: var(--font-size-base);
line-height: 1.5;
color: var(--text);
/* Appearance */
background-color: var(--background);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
/* Transitions */
transition: var(--transition-colors), border-color var(--duration-fast) var(--ease-out);
}
.input::placeholder {
color: var(--text-muted);
}
.input:hover:not(:disabled):not(:focus) {
border-color: var(--border-strong);
}
.input:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px var(--primary-subtle);
}
.input:disabled {
opacity: 0.5;
cursor: not-allowed;
background-color: var(--surface-subtle);
}
/* Input with error */
.input-error {
border-color: var(--danger);
}
.input-error:focus {
border-color: var(--danger);
box-shadow: 0 0 0 3px var(--danger-subtle);
}
/* Input sizes */
.input-sm {
height: var(--input-height-sm);
padding-inline: var(--spacing-3);
font-size: var(--font-size-sm);
}
.input-lg {
height: var(--input-height-lg);
padding-inline: var(--spacing-6);
font-size: var(--font-size-lg);
}
/* Textarea */
.textarea {
min-height: 5rem;
padding-block: var(--spacing-3);
resize: vertical;
}
/* Label */
.label {
display: block;
font-size: var(--font-size-sm);
font-weight: var(--font-weight-medium);
color: var(--text);
margin-bottom: var(--spacing-2);
}
.label-required::after {
content: ' *';
color: var(--danger);
}
/* Helper text */
.helper-text {
display: block;
font-size: var(--font-size-sm);
color: var(--text-muted);
margin-top: var(--spacing-1-5);
}
.helper-text-error {
color: var(--danger);
}
/* Form group */
.form-group {
margin-bottom: var(--spacing-6);
}
/* Select */
.select {
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M4.5 6L8 9.5L11.5 6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right var(--spacing-3) center;
padding-right: var(--spacing-10);
}
/* Checkbox & Radio */
.checkbox,
.radio {
appearance: none;
width: 1.25rem;
height: 1.25rem;
border: 2px solid var(--border);
border-radius: var(--radius-xs);
background-color: var(--background);
cursor: pointer;
position: relative;
transition: var(--transition-colors);
}
.radio {
border-radius: var(--radius-full);
}
.checkbox:checked,
.radio:checked {
background-color: var(--primary);
border-color: var(--primary);
}
.checkbox:checked::after {
content: '';
position: absolute;
top: 2px;
left: 5px;
width: 4px;
height: 8px;
border: 2px solid white;
border-top: 0;
border-left: 0;
transform: rotate(45deg);
}
.radio:checked::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 8px;
height: 8px;
background-color: white;
border-radius: var(--radius-full);
}
/* ============================================
CARDS
============================================ */
.card {
background-color: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: var(--spacing-6);
box-shadow: var(--shadow-sm);
transition: var(--transition-all);
}
.card:hover {
box-shadow: var(--shadow-md);
border-color: var(--border-strong);
}
.card-header {
margin-bottom: var(--spacing-4);
padding-bottom: var(--spacing-4);
border-bottom: 1px solid var(--border-subtle);
}
.card-title {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-semibold);
color: var(--text);
margin: 0;
}
.card-description {
font-size: var(--font-size-sm);
color: var(--text-secondary);
margin-top: var(--spacing-2);
}
.card-body {
color: var(--text);
}
.card-footer {
margin-top: var(--spacing-4);
padding-top: var(--spacing-4);
border-top: 1px solid var(--border-subtle);
display: flex;
gap: var(--spacing-3);
}
/* Card variants */
.card-interactive {
cursor: pointer;
}
.card-interactive:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-lg);
}
.card-interactive:active {
transform: translateY(0);
box-shadow: var(--shadow-sm);
}
/* ============================================
BADGES & TAGS
============================================ */
.badge {
display: inline-flex;
align-items: center;
gap: var(--spacing-1);
padding: var(--spacing-0-5) var(--spacing-2);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-medium);
line-height: 1;
border-radius: var(--radius-xs);
white-space: nowrap;
}
.badge-primary {
background-color: var(--primary-subtle);
color: var(--primary);
}
.badge-secondary {
background-color: var(--secondary-subtle);
color: var(--secondary);
}
.badge-success {
background-color: var(--success-subtle);
color: var(--success);
}
.badge-warning {
background-color: var(--warning-subtle);
color: var(--warning);
}
.badge-danger {
background-color: var(--danger-subtle);
color: var(--danger);
}
.badge-outline {
background-color: transparent;
border: 1px solid var(--border);
color: var(--text);
}
/* ============================================
ALERTS
============================================ */
.alert {
padding: var(--spacing-4);
border-radius: var(--radius-md);
border: 1px solid transparent;
display: flex;
gap: var(--spacing-3);
}
.alert-icon {
flex-shrink: 0;
width: var(--icon-lg);
height: var(--icon-lg);
}
.alert-content {
flex: 1;
}
.alert-title {
font-weight: var(--font-weight-semibold);
margin-bottom: var(--spacing-1);
}
.alert-description {
font-size: var(--font-size-sm);
opacity: 0.9;
}
.alert-info {
background-color: var(--info-subtle);
color: var(--info);
border-color: var(--info);
}
.alert-success {
background-color: var(--success-subtle);
color: var(--success);
border-color: var(--success);
}
.alert-warning {
background-color: var(--warning-subtle);
color: var(--warning);
border-color: var(--warning);
}
.alert-danger {
background-color: var(--danger-subtle);
color: var(--danger);
border-color: var(--danger);
}
/* ============================================
MODALS
============================================ */
.modal-overlay {
position: fixed;
inset: 0;
background-color: var(--overlay);
display: flex;
align-items: center;
justify-content: center;
padding: var(--spacing-4);
z-index: var(--z-modal-backdrop);
animation: fade-in var(--duration-base) var(--ease-out);
}
.modal {
background-color: var(--surface);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-2xl);
max-width: 32rem;
width: 100%;
max-height: 90vh;
overflow: auto;
animation: modal-enter var(--duration-base) var(--ease-out);
z-index: var(--z-modal);
}
.modal-header {
padding: var(--spacing-6);
border-bottom: 1px solid var(--border-subtle);
display: flex;
align-items: center;
justify-content: space-between;
}
.modal-title {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-semibold);
color: var(--text);
margin: 0;
}
.modal-close {
background: transparent;
border: none;
padding: var(--spacing-2);
cursor: pointer;
color: var(--text-muted);
border-radius: var(--radius-sm);
transition: var(--transition-colors);
}
.modal-close:hover {
background-color: var(--surface-hover);
color: var(--text);
}
.modal-body {
padding: var(--spacing-6);
}
.modal-footer {
padding: var(--spacing-6);
border-top: 1px solid var(--border-subtle);
display: flex;
gap: var(--spacing-3);
justify-content: flex-end;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes modal-enter {
from {
opacity: 0;
transform: translateY(-1rem) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* ============================================
TOOLTIPS
============================================ */
.tooltip {
position: relative;
display: inline-block;
}
.tooltip-content {
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%) translateY(-0.5rem);
padding: var(--spacing-2) var(--spacing-3);
background-color: var(--text);
color: var(--text-inverse);
font-size: var(--font-size-sm);
border-radius: var(--radius-sm);
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: var(--transition-opacity);
z-index: var(--z-tooltip);
}
.tooltip:hover .tooltip-content {
opacity: 1;
}
.tooltip-content::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 4px solid transparent;
border-top-color: var(--text);
}
/* ============================================
LOADING SKELETON
============================================ */
.skeleton {
background: linear-gradient(
90deg,
var(--surface-subtle) 0%,
var(--surface-hover) 50%,
var(--surface-subtle) 100%
);
background-size: 200% 100%;
animation: shimmer 1.5s ease-in-out infinite;
border-radius: var(--radius-sm);
}
.skeleton-text {
height: 1em;
margin-bottom: var(--spacing-2);
}
.skeleton-title {
height: 1.5em;
width: 60%;
margin-bottom: var(--spacing-3);
}
.skeleton-avatar {
width: var(--avatar-md);
height: var(--avatar-md);
border-radius: var(--radius-full);
}
.skeleton-card {
height: 12rem;
border-radius: var(--radius-lg);
}
@keyframes shimmer {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
/* ============================================
AVATARS
============================================ */
.avatar {
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--avatar-md);
height: var(--avatar-md);
border-radius: var(--radius-full);
overflow: hidden;
background-color: var(--surface-subtle);
color: var(--text);
font-weight: var(--font-weight-medium);
}
.avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.avatar-sm {
width: var(--avatar-sm);
height: var(--avatar-sm);
font-size: var(--font-size-sm);
}
.avatar-lg {
width: var(--avatar-lg);
height: var(--avatar-lg);
font-size: var(--font-size-xl);
}
/* ============================================
EMPTY STATES
============================================ */
.empty-state {
text-align: center;
padding: var(--spacing-16) var(--spacing-8);
}
.empty-state-icon {
width: var(--spacing-16);
height: var(--spacing-16);
margin: 0 auto var(--spacing-6);
color: var(--text-muted);
}
.empty-state-title {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-semibold);
color: var(--text);
margin-bottom: var(--spacing-2);
}
.empty-state-description {
font-size: var(--font-size-base);
color: var(--text-secondary);
margin-bottom: var(--spacing-6);
max-width: 28rem;
margin-left: auto;
margin-right: auto;
}
.empty-state-action {
margin-top: var(--spacing-6);
}
/* ============================================
ERROR STATES
============================================ */
.error-state {
text-align: center;
padding: var(--spacing-12) var(--spacing-8);
background-color: var(--danger-subtle);
border-radius: var(--radius-lg);
border: 1px solid var(--danger);
}
.error-state-icon {
width: var(--spacing-12);
height: var(--spacing-12);
margin: 0 auto var(--spacing-4);
color: var(--danger);
}
.error-state-title {
font-size: var(--font-size-lg);
font-weight: var(--font-weight-semibold);
color: var(--danger);
margin-bottom: var(--spacing-2);
}
.error-state-message {
font-size: var(--font-size-base);
color: var(--text);
margin-bottom: var(--spacing-4);
}
.error-state-actions {
display: flex;
gap: var(--spacing-3);
justify-content: center;
margin-top: var(--spacing-4);
}
/* ============================================
RESPONSIVE UTILITIES
============================================ */
/* Hide on mobile */
@media (max-width: 767px) {
.hide-mobile {
display: none !important;
}
}
/* Hide on tablet and up */
@media (min-width: 768px) {
.hide-tablet {
display: none !important;
}
}
/* Hide on desktop */
@media (min-width: 1024px) {
.hide-desktop {
display: none !important;
}
}

View File

@@ -0,0 +1,525 @@
/**
* Design Tokens — Complete CSS Custom Properties System
*
* This file provides a comprehensive design token system for consistent UI development.
* It includes semantic color slots, typography scales, spacing, radius, shadows, and motion.
*
* Usage:
* 1. Import this file in your globals.css: @import './tokens.css';
* 2. Reference tokens using var(--token-name)
* 3. Override in [data-theme="dark"] for dark mode
*
* Location: {project_path}/skills/frontend-design/examples/css/tokens.css
*/
/* ============================================
COLOR SYSTEM - Semantic Tokens
============================================ */
:root {
/* Background & Surfaces */
--background: oklch(99% 0 0); /* Main page background */
--surface: oklch(100% 0 0); /* Card/panel background */
--surface-subtle: oklch(98% 0.005 250); /* Subtle surface variant */
--surface-hover: oklch(97% 0.01 250); /* Hover state for surfaces */
/* Text Colors */
--text: oklch(20% 0.01 250); /* Primary text */
--text-secondary: oklch(45% 0.015 250); /* Secondary text */
--text-muted: oklch(60% 0.01 250); /* Muted/helper text */
--text-inverse: oklch(98% 0 0); /* Text on dark backgrounds */
/* Borders */
--border: oklch(90% 0.005 250); /* Standard borders */
--border-subtle: oklch(95% 0.003 250); /* Subtle dividers */
--border-strong: oklch(75% 0.01 250); /* Emphasized borders */
/* Primary Brand */
--primary: oklch(55% 0.18 250); /* Primary brand color */
--primary-hover: oklch(50% 0.20 250); /* Primary hover state */
--primary-active: oklch(45% 0.22 250); /* Primary active/pressed */
--primary-subtle: oklch(95% 0.03 250); /* Primary tint background */
--primary-muted: oklch(85% 0.08 250); /* Primary muted variant */
--primary-foreground: oklch(98% 0.01 250); /* Text on primary */
/* Secondary */
--secondary: oklch(65% 0.08 280); /* Secondary accent */
--secondary-hover: oklch(60% 0.10 280); /* Secondary hover */
--secondary-active: oklch(55% 0.12 280); /* Secondary active */
--secondary-subtle: oklch(95% 0.02 280); /* Secondary tint */
--secondary-foreground: oklch(98% 0.01 280); /* Text on secondary */
/* Accent */
--accent: oklch(70% 0.15 160); /* Accent highlights */
--accent-hover: oklch(65% 0.17 160); /* Accent hover */
--accent-foreground: oklch(10% 0.01 160); /* Text on accent */
/* Semantic Colors */
--success: oklch(65% 0.15 145); /* Success states */
--success-subtle: oklch(95% 0.03 145); /* Success background */
--success-foreground: oklch(98% 0.01 145); /* Text on success */
--warning: oklch(75% 0.15 85); /* Warning states */
--warning-subtle: oklch(95% 0.05 85); /* Warning background */
--warning-foreground: oklch(15% 0.02 85); /* Text on warning */
--danger: oklch(60% 0.20 25); /* Error/danger states */
--danger-subtle: oklch(95% 0.04 25); /* Error background */
--danger-foreground: oklch(98% 0.01 25); /* Text on danger */
--info: oklch(65% 0.12 230); /* Info states */
--info-subtle: oklch(95% 0.02 230); /* Info background */
--info-foreground: oklch(98% 0.01 230); /* Text on info */
/* Overlays & Scrim */
--overlay: oklch(0% 0 0 / 0.5); /* Modal overlay */
--scrim: oklch(0% 0 0 / 0.3); /* Backdrop scrim */
}
/* Dark Mode Color Adjustments */
[data-theme="dark"] {
/* Background & Surfaces */
--background: oklch(15% 0.01 250);
--surface: oklch(20% 0.015 250);
--surface-subtle: oklch(25% 0.02 250);
--surface-hover: oklch(30% 0.025 250);
/* Text Colors */
--text: oklch(95% 0.01 250);
--text-secondary: oklch(70% 0.015 250);
--text-muted: oklch(55% 0.01 250);
--text-inverse: oklch(15% 0 0);
/* Borders */
--border: oklch(35% 0.01 250);
--border-subtle: oklch(25% 0.005 250);
--border-strong: oklch(50% 0.015 250);
/* Primary Brand (adjusted for dark) */
--primary: oklch(65% 0.18 250);
--primary-hover: oklch(70% 0.20 250);
--primary-active: oklch(75% 0.22 250);
--primary-subtle: oklch(25% 0.08 250);
--primary-muted: oklch(35% 0.12 250);
--primary-foreground: oklch(10% 0.01 250);
/* Secondary */
--secondary: oklch(70% 0.08 280);
--secondary-hover: oklch(75% 0.10 280);
--secondary-active: oklch(80% 0.12 280);
--secondary-subtle: oklch(25% 0.04 280);
--secondary-foreground: oklch(10% 0.01 280);
/* Accent */
--accent: oklch(75% 0.15 160);
--accent-hover: oklch(80% 0.17 160);
--accent-foreground: oklch(10% 0.01 160);
/* Semantic Colors (adjusted) */
--success: oklch(70% 0.15 145);
--success-subtle: oklch(22% 0.06 145);
--warning: oklch(80% 0.15 85);
--warning-subtle: oklch(25% 0.08 85);
--danger: oklch(65% 0.20 25);
--danger-subtle: oklch(22% 0.08 25);
--info: oklch(70% 0.12 230);
--info-subtle: oklch(22% 0.05 230);
/* Overlays */
--overlay: oklch(0% 0 0 / 0.7);
--scrim: oklch(0% 0 0 / 0.5);
}
/* ============================================
TYPOGRAPHY SCALE
============================================ */
:root {
/* Font Families */
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
--font-serif: 'Merriweather', Georgia, serif;
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
/* Font Sizes - Using clamp() for fluid typography */
--font-size-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.875rem); /* 12-14px */
--font-size-sm: clamp(0.875rem, 0.8rem + 0.2vw, 1rem); /* 14-16px */
--font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem); /* 16-18px */
--font-size-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem); /* 18-20px */
--font-size-xl: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem); /* 20-24px */
--font-size-2xl: clamp(1.5rem, 1.35rem + 0.6vw, 2rem); /* 24-32px */
--font-size-3xl: clamp(1.875rem, 1.65rem + 0.9vw, 2.5rem); /* 30-40px */
--font-size-4xl: clamp(2.25rem, 1.95rem + 1.2vw, 3.5rem); /* 36-56px */
--font-size-5xl: clamp(3rem, 2.5rem + 2vw, 4.5rem); /* 48-72px */
/* Line Heights */
--line-height-none: 1;
--line-height-tight: 1.25;
--line-height-snug: 1.375;
--line-height-normal: 1.5;
--line-height-relaxed: 1.625;
--line-height-loose: 2;
/* Font Weights */
--font-weight-light: 300;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
/* Letter Spacing */
--letter-spacing-tighter: -0.05em;
--letter-spacing-tight: -0.025em;
--letter-spacing-normal: 0;
--letter-spacing-wide: 0.025em;
--letter-spacing-wider: 0.05em;
--letter-spacing-widest: 0.1em;
}
/* Typography Presets */
.text-display {
font-size: var(--font-size-5xl);
line-height: var(--line-height-tight);
font-weight: var(--font-weight-extrabold);
letter-spacing: var(--letter-spacing-tighter);
}
.text-h1 {
font-size: var(--font-size-4xl);
line-height: var(--line-height-tight);
font-weight: var(--font-weight-bold);
letter-spacing: var(--letter-spacing-tight);
}
.text-h2 {
font-size: var(--font-size-3xl);
line-height: var(--line-height-snug);
font-weight: var(--font-weight-bold);
}
.text-h3 {
font-size: var(--font-size-2xl);
line-height: var(--line-height-snug);
font-weight: var(--font-weight-semibold);
}
.text-h4 {
font-size: var(--font-size-xl);
line-height: var(--line-height-normal);
font-weight: var(--font-weight-semibold);
}
.text-body {
font-size: var(--font-size-base);
line-height: var(--line-height-relaxed);
font-weight: var(--font-weight-normal);
}
.text-small {
font-size: var(--font-size-sm);
line-height: var(--line-height-normal);
font-weight: var(--font-weight-normal);
}
.text-caption {
font-size: var(--font-size-xs);
line-height: var(--line-height-normal);
font-weight: var(--font-weight-normal);
letter-spacing: var(--letter-spacing-wide);
}
/* ============================================
SPACING SCALE (8px System)
============================================ */
:root {
--spacing-0: 0;
--spacing-px: 1px;
--spacing-0-5: 0.125rem; /* 2px */
--spacing-1: 0.25rem; /* 4px */
--spacing-1-5: 0.375rem; /* 6px */
--spacing-2: 0.5rem; /* 8px */
--spacing-2-5: 0.625rem; /* 10px */
--spacing-3: 0.75rem; /* 12px */
--spacing-4: 1rem; /* 16px */
--spacing-5: 1.25rem; /* 20px */
--spacing-6: 1.5rem; /* 24px */
--spacing-7: 1.75rem; /* 28px */
--spacing-8: 2rem; /* 32px */
--spacing-9: 2.25rem; /* 36px */
--spacing-10: 2.5rem; /* 40px */
--spacing-12: 3rem; /* 48px */
--spacing-14: 3.5rem; /* 56px */
--spacing-16: 4rem; /* 64px */
--spacing-20: 5rem; /* 80px */
--spacing-24: 6rem; /* 96px */
--spacing-28: 7rem; /* 112px */
--spacing-32: 8rem; /* 128px */
--spacing-36: 9rem; /* 144px */
--spacing-40: 10rem; /* 160px */
--spacing-48: 12rem; /* 192px */
--spacing-56: 14rem; /* 224px */
--spacing-64: 16rem; /* 256px */
}
/* ============================================
BORDER RADIUS SCALE
============================================ */
:root {
--radius-none: 0;
--radius-xs: 0.125rem; /* 2px - badges, tags */
--radius-sm: 0.25rem; /* 4px - buttons, small inputs */
--radius-md: 0.375rem; /* 6px - inputs, cards */
--radius-lg: 0.5rem; /* 8px - large cards */
--radius-xl: 0.75rem; /* 12px - modals, panels */
--radius-2xl: 1rem; /* 16px - hero sections */
--radius-3xl: 1.5rem; /* 24px - special elements */
--radius-full: 9999px; /* Pills, avatars, circles */
}
/* ============================================
SHADOW SCALE
============================================ */
:root {
/* Light Mode Shadows */
--shadow-xs: 0 1px 2px 0 oklch(0% 0 0 / 0.05);
--shadow-sm: 0 1px 3px 0 oklch(0% 0 0 / 0.1),
0 1px 2px -1px oklch(0% 0 0 / 0.1);
--shadow-md: 0 4px 6px -1px oklch(0% 0 0 / 0.1),
0 2px 4px -2px oklch(0% 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px oklch(0% 0 0 / 0.1),
0 4px 6px -4px oklch(0% 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px oklch(0% 0 0 / 0.1),
0 8px 10px -6px oklch(0% 0 0 / 0.1);
--shadow-2xl: 0 25px 50px -12px oklch(0% 0 0 / 0.25);
/* Colored Shadows (for accents) */
--shadow-primary: 0 4px 12px -2px var(--primary),
0 2px 6px -2px var(--primary);
--shadow-secondary: 0 4px 12px -2px var(--secondary),
0 2px 6px -2px var(--secondary);
}
[data-theme="dark"] {
/* Stronger shadows for dark mode */
--shadow-xs: 0 1px 2px 0 oklch(0% 0 0 / 0.3);
--shadow-sm: 0 1px 3px 0 oklch(0% 0 0 / 0.4),
0 1px 2px -1px oklch(0% 0 0 / 0.3);
--shadow-md: 0 4px 6px -1px oklch(0% 0 0 / 0.4),
0 2px 4px -2px oklch(0% 0 0 / 0.3);
--shadow-lg: 0 10px 15px -3px oklch(0% 0 0 / 0.5),
0 4px 6px -4px oklch(0% 0 0 / 0.4);
--shadow-xl: 0 20px 25px -5px oklch(0% 0 0 / 0.5),
0 8px 10px -6px oklch(0% 0 0 / 0.4);
--shadow-2xl: 0 25px 50px -12px oklch(0% 0 0 / 0.6);
}
/* ============================================
MOTION TOKENS
============================================ */
:root {
/* Duration */
--duration-instant: 0ms;
--duration-fast: 150ms;
--duration-base: 220ms;
--duration-slow: 300ms;
--duration-slower: 400ms;
/* Easing Functions */
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
/* Common Transitions */
--transition-colors: color var(--duration-fast) var(--ease-out),
background-color var(--duration-fast) var(--ease-out),
border-color var(--duration-fast) var(--ease-out);
--transition-transform: transform var(--duration-base) var(--ease-out);
--transition-opacity: opacity var(--duration-base) var(--ease-out);
--transition-all: all var(--duration-base) var(--ease-in-out);
}
/* Respect Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
:root {
--duration-instant: 0ms;
--duration-fast: 0ms;
--duration-base: 0ms;
--duration-slow: 0ms;
--duration-slower: 0ms;
}
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* ============================================
LAYOUT & CONTAINER
============================================ */
:root {
/* Container widths */
--container-sm: 640px;
--container-md: 768px;
--container-lg: 1024px;
--container-xl: 1280px;
--container-2xl: 1536px;
/* Breakpoints (for reference in JS) */
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;
/* Z-index scale */
--z-base: 0;
--z-dropdown: 1000;
--z-sticky: 1100;
--z-fixed: 1200;
--z-modal-backdrop: 1300;
--z-modal: 1400;
--z-popover: 1500;
--z-tooltip: 1600;
--z-notification: 1700;
--z-max: 9999;
}
/* ============================================
COMPONENT DENSITY
============================================ */
:root {
/* Button heights */
--button-height-sm: 2.25rem; /* 36px */
--button-height-md: 2.75rem; /* 44px */
--button-height-lg: 3rem; /* 48px */
/* Input heights */
--input-height-sm: 2.25rem; /* 36px */
--input-height-md: 2.5rem; /* 40px */
--input-height-lg: 3rem; /* 48px */
/* Icon sizes */
--icon-xs: 0.75rem; /* 12px */
--icon-sm: 1rem; /* 16px */
--icon-md: 1.25rem; /* 20px */
--icon-lg: 1.5rem; /* 24px */
--icon-xl: 2rem; /* 32px */
--icon-2xl: 2.5rem; /* 40px */
/* Avatar sizes */
--avatar-xs: 1.5rem; /* 24px */
--avatar-sm: 2rem; /* 32px */
--avatar-md: 2.5rem; /* 40px */
--avatar-lg: 3rem; /* 48px */
--avatar-xl: 4rem; /* 64px */
--avatar-2xl: 6rem; /* 96px */
}
/* ============================================
FOCUS & ACCESSIBILITY
============================================ */
:root {
--focus-ring-width: 2px;
--focus-ring-offset: 2px;
--focus-ring-color: var(--primary);
}
/* Default focus style */
:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
border-radius: var(--radius-sm);
}
/* Remove default outline, apply custom */
*:focus {
outline: none;
}
*:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
}
/* ============================================
USAGE EXAMPLES
============================================ */
/*
Example 1: Button with tokens
.button {
height: var(--button-height-md);
padding-inline: var(--spacing-6);
background-color: var(--primary);
color: var(--primary-foreground);
border-radius: var(--radius-sm);
font-size: var(--font-size-base);
font-weight: var(--font-weight-medium);
transition: var(--transition-colors);
box-shadow: var(--shadow-sm);
}
.button:hover {
background-color: var(--primary-hover);
}
.button:active {
background-color: var(--primary-active);
transform: translateY(1px);
}
Example 2: Card with tokens
.card {
background-color: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: var(--spacing-6);
box-shadow: var(--shadow-sm);
transition: var(--transition-all);
}
.card:hover {
box-shadow: var(--shadow-md);
border-color: var(--border-strong);
}
Example 3: Typography with tokens
.heading {
font-size: var(--font-size-3xl);
line-height: var(--line-height-tight);
font-weight: var(--font-weight-bold);
color: var(--text);
margin-bottom: var(--spacing-4);
}
.paragraph {
font-size: var(--font-size-base);
line-height: var(--line-height-relaxed);
color: var(--text-secondary);
margin-bottom: var(--spacing-6);
}
*/