asw/content/docs/reset.md
Vigilio Desto da1d02ccd1
Port vault section (5 pages) and docs section (11 pages)
- content/vault/: _index.md, diff.md, session.md, status.md, tasks.md, wikilinks.md
- content/docs/: _index.md, introduction, tokens, reset, semantic-html,
  components, data-attributes, navigation, layouts, charts, chroma, accordion-dialog

96 pages build clean (was 36). Docs use sidebar nav + TOC layout.
Vault uses sidebar with section fallback (no vault menu configured yet).
URLs fixed: playground refs → asw.trentuna.com.

Closes: asw#12, asw#9
2026-04-10 18:40:50 +02:00

128 lines
3.3 KiB
Markdown

---
title: "Reset"
description: "What ASW's reset layer does, where it came from, and what it deliberately leaves alone."
type: docs
weight: 60
date: 2026-04-09
tags: ["reset", "css", "reference"]
ai-disclosure: "generated"
ai-model: "claude-sonnet-4-5"
ai-provider: "Anthropic"
---
ASW's reset is in `src/layers/00-reset.css`, ported from [Pico CSS v2.1.1](https://picocss.com/) (MIT). It's an opinionated normalize, not a zero-baseline reset — it corrects browser inconsistencies without stripping all defaults.
---
## What it does
### Box-sizing
Every element uses `border-box`. Padding and border are included in the declared width.
```css
*, *::before, *::after {
box-sizing: border-box;
background-repeat: no-repeat;
}
```
`background-repeat: no-repeat` prevents accidental tiling on elements that receive a background image.
### Document baseline
```css
:where(:root) {
-webkit-tap-highlight-color: transparent; /* remove tap flash on mobile */
text-size-adjust: 100%; /* prevent font inflation on mobile */
text-rendering: optimizeLegibility;
overflow-wrap: break-word; /* wrap long URLs / tokens */
tab-size: 4;
}
```
### Font size
```css
html { font-size: 100%; }
```
Root font size is `100%` of the browser default (typically 16px). Responsive scaling is applied in `01-tokens.css` via `clamp()`. Setting `100%` here respects user accessibility preferences — users who set a larger browser font get a proportionally larger site.
### Body
```css
body {
width: 100%;
margin: 0;
padding: 0;
font-size: var(--text-base);
font-family: var(--font-ui);
background-color: var(--surface);
color: var(--text);
}
```
All visual values come from ASW tokens. Font and colour are set once here and inherited everywhere.
### Main
```css
main { display: block; }
```
Fixes a legacy IE bug where `<main>` wasn't treated as a block element. Still included for completeness.
### Nested lists
```css
:where(dl, ol, ul) :where(dl, ol, ul) { margin: 0; }
```
Removes the double margin that browsers add to nested lists.
---
## What it leaves alone
The reset deliberately does **not**:
- Zero out heading sizes or margins (those are handled by `02-semantic.css`)
- Remove list styles (lists get `list-style: square` in the semantic layer)
- Reset form element appearance (handled by `03-components.css`)
- Set `line-height` on body (set via `var(--leading)` in `08-layout.css`)
---
## Pseudo-elements
```css
::before, ::after {
text-decoration: inherit;
vertical-align: inherit;
}
```
Pseudo-elements inherit text decoration and vertical alignment from their parent. This prevents `::before`/`::after` content from appearing unexpectedly underlined in links.
---
## Customising the reset
The reset layer uses low-specificity `:where()` selectors where possible. Override anything with a standard selector — no `!important` needed.
```css
/* Override: use rem-based font scaling instead of responsive clamp */
html { font-size: 1rem; }
/* Override: add body padding for a specific layout */
body { padding-inline: var(--space-4); }
```
---
## Related
- [Semantic HTML](/docs/semantic-html/) — element styles built on top of this reset
- [Token System](/docs/tokens/) — the custom properties (`--surface`, `--text`, `--font-ui`) referenced in this layer