base_styles.css in CSS
A complete base stylesheet: reset, tokens, typography and form defaults.
/* Base stylesheet: reset, tokens, elements. */
@layer reset, tokens, base;
@layer reset {
*,
*::before,
*::after {
box-sizing: border-box;
}
body,
h1,
h2,
h3,
p,
figure {
margin: 0;
}
img,
svg,
video {
display: block;
max-width: 100%;
}
button,
input,
select,
textarea {
font: inherit;
color: inherit;
}
}
@layer tokens {
:root {
--bg: #ffffff;
--surface: #f4f4f6;
--fg: #14161c;
--muted: #5b6070;
--accent: #7c5cff;
--danger: #e5484d;
--radius: 0.5rem;
--pad: 1rem;
--measure: 68ch;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0b0c10;
--surface: #14161c;
--fg: #e8e8ea;
--muted: #9aa0b0;
}
}
}
@layer base {
body {
background: var(--bg);
color: var(--fg);
font-family: system-ui, sans-serif;
line-height: 1.5;
}
h1 {
font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem);
line-height: 1.1;
text-wrap: balance;
}
p {
max-width: var(--measure);
}
a {
color: var(--accent);
text-underline-offset: 0.2em;
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
}
How it works
- Layers keep the reset from fighting the component rules.
- Every color and radius comes from a custom property.
- The dark theme is a variable swap, not a second stylesheet.
Keywords and builtins used here
backgroundchclampcolordisplayemfontlayermarginmediaoutlinepxremvarvw
The run, in numbers
- Lines
- 86
- Characters to type
- 996
- Tokens
- 260
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 195 seconds.
Step 1 of 1 in Encore, step 26 of 26 in Selectors & the box model.