From f5cd37254c424dd6c606536777f63fb6185955fe Mon Sep 17 00:00:00 2001 From: fretuks Date: Thu, 29 Oct 2026 21:42:51 +0100 Subject: [PATCH] Initial Frost v0.1 framework --- README.md | 91 +++++++++++++++++++++++++++++++++++++ accessibility.css | 47 ++++++++++++++++++++ base.css | 43 ++++++++++++++++++ components.css | 50 +++++++++++++++++++++ controls.css | 55 +++++++++++++++++++++++ examples/index.html | 78 ++++++++++++++++++++++++++++++++ frost.css | 9 ++++ layout.css | 58 ++++++++++++++++++++++++ tokens.css | 106 ++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 537 insertions(+) create mode 100644 README.md create mode 100644 accessibility.css create mode 100644 base.css create mode 100644 components.css create mode 100644 controls.css create mode 100644 examples/index.html create mode 100644 frost.css create mode 100644 layout.css create mode 100644 tokens.css diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6c7f7c --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +# Frost CSS Framework + +Frost is a small, semantic CSS foundation for personal websites and web applications. It provides tokens, accessible base styles, layout primitives, controls, and a few common components without trying to replace Bootstrap or Tailwind. + +## Installation + +For a static site: + +```html + +``` + +For a CSS-aware build: + +```css +@import "./frost/frost.css"; +``` + +## Basic usage + +```html +
+
+

Welcome to Frost

+

A compact foundation for reusable interfaces.

+ Get started +
+
+``` + +## Layout + +```html +
+
One
+
Two
+
+``` + +`frost-stack`, `frost-row`, and `frost-grid` expose local custom properties for gap customization: + +```html +
+ ... +
+``` + +## Forms + +```html + +``` + +## Themes + +Without an explicit theme, Frost follows `prefers-color-scheme`. Explicit themes override that behavior: + +```html + +``` + +or: + +```html + +``` + +Frost does not require JavaScript; a theme switcher can be added later by Iceberg or ordinary vanilla JavaScript. + +## Customization + +Override semantic tokens in the project layer: + +```css +:root { + --frost-color-accent: #0f766e; + --frost-container-max: 68rem; + --frost-radius-md: 0.5rem; +} +``` + +The public API uses the `frost-` class prefix and `--frost-*` custom-property prefix to reduce collisions with project CSS and third-party libraries. + +## Philosophy + +Frost is intentionally smaller than Bootstrap and Tailwind. It establishes predictable foundations while leaving branding, page composition, JavaScript behavior, and specialized components to the project using it. + diff --git a/accessibility.css b/accessibility.css new file mode 100644 index 0000000..bc9afc0 --- /dev/null +++ b/accessibility.css @@ -0,0 +1,47 @@ +@layer frost.accessibility { + :where(:focus-visible) { + outline: var(--frost-focus-width) solid var(--frost-focus-color); + outline-offset: var(--frost-focus-offset); + } + + .frost-visually-hidden:not(:focus):not(:active) { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0 0 0 0); + clip-path: inset(50%); + white-space: nowrap; + border: 0; + } + + .frost-skip-link { + position: fixed; + top: 0; + left: 1rem; + z-index: 100; + padding: var(--frost-space-2) var(--frost-space-3); + transform: translateY(-150%); + background: var(--frost-color-surface); + color: var(--frost-color-text); + border: 1px solid var(--frost-color-border-strong); + border-radius: var(--frost-radius-sm); + transition: transform var(--frost-duration-fast) var(--frost-ease-out); + } + + .frost-skip-link:focus { transform: translateY(1rem); } + .frost-hidden { display: none; } + + @media (prefers-reduced-motion: reduce) { + :where(html) { scroll-behavior: auto; } + :where(*, *::before, *::after) { + animation-duration: 1ms !important; + animation-iteration-count: 1 !important; + scroll-behavior: auto !important; + transition-duration: 1ms !important; + } + } +} + diff --git a/base.css b/base.css new file mode 100644 index 0000000..b367528 --- /dev/null +++ b/base.css @@ -0,0 +1,43 @@ +@layer frost.base { + :where(*, *::before, *::after) { box-sizing: border-box; } + + :where(html) { + min-width: 20rem; + background: var(--frost-color-bg); + color: var(--frost-color-text); + scroll-behavior: smooth; + } + + :where(body) { + min-width: 20rem; + min-height: 100vh; + margin: 0; + background: var(--frost-color-bg); + color: var(--frost-color-text); + font-family: var(--frost-font-body); + font-size: var(--frost-font-size-base); + line-height: var(--frost-line-height-body); + text-rendering: optimizeLegibility; + } + + :where(button, input, select, textarea) { font: inherit; } + :where(button, [role="button"], select) { cursor: pointer; } + :where(button:disabled, input:disabled, select:disabled, textarea:disabled) { cursor: not-allowed; } + :where(img, picture, video, canvas, svg) { display: block; max-width: 100%; } + :where(img, video) { height: auto; } + :where(a) { color: var(--frost-color-accent); } + :where(button) { color: inherit; } + :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin-block: 0; } + :where(h1, h2, h3, h4, h5, h6) { + color: var(--frost-color-text); + font-family: var(--frost-font-heading); + line-height: var(--frost-line-height-heading); + } + :where(h1) { font-size: clamp(2rem, 5vw, 3.5rem); } + :where(h2) { font-size: var(--frost-font-size-xl); } + :where(code, kbd, pre) { font-family: var(--frost-font-mono); } + :where(table) { border-collapse: collapse; border-spacing: 0; } + :where(th, td) { text-align: start; } + :where(::selection) { background: var(--frost-color-accent); color: var(--frost-color-on-accent); } +} + diff --git a/components.css b/components.css new file mode 100644 index 0000000..cd8bbd5 --- /dev/null +++ b/components.css @@ -0,0 +1,50 @@ +@layer frost.components { + .frost-card, .frost-surface { + border: 1px solid var(--frost-color-border); + border-radius: var(--frost-radius-lg); + background: var(--frost-color-surface); + } + + .frost-card { padding: var(--frost-space-6); } + .frost-card--flat { box-shadow: none; } + .frost-card--elevated { box-shadow: var(--frost-shadow-md); } + .frost-card--interactive { transition: border-color var(--frost-duration-base) var(--frost-ease-standard), box-shadow var(--frost-duration-base) var(--frost-ease-standard), transform var(--frost-duration-fast) var(--frost-ease-out); } + .frost-card--interactive:hover { border-color: var(--frost-color-border-strong); box-shadow: var(--frost-shadow-md); transform: translateY(-1px); } + + .frost-badge { + display: inline-flex; + align-items: center; + min-height: 1.5rem; + padding: var(--frost-space-1) var(--frost-space-2); + border: 1px solid var(--frost-color-border); + border-radius: var(--frost-radius-pill); + background: var(--frost-color-surface-soft); + color: var(--frost-color-text); + font-size: 0.8125rem; + font-weight: 650; + line-height: 1; + } + + .frost-badge--success { border-color: var(--frost-color-success); border-color: color-mix(in srgb, var(--frost-color-success) 45%, var(--frost-color-border)); color: var(--frost-color-success); } + .frost-badge--warning { border-color: var(--frost-color-warning); border-color: color-mix(in srgb, var(--frost-color-warning) 45%, var(--frost-color-border)); color: var(--frost-color-warning); } + .frost-badge--danger { border-color: var(--frost-color-danger); border-color: color-mix(in srgb, var(--frost-color-danger) 45%, var(--frost-color-border)); color: var(--frost-color-danger); } + .frost-badge--info { border-color: var(--frost-color-info); border-color: color-mix(in srgb, var(--frost-color-info) 45%, var(--frost-color-border)); color: var(--frost-color-info); } + + .frost-notice { padding: var(--frost-space-4); border: 1px solid var(--frost-color-border-strong); border-radius: var(--frost-radius-md); background: var(--frost-color-surface-soft); color: var(--frost-color-text); } + .frost-notice--info { border-color: var(--frost-color-info); } + .frost-notice--success { border-color: var(--frost-color-success); } + .frost-notice--warning { border-color: var(--frost-color-warning); } + .frost-notice--danger { border-color: var(--frost-color-danger); } + + @media (prefers-reduced-motion: reduce) { + .frost-card--interactive:hover { transform: none; } + } +} + +@layer frost.utilities { + .frost-text-muted { color: var(--frost-color-text-muted); } + .frost-text-center { text-align: center; } + .frost-width-full { width: 100%; } + .frost-overflow-auto { overflow: auto; } +} + diff --git a/controls.css b/controls.css new file mode 100644 index 0000000..aac527d --- /dev/null +++ b/controls.css @@ -0,0 +1,55 @@ +@layer frost.controls { + :where(.frost-button) { + display: inline-flex; + min-height: 2.5rem; + align-items: center; + justify-content: center; + gap: var(--frost-space-2); + padding: var(--frost-space-2) var(--frost-space-4); + border: 1px solid transparent; + border-radius: var(--frost-radius-md); + background: transparent; + color: inherit; + font-weight: 650; + line-height: 1.2; + text-decoration: none; + transition: background-color var(--frost-duration-base) var(--frost-ease-standard), border-color var(--frost-duration-base) var(--frost-ease-standard), color var(--frost-duration-base) var(--frost-ease-standard), transform var(--frost-duration-fast) var(--frost-ease-out); + } + + :where(.frost-button--primary) { border-color: var(--frost-color-accent); background: var(--frost-color-accent); color: var(--frost-color-on-accent); } + :where(.frost-button--secondary) { border-color: var(--frost-color-border-strong); background: var(--frost-color-surface); color: var(--frost-color-text); } + :where(.frost-button--ghost) { border-color: transparent; color: var(--frost-color-accent); } + :where(.frost-button--danger) { border-color: var(--frost-color-danger); background: var(--frost-color-danger); color: #fff; } + :where(.frost-button--primary:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-accent-hover); border-color: var(--frost-color-accent-hover); } + :where(.frost-button--secondary:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-surface-hover); } + :where(.frost-button--ghost:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-surface-soft); } + :where(.frost-button--danger:hover:not(:disabled):not([aria-disabled="true"])) { filter: brightness(0.92); } + :where(.frost-button:active:not(:disabled):not([aria-disabled="true"])) { transform: translateY(1px); } + :where(.frost-button:disabled, .frost-button[aria-disabled="true"]) { opacity: 0.55; cursor: not-allowed; } + + :where(.frost-input, .frost-select, .frost-textarea) { + display: block; + width: 100%; + min-height: 2.5rem; + padding: var(--frost-space-2) var(--frost-space-3); + border: 1px solid var(--frost-color-border-strong); + border-radius: var(--frost-radius-md); + background: var(--frost-color-surface); + color: var(--frost-color-text); + line-height: 1.4; + transition: border-color var(--frost-duration-base) var(--frost-ease-standard), background-color var(--frost-duration-base) var(--frost-ease-standard), box-shadow var(--frost-duration-base) var(--frost-ease-standard); + } + + :where(.frost-textarea) { min-height: 7rem; resize: vertical; } + :where(.frost-input::placeholder, .frost-textarea::placeholder) { color: var(--frost-color-text-muted); opacity: 1; } + :where(.frost-input:focus, .frost-select:focus, .frost-textarea:focus) { border-color: var(--frost-focus-color); box-shadow: 0 0 0 var(--frost-focus-width) rgb(37 99 235 / 0.22); box-shadow: 0 0 0 var(--frost-focus-width) color-mix(in srgb, var(--frost-focus-color) 22%, transparent); } + :where(.frost-input:disabled, .frost-select:disabled, .frost-textarea:disabled) { background: var(--frost-color-surface-soft); opacity: 0.65; } + :where(.frost-input[aria-invalid="true"], .frost-select[aria-invalid="true"], .frost-textarea[aria-invalid="true"]) { border-color: var(--frost-color-danger); } + + .frost-field { display: grid; gap: var(--frost-space-2); } + .frost-label { color: var(--frost-color-text); font-weight: 650; } + .frost-help, .frost-error { font-size: var(--frost-font-size-sm); } + .frost-help { color: var(--frost-color-text-muted); } + .frost-error { color: var(--frost-color-danger); } +} + diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 0000000..1304e81 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,78 @@ + + + + + + Frost v0.1 example + + + + + Skip to content +
+
+
+

Frost CSS framework

+

Small foundations for cold starts.

+
+ +
+ +
+ Frost is CSS-only. This page uses a tiny script only to demonstrate explicit theme switching. +
+ +
+

Tokens and surfaces

+
+
Accent
+
Flat card
+
Elevated card
+
+
+ +
+

Buttons and badges

+
+ + + + + + Success + Warning +
+
+ +
+
+

Form controls

+
+ + + + +
+
+
+ +

Sidebar layout

The layout becomes a normal single column below 48rem.

+
+
+
+ + + diff --git a/frost.css b/frost.css new file mode 100644 index 0000000..833ede7 --- /dev/null +++ b/frost.css @@ -0,0 +1,9 @@ +@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.utilities; + +@import url("./tokens.css") layer(frost.tokens); +@import url("./base.css") layer(frost.base); +@import url("./accessibility.css") layer(frost.accessibility); +@import url("./layout.css") layer(frost.layout); +@import url("./controls.css") layer(frost.controls); +@import url("./components.css") layer(frost.components); + diff --git a/layout.css b/layout.css new file mode 100644 index 0000000..5dc45c6 --- /dev/null +++ b/layout.css @@ -0,0 +1,58 @@ +@layer frost.layout { + .frost-container { + width: min(100% - (2 * var(--frost-container-gutter)), var(--frost-container-max)); + margin-inline: auto; + } + + .frost-stack { + --frost-stack-gap: var(--frost-space-4); + display: grid; + gap: var(--frost-stack-gap); + } + + .frost-row { + --frost-row-gap: var(--frost-space-4); + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--frost-row-gap); + } + + .frost-center { + display: grid; + min-width: 0; + min-height: 100%; + place-items: center; + } + + .frost-grid { + --frost-grid-min: 16rem; + --frost-grid-gap: var(--frost-space-6); + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--frost-grid-min)), 1fr)); + gap: var(--frost-grid-gap); + } + + .frost-sidebar-layout { + display: grid; + grid-template-columns: minmax(0, var(--frost-sidebar-width)) minmax(0, 1fr); + min-height: 100%; + } + + .frost-sidebar { + min-width: 0; + position: sticky; + top: 0; + align-self: start; + min-height: 100vh; + overflow: auto; + } + + .frost-main { min-width: 0; } + + @media (max-width: 48rem) { + .frost-sidebar-layout { grid-template-columns: 1fr; } + .frost-sidebar { position: static; min-height: auto; } + } +} + diff --git a/tokens.css b/tokens.css new file mode 100644 index 0000000..2d5999c --- /dev/null +++ b/tokens.css @@ -0,0 +1,106 @@ +:root { + color-scheme: light; + + --frost-color-bg: #f6f7f8; + --frost-color-surface: #ffffff; + --frost-color-surface-soft: #eef1f3; + --frost-color-surface-hover: #e6eaed; + --frost-color-text: #172027; + --frost-color-text-muted: #5f6b73; + --frost-color-border: #d8dfe3; + --frost-color-border-strong: #b7c1c8; + --frost-color-accent: #2563eb; + --frost-color-accent-hover: #1d4ed8; + --frost-color-on-accent: #ffffff; + --frost-color-success: #147a4b; + --frost-color-warning: #9a5b00; + --frost-color-danger: #b42318; + --frost-color-info: #1769aa; + + --frost-space-1: 0.25rem; + --frost-space-2: 0.5rem; + --frost-space-3: 0.75rem; + --frost-space-4: 1rem; + --frost-space-5: 1.25rem; + --frost-space-6: 1.5rem; + --frost-space-8: 2rem; + --frost-space-10: 2.5rem; + + --frost-radius-sm: 0.375rem; + --frost-radius-md: 0.625rem; + --frost-radius-lg: 1rem; + --frost-radius-xl: 1.5rem; + --frost-radius-pill: 999px; + + --frost-shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06); + --frost-shadow-md: 0 4px 14px rgb(15 23 42 / 0.10); + --frost-shadow-lg: 0 16px 45px rgb(15 23 42 / 0.14); + + --frost-font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + --frost-font-heading: var(--frost-font-body); + --frost-font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; + --frost-font-display: var(--frost-font-heading); + --frost-line-height-body: 1.55; + --frost-line-height-heading: 1.15; + --frost-font-size-sm: 0.875rem; + --frost-font-size-base: 1rem; + --frost-font-size-lg: 1.125rem; + --frost-font-size-xl: clamp(1.5rem, 3vw, 2.25rem); + + --frost-duration-fast: 150ms; + --frost-duration-base: 200ms; + --frost-duration-slow: 300ms; + --frost-ease-standard: ease; + --frost-ease-out: ease-out; + + --frost-container-max: 72rem; + --frost-container-gutter: clamp(1rem, 4vw, 2rem); + --frost-sidebar-width: 16rem; + --frost-focus-color: var(--frost-color-accent); + --frost-focus-width: 3px; + --frost-focus-offset: 3px; +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + color-scheme: dark; + --frost-color-bg: #11161a; + --frost-color-surface: #192126; + --frost-color-surface-soft: #222c32; + --frost-color-surface-hover: #2b373e; + --frost-color-text: #edf2f4; + --frost-color-text-muted: #aab7bd; + --frost-color-border: #35434b; + --frost-color-border-strong: #52626b; + --frost-color-accent: #79a9ff; + --frost-color-accent-hover: #a0c2ff; + --frost-color-on-accent: #0d1a32; + --frost-color-success: #65d39b; + --frost-color-warning: #f3bd63; + --frost-color-danger: #ff9388; + --frost-color-info: #7fc4ff; + --frost-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25); + --frost-shadow-md: 0 4px 14px rgb(0 0 0 / 0.28); + --frost-shadow-lg: 0 16px 45px rgb(0 0 0 / 0.38); + } +} + +:root[data-theme="dark"] { + color-scheme: dark; + --frost-color-bg: #11161a; + --frost-color-surface: #192126; + --frost-color-surface-soft: #222c32; + --frost-color-surface-hover: #2b373e; + --frost-color-text: #edf2f4; + --frost-color-text-muted: #aab7bd; + --frost-color-border: #35434b; + --frost-color-border-strong: #52626b; + --frost-color-accent: #79a9ff; + --frost-color-accent-hover: #a0c2ff; + --frost-color-on-accent: #0d1a32; + --frost-color-success: #65d39b; + --frost-color-warning: #f3bd63; + --frost-color-danger: #ff9388; + --frost-color-info: #7fc4ff; +} +