Initial Frost v0.1 framework

This commit is contained in:
2026-10-29 21:42:51 +01:00
commit f5cd37254c
9 changed files with 537 additions and 0 deletions
+91
View File
@@ -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
<link rel="stylesheet" href="frost/frost.css">
```
For a CSS-aware build:
```css
@import "./frost/frost.css";
```
## Basic usage
```html
<main class="frost-container frost-stack">
<section class="frost-card frost-card--elevated">
<h1>Welcome to Frost</h1>
<p class="frost-text-muted">A compact foundation for reusable interfaces.</p>
<a class="frost-button frost-button--primary" href="/start">Get started</a>
</section>
</main>
```
## Layout
```html
<div class="frost-grid" style="--frost-grid-min: 14rem">
<article class="frost-card">One</article>
<article class="frost-card">Two</article>
</div>
```
`frost-stack`, `frost-row`, and `frost-grid` expose local custom properties for gap customization:
```html
<div class="frost-stack" style="--frost-stack-gap: var(--frost-space-8)">
...
</div>
```
## Forms
```html
<label class="frost-field">
<span class="frost-label">Email</span>
<input class="frost-input" type="email" autocomplete="email">
<span class="frost-help">We will only use this for account notifications.</span>
</label>
```
## Themes
Without an explicit theme, Frost follows `prefers-color-scheme`. Explicit themes override that behavior:
```html
<html data-theme="dark">
```
or:
```html
<html data-theme="light">
```
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.
+47
View File
@@ -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;
}
}
}
+43
View File
@@ -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); }
}
+50
View File
@@ -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; }
}
+55
View File
@@ -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); }
}
+78
View File
@@ -0,0 +1,78 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Frost v0.1 example</title>
<link rel="stylesheet" href="../frost.css">
<style>
body { padding-block: var(--frost-space-8); }
.example-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--frost-space-4); margin-block-end: var(--frost-space-8); }
.example-header h1 { margin-block-end: var(--frost-space-2); }
.example-section { margin-block-start: var(--frost-space-8); }
.example-section > h2 { margin-block-end: var(--frost-space-4); }
.example-sidebar { padding: var(--frost-space-4); background: var(--frost-color-surface-soft); border-inline-end: 1px solid var(--frost-color-border); }
.example-sidebar a { display: block; padding: var(--frost-space-2); }
.swatch { min-height: 4rem; padding: var(--frost-space-3); border-radius: var(--frost-radius-md); background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
</style>
</head>
<body>
<a class="frost-skip-link" href="#main">Skip to content</a>
<main id="main" class="frost-container">
<header class="example-header">
<div>
<p class="frost-text-muted">Frost CSS framework</p>
<h1>Small foundations for cold starts.</h1>
</div>
<button class="frost-button frost-button--secondary" id="theme-toggle" type="button">Toggle theme</button>
</header>
<section class="frost-notice frost-notice--info" aria-label="Framework note">
Frost is CSS-only. This page uses a tiny script only to demonstrate explicit theme switching.
</section>
<section class="example-section frost-stack">
<h2>Tokens and surfaces</h2>
<div class="frost-grid" style="--frost-grid-min: 12rem">
<div class="swatch">Accent</div>
<div class="frost-card frost-card--flat">Flat card</div>
<div class="frost-card frost-card--elevated">Elevated card</div>
</div>
</section>
<section class="example-section frost-stack">
<h2>Buttons and badges</h2>
<div class="frost-row">
<button class="frost-button frost-button--primary">Primary</button>
<button class="frost-button frost-button--secondary">Secondary</button>
<button class="frost-button frost-button--ghost">Ghost</button>
<button class="frost-button frost-button--danger">Danger</button>
<button class="frost-button frost-button--secondary" disabled>Disabled</button>
<span class="frost-badge frost-badge--success">Success</span>
<span class="frost-badge frost-badge--warning">Warning</span>
</div>
</section>
<section class="example-section frost-grid" style="--frost-grid-min: 18rem">
<div class="frost-card">
<h2>Form controls</h2>
<form class="frost-stack" style="--frost-stack-gap: var(--frost-space-4)">
<label class="frost-field"><span class="frost-label">Name</span><input class="frost-input" type="text" placeholder="Ada Lovelace"></label>
<label class="frost-field"><span class="frost-label">Type</span><select class="frost-select"><option>Website</option><option>Application</option></select></label>
<label class="frost-field"><span class="frost-label">Message</span><textarea class="frost-textarea" placeholder="Write something..."></textarea></label>
<button class="frost-button frost-button--primary" type="submit">Submit</button>
</form>
</div>
<div id="controls" class="frost-sidebar-layout">
<aside class="frost-sidebar example-sidebar"><strong>Sidebar</strong><a href="#main">Overview</a><a href="#controls">Controls</a></aside>
<div class="frost-main frost-card frost-card--flat"><h2>Sidebar layout</h2><p class="frost-text-muted">The layout becomes a normal single column below 48rem.</p></div>
</div>
</section>
</main>
<script>
document.querySelector('#theme-toggle').addEventListener('click', () => {
document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
});
</script>
</body>
</html>
+9
View File
@@ -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);
+58
View File
@@ -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; }
}
}
+106
View File
@@ -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;
}