···11+# Volt CSS Semantics
22+33+Auto-generated documentation from base.css
44+55+## CSS Custom Properties
66+77+All design tokens defined in the stylesheet.
88+99+### Typography
1010+1111+- `--font-size-base`: `18px`
1212+- `--font-size-sm`: `0.889rem`
1313+- `--font-size-lg`: `1.125rem`
1414+- `--font-size-xl`: `1.266rem`
1515+- `--font-size-2xl`: `1.424rem`
1616+- `--font-size-3xl`: `1.802rem`
1717+- `--font-size-4xl`: `2.027rem`
1818+- `--font-size-5xl`: `2.566rem`
1919+- `--font-sans`: `"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`
2020+- `--font-serif`: `"Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif`
2121+- `--font-mono`: `"SF Mono", "Cascadia Code", "Fira Code", "Roboto Mono", Consolas, monospace`
2222+- `--line-height-tight`: `1.25`
2323+- `--line-height-base`: `1.6`
2424+- `--line-height-relaxed`: `1.8`
2525+- `--font-size-base`: `16px`
2626+- `--font-size-base`: `15px`
2727+2828+### Spacing
2929+3030+- `--space-xs`: `0.25rem`
3131+- `--space-sm`: `0.5rem`
3232+- `--space-md`: `1rem`
3333+- `--space-lg`: `1.5rem`
3434+- `--space-xl`: `2rem`
3535+- `--space-2xl`: `3rem`
3636+- `--space-3xl`: `4rem`
3737+- `--space-2xl`: `2rem`
3838+- `--space-3xl`: `3rem`
3939+4040+### Layout
4141+4242+- `--content-width`: `70ch`
4343+- `--sidenote-width`: `18rem`
4444+- `--sidenote-gap`: `2rem`
4545+4646+### Colors
4747+4848+- `--color-bg`: `#fefefe`
4949+- `--color-bg-alt`: `#f5f5f5`
5050+- `--color-text`: `#1a1a1a`
5151+- `--color-text-muted`: `#666666`
5252+- `--color-accent`: `#0066cc`
5353+- `--color-accent-hover`: `#0052a3`
5454+- `--color-border`: `#d4d4d4`
5555+- `--color-code-bg`: `#f8f8f8`
5656+- `--color-mark`: `#fff3cd`
5757+- `--color-success`: `#22863a`
5858+- `--color-warning`: `#bf8700`
5959+- `--color-error`: `#cb2431`
6060+- `--color-bg`: `#1a1a1a`
6161+- `--color-bg-alt`: `#2a2a2a`
6262+- `--color-text`: `#e6e6e6`
6363+- `--color-text-muted`: `#a0a0a0`
6464+- `--color-accent`: `#4da6ff`
6565+- `--color-accent-hover`: `#66b3ff`
6666+- `--color-border`: `#404040`
6767+- `--color-code-bg`: `#2a2a2a`
6868+- `--color-mark`: `#4a4a00`
6969+- `--color-success`: `#34d058`
7070+- `--color-warning`: `#ffdf5d`
7171+- `--color-error`: `#f97583`
7272+7373+### Effects
7474+7575+- `--shadow-sm`: `0 1px 2px rgba(0, 0, 0, 0.05)`
7676+- `--shadow-md`: `0 4px 6px rgba(0, 0, 0, 0.07)`
7777+- `--shadow-lg`: `0 10px 15px rgba(0, 0, 0, 0.1)`
7878+- `--radius-sm`: `3px`
7979+- `--radius-md`: `6px`
8080+- `--radius-lg`: `8px`
8181+- `--transition-fast`: `150ms ease-in-out`
8282+- `--transition-base`: `250ms ease-in-out`
8383+- `--shadow-sm`: `0 1px 2px rgba(0, 0, 0, 0.3)`
8484+- `--shadow-md`: `0 4px 6px rgba(0, 0, 0, 0.4)`
8585+- `--shadow-lg`: `0 10px 15px rgba(0, 0, 0, 0.5)`
8686+8787+## Element Coverage
8888+8989+HTML elements with defined styling in the stylesheet.
9090+9191+**Coverage**: 58/60 elements
9292+9393+### Styled Elements
9494+9595+**Document Structure**: html, body
9696+**Typography**: h1, h2, h3, h4, h5, h6, p, a, em, strong, mark, small, sub, sup, hr
9797+**Lists**: ul, ol, li, dl, dt, dd
9898+**Semantic**: blockquote, cite, article, section, aside, header, footer, nav, details, summary
9999+**Forms**: form, fieldset, legend, label, input, select, textarea, button
100100+**Tables**: table, thead, th, td
101101+**Media**: img, figure, figcaption, video, audio, canvas, svg, iframe
102102+**Code**: code, pre, kbd, samp, var
103103+104104+### Unstyled Elements
105105+106106+tbody, tr
107107+108108+## Documentation Comments
109109+110110+Inline documentation extracted from CSS comments.
111111+112112+### `:root`
113113+114114+Root-level CSS variables define the design system. Light theme is default, dark theme overrides via media query.
115115+116116+### `@media (prefers-color-scheme: dark)`
117117+118118+Dark Theme Overrides Automatically applied when user prefers dark color scheme
119119+120120+### `*, *::before, *::after`
121121+122122+Modern CSS reset with sensible defaults
123123+124124+### `html`
125125+126126+Document root configuration Sets base font size for rem calculations
127127+128128+### `body`
129129+130130+Body element - Primary container Sets default typography and colors for the entire document
131131+132132+### `h1, h2, h3, h4, h5, h6`
133133+134134+Headings hierarchy Uses modular scale for harmonious sizing Tighter line-height for larger text improves readability
135135+136136+### `h1`
137137+138138+Individual heading sizes h1-h3 use slightly larger weights for emphasis
139139+140140+### `p`
141141+142142+Paragraph spacing Generous spacing between paragraphs aids scanning
143143+144144+### `h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p`
145145+146146+First paragraph after headings - No top margin Common convention in academic typography
147147+148148+### `a`
149149+150150+Links - Accessible and distinctive Uses accent color with underline for clarity
151151+152152+### `em`
153153+154154+Emphasis and strong elements
155155+156156+### `mark`
157157+158158+Marked/highlighted text
159159+160160+### `sub, sup`
161161+162162+Subscript and superscript Prevents them from affecting line height
163163+164164+### `small`
165165+166166+Small text Also used for Tufte-style sidenotes (see sidenotes section)
167167+168168+### `ul, ol`
169169+170170+List spacing and indentation Nested lists inherit proper spacing
171171+172172+### `li`
173173+174174+List items
175175+176176+### `li > ul, li > ol`
177177+178178+Nested lists - Reduced spacing
179179+180180+### `dl`
181181+182182+Description lists - For key-value pairs
183183+184184+### `p:has(small)`
185185+186186+Parent paragraph must be positioned for absolute children
187187+188188+### `p small`
189189+190190+Pull small elements into the right margin Creates classic Tufte-style sidenote layout
191191+192192+### `@media (max-width: 767px)`
193193+194194+Mobile sidenotes - Inline with subtle styling
195195+196196+### `blockquote`
197197+198198+Blockquote styling Left border for visual distinction, italic for emphasis
199199+200200+### `cite`
201201+202202+Citation element
203203+204204+### `code`
205205+206206+Inline code Monospace font with subtle background for distinction
207207+208208+### `kbd`
209209+210210+Keyboard input Styled like keys on a keyboard
211211+212212+### `samp`
213213+214214+Sample output
215215+216216+### `var`
217217+218218+Variable
219219+220220+### `pre`
221221+222222+Preformatted code blocks Horizontal scrolling for overflow, no word wrap
223223+224224+### `hr`
225225+226226+Section dividers Centered decorative element with breathing room
227227+228228+### `table`
229229+230230+Table container for horizontal scrolling on small screens
231231+232232+### `thead`
233233+234234+Table header styling Bold text with bottom border for separation
235235+236236+### `td`
237237+238238+Table cells
239239+240240+### `tbody tr:nth-child(even)`
241241+242242+Zebra striping for easier row scanning
243243+244244+### `tbody tr:hover`
245245+246246+Hover state for interactive tables
247247+248248+### `form`
249249+250250+Form container spacing
251251+252252+### `fieldset`
253253+254254+Fieldset grouping
255255+256256+### `label`
257257+258258+Labels Block display for better touch targets
259259+260260+### `textarea`
261261+262262+Textarea specific
263263+264264+### `input[type="checkbox"],`
265265+266266+Checkboxes and radio buttons
267267+268268+### `input[type="file"]`
269269+270270+File input
271271+272272+### `input[type="range"]`
273273+274274+Range input
275275+276276+### `progress, meter`
277277+278278+Progress and meter
279279+280280+### `input[type="reset"]`
281281+282282+Reset button - Subdued styling
283283+284284+### `img`
285285+286286+Images Responsive by default, maintains aspect ratio
287287+288288+### `figure`
289289+290290+Figures with captions Common in academic and technical writing
291291+292292+### `video, audio`
293293+294294+Video and audio Responsive and accessible
295295+296296+### `canvas, svg`
297297+298298+Canvas and SVG
299299+300300+### `iframe`
301301+302302+iframe - Responsive wrapper
303303+304304+### `article, section`
305305+306306+Article and Section Spacing between major content blocks
307307+308308+### `aside`
309309+310310+Aside Complementary content, styled distinctly
311311+312312+### `header`
313313+314314+Header and Footer
315315+316316+### `nav`
317317+318318+Nav Navigation menus
319319+320320+### `details`
321321+322322+Details and Summary Disclosure widget for expandable content
323323+324324+### `.sr-only`
325325+326326+Screen reader only Hides content visually but keeps it accessible to assistive technology
327327+328328+### `@media print`
329329+330330+Print-specific optimizations
331331+332332+### `@media (max-width: 768px)`
333333+334334+Tablet and below - Reduce spacing
335335+336336+### `@media (max-width: 480px)`
337337+338338+Mobile - Further reduced spacing and sizing
+329
docs/css/volt-css.md
···11+# Volt CSS
22+33+A classless CSS stylesheet for elegant, readable web documents. Drop it into any HTML page for instant, semantic styling without touching a single class name.
44+55+## Philosophy
66+77+Volt CSS embraces semantic HTML5 and lets the content structure define the presentation. Inspired by academic typography and modern web design, it creates documents that are beautiful, accessible, and optimized for reading.
88+99+### Core Principles
1010+1111+- **Classless**: Style semantic HTML elements directly.
1212+- Optimized line lengths, modular type scale, and generous whitespace optimized for reading
1313+- Automatic light and dark modes via `prefers-color-scheme` to respect user preferences with carefully calibrated color palettes for both modes.
1414+- **Accessibility**: WCAG AA contrast ratios, keyboard navigation support, and semantic HTML patterns
1515+- Mobile-first (ish) design that adapts gracefully from phones to wide desktop monitors without compromising readability.
1616+1717+## Inspiration
1818+1919+Volt CSS synthesizes ideas from several excellent classless CSS frameworks:
2020+2121+- **magick.css**: Tufte-style [sidenotes](#tufte-style-sidenotes), playful personality, well-commented code
2222+- **LaTeX.css**: Academic typography, wide margins, optimized for technical content
2323+- **Sakura**: Minimal duotone color palettes, rapid prototyping
2424+- **Matcha**: Semantic hierarchy, CSS custom properties architecture
2525+- **MVP.css**: Sensible defaults, zero configuration needed
2626+2727+## Features
2828+2929+### Complete Element Coverage
3030+3131+All semantic HTML5 elements are styled out of the box:
3232+3333+- Typography: headings, paragraphs, links, lists (ordered, unordered, description)
3434+- Content: blockquotes, code blocks, tables, figures with captions
3535+- Forms: inputs, textareas, selects, buttons, checkboxes, radio buttons, file uploads
3636+- Media: images, video, audio, iframes
3737+- Semantic: article, section, aside, header, footer, nav, details/summary
3838+3939+### Tufte-Style Sidenotes
4040+4141+Inspired by Edward Tufte's beautiful book design, margin notes can be added using simple `<small>` elements within paragraphs.
4242+4343+**Desktop**: Notes appear in the right margin
4444+**Mobile**: Notes appear inline with subtle styling
4545+4646+### Example
4747+4848+```html
4949+<p>
5050+ The framework handles reactivity through signals.
5151+ <small>
5252+ Signals are similar to reactive primitives in Solid.js and Vue 3's
5353+ ref() system, but with a simpler API surface.
5454+ </small>
5555+ This approach keeps the mental model straightforward.
5656+</p>
5757+```
5858+5959+### Modular Type Scale
6060+6161+Font sizes use a 1.25 ratio (major third) for "harmonious" hierarchy:
6262+6363+- Base: `18px` (`1rem`)
6464+- Scale: `0.889rem`, `1.125rem`, `1.266rem`, `1.424rem`, `1.802rem`, `2.027rem`, `2.566rem`
6565+- Headings use larger sizes from the scale, body text uses base and smaller sizes
6666+6767+### Optimized Reading Width
6868+6969+Main content is constrained to approximately 70 characters per line, around the optimal range for comfortable reading.
7070+Sidenotes extend into the right margin when space allows.
7171+7272+### Dark Mode Support
7373+7474+The stylesheet automatically switches to dark mode when the user's system preference is set to dark:
7575+7676+```css
7777+@media (prefers-color-scheme: dark) {
7878+ /* Dark theme colors applied automatically */
7979+}
8080+```
8181+8282+Both themes use carefully selected colors with proper contrast ratios for accessibility.
8383+8484+## Usage
8585+8686+### Basic Setup
8787+8888+Include the stylesheet in your HTML `<head>`:
8989+9090+```html
9191+<!DOCTYPE html>
9292+<html lang="en">
9393+ <head>
9494+ <meta charset="UTF-8">
9595+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9696+ <link rel="stylesheet" href="/src/styles/base.css">
9797+ <title>My Document</title>
9898+ </head>
9999+ <body>
100100+ <!-- Your markup -->
101101+ </body>
102102+</html>
103103+```
104104+105105+### Example Document Structure
106106+107107+```html
108108+<body>
109109+ <header>
110110+ <h1>Document Title</h1>
111111+ <p>Subtitle or introduction</p>
112112+ </header>
113113+114114+ <article>
115115+ <h2>Section Heading</h2>
116116+ <p>
117117+ Your content flows naturally.
118118+ <small>Add sidenotes for additional context.</small>
119119+ The stylesheet handles all the styling.
120120+ </p>
121121+122122+ <blockquote>
123123+ <p>Quotes are styled with subtle backgrounds and borders.</p>
124124+ <cite>Author Name</cite>
125125+ </blockquote>
126126+127127+ <pre><code>// Code blocks use monospace fonts
128128+const example = "syntax highlighting not included";</code></pre>
129129+130130+ <table>
131131+ <thead>
132132+ <tr>
133133+ <th>Feature</th>
134134+ <th>Status</th>
135135+ </tr>
136136+ </thead>
137137+ <tbody>
138138+ <tr>
139139+ <td>Tables</td>
140140+ <td>Styled with zebra striping</td>
141141+ </tr>
142142+ </tbody>
143143+ </table>
144144+ </article>
145145+146146+ <footer>
147147+ <p>Footer content, copyright, etc.</p>
148148+ </footer>
149149+</body>
150150+```
151151+152152+### Forms
153153+154154+Forms get styling with focus states, required field indicators, and proper spacing:
155155+156156+```html
157157+<form>
158158+ <fieldset>
159159+ <legend>User Information</legend>
160160+161161+ <label for="name">Name</label>
162162+ <input type="text" id="name" name="name" required>
163163+164164+ <label for="email">Email</label>
165165+ <input type="email" id="email" name="email" required>
166166+167167+ <label for="message">Message</label>
168168+ <textarea id="message" name="message"></textarea>
169169+170170+ <button type="submit">Send Message</button>
171171+ <input type="reset" value="Clear Form">
172172+ </fieldset>
173173+</form>
174174+```
175175+176176+## Customization
177177+178178+### CSS Custom Properties
179179+180180+All design tokens are defined as CSS custom properties (CSS variables) in the `:root` selector. Override them to customize the appearance:
181181+182182+```css
183183+:root {
184184+ /* Change the accent color */
185185+ --color-accent: #d63384;
186186+ --color-accent-hover: #b02a6b;
187187+188188+ /* Adjust spacing */
189189+ --space-md: 1.25rem;
190190+191191+ /* Change fonts */
192192+ --font-sans: "Your Font", system-ui, sans-serif;
193193+194194+ /* Modify content width */
195195+ --content-width: 60ch;
196196+}
197197+```
198198+199199+### Properties
200200+201201+**Typography**:
202202+203203+- `--font-sans`, `--font-serif`, `--font-mono`: Font families
204204+- `--font-size-*`: Size scale from sm to 5xl
205205+- `--line-height-tight`, `--line-height-base`, `--line-height-relaxed`
206206+207207+**Colors**:
208208+209209+- `--color-bg`: Background color
210210+- `--color-bg-alt`: Alternate background (code blocks, table stripes)
211211+- `--color-text`: Primary text color
212212+- `--color-text-muted`: Secondary text color
213213+- `--color-accent`: Accent color for links, buttons
214214+- `--color-accent-hover`: Hover state for accent color
215215+- `--color-border`: Border color
216216+- `--color-code-bg`: Code block background
217217+- `--color-mark`: Highlighted text background
218218+- `--color-success`, `--color-warning`, `--color-error`: Semantic colors
219219+220220+**Spacing**:
221221+222222+- `--space-xs` through `--space-3xl`: Spacing scale
223223+224224+**Layout**:
225225+226226+- `--content-width`: Maximum width for readable content
227227+- `--sidenote-width`: Width of margin notes
228228+- `--sidenote-gap`: Space between content and sidenotes
229229+230230+**Effects**:
231231+232232+- `--shadow-sm`, `--shadow-md`, `--shadow-lg`: Box shadows
233233+- `--radius-sm`, `--radius-md`, `--radius-lg`: Border radius
234234+- `--transition-fast`, `--transition-base`: Transition durations
235235+236236+### Dark Mode Customization
237237+238238+Override dark mode colors specifically:
239239+240240+```css
241241+@media (prefers-color-scheme: dark) {
242242+ :root {
243243+ --color-accent: #f0f;
244244+ --color-bg: #000;
245245+ }
246246+}
247247+```
248248+249249+### Scoped Customization
250250+251251+Apply custom styling to specific sections without affecting the whole document:
252252+253253+```html
254254+<style>
255255+ .special-section {
256256+ --color-accent: #e74c3c;
257257+ --font-sans: "Georgia", serif;
258258+ }
259259+</style>
260260+261261+<div class="special-section">
262262+ <h2>This section uses different colors and fonts</h2>
263263+ <p>All nested elements inherit the custom properties.</p>
264264+</div>
265265+```
266266+267267+## Browser Support
268268+269269+Volt CSS uses modern CSS features and targets evergreen browsers:
270270+271271+- Chrome/Edge 90+
272272+- Firefox 88+
273273+- Safari 14+
274274+275275+Specifically relies on:
276276+277277+- CSS custom properties (CSS variables)
278278+- CSS Grid and Flexbox
279279+- `:has()` selector (for sidenote positioning)
280280+- `prefers-color-scheme` media query
281281+282282+For older browsers, content remains readable but may lack advanced layout features like margin sidenotes.
283283+284284+## Accessibility
285285+286286+- All color combinations meet WCAG AA standards (4.5:1 for normal text, 3:1 for large text)
287287+- Clear, visible focus states for keyboard navigation
288288+- Encourages proper heading hierarchy, landmark regions, and form labels
289289+- Works on all devices and respects user font size preferences
290290+- No animations that could trigger vestibular disorders
291291+292292+## Size & Performance
293293+294294+The complete stylesheet is approximately 15KB uncompressed, 3-4KB when gzipped
295295+296296+For maximum performance:
297297+298298+1. Serve with proper compression (gzip or brotli)
299299+2. Set appropriate cache headers
300300+3. Consider inlining in `<style>` tags for above-the-fold content on single-page sites
301301+302302+## Design Decisions
303303+304304+### Sans-Serif
305305+306306+While serif fonts are traditional for long-form reading, modern screens render sans-serif fonts with excellent clarity. The system font stack ensures fast loading and familiar reading experience while maintaining personality through spacing, hierarchy, and layout.
307307+308308+### `<small>` Sidenotes?
309309+310310+The `<small>` element semantically represents side comments and fine print, making it a natural choice for sidenotes. This approach requires no custom attributes or classes, keeping markup clean and portable.
311311+312312+### 70 Characters Line Length
313313+314314+Research shows optimal reading comprehension occurs with 45-75 characters per line. 70 characters balances readability with efficient use of screen space.
315315+316316+### Automatic Dark Mode
317317+318318+Respecting user preferences improves accessibility and reduces eye strain. Automatic theme switching via `prefers-color-scheme` requires zero configuration while providing the best experience for each user.
319319+320320+## License
321321+322322+Part of the Volt.js project. MIT licensed.
323323+324324+## Further Reading
325325+326326+- [Tufte CSS](https://edwardtufte.github.io/tufte-css/)
327327+- [Practical Typography by Matthew Butterick](https://practicaltypography.com/)
328328+- [The Elements of Typographic Style Applied to the Web](http://webtypography.net/)
329329+- [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/WCAG21/quickref/)