Global rules, attributes and parent states

import { const cx: (...a: css.ClassValue[]) => stringcx } from "cssints";
import * as import csscss from "cssints" with { type: "cssints" };

const const dark: css.QueryWrapdark = import csscss.
const media: Condition
<"(prefers-color-scheme: dark)">(query: "(prefers-color-scheme: dark)") => css.QueryWrap (+2 overloads)
media
("(prefers-color-scheme: dark)");
// a reset: rules with no class import csscss.const global: <"*, *::before, *::after">(selector: "*, *::before, *::after", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("*, *::before, *::after", import csscss.const boxSizing: <readonly ["border-box"]>(parts_0: "border-box") => css.Style
`content-box | border-box`. Chrome 10, Edge 12, Firefox 29, Safari 5.1, iOS 6, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/box-sizing)
boxSizing
("border-box"));
import csscss.const global: <"body">(selector: "body", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("body", import csscss.const margin: <readonly ["0"]>(parts_0: "0") => css.Style
`<'margin-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/margin)
margin
("0"), import csscss.const margin: <readonly ["8px"]>(parts_0: "8px") => css.Style
`<'margin-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/margin)
margin
("8px")); // the later margin wins
import csscss.const global: <":root">(selector: ":root", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
(":root", import csscss.const colorScheme: <readonly ["light"]>(parts_0: "light") => css.Style
`normal | [ light | dark | <custom-ident> ]+ && only?`. Chrome 81, Edge 81, Firefox 96, Safari 13, iOS 13, Android 81. [MDN](https://developer.mozilla.org/docs/Web/CSS/color-scheme)
colorScheme
("light"), const dark: (...styles: css.Style[]) => css.Styledark(import csscss.const colorScheme: <readonly ["dark"]>(parts_0: "dark") => css.Style
`normal | [ light | dark | <custom-ident> ]+ && only?`. Chrome 81, Edge 81, Firefox 96, Safari 13, iOS 13, Android 81. [MDN](https://developer.mozilla.org/docs/Web/CSS/color-scheme)
colorScheme
("dark")));
import csscss.const global: <"a[href^='http'] > b">(selector: "a[href^='http'] > b", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("a[href^='http'] > b", import csscss.const color: <readonly ["red"]>(parts_0: "red") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("red"));
import csscss.const global: <"a[href">(selector: "global(): unbalanced brackets or quotes in \"a[href\"", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("a[href", import csscss.const color: <readonly ["red"]>(parts_0: "red") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("red")); // error: a bracket is open
Argument of type '"a[href"' is not assignable to parameter of type '"global(): unbalanced brackets or quotes in \"a[href\""'.
import csscss.const global: <"a >">(selector: "a >", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("a >", import csscss.const color: <readonly ["red"]>(parts_0: "red") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("red")); // selector: unexpected end in "a >", expected <complex-selector-list>
import csscss.const global: <"a">(selector: "a", ...styles: css.Style[]) => void
`global(":root", media(dark)(colorScheme("dark")))`: a rule with no class, in layer `_.k`, in the sheet of the module that calls it. The selector is a `<complex-selector-list>` (the build reads it, the types check the brackets and quotes); the styles are plain declarations, under media(), container() or supports() if you like.
global
("a", import csscss.const hover: (...styles: css.Style[]) => css.Style
Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/:hover)
hover
(import csscss.const color: <readonly ["red"]>(parts_0: "red") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("red"))); // global() takes media(), container() and supports() conditions, not :hover: write the state in the selector
// an attribute state, and the state of a marked ancestor export const const row: css.Stylerow = import csscss.const cn: (...styles: css.Style[]) => css.Stylecn(import csscss.const group: <never>(name?: undefined) => css.Style
`group()` is the marker class `_g` for the element whose state `within()` reads; `group("row")` is `_g-row`, for a nested group. It has no CSS of its own.
group
(), import csscss.const p: <readonly [2]>(parts_0: 2) => css.Style
`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)
p
(2));
export const const link: stringlink = function cx(...a: css.ClassValue[]): stringcx( import csscss.const color: <readonly ["gray"]>(parts_0: "gray") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("gray"),
import csscss.const attr: <"aria-current">(name: "aria-current", value: string, op?: css.AttrOp) => css.StateWrap (+1 overload)attr("aria-current", "page")(import csscss.const color: <readonly ["blue"]>(parts_0: "blue") => css.Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("blue")),
import csscss.const within: <never>(state: css.StateWrap, name?: undefined) => css.Wrap
`within(hover)(color("red"))` is the style while a marked ancestor is hovered: `:where(._g:hover) ._x`, one class of specificity, one condition. `within(hover, "row")` reads the `group("row")` ancestor.
within
(import csscss.const hover: css.StateWrap
Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/:hover)
hover
)(import csscss.const textDecoration: <readonly ["underline"]>(parts_0: "underline") => css.Style
`<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/text-decoration)
textDecoration
("underline")),
); export const const icon: css.Styleicon = import csscss.const attr: <"href">(name: "href", value: string, op?: css.AttrOp) => css.StateWrap (+1 overload)attr("href", ".pdf", "$=")(import csscss.const opacity: <readonly [0.8]>(parts_0: 0.8) => css.Style
`<opacity-value>`. Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/opacity)
opacity
(0.8));
export const const nested: css.Stylenested = import csscss.const cn: (...styles: css.Style[]) => css.Stylecn(import csscss.const group: <"card">(name?: "card" | undefined) => css.Style
`group()` is the marker class `_g` for the element whose state `within()` reads; `group("row")` is `_g-row`, for a nested group. It has no CSS of its own.
group
("card"), import csscss.const within: <"card">(state: css.StateWrap, name?: "card" | undefined) => css.Wrap
`within(hover)(color("red"))` is the style while a marked ancestor is hovered: `:where(._g:hover) ._x`, one class of specificity, one condition. `within(hover, "row")` reads the `group("row")` ancestor.
within
(import csscss.const focusVisible: css.StateWrap
Chrome 86, Edge 86, Firefox 85, Safari 15.4, iOS 15.4, Android 86. [MDN](https://developer.mozilla.org/docs/Web/CSS/:focus-visible)
focusVisible
, "card")(import csscss.const outline: <readonly ["2px solid"]>(parts_0: "2px solid") => css.Style
`<'outline-width'> || <'outline-style'> || <'outline-color'>`. Chrome 94, Edge 94, Firefox 88, Safari 16.4, iOS 16.4, Android 94. [MDN](https://developer.mozilla.org/docs/Web/CSS/outline)
outline
("2px solid")));
import csscss.const attr: <"a b">(name: "\"a b\" is not a name") => css.StateWrap (+1 overload)attr("a b"); // error: a name has no space
Argument of type '"a b"' is not assignable to parameter of type '"\"a b\" is not a name"'.
import csscss.const attr: <"a">(name: "a", value: string, op?: css.AttrOp) => css.StateWrap (+1 overload)attr("a", "x", "!="); // error: not an operator
Argument of type '"!="' is not assignable to parameter of type 'AttrOp | undefined'.
import csscss.const within: <never>(state: css.StateWrap, name?: undefined) => css.Wrap
`within(hover)(color("red"))` is the style while a marked ancestor is hovered: `:where(._g:hover) ._x`, one class of specificity, one condition. `within(hover, "row")` reads the `group("row")` ancestor.
within
(css.media("(width >= 40rem)")); // error: a media query is not a state
Argument of type 'QueryWrap' is not assignable to parameter of type 'StateWrap'. Type 'QueryWrap' is not assignable to type '{ readonly __state: true; }'.
@layer _.k {
	*, *::before, *::after{box-sizing:border-box}
	body{margin:8px}
	:root{color-scheme:light}@media (prefers-color-scheme: dark){:root{color-scheme:dark}}
	a[href^='http'] > b{color:red}
}
@layer _.b {
	:where(._g:hover) ._72037{text-decoration:underline}
	._fc1pxh[aria-current="page"]{color:blue}
	._pl3vkk[href$=".pdf"]{opacity:0.8}
}