cfsa-antigravity 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +324 -0
- package/package.json +34 -0
- package/template/.agent/instructions/commands.md +48 -0
- package/template/.agent/instructions/patterns.md +61 -0
- package/template/.agent/instructions/structure.md +29 -0
- package/template/.agent/instructions/tech-stack.md +43 -0
- package/template/.agent/instructions/workflow.md +41 -0
- package/template/.agent/kit-sync.md +15 -0
- package/template/.agent/rules/boundary-not-placeholder.md +146 -0
- package/template/.agent/rules/completion-checklist.md +48 -0
- package/template/.agent/rules/decision-classification.md +103 -0
- package/template/.agent/rules/extensibility.md +47 -0
- package/template/.agent/rules/question-vs-command.md +81 -0
- package/template/.agent/rules/security-first.md +43 -0
- package/template/.agent/rules/specificity-standards.md +54 -0
- package/template/.agent/rules/tdd-contract-first.md +57 -0
- package/template/.agent/rules/vertical-slices.md +42 -0
- package/template/.agent/skill-library/MANIFEST.md +480 -0
- package/template/.agent/skill-library/README.md +38 -0
- package/template/.agent/skill-library/meta/brand-guidelines/SKILL.md +73 -0
- package/template/.agent/skill-library/meta/claude-code/README.md +9 -0
- package/template/.agent/skill-library/meta/claude-code/agent-development/SKILL.md +415 -0
- package/template/.agent/skill-library/meta/claude-code/hook-development/SKILL.md +712 -0
- package/template/.agent/skill-library/meta/claude-code/plugin-structure/SKILL.md +476 -0
- package/template/.agent/skill-library/meta/git-advanced/SKILL.md +972 -0
- package/template/.agent/skill-library/meta/mcp-builder/SKILL.md +236 -0
- package/template/.agent/skill-library/meta/product-marketing-context/SKILL.md +241 -0
- package/template/.agent/skill-library/meta/regex-patterns/SKILL.md +751 -0
- package/template/.agent/skill-library/meta/tmux-processes/SKILL.md +210 -0
- package/template/.agent/skill-library/meta/using-tmux-for-interactive-commands/SKILL.md +178 -0
- package/template/.agent/skill-library/stack/3d/threejs-pro/SKILL.md +300 -0
- package/template/.agent/skill-library/stack/ai/ai-sdk/SKILL.md +77 -0
- package/template/.agent/skill-library/stack/ai/langchain/SKILL.md +530 -0
- package/template/.agent/skill-library/stack/ai/ollama/SKILL.md +321 -0
- package/template/.agent/skill-library/stack/ai/openai-sdk/SKILL.md +549 -0
- package/template/.agent/skill-library/stack/analytics/google-analytics/SKILL.md +153 -0
- package/template/.agent/skill-library/stack/api/graphql/SKILL.md +1061 -0
- package/template/.agent/skill-library/stack/api/trpc/SKILL.md +576 -0
- package/template/.agent/skill-library/stack/auth/authjs/SKILL.md +569 -0
- package/template/.agent/skill-library/stack/auth/clerk/SKILL.md +590 -0
- package/template/.agent/skill-library/stack/auth/firebase-auth/SKILL.md +734 -0
- package/template/.agent/skill-library/stack/cms/payload-cms/SKILL.md +573 -0
- package/template/.agent/skill-library/stack/cms/shopify/SKILL.md +1193 -0
- package/template/.agent/skill-library/stack/cms/wordpress/SKILL.md +1104 -0
- package/template/.agent/skill-library/stack/css/sass-scss/SKILL.md +1121 -0
- package/template/.agent/skill-library/stack/css/tailwind-css-patterns/SKILL.md +863 -0
- package/template/.agent/skill-library/stack/css/tailwind-design-system/SKILL.md +490 -0
- package/template/.agent/skill-library/stack/css/vanilla-css/SKILL.md +1078 -0
- package/template/.agent/skill-library/stack/databases/clickhouse/SKILL.md +311 -0
- package/template/.agent/skill-library/stack/databases/influxdb/SKILL.md +280 -0
- package/template/.agent/skill-library/stack/databases/lancedb/SKILL.md +415 -0
- package/template/.agent/skill-library/stack/databases/mongodb/SKILL.md +1169 -0
- package/template/.agent/skill-library/stack/databases/neo4j/SKILL.md +839 -0
- package/template/.agent/skill-library/stack/databases/pgvector/SKILL.md +241 -0
- package/template/.agent/skill-library/stack/databases/pinecone/SKILL.md +212 -0
- package/template/.agent/skill-library/stack/databases/postgresql/SKILL.md +658 -0
- package/template/.agent/skill-library/stack/databases/qdrant/SKILL.md +312 -0
- package/template/.agent/skill-library/stack/databases/redis/SKILL.md +1079 -0
- package/template/.agent/skill-library/stack/databases/spacetimedb/SKILL.md +532 -0
- package/template/.agent/skill-library/stack/databases/sqlite/SKILL.md +1132 -0
- package/template/.agent/skill-library/stack/databases/supabase/SKILL.md +640 -0
- package/template/.agent/skill-library/stack/databases/surrealdb-expert/SKILL.md +945 -0
- package/template/.agent/skill-library/stack/databases/timescaledb/SKILL.md +745 -0
- package/template/.agent/skill-library/stack/databases/weaviate/SKILL.md +218 -0
- package/template/.agent/skill-library/stack/devops/github-actions/SKILL.md +554 -0
- package/template/.agent/skill-library/stack/devops/kubernetes/SKILL.md +950 -0
- package/template/.agent/skill-library/stack/devops/nginx/SKILL.md +841 -0
- package/template/.agent/skill-library/stack/devops/terraform/SKILL.md +860 -0
- package/template/.agent/skill-library/stack/email/resend/SKILL.md +391 -0
- package/template/.agent/skill-library/stack/engines/godot/SKILL.md +488 -0
- package/template/.agent/skill-library/stack/extensions/chrome-extension/SKILL.md +375 -0
- package/template/.agent/skill-library/stack/extensions/vscode-extension/SKILL.md +453 -0
- package/template/.agent/skill-library/stack/frameworks/astro-framework/SKILL.md +162 -0
- package/template/.agent/skill-library/stack/frameworks/electron/SKILL.md +1286 -0
- package/template/.agent/skill-library/stack/frameworks/fastapi/SKILL.md +650 -0
- package/template/.agent/skill-library/stack/frameworks/hono/SKILL.md +90 -0
- package/template/.agent/skill-library/stack/frameworks/nestjs/SKILL.md +878 -0
- package/template/.agent/skill-library/stack/frameworks/nextjs/SKILL.md +635 -0
- package/template/.agent/skill-library/stack/frameworks/nuxt/SKILL.md +564 -0
- package/template/.agent/skill-library/stack/frameworks/sveltekit/SKILL.md +614 -0
- package/template/.agent/skill-library/stack/frameworks/tauri/SKILL.md +920 -0
- package/template/.agent/skill-library/stack/gamedev/godot/SKILL.md +1032 -0
- package/template/.agent/skill-library/stack/gamedev/unity/SKILL.md +1175 -0
- package/template/.agent/skill-library/stack/hosting/aws/SKILL.md +467 -0
- package/template/.agent/skill-library/stack/hosting/cloudflare/SKILL.md +201 -0
- package/template/.agent/skill-library/stack/hosting/docker-expert/SKILL.md +409 -0
- package/template/.agent/skill-library/stack/hosting/vercel/SKILL.md +484 -0
- package/template/.agent/skill-library/stack/languages/bash-scripting/SKILL.md +773 -0
- package/template/.agent/skill-library/stack/languages/c-cpp/SKILL.md +712 -0
- package/template/.agent/skill-library/stack/languages/gdscript/SKILL.md +789 -0
- package/template/.agent/skill-library/stack/languages/go/SKILL.md +664 -0
- package/template/.agent/skill-library/stack/languages/java/SKILL.md +778 -0
- package/template/.agent/skill-library/stack/languages/kotlin/SKILL.md +665 -0
- package/template/.agent/skill-library/stack/languages/python/SKILL.md +678 -0
- package/template/.agent/skill-library/stack/languages/rust/SKILL.md +673 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/SKILL.md +141 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/advanced-generics.md +90 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/branded-types.md +57 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/builder-pattern.md +71 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/common-pitfalls.md +135 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/conditional-types.md +27 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/decorators.md +98 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/discriminated-unions.md +62 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/mapped-types.md +53 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/performance-best-practices.md +104 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/template-literal-types.md +49 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/testing-types.md +112 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/type-guards.md +70 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/type-inference.md +101 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/utility-types.md +98 -0
- package/template/.agent/skill-library/stack/languages/vanilla-javascript/SKILL.md +803 -0
- package/template/.agent/skill-library/stack/messaging/kafka/SKILL.md +235 -0
- package/template/.agent/skill-library/stack/mobile/expo-react-native/SKILL.md +665 -0
- package/template/.agent/skill-library/stack/mobile/flutter/SKILL.md +316 -0
- package/template/.agent/skill-library/stack/mobile/react-native/SKILL.md +337 -0
- package/template/.agent/skill-library/stack/monitoring/posthog/SKILL.md +396 -0
- package/template/.agent/skill-library/stack/monitoring/sentry/SKILL.md +509 -0
- package/template/.agent/skill-library/stack/observability/datadog/SKILL.md +179 -0
- package/template/.agent/skill-library/stack/observability/distributed-tracing/SKILL.md +140 -0
- package/template/.agent/skill-library/stack/observability/logging-best-practices/SKILL.md +168 -0
- package/template/.agent/skill-library/stack/observability/opentelemetry/SKILL.md +164 -0
- package/template/.agent/skill-library/stack/observability/prometheus-grafana/SKILL.md +246 -0
- package/template/.agent/skill-library/stack/observability/python-observability/SKILL.md +158 -0
- package/template/.agent/skill-library/stack/orm/drizzle-orm/SKILL.md +613 -0
- package/template/.agent/skill-library/stack/orm/prisma/SKILL.md +744 -0
- package/template/.agent/skill-library/stack/payments/lemonsqueezy/SKILL.md +393 -0
- package/template/.agent/skill-library/stack/payments/stripe-integration/SKILL.md +457 -0
- package/template/.agent/skill-library/stack/queue/bullmq/SKILL.md +385 -0
- package/template/.agent/skill-library/stack/queue/inngest/SKILL.md +438 -0
- package/template/.agent/skill-library/stack/realtime/socketio/SKILL.md +595 -0
- package/template/.agent/skill-library/stack/search/elasticsearch/SKILL.md +248 -0
- package/template/.agent/skill-library/stack/search/meilisearch/SKILL.md +385 -0
- package/template/.agent/skill-library/stack/security/crypto-patterns/SKILL.md +437 -0
- package/template/.agent/skill-library/stack/security/csp-cors-headers/SKILL.md +588 -0
- package/template/.agent/skill-library/stack/security/dependency-auditing/SKILL.md +560 -0
- package/template/.agent/skill-library/stack/security/input-sanitization/SKILL.md +430 -0
- package/template/.agent/skill-library/stack/security/owasp-web-security/SKILL.md +421 -0
- package/template/.agent/skill-library/stack/state/tanstack-query/SKILL.md +637 -0
- package/template/.agent/skill-library/stack/state/zustand/SKILL.md +483 -0
- package/template/.agent/skill-library/stack/storage/aws-s3/SKILL.md +415 -0
- package/template/.agent/skill-library/stack/testing/playwright/SKILL.md +641 -0
- package/template/.agent/skill-library/stack/testing/storybook/SKILL.md +923 -0
- package/template/.agent/skill-library/stack/testing/testing-library/SKILL.md +872 -0
- package/template/.agent/skill-library/stack/testing/vitest/SKILL.md +714 -0
- package/template/.agent/skill-library/stack/ui/react-best-practices/SKILL.md +877 -0
- package/template/.agent/skill-library/stack/ui/react-composition-patterns/SKILL.md +1107 -0
- package/template/.agent/skill-library/stack/ui/react-flow/SKILL.md +425 -0
- package/template/.agent/skill-library/stack/ui/shadcn-ui/SKILL.md +703 -0
- package/template/.agent/skill-library/surface/api/api-caching/SKILL.md +458 -0
- package/template/.agent/skill-library/surface/api/api-documentation-openapi/SKILL.md +697 -0
- package/template/.agent/skill-library/surface/api/api-error-handling/SKILL.md +478 -0
- package/template/.agent/skill-library/surface/api/api-security-checklist/SKILL.md +147 -0
- package/template/.agent/skill-library/surface/api/api-versioning/SKILL.md +420 -0
- package/template/.agent/skill-library/surface/api/email-best-practices/SKILL.md +59 -0
- package/template/.agent/skill-library/surface/api/rate-limiting-abuse-protection/SKILL.md +147 -0
- package/template/.agent/skill-library/surface/api/rest-api-design/SKILL.md +478 -0
- package/template/.agent/skill-library/surface/api/webhook-design/SKILL.md +752 -0
- package/template/.agent/skill-library/surface/cli/cli-configuration-management/SKILL.md +445 -0
- package/template/.agent/skill-library/surface/cli/cli-error-diagnostics/SKILL.md +515 -0
- package/template/.agent/skill-library/surface/cli/cli-shell-integration/SKILL.md +479 -0
- package/template/.agent/skill-library/surface/cli/cli-ux-design/SKILL.md +477 -0
- package/template/.agent/skill-library/surface/desktop/desktop-app-distribution/SKILL.md +416 -0
- package/template/.agent/skill-library/surface/desktop/desktop-security-sandboxing/SKILL.md +407 -0
- package/template/.agent/skill-library/surface/desktop/desktop-ux-conventions/SKILL.md +361 -0
- package/template/.agent/skill-library/surface/desktop/native-os-integration/SKILL.md +563 -0
- package/template/.agent/skill-library/surface/extension/browser-extension-patterns/SKILL.md +482 -0
- package/template/.agent/skill-library/surface/extension/plugin-architecture-design/SKILL.md +632 -0
- package/template/.agent/skill-library/surface/extension/vscode-extension-development/SKILL.md +728 -0
- package/template/.agent/skill-library/surface/mobile/app-store-submission/SKILL.md +304 -0
- package/template/.agent/skill-library/surface/mobile/mobile-offline-sync/SKILL.md +443 -0
- package/template/.agent/skill-library/surface/mobile/mobile-responsive-patterns/SKILL.md +432 -0
- package/template/.agent/skill-library/surface/mobile/push-notifications/SKILL.md +495 -0
- package/template/.agent/skill-library/surface/web/accessibility-compliance/SKILL.md +827 -0
- package/template/.agent/skill-library/surface/web/ai-seo/SKILL.md +398 -0
- package/template/.agent/skill-library/surface/web/ai-seo/references/content-patterns.md +285 -0
- package/template/.agent/skill-library/surface/web/ai-seo/references/platform-ranking-factors.md +152 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/SKILL.md +309 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/event-library.md +260 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/ga4-implementation.md +300 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/gtm-implementation.md +390 -0
- package/template/.agent/skill-library/surface/web/authentication-ui-flows/SKILL.md +530 -0
- package/template/.agent/skill-library/surface/web/dark-mode-theming/SKILL.md +516 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/SKILL.md +105 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/charts.csv +26 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/colors.csv +97 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/landing.csv +31 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/styles.csv +59 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/typography.csv +58 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/ux-guidelines.csv +100 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/core.py +258 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/design_system.py +1067 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/search.py +106 -0
- package/template/.agent/skill-library/surface/web/form-handling-validation/SKILL.md +675 -0
- package/template/.agent/skill-library/surface/web/frontend-design/SKILL.md +1393 -0
- package/template/.agent/skill-library/surface/web/frontend-design/templates/cppn-hero.tsx +299 -0
- package/template/.agent/skill-library/surface/web/frontend-design/templates/wave-hero.tsx +875 -0
- package/template/.agent/skill-library/surface/web/frontend-verification/SKILL.md +111 -0
- package/template/.agent/skill-library/surface/web/frontend-verification/scripts/ux_audit.py +739 -0
- package/template/.agent/skill-library/surface/web/i18n-localization/SKILL.md +154 -0
- package/template/.agent/skill-library/surface/web/offline-first-pwa/SKILL.md +657 -0
- package/template/.agent/skill-library/surface/web/page-cro/SKILL.md +182 -0
- package/template/.agent/skill-library/surface/web/page-cro/references/experiments.md +248 -0
- package/template/.agent/skill-library/surface/web/programmatic-seo/SKILL.md +238 -0
- package/template/.agent/skill-library/surface/web/programmatic-seo/references/playbooks.md +308 -0
- package/template/.agent/skill-library/surface/web/schema-markup/SKILL.md +179 -0
- package/template/.agent/skill-library/surface/web/schema-markup/references/schema-examples.md +398 -0
- package/template/.agent/skill-library/surface/web/seo-audit/SKILL.md +394 -0
- package/template/.agent/skill-library/surface/web/seo-audit/references/ai-writing-detection.md +200 -0
- package/template/.agent/skill-library/surface/web/web-performance-optimization/SKILL.md +646 -0
- package/template/.agent/skill-library/surface/web/web-scraping/SKILL.md +58 -0
- package/template/.agent/skills/accessibility/SKILL.md +522 -0
- package/template/.agent/skills/accessibility/references/WCAG.md +162 -0
- package/template/.agent/skills/adversarial-review/SKILL.md +90 -0
- package/template/.agent/skills/antigravity-workflows/SKILL.md +81 -0
- package/template/.agent/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
- package/template/.agent/skills/api-design-principles/SKILL.md +37 -0
- package/template/.agent/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/template/.agent/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/template/.agent/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/template/.agent/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/template/.agent/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/template/.agent/skills/api-versioning/SKILL.md +420 -0
- package/template/.agent/skills/architecture-mapping/SKILL.md +219 -0
- package/template/.agent/skills/bootstrap-agents/SKILL.md +259 -0
- package/template/.agent/skills/brainstorming/SKILL.md +236 -0
- package/template/.agent/skills/brand-guidelines/SKILL.md +44 -0
- package/template/.agent/skills/clean-code/SKILL.md +94 -0
- package/template/.agent/skills/code-review-pro/SKILL.md +152 -0
- package/template/.agent/skills/concise-planning/SKILL.md +68 -0
- package/template/.agent/skills/cross-layer-consistency/SKILL.md +117 -0
- package/template/.agent/skills/database-schema-design/SKILL.md +429 -0
- package/template/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/template/.agent/skills/design-anti-cliche/SKILL.md +159 -0
- package/template/.agent/skills/design-direction/SKILL.md +45 -0
- package/template/.agent/skills/error-handling-patterns/SKILL.md +721 -0
- package/template/.agent/skills/find-skills/SKILL.md +145 -0
- package/template/.agent/skills/git-advanced/SKILL.md +972 -0
- package/template/.agent/skills/git-workflow/SKILL.md +420 -0
- package/template/.agent/skills/idea-extraction/SKILL.md +271 -0
- package/template/.agent/skills/logging-best-practices/SKILL.md +851 -0
- package/template/.agent/skills/migration-management/SKILL.md +384 -0
- package/template/.agent/skills/minimalist-surgical-development/SKILL.md +69 -0
- package/template/.agent/skills/parallel-agents/SKILL.md +165 -0
- package/template/.agent/skills/parallel-debugging/SKILL.md +135 -0
- package/template/.agent/skills/parallel-feature-development/SKILL.md +166 -0
- package/template/.agent/skills/performance-budgeting/SKILL.md +144 -0
- package/template/.agent/skills/pipeline-rubrics/SKILL.md +51 -0
- package/template/.agent/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
- package/template/.agent/skills/pipeline-rubrics/references/be-rubric.md +21 -0
- package/template/.agent/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
- package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
- package/template/.agent/skills/pipeline-rubrics/references/scoring.md +28 -0
- package/template/.agent/skills/pipeline-rubrics/references/vision-rubric.md +11 -0
- package/template/.agent/skills/prd-templates/SKILL.md +88 -0
- package/template/.agent/skills/prd-templates/references/architecture-design-template.md +88 -0
- package/template/.agent/skills/prd-templates/references/be-spec-template.md +101 -0
- package/template/.agent/skills/prd-templates/references/data-placement-template.md +74 -0
- package/template/.agent/skills/prd-templates/references/decomposition-templates.md +211 -0
- package/template/.agent/skills/prd-templates/references/design-system-decisions.md +198 -0
- package/template/.agent/skills/prd-templates/references/engineering-standards-template.md +124 -0
- package/template/.agent/skills/prd-templates/references/fe-classification-procedures.md +47 -0
- package/template/.agent/skills/prd-templates/references/fe-spec-template.md +84 -0
- package/template/.agent/skills/prd-templates/references/infrastructure-report-template.md +71 -0
- package/template/.agent/skills/prd-templates/references/operational-templates.md +116 -0
- package/template/.agent/skills/prd-templates/references/placeholder-guard-template.md +21 -0
- package/template/.agent/skills/prd-templates/references/surface-model.md +61 -0
- package/template/.agent/skills/prd-templates/references/vision-template.md +66 -0
- package/template/.agent/skills/prompt-engineer/README.md +659 -0
- package/template/.agent/skills/prompt-engineer/SKILL.md +249 -0
- package/template/.agent/skills/regex-patterns/SKILL.md +751 -0
- package/template/.agent/skills/resolve-ambiguity/SKILL.md +278 -0
- package/template/.agent/skills/rest-api-design/SKILL.md +478 -0
- package/template/.agent/skills/security-scanning-security-hardening/SKILL.md +231 -0
- package/template/.agent/skills/session-continuity/SKILL.md +730 -0
- package/template/.agent/skills/session-continuity/protocols/01-session-resumption.md +38 -0
- package/template/.agent/skills/session-continuity/protocols/02-progress-generation.md +85 -0
- package/template/.agent/skills/session-continuity/protocols/03-progress-update.md +70 -0
- package/template/.agent/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
- package/template/.agent/skills/session-continuity/protocols/05-session-close.md +37 -0
- package/template/.agent/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
- package/template/.agent/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
- package/template/.agent/skills/session-continuity/protocols/08-spec-pipeline-update.md +43 -0
- package/template/.agent/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
- package/template/.agent/skills/session-continuity/protocols/10-placeholder-verification-gate.md +104 -0
- package/template/.agent/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
- package/template/.agent/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.agent/skills/skill-creator/README.md +270 -0
- package/template/.agent/skills/skill-creator/SKILL.md +590 -0
- package/template/.agent/skills/skill-creator/references/output-patterns.md +82 -0
- package/template/.agent/skills/skill-creator/references/workflows.md +28 -0
- package/template/.agent/skills/skill-creator/scripts/init_skill.py +303 -0
- package/template/.agent/skills/skill-creator/scripts/package_skill.py +110 -0
- package/template/.agent/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/template/.agent/skills/spec-writing/SKILL.md +110 -0
- package/template/.agent/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/template/.agent/skills/systematic-debugging/SKILL.md +297 -0
- package/template/.agent/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/template/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/template/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/template/.agent/skills/systematic-debugging/find-polluter.sh +63 -0
- package/template/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/template/.agent/skills/systematic-debugging/test-academic.md +14 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/template/.agent/skills/tdd-workflow/SKILL.md +409 -0
- package/template/.agent/skills/tech-stack-catalog/SKILL.md +49 -0
- package/template/.agent/skills/tech-stack-catalog/references/constraint-questions.md +21 -0
- package/template/.agent/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
- package/template/.agent/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
- package/template/.agent/skills/technical-writer/SKILL.md +242 -0
- package/template/.agent/skills/testing-strategist/SKILL.md +932 -0
- package/template/.agent/skills/verification-before-completion/SKILL.md +145 -0
- package/template/.agent/skills/workflow-automation/SKILL.md +73 -0
- package/template/.agent/workflows/audit-ambiguity-execute.md +165 -0
- package/template/.agent/workflows/audit-ambiguity-rubrics.md +83 -0
- package/template/.agent/workflows/audit-ambiguity.md +64 -0
- package/template/.agent/workflows/bootstrap-agents-fill.md +201 -0
- package/template/.agent/workflows/bootstrap-agents-provision.md +197 -0
- package/template/.agent/workflows/bootstrap-agents.md +66 -0
- package/template/.agent/workflows/create-prd-architecture.md +119 -0
- package/template/.agent/workflows/create-prd-compile.md +138 -0
- package/template/.agent/workflows/create-prd-design-system.md +135 -0
- package/template/.agent/workflows/create-prd-security.md +113 -0
- package/template/.agent/workflows/create-prd-stack.md +91 -0
- package/template/.agent/workflows/create-prd.md +168 -0
- package/template/.agent/workflows/decompose-architecture-structure.md +82 -0
- package/template/.agent/workflows/decompose-architecture-validate.md +119 -0
- package/template/.agent/workflows/decompose-architecture.md +111 -0
- package/template/.agent/workflows/evolve-contract.md +98 -0
- package/template/.agent/workflows/evolve-feature-cascade.md +140 -0
- package/template/.agent/workflows/evolve-feature-classify.md +116 -0
- package/template/.agent/workflows/evolve-feature.md +56 -0
- package/template/.agent/workflows/ideate-discover.md +144 -0
- package/template/.agent/workflows/ideate-extract.md +129 -0
- package/template/.agent/workflows/ideate-validate.md +117 -0
- package/template/.agent/workflows/ideate.md +113 -0
- package/template/.agent/workflows/implement-slice-setup.md +113 -0
- package/template/.agent/workflows/implement-slice-tdd.md +198 -0
- package/template/.agent/workflows/implement-slice.md +50 -0
- package/template/.agent/workflows/plan-phase.md +202 -0
- package/template/.agent/workflows/propagate-decision-apply.md +135 -0
- package/template/.agent/workflows/propagate-decision-scan.md +147 -0
- package/template/.agent/workflows/propagate-decision.md +56 -0
- package/template/.agent/workflows/remediate-pipeline-assess.md +138 -0
- package/template/.agent/workflows/remediate-pipeline-execute.md +135 -0
- package/template/.agent/workflows/remediate-pipeline.md +55 -0
- package/template/.agent/workflows/resolve-ambiguity.md +82 -0
- package/template/.agent/workflows/sync-kit.md +209 -0
- package/template/.agent/workflows/update-architecture-map.md +74 -0
- package/template/.agent/workflows/validate-phase.md +219 -0
- package/template/.agent/workflows/verify-infrastructure.md +207 -0
- package/template/.agent/workflows/write-architecture-spec-deepen.md +139 -0
- package/template/.agent/workflows/write-architecture-spec-design.md +202 -0
- package/template/.agent/workflows/write-architecture-spec.md +63 -0
- package/template/.agent/workflows/write-be-spec-classify.md +165 -0
- package/template/.agent/workflows/write-be-spec-write.md +98 -0
- package/template/.agent/workflows/write-be-spec.md +76 -0
- package/template/.agent/workflows/write-fe-spec-classify.md +170 -0
- package/template/.agent/workflows/write-fe-spec-write.md +94 -0
- package/template/.agent/workflows/write-fe-spec.md +71 -0
- package/template/AGENTS.md +176 -0
- package/template/GEMINI.md +177 -0
- package/template/docs/README.md +187 -0
- package/template/docs/audits/.gitkeep +0 -0
- package/template/docs/audits/README.md +10 -0
- package/template/docs/plans/.gitkeep +0 -0
- package/template/docs/plans/README.md +21 -0
- package/template/docs/plans/be/.gitkeep +0 -0
- package/template/docs/plans/be/README.md +11 -0
- package/template/docs/plans/fe/.gitkeep +0 -0
- package/template/docs/plans/fe/README.md +11 -0
- package/template/docs/plans/ia/.gitkeep +0 -0
- package/template/docs/plans/ia/README.md +17 -0
- package/template/docs/plans/ia/deep-dives/.gitkeep +0 -0
- package/template/docs/plans/ia/deep-dives/README.md +5 -0
- package/template/docs/plans/phases/.gitkeep +0 -0
- package/template/docs/plans/phases/README.md +11 -0
|
@@ -0,0 +1,1078 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vanilla-css
|
|
3
|
+
description: Provides comprehensive modern vanilla CSS patterns (2024+) including custom properties, container queries, cascade layers, :has() selector, native nesting, @scope, color-mix(), oklch colors, scroll-driven animations, view transitions, logical properties, subgrid, anchor positioning, popover API, @property, media queries, CSS reset best practices, BEM methodology, and progressive enhancement strategies. Use when building stylesheets without a preprocessor or framework.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Modern Vanilla CSS Development Patterns
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Expert guide for building production-quality stylesheets with modern vanilla CSS (2024+). Covers native features that replace preprocessors: nesting, custom properties, cascade layers, container queries, and more. No build step required for most features.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- Building stylesheets without a CSS preprocessor or utility framework
|
|
17
|
+
- Leveraging native CSS features that replace Sass/Less functionality
|
|
18
|
+
- Creating themeable design systems with custom properties
|
|
19
|
+
- Implementing responsive component-based layouts with container queries
|
|
20
|
+
- Building accessible, performant interfaces with progressive enhancement
|
|
21
|
+
- Styling web components or shadow DOM content
|
|
22
|
+
- Projects where minimal tooling and long-term maintainability matter
|
|
23
|
+
|
|
24
|
+
## Instructions
|
|
25
|
+
|
|
26
|
+
1. **Use cascade layers** to organize specificity and avoid wars
|
|
27
|
+
2. **Use custom properties** for all design tokens (colors, spacing, typography)
|
|
28
|
+
3. **Use native nesting** instead of preprocessor nesting (max 3 levels)
|
|
29
|
+
4. **Use container queries** for component-level responsiveness
|
|
30
|
+
5. **Use logical properties** instead of physical (inline/block, not left/right)
|
|
31
|
+
6. **Use oklch** for perceptually uniform color manipulation
|
|
32
|
+
7. **Progressive enhancement**: core layout works without newest features
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Complete Modern Stylesheet Architecture
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
/* === 1. Cascade Layers === */
|
|
40
|
+
@layer reset, tokens, base, layout, components, utilities, overrides;
|
|
41
|
+
|
|
42
|
+
/* === 2. Reset Layer === */
|
|
43
|
+
@layer reset {
|
|
44
|
+
*,
|
|
45
|
+
*::before,
|
|
46
|
+
*::after {
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
margin: 0;
|
|
49
|
+
padding: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
html {
|
|
53
|
+
-webkit-text-size-adjust: none;
|
|
54
|
+
text-size-adjust: none;
|
|
55
|
+
scroll-behavior: smooth;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
body {
|
|
59
|
+
min-block-size: 100dvh;
|
|
60
|
+
line-height: 1.5;
|
|
61
|
+
-webkit-font-smoothing: antialiased;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
img, picture, video, canvas, svg {
|
|
65
|
+
display: block;
|
|
66
|
+
max-inline-size: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
input, button, textarea, select {
|
|
70
|
+
font: inherit;
|
|
71
|
+
color: inherit;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
75
|
+
overflow-wrap: break-word;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* === 3. Design Tokens Layer === */
|
|
80
|
+
@layer tokens {
|
|
81
|
+
:root {
|
|
82
|
+
/* --- Color Palette (oklch) --- */
|
|
83
|
+
--color-primary: oklch(55% 0.25 265);
|
|
84
|
+
--color-primary-light: oklch(70% 0.2 265);
|
|
85
|
+
--color-primary-dark: oklch(40% 0.25 265);
|
|
86
|
+
--color-secondary: oklch(65% 0.15 160);
|
|
87
|
+
|
|
88
|
+
--color-surface: oklch(99% 0 0);
|
|
89
|
+
--color-surface-raised: oklch(97% 0 0);
|
|
90
|
+
--color-surface-sunken: oklch(95% 0 0);
|
|
91
|
+
|
|
92
|
+
--color-text: oklch(20% 0 0);
|
|
93
|
+
--color-text-muted: oklch(45% 0 0);
|
|
94
|
+
--color-text-on-primary: oklch(98% 0 0);
|
|
95
|
+
|
|
96
|
+
--color-border: oklch(85% 0 0);
|
|
97
|
+
--color-focus-ring: oklch(65% 0.25 265 / 0.5);
|
|
98
|
+
|
|
99
|
+
--color-success: oklch(60% 0.2 145);
|
|
100
|
+
--color-warning: oklch(75% 0.15 85);
|
|
101
|
+
--color-error: oklch(55% 0.25 25);
|
|
102
|
+
|
|
103
|
+
/* --- Spacing Scale --- */
|
|
104
|
+
--space-xs: 0.25rem;
|
|
105
|
+
--space-sm: 0.5rem;
|
|
106
|
+
--space-md: 1rem;
|
|
107
|
+
--space-lg: 1.5rem;
|
|
108
|
+
--space-xl: 2rem;
|
|
109
|
+
--space-2xl: 3rem;
|
|
110
|
+
--space-3xl: 4rem;
|
|
111
|
+
|
|
112
|
+
/* --- Typography --- */
|
|
113
|
+
--font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
114
|
+
--font-mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;
|
|
115
|
+
|
|
116
|
+
--text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);
|
|
117
|
+
--text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
|
|
118
|
+
--text-base: clamp(0.95rem, 0.9rem + 0.25vw, 1rem);
|
|
119
|
+
--text-lg: clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
|
|
120
|
+
--text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
|
|
121
|
+
--text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
|
|
122
|
+
--text-3xl: clamp(1.875rem, 1.5rem + 1.875vw, 2.5rem);
|
|
123
|
+
|
|
124
|
+
/* --- Border Radius --- */
|
|
125
|
+
--radius-sm: 0.25rem;
|
|
126
|
+
--radius-md: 0.5rem;
|
|
127
|
+
--radius-lg: 0.75rem;
|
|
128
|
+
--radius-full: 9999px;
|
|
129
|
+
|
|
130
|
+
/* --- Shadows --- */
|
|
131
|
+
--shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.05);
|
|
132
|
+
--shadow-md: 0 4px 6px oklch(0% 0 0 / 0.07),
|
|
133
|
+
0 2px 4px oklch(0% 0 0 / 0.05);
|
|
134
|
+
--shadow-lg: 0 10px 15px oklch(0% 0 0 / 0.1),
|
|
135
|
+
0 4px 6px oklch(0% 0 0 / 0.05);
|
|
136
|
+
|
|
137
|
+
/* --- Transitions --- */
|
|
138
|
+
--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
|
|
139
|
+
--duration-fast: 150ms;
|
|
140
|
+
--duration-normal: 250ms;
|
|
141
|
+
--duration-slow: 400ms;
|
|
142
|
+
|
|
143
|
+
/* --- Z-Index Scale --- */
|
|
144
|
+
--z-dropdown: 100;
|
|
145
|
+
--z-sticky: 200;
|
|
146
|
+
--z-overlay: 300;
|
|
147
|
+
--z-modal: 400;
|
|
148
|
+
--z-popover: 500;
|
|
149
|
+
--z-toast: 600;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Constraints and Warnings
|
|
155
|
+
|
|
156
|
+
- **Browser support**: Check caniuse.com for :has(), @layer, container queries, oklch
|
|
157
|
+
- **Native nesting**: Supported in all modern browsers but not IE or older Safari
|
|
158
|
+
- **Anchor positioning**: Still limited browser support as of 2024
|
|
159
|
+
- **Scroll-driven animations**: Chrome/Edge only as of late 2024
|
|
160
|
+
- **View transitions**: Same-document supported widely; cross-document is newer
|
|
161
|
+
- **@scope**: Limited browser support; use as progressive enhancement
|
|
162
|
+
- **@property**: Supported in Chromium and Safari 15.4+, Firefox 128+
|
|
163
|
+
- **No fallback = broken**: Always provide fallback for cutting-edge features
|
|
164
|
+
|
|
165
|
+
## Core Concepts
|
|
166
|
+
|
|
167
|
+
### Custom Properties (CSS Variables)
|
|
168
|
+
|
|
169
|
+
Custom properties cascade and can be scoped to any selector:
|
|
170
|
+
|
|
171
|
+
```css
|
|
172
|
+
/* Global tokens */
|
|
173
|
+
:root {
|
|
174
|
+
--brand-hue: 265;
|
|
175
|
+
--brand-color: oklch(55% 0.25 var(--brand-hue));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Component-scoped overrides */
|
|
179
|
+
.card {
|
|
180
|
+
--card-padding: var(--space-lg);
|
|
181
|
+
--card-radius: var(--radius-md);
|
|
182
|
+
|
|
183
|
+
padding: var(--card-padding);
|
|
184
|
+
border-radius: var(--card-radius);
|
|
185
|
+
background: var(--color-surface-raised);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.card--compact {
|
|
189
|
+
--card-padding: var(--space-sm);
|
|
190
|
+
--card-radius: var(--radius-sm);
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Dark Mode Theming
|
|
195
|
+
|
|
196
|
+
```css
|
|
197
|
+
@layer tokens {
|
|
198
|
+
:root {
|
|
199
|
+
color-scheme: light dark;
|
|
200
|
+
|
|
201
|
+
--color-surface: oklch(99% 0 0);
|
|
202
|
+
--color-text: oklch(20% 0 0);
|
|
203
|
+
--color-border: oklch(85% 0 0);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@media (prefers-color-scheme: dark) {
|
|
207
|
+
:root {
|
|
208
|
+
--color-surface: oklch(15% 0 0);
|
|
209
|
+
--color-text: oklch(90% 0 0);
|
|
210
|
+
--color-border: oklch(30% 0 0);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Class-based override for manual toggle */
|
|
215
|
+
[data-theme="dark"] {
|
|
216
|
+
--color-surface: oklch(15% 0 0);
|
|
217
|
+
--color-text: oklch(90% 0 0);
|
|
218
|
+
--color-border: oklch(30% 0 0);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Cascade Layers (@layer)
|
|
224
|
+
|
|
225
|
+
Layers control specificity order regardless of selector weight:
|
|
226
|
+
|
|
227
|
+
```css
|
|
228
|
+
/* Declaration order sets priority (last wins) */
|
|
229
|
+
@layer reset, base, components, utilities;
|
|
230
|
+
|
|
231
|
+
@layer reset {
|
|
232
|
+
/* Lowest priority -- easily overridden */
|
|
233
|
+
a { color: inherit; text-decoration: none; }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@layer base {
|
|
237
|
+
a { color: var(--color-primary); }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@layer components {
|
|
241
|
+
.nav__link { color: var(--color-text); }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@layer utilities {
|
|
245
|
+
/* Highest priority among layers */
|
|
246
|
+
.text-primary { color: var(--color-primary); }
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Unlayered styles beat ALL layers */
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Native CSS Nesting
|
|
253
|
+
|
|
254
|
+
```css
|
|
255
|
+
.card {
|
|
256
|
+
background: var(--color-surface-raised);
|
|
257
|
+
border: 1px solid var(--color-border);
|
|
258
|
+
border-radius: var(--radius-md);
|
|
259
|
+
|
|
260
|
+
/* Direct child nesting */
|
|
261
|
+
& .card__header {
|
|
262
|
+
padding: var(--space-md);
|
|
263
|
+
border-block-end: 1px solid var(--color-border);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
& .card__body {
|
|
267
|
+
padding: var(--space-lg);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* Pseudo-classes */
|
|
271
|
+
&:hover {
|
|
272
|
+
box-shadow: var(--shadow-md);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&:focus-within {
|
|
276
|
+
outline: 2px solid var(--color-focus-ring);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/* Media queries nest inside selectors */
|
|
280
|
+
@media (width >= 768px) {
|
|
281
|
+
display: grid;
|
|
282
|
+
grid-template-columns: 200px 1fr;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Container Queries
|
|
288
|
+
|
|
289
|
+
```css
|
|
290
|
+
/* Define a containment context */
|
|
291
|
+
.widget-container {
|
|
292
|
+
container-type: inline-size;
|
|
293
|
+
container-name: widget;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Respond to the container's size, not the viewport */
|
|
297
|
+
.widget {
|
|
298
|
+
display: grid;
|
|
299
|
+
gap: var(--space-sm);
|
|
300
|
+
|
|
301
|
+
@container widget (inline-size >= 400px) {
|
|
302
|
+
grid-template-columns: 1fr 1fr;
|
|
303
|
+
gap: var(--space-md);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@container widget (inline-size >= 700px) {
|
|
307
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
308
|
+
gap: var(--space-lg);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### The :has() Selector
|
|
314
|
+
|
|
315
|
+
The parent selector -- style an element based on its contents:
|
|
316
|
+
|
|
317
|
+
```css
|
|
318
|
+
/* Card that contains an image gets different layout */
|
|
319
|
+
.card:has(> img) {
|
|
320
|
+
padding: 0;
|
|
321
|
+
|
|
322
|
+
& img {
|
|
323
|
+
border-radius: var(--radius-md) var(--radius-md) 0 0;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/* Form group with invalid input */
|
|
328
|
+
.form-group:has(:invalid) {
|
|
329
|
+
& .form-group__label {
|
|
330
|
+
color: var(--color-error);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
& .form-group__message {
|
|
334
|
+
display: block;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* Style a label when its associated checkbox is checked */
|
|
339
|
+
label:has(input[type="checkbox"]:checked) {
|
|
340
|
+
background: var(--color-primary-light);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Navigation link that is the current page */
|
|
344
|
+
.nav:has(.nav__link[aria-current="page"]) {
|
|
345
|
+
border-block-end-color: var(--color-primary);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### @scope
|
|
350
|
+
|
|
351
|
+
Limit where styles apply without increasing specificity:
|
|
352
|
+
|
|
353
|
+
```css
|
|
354
|
+
@scope (.card) to (.card__footer) {
|
|
355
|
+
/* Styles apply inside .card but NOT inside .card__footer */
|
|
356
|
+
a {
|
|
357
|
+
color: var(--color-primary);
|
|
358
|
+
text-decoration: underline;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
@scope ([data-theme="admin"]) {
|
|
363
|
+
.btn {
|
|
364
|
+
--btn-bg: oklch(45% 0.2 25);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### color-mix() and oklch Colors
|
|
370
|
+
|
|
371
|
+
```css
|
|
372
|
+
:root {
|
|
373
|
+
--brand: oklch(55% 0.25 265);
|
|
374
|
+
|
|
375
|
+
/* Generate tints and shades */
|
|
376
|
+
--brand-100: color-mix(in oklch, var(--brand) 10%, white);
|
|
377
|
+
--brand-200: color-mix(in oklch, var(--brand) 25%, white);
|
|
378
|
+
--brand-300: color-mix(in oklch, var(--brand) 40%, white);
|
|
379
|
+
--brand-500: var(--brand);
|
|
380
|
+
--brand-700: color-mix(in oklch, var(--brand) 70%, black);
|
|
381
|
+
--brand-900: color-mix(in oklch, var(--brand) 40%, black);
|
|
382
|
+
|
|
383
|
+
/* Semi-transparent variants */
|
|
384
|
+
--brand-overlay: color-mix(in oklch, var(--brand) 15%, transparent);
|
|
385
|
+
|
|
386
|
+
/* Mix two brand colors */
|
|
387
|
+
--accent: color-mix(in oklch, var(--brand) 50%, oklch(70% 0.2 145));
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### @property (Typed Custom Properties)
|
|
392
|
+
|
|
393
|
+
```css
|
|
394
|
+
/* Register a custom property with type, inheritance, and initial value */
|
|
395
|
+
@property --gradient-angle {
|
|
396
|
+
syntax: "<angle>";
|
|
397
|
+
inherits: false;
|
|
398
|
+
initial-value: 0deg;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
@property --color-progress {
|
|
402
|
+
syntax: "<percentage>";
|
|
403
|
+
inherits: true;
|
|
404
|
+
initial-value: 0%;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Now you can animate custom properties */
|
|
408
|
+
.gradient-spinner {
|
|
409
|
+
background: conic-gradient(
|
|
410
|
+
from var(--gradient-angle),
|
|
411
|
+
var(--color-primary),
|
|
412
|
+
var(--color-secondary),
|
|
413
|
+
var(--color-primary)
|
|
414
|
+
);
|
|
415
|
+
animation: spin-gradient 3s linear infinite;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
@keyframes spin-gradient {
|
|
419
|
+
to {
|
|
420
|
+
--gradient-angle: 360deg;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Logical Properties
|
|
426
|
+
|
|
427
|
+
Replace physical properties (top/right/bottom/left) with flow-relative ones:
|
|
428
|
+
|
|
429
|
+
```css
|
|
430
|
+
/* Physical (breaks in RTL) */
|
|
431
|
+
.card-old {
|
|
432
|
+
margin-left: 1rem;
|
|
433
|
+
padding-top: 0.5rem;
|
|
434
|
+
border-right: 1px solid gray;
|
|
435
|
+
text-align: left;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/* Logical (works in LTR and RTL) */
|
|
439
|
+
.card {
|
|
440
|
+
margin-inline-start: 1rem;
|
|
441
|
+
padding-block-start: 0.5rem;
|
|
442
|
+
border-inline-end: 1px solid var(--color-border);
|
|
443
|
+
text-align: start;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* Common logical property mappings:
|
|
447
|
+
left/right -> inline-start/inline-end
|
|
448
|
+
top/bottom -> block-start/block-end
|
|
449
|
+
width -> inline-size
|
|
450
|
+
height -> block-size
|
|
451
|
+
margin-left -> margin-inline-start
|
|
452
|
+
padding-top -> padding-block-start
|
|
453
|
+
border-bottom -> border-block-end
|
|
454
|
+
text-align: left -> text-align: start
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
.container {
|
|
458
|
+
max-inline-size: 1200px;
|
|
459
|
+
margin-inline: auto;
|
|
460
|
+
padding-inline: var(--space-md);
|
|
461
|
+
padding-block: var(--space-xl);
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Subgrid
|
|
466
|
+
|
|
467
|
+
```css
|
|
468
|
+
.page-grid {
|
|
469
|
+
display: grid;
|
|
470
|
+
grid-template-columns:
|
|
471
|
+
[full-start] minmax(var(--space-md), 1fr)
|
|
472
|
+
[content-start] min(65ch, 100%)
|
|
473
|
+
[content-end] minmax(var(--space-md), 1fr)
|
|
474
|
+
[full-end];
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/* Children inherit the parent grid tracks */
|
|
478
|
+
.page-grid > .card {
|
|
479
|
+
grid-column: content;
|
|
480
|
+
display: grid;
|
|
481
|
+
grid-template-columns: subgrid;
|
|
482
|
+
|
|
483
|
+
& .card__title,
|
|
484
|
+
& .card__body {
|
|
485
|
+
grid-column: content;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/* Subgrid for aligned card layouts */
|
|
490
|
+
.card-list {
|
|
491
|
+
display: grid;
|
|
492
|
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
493
|
+
gap: var(--space-lg);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.card-list > .card {
|
|
497
|
+
display: grid;
|
|
498
|
+
grid-template-rows: subgrid;
|
|
499
|
+
grid-row: span 3; /* header, body, footer */
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Anchor Positioning
|
|
504
|
+
|
|
505
|
+
```css
|
|
506
|
+
/* Define an anchor */
|
|
507
|
+
.trigger {
|
|
508
|
+
anchor-name: --tooltip-anchor;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/* Position relative to the anchor */
|
|
512
|
+
.tooltip {
|
|
513
|
+
position: fixed;
|
|
514
|
+
position-anchor: --tooltip-anchor;
|
|
515
|
+
inset-area: top;
|
|
516
|
+
margin-block-end: var(--space-xs);
|
|
517
|
+
|
|
518
|
+
/* Fallback if not enough space */
|
|
519
|
+
position-try-fallbacks: flip-block, flip-inline;
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Popover API
|
|
524
|
+
|
|
525
|
+
```css
|
|
526
|
+
/* Style the popover */
|
|
527
|
+
[popover] {
|
|
528
|
+
border: 1px solid var(--color-border);
|
|
529
|
+
border-radius: var(--radius-md);
|
|
530
|
+
padding: var(--space-lg);
|
|
531
|
+
box-shadow: var(--shadow-lg);
|
|
532
|
+
max-inline-size: 400px;
|
|
533
|
+
|
|
534
|
+
/* Entry animation */
|
|
535
|
+
opacity: 0;
|
|
536
|
+
transform: translateY(-8px);
|
|
537
|
+
transition:
|
|
538
|
+
opacity var(--duration-normal) var(--ease-out),
|
|
539
|
+
transform var(--duration-normal) var(--ease-out),
|
|
540
|
+
display var(--duration-normal) var(--ease-out) allow-discrete,
|
|
541
|
+
overlay var(--duration-normal) var(--ease-out) allow-discrete;
|
|
542
|
+
|
|
543
|
+
&:popover-open {
|
|
544
|
+
opacity: 1;
|
|
545
|
+
transform: translateY(0);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* Starting style for entry animation */
|
|
549
|
+
@starting-style {
|
|
550
|
+
&:popover-open {
|
|
551
|
+
opacity: 0;
|
|
552
|
+
transform: translateY(-8px);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/* Style the backdrop */
|
|
558
|
+
[popover]::backdrop {
|
|
559
|
+
background: oklch(0% 0 0 / 0.3);
|
|
560
|
+
backdrop-filter: blur(4px);
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### Scroll-Driven Animations
|
|
565
|
+
|
|
566
|
+
```css
|
|
567
|
+
/* Progress bar that tracks page scroll */
|
|
568
|
+
.scroll-progress {
|
|
569
|
+
position: fixed;
|
|
570
|
+
inset-block-start: 0;
|
|
571
|
+
inset-inline: 0;
|
|
572
|
+
block-size: 3px;
|
|
573
|
+
background: var(--color-primary);
|
|
574
|
+
transform-origin: left;
|
|
575
|
+
animation: grow-progress linear both;
|
|
576
|
+
animation-timeline: scroll();
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
@keyframes grow-progress {
|
|
580
|
+
from { transform: scaleX(0); }
|
|
581
|
+
to { transform: scaleX(1); }
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* Reveal elements as they enter the viewport */
|
|
585
|
+
.reveal {
|
|
586
|
+
opacity: 0;
|
|
587
|
+
transform: translateY(20px);
|
|
588
|
+
animation: reveal-in linear both;
|
|
589
|
+
animation-timeline: view();
|
|
590
|
+
animation-range: entry 0% entry 100%;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
@keyframes reveal-in {
|
|
594
|
+
to {
|
|
595
|
+
opacity: 1;
|
|
596
|
+
transform: translateY(0);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### View Transitions
|
|
602
|
+
|
|
603
|
+
```css
|
|
604
|
+
/* Define which elements participate in transitions */
|
|
605
|
+
.page-header {
|
|
606
|
+
view-transition-name: page-header;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.hero-image {
|
|
610
|
+
view-transition-name: hero-image;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/* Customize the transition animation */
|
|
614
|
+
::view-transition-old(hero-image) {
|
|
615
|
+
animation: 300ms var(--ease-out) both fade-out;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
::view-transition-new(hero-image) {
|
|
619
|
+
animation: 300ms var(--ease-out) both fade-in;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
@keyframes fade-out {
|
|
623
|
+
to { opacity: 0; }
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
@keyframes fade-in {
|
|
627
|
+
from { opacity: 0; }
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/* Trigger from JavaScript */
|
|
631
|
+
/* document.startViewTransition(() => updateDOM()); */
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
## Layout Patterns
|
|
635
|
+
|
|
636
|
+
### Holy Grail Layout
|
|
637
|
+
|
|
638
|
+
```css
|
|
639
|
+
.layout {
|
|
640
|
+
display: grid;
|
|
641
|
+
grid-template-rows: auto 1fr auto;
|
|
642
|
+
grid-template-columns: minmax(200px, 1fr) minmax(0, 3fr) minmax(200px, 1fr);
|
|
643
|
+
grid-template-areas:
|
|
644
|
+
"header header header"
|
|
645
|
+
"nav main aside"
|
|
646
|
+
"footer footer footer";
|
|
647
|
+
min-block-size: 100dvh;
|
|
648
|
+
|
|
649
|
+
@media (width < 768px) {
|
|
650
|
+
grid-template-columns: 1fr;
|
|
651
|
+
grid-template-areas:
|
|
652
|
+
"header"
|
|
653
|
+
"nav"
|
|
654
|
+
"main"
|
|
655
|
+
"aside"
|
|
656
|
+
"footer";
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.layout__header { grid-area: header; }
|
|
661
|
+
.layout__nav { grid-area: nav; }
|
|
662
|
+
.layout__main { grid-area: main; }
|
|
663
|
+
.layout__aside { grid-area: aside; }
|
|
664
|
+
.layout__footer { grid-area: footer; }
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
### Fluid Typography and Spacing
|
|
668
|
+
|
|
669
|
+
```css
|
|
670
|
+
:root {
|
|
671
|
+
/* Fluid type scale using clamp */
|
|
672
|
+
--text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
|
|
673
|
+
--text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
|
|
674
|
+
--text-xl: clamp(1.25rem, 1rem + 1vw, 1.75rem);
|
|
675
|
+
--text-2xl: clamp(1.5rem, 1rem + 2vw, 2.5rem);
|
|
676
|
+
--text-3xl: clamp(2rem, 1.25rem + 3vw, 3.5rem);
|
|
677
|
+
|
|
678
|
+
/* Fluid spacing */
|
|
679
|
+
--space-fluid-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
|
|
680
|
+
--space-fluid-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
|
|
681
|
+
--space-fluid-lg: clamp(1.5rem, 1rem + 2.5vw, 3rem);
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
## Media Queries
|
|
686
|
+
|
|
687
|
+
### Preference Queries
|
|
688
|
+
|
|
689
|
+
```css
|
|
690
|
+
/* Reduced motion */
|
|
691
|
+
@media (prefers-reduced-motion: reduce) {
|
|
692
|
+
*,
|
|
693
|
+
*::before,
|
|
694
|
+
*::after {
|
|
695
|
+
animation-duration: 0.01ms !important;
|
|
696
|
+
animation-iteration-count: 1 !important;
|
|
697
|
+
transition-duration: 0.01ms !important;
|
|
698
|
+
scroll-behavior: auto !important;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/* Color scheme */
|
|
703
|
+
@media (prefers-color-scheme: dark) {
|
|
704
|
+
:root {
|
|
705
|
+
--color-surface: oklch(15% 0 0);
|
|
706
|
+
--color-text: oklch(90% 0 0);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/* Contrast preference */
|
|
711
|
+
@media (prefers-contrast: more) {
|
|
712
|
+
:root {
|
|
713
|
+
--color-text: oklch(0% 0 0);
|
|
714
|
+
--color-border: oklch(30% 0 0);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/* Reduced transparency */
|
|
719
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
720
|
+
.glass-panel {
|
|
721
|
+
backdrop-filter: none;
|
|
722
|
+
background: var(--color-surface);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Modern Range Syntax
|
|
728
|
+
|
|
729
|
+
```css
|
|
730
|
+
/* Old: @media (min-width: 768px) and (max-width: 1024px) */
|
|
731
|
+
/* New: */
|
|
732
|
+
@media (768px <= width <= 1024px) {
|
|
733
|
+
.container { padding-inline: var(--space-lg); }
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
@media (width >= 1024px) {
|
|
737
|
+
.sidebar { display: block; }
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
@media (width < 640px) {
|
|
741
|
+
.desktop-only { display: none; }
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
## CSS Reset Best Practices
|
|
746
|
+
|
|
747
|
+
```css
|
|
748
|
+
@layer reset {
|
|
749
|
+
/* Box model */
|
|
750
|
+
*, *::before, *::after {
|
|
751
|
+
box-sizing: border-box;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/* Remove default margin */
|
|
755
|
+
* {
|
|
756
|
+
margin: 0;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/* Full viewport height */
|
|
760
|
+
html, body {
|
|
761
|
+
min-block-size: 100dvh;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/* Typography defaults */
|
|
765
|
+
body {
|
|
766
|
+
line-height: 1.5;
|
|
767
|
+
-webkit-font-smoothing: antialiased;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/* Media elements */
|
|
771
|
+
img, picture, video, canvas, svg {
|
|
772
|
+
display: block;
|
|
773
|
+
max-inline-size: 100%;
|
|
774
|
+
block-size: auto;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/* Form elements inherit font */
|
|
778
|
+
input, button, textarea, select {
|
|
779
|
+
font: inherit;
|
|
780
|
+
color: inherit;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/* Avoid text overflow */
|
|
784
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
785
|
+
overflow-wrap: break-word;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/* Remove list styles for lists with role */
|
|
789
|
+
ul[role="list"], ol[role="list"] {
|
|
790
|
+
list-style: none;
|
|
791
|
+
padding: 0;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/* Anchor defaults */
|
|
795
|
+
a {
|
|
796
|
+
color: inherit;
|
|
797
|
+
text-decoration-skip-ink: auto;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/* Table defaults */
|
|
801
|
+
table {
|
|
802
|
+
border-collapse: collapse;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/* Remove button styling */
|
|
806
|
+
button {
|
|
807
|
+
background: none;
|
|
808
|
+
border: none;
|
|
809
|
+
cursor: pointer;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
## BEM Methodology
|
|
815
|
+
|
|
816
|
+
Block-Element-Modifier naming for maintainable CSS:
|
|
817
|
+
|
|
818
|
+
```css
|
|
819
|
+
/* Block */
|
|
820
|
+
.card { }
|
|
821
|
+
|
|
822
|
+
/* Element (double underscore) */
|
|
823
|
+
.card__header { }
|
|
824
|
+
.card__body { }
|
|
825
|
+
.card__footer { }
|
|
826
|
+
.card__title { }
|
|
827
|
+
.card__action { }
|
|
828
|
+
|
|
829
|
+
/* Modifier (double hyphen) */
|
|
830
|
+
.card--featured { }
|
|
831
|
+
.card--compact { }
|
|
832
|
+
.card__action--primary { }
|
|
833
|
+
.card__action--disabled { }
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
### BEM with Native Nesting
|
|
837
|
+
|
|
838
|
+
```css
|
|
839
|
+
.card {
|
|
840
|
+
background: var(--color-surface-raised);
|
|
841
|
+
border-radius: var(--radius-md);
|
|
842
|
+
overflow: hidden;
|
|
843
|
+
|
|
844
|
+
&__header {
|
|
845
|
+
padding: var(--space-md);
|
|
846
|
+
border-block-end: 1px solid var(--color-border);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
&__title {
|
|
850
|
+
font-size: var(--text-lg);
|
|
851
|
+
font-weight: 600;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
&__body {
|
|
855
|
+
padding: var(--space-lg);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
&__footer {
|
|
859
|
+
padding: var(--space-md);
|
|
860
|
+
display: flex;
|
|
861
|
+
justify-content: flex-end;
|
|
862
|
+
gap: var(--space-sm);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/* Modifiers */
|
|
866
|
+
&--featured {
|
|
867
|
+
border: 2px solid var(--color-primary);
|
|
868
|
+
|
|
869
|
+
& .card__header {
|
|
870
|
+
background: var(--color-primary);
|
|
871
|
+
color: var(--color-text-on-primary);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
&--compact {
|
|
876
|
+
& .card__body {
|
|
877
|
+
padding: var(--space-sm);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
## Component Patterns
|
|
884
|
+
|
|
885
|
+
### Button Component
|
|
886
|
+
|
|
887
|
+
```css
|
|
888
|
+
.btn {
|
|
889
|
+
--btn-bg: var(--color-primary);
|
|
890
|
+
--btn-color: var(--color-text-on-primary);
|
|
891
|
+
--btn-padding-inline: var(--space-lg);
|
|
892
|
+
--btn-padding-block: var(--space-sm);
|
|
893
|
+
--btn-radius: var(--radius-md);
|
|
894
|
+
|
|
895
|
+
display: inline-flex;
|
|
896
|
+
align-items: center;
|
|
897
|
+
justify-content: center;
|
|
898
|
+
gap: var(--space-xs);
|
|
899
|
+
padding-block: var(--btn-padding-block);
|
|
900
|
+
padding-inline: var(--btn-padding-inline);
|
|
901
|
+
background: var(--btn-bg);
|
|
902
|
+
color: var(--btn-color);
|
|
903
|
+
border: 2px solid transparent;
|
|
904
|
+
border-radius: var(--btn-radius);
|
|
905
|
+
font-weight: 600;
|
|
906
|
+
font-size: var(--text-base);
|
|
907
|
+
line-height: 1;
|
|
908
|
+
cursor: pointer;
|
|
909
|
+
transition: all var(--duration-fast) var(--ease-out);
|
|
910
|
+
|
|
911
|
+
&:hover {
|
|
912
|
+
--btn-bg: var(--color-primary-dark);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
&:focus-visible {
|
|
916
|
+
outline: 2px solid var(--color-focus-ring);
|
|
917
|
+
outline-offset: 2px;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
&:active {
|
|
921
|
+
transform: scale(0.98);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
&:disabled {
|
|
925
|
+
opacity: 0.5;
|
|
926
|
+
cursor: not-allowed;
|
|
927
|
+
pointer-events: none;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
&--secondary {
|
|
931
|
+
--btn-bg: transparent;
|
|
932
|
+
--btn-color: var(--color-primary);
|
|
933
|
+
border-color: var(--color-primary);
|
|
934
|
+
|
|
935
|
+
&:hover {
|
|
936
|
+
--btn-bg: var(--color-primary);
|
|
937
|
+
--btn-color: var(--color-text-on-primary);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
&--sm {
|
|
942
|
+
--btn-padding-inline: var(--space-md);
|
|
943
|
+
--btn-padding-block: var(--space-xs);
|
|
944
|
+
font-size: var(--text-sm);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
&--lg {
|
|
948
|
+
--btn-padding-inline: var(--space-xl);
|
|
949
|
+
--btn-padding-block: var(--space-md);
|
|
950
|
+
font-size: var(--text-lg);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
### Form Input
|
|
956
|
+
|
|
957
|
+
```css
|
|
958
|
+
.input {
|
|
959
|
+
--input-border: var(--color-border);
|
|
960
|
+
--input-bg: var(--color-surface);
|
|
961
|
+
|
|
962
|
+
display: block;
|
|
963
|
+
inline-size: 100%;
|
|
964
|
+
padding: var(--space-sm) var(--space-md);
|
|
965
|
+
background: var(--input-bg);
|
|
966
|
+
border: 1px solid var(--input-border);
|
|
967
|
+
border-radius: var(--radius-md);
|
|
968
|
+
font-size: var(--text-base);
|
|
969
|
+
transition: border-color var(--duration-fast);
|
|
970
|
+
|
|
971
|
+
&:focus {
|
|
972
|
+
--input-border: var(--color-primary);
|
|
973
|
+
outline: 2px solid var(--color-focus-ring);
|
|
974
|
+
outline-offset: -1px;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
&[aria-invalid="true"] {
|
|
978
|
+
--input-border: var(--color-error);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
&:disabled {
|
|
982
|
+
opacity: 0.6;
|
|
983
|
+
cursor: not-allowed;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
## Progressive Enhancement
|
|
989
|
+
|
|
990
|
+
```css
|
|
991
|
+
/* Base: works everywhere */
|
|
992
|
+
.grid {
|
|
993
|
+
display: flex;
|
|
994
|
+
flex-wrap: wrap;
|
|
995
|
+
gap: var(--space-md);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
.grid > * {
|
|
999
|
+
flex: 1 1 250px;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/* Enhancement: container queries */
|
|
1003
|
+
@supports (container-type: inline-size) {
|
|
1004
|
+
.grid-container {
|
|
1005
|
+
container-type: inline-size;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.grid {
|
|
1009
|
+
display: grid;
|
|
1010
|
+
grid-template-columns: 1fr;
|
|
1011
|
+
|
|
1012
|
+
@container (inline-size >= 500px) {
|
|
1013
|
+
grid-template-columns: repeat(2, 1fr);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
@container (inline-size >= 800px) {
|
|
1017
|
+
grid-template-columns: repeat(3, 1fr);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
/* Enhancement: :has() */
|
|
1023
|
+
@supports selector(:has(*)) {
|
|
1024
|
+
.form-group:has(:invalid:not(:placeholder-shown)) {
|
|
1025
|
+
& .form-group__error {
|
|
1026
|
+
display: block;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/* Enhancement: oklch colors */
|
|
1032
|
+
@supports (color: oklch(50% 0.2 265)) {
|
|
1033
|
+
:root {
|
|
1034
|
+
--color-primary: oklch(55% 0.25 265);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
## Anti-Patterns
|
|
1040
|
+
|
|
1041
|
+
| Anti-Pattern | Why It Is Bad | Correct Approach |
|
|
1042
|
+
|--------------|---------------|------------------|
|
|
1043
|
+
| `!important` everywhere | Breaks cascade, unmaintainable | Use @layer for specificity control |
|
|
1044
|
+
| Deep nesting (4+ levels) | Hard to read, high specificity | Max 3 levels of nesting |
|
|
1045
|
+
| Magic numbers (`margin: 37px`) | Arbitrary, not from a scale | Use design token variables |
|
|
1046
|
+
| Physical properties only | Breaks RTL/vertical writing modes | Use logical properties |
|
|
1047
|
+
| IDs for styling (`#header`) | Too specific, cannot reuse | Use classes with BEM |
|
|
1048
|
+
| `px` for font sizes | Does not respect user preferences | Use `rem` or `clamp()` |
|
|
1049
|
+
| Inline styles in HTML | Cannot be overridden easily | Use classes and custom properties |
|
|
1050
|
+
| Using `@import` (non-layered) | Creates render-blocking requests | Use `@layer` or bundler imports |
|
|
1051
|
+
| Animating `width`/`height` | Triggers layout, poor performance | Animate `transform` and `opacity` |
|
|
1052
|
+
| `* { transition: all }` | Unexpected transitions everywhere | Target specific properties |
|
|
1053
|
+
| Colors as hex in every rule | Hard to theme, no consistency | Define in `:root` as tokens |
|
|
1054
|
+
| `float` for layout | Legacy, replaced by flexbox/grid | Use `display: flex` or `grid` |
|
|
1055
|
+
|
|
1056
|
+
## Best Practices
|
|
1057
|
+
|
|
1058
|
+
1. **Layer everything**: Use `@layer` to avoid specificity conflicts
|
|
1059
|
+
2. **Token everything**: All values come from custom properties in `:root`
|
|
1060
|
+
3. **Use oklch**: Perceptually uniform, easy to generate tints/shades
|
|
1061
|
+
4. **Logical properties**: Always use inline/block instead of left/right/top/bottom
|
|
1062
|
+
5. **Mobile-first**: Write base styles for small screens, enhance with `@media`
|
|
1063
|
+
6. **Container queries for components**: Viewport media queries for layout, container queries for components
|
|
1064
|
+
7. **Nest max 3 levels**: Deeper nesting is a code smell
|
|
1065
|
+
8. **Fluid typography**: Use `clamp()` for text sizing
|
|
1066
|
+
9. **Respect user preferences**: `prefers-reduced-motion`, `prefers-color-scheme`, `prefers-contrast`
|
|
1067
|
+
10. **Focus styles are mandatory**: Every interactive element needs `:focus-visible`
|
|
1068
|
+
11. **Test RTL**: Logical properties make it easy but always verify
|
|
1069
|
+
12. **Progressive enhance**: Feature-query new CSS with `@supports`
|
|
1070
|
+
|
|
1071
|
+
## References
|
|
1072
|
+
|
|
1073
|
+
- MDN Web Docs: https://developer.mozilla.org/en-US/docs/Web/CSS
|
|
1074
|
+
- Can I Use: https://caniuse.com
|
|
1075
|
+
- CSS Tricks: https://css-tricks.com
|
|
1076
|
+
- Modern CSS: https://moderncss.dev
|
|
1077
|
+
- Open Props: https://open-props.style
|
|
1078
|
+
- Every Layout: https://every-layout.dev
|