Files
playwriter/website/AGENTS.md
Tommy D. Rossi 258f42527c website: move editorial tokens to globals.css, remove --ll- prefix
All CSS variables previously scoped under .liveline-page with --ll- prefix
are now at :root in globals.css with no prefix. Four names conflicting with
shadcn were renamed: --brand-primary, --brand-secondary, --link-accent,
--page-border.

Class renames: .liveline-page → .editorial-page, .liveline-article →
.editorial-article, .ll-bleed → .bleed, .ll-inline-code → .inline-code,
.ll-prose → .editorial-prose.

Filenames kept as-is for this commit to isolate the rename.
2026-02-20 23:02:02 +01:00

55 lines
1.7 KiB
Markdown

# Website
## Tailwind dark mode
Dark mode uses `prefers-color-scheme` media query, configured in `globals.css`:
```css
@custom-variant dark (@media (prefers-color-scheme: dark));
```
### `@variant dark` rules
1. **Must be nested inside a selector**, never at the top level:
```css
/* WRONG - silently produces no output */
@variant dark {
.my-class { color: white; }
}
/* CORRECT - nest inside the selector */
.my-class {
@variant dark {
color: white;
}
}
/* CORRECT - define variables inside :root */
:root {
@variant dark {
--my-var: white;
}
}
```
2. **Only works in CSS files that are part of the Tailwind compilation chain.** Files must be imported via CSS `@import` from `globals.css` (which has `@import "tailwindcss"`). JS/TS `import "file.css"` in route files does NOT go through Tailwind — `@variant dark` will silently fail.
```css
/* globals.css — this is the Tailwind entry point */
@import "tailwindcss";
@import "./liveline.css"; /* editorial page styles (class names, layout) */
@import "./liveline-prism.css"; /* prism syntax highlighting */
@custom-variant dark (@media (prefers-color-scheme: dark));
```
If you create a new CSS file that needs `@variant dark`, add it as a CSS `@import` in `globals.css`. Do NOT import it from a `.tsx` file.
### For many dark overrides, use CSS variables on `:root`
For files with many dark mode selectors (like prism syntax colors), define CSS variables in `:root { @variant dark { ... } }` and reference them in selectors. This avoids repeating `@variant dark` in every rule.
## No localStorage dark mode toggle
There is no JS-based `.dark` class toggle. Do not add inline scripts to toggle `.dark` on `<html>`. The site follows the OS preference only via `prefers-color-scheme`.