@stnd/styles 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @stnd/styles
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Mariage theme fix
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Francis Fontaine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,16 +1,33 @@
1
1
  ---
2
2
  title: "@stnd/styles"
3
- status: active
3
+ aliases: []
4
+ created: 2026-07-04 23:27
5
+ modified: 2026-07-05 19:16
6
+ last_audited: 2026-07-14
7
+ audit_interval_days: 90
8
+ next_audit: 2026-10-12
9
+ audit_priority: 3
4
10
  maturity: tree
5
- type: package
11
+ mode: read
12
+ publish: false
13
+ status: active
6
14
  tags:
7
15
  - package
8
16
  - stnd
17
+ theme: kernel
18
+ type: package
19
+ visibility: private
20
+ ---
21
+
22
+ # @[stnd](../README)/styles
23
+
24
+ > The CSS typography and design system framework for the Standard Ecosystem.
25
+
9
26
  ---
10
27
 
11
- # @stnd/styles
28
+ This is the CSS. One seed color in, a whole harmonious palette out; one base font size in, a whole readable type scale out. You almost never touch this package directly — it’s on automatically (see `@stnd/modules/styles` in the Gold Standard). You touch it when you want to *change* the numbers behind the look (the golden-ratio scale, the OKLCH color math) rather than a specific theme’s colors (that’s `@stnd/themes`).
12
29
 
13
- The CSS typography and design system framework for the Standard Ecosystem.
30
+ **You’re already using it.** Nothing to install or configure for a normal site.
14
31
 
15
32
  ## Overview
16
33
 
@@ -22,9 +39,9 @@ The CSS typography and design system framework for the Standard Ecosystem.
22
39
 
23
40
  The system rejects arbitrary pixel coordinates. All spacing, font scaling, and line heights are tied to three mathematical constants:
24
41
 
25
- * **Golden Ratio** ($\phi \approx 1.618$): Governs structural widths, block margins, and main layout columns.
26
- * **Silver Ratio** ($\theta \approx 1.414$): Governs the typographic scale and base vertical rhythm.
27
- * **Halfstep** ($\sqrt{\phi} \approx 1.272$): Square root of the Golden Ratio, used for subheadings, margins, and inline gaps.
42
+ - **Golden Ratio** ($\phi \approx 1.618$): Governs structural widths, block margins, and main layout columns.
43
+ - **Silver Ratio** ($\theta \approx 1.414$): Governs the typographic scale and base vertical rhythm.
44
+ - **Halfstep** ($\sqrt{\phi} \approx 1.272$): Square root of the Golden Ratio, used for subheadings, margins, and inline gaps.
28
45
 
29
46
  ---
30
47
 
@@ -49,12 +66,12 @@ Standard applies a strict modular font scale to prevent typographic clashes. Bod
49
66
 
50
67
  Vertical rhythm is managed through a base unit `--space` (usually $1\text{rem}$ / $16\text{px}$). Multiples and fractions are locked:
51
68
 
52
- * **Standard Spacing (Multiples)**:
53
- * `--space-2`, `--space-4`, `--space-8`, `--space-12`
54
- * **Sub-units (Fractions)**:
55
- * `--space-half` (0.5x), `--space-third` (0.33x), `--space-d4` (0.25x), `--space-d8` (0.125x)
69
+ - **Standard Spacing (Multiples)**:
70
+ - `--space-2`, `--space-4`, `--space-8`, `--space-12`
71
+ - **Sub-units (Fractions)**:
72
+ - `--space-half` (0.5x), `--space-third` (0.33x), `--space-d4` (0.25x), `--space-d8` (0.125x)
56
73
 
57
- Elements align to this grid through a strict rule: *the sum of an element's font-size, line-height, and margins must always be a multiple of `--space`.*
74
+ Elements align to this grid through a strict rule: *the sum of an element’s font-size, line-height, and margins must always be a multiple of `--space`.*
58
75
 
59
76
  ---
60
77
 
@@ -74,9 +91,9 @@ Instead of hardcoding colors, the system generates complete color palettes dynam
74
91
 
75
92
  Specialized styling rules load automatically depending on document attributes:
76
93
 
77
- * **Prose Mode** (`.prose`): Restricts reading width to an optimal measure ($\approx 65\text{ch}$) to prevent eye strain.
78
- * **Dark Mode**: Evaluated via system settings (`prefers-color-scheme`) or overridden with the `.theme-dark` class.
79
- * **E-Ink Mode** (`.standard-eink`): Strips out all transforms, blurs, and animations, switching colors to pure high-contrast black and white to prevent ghosting on e-readers.
94
+ - **Prose Mode** (`.prose`): Restricts reading width to an optimal measure ($\approx 65\text{ch}$) to prevent eye strain.
95
+ - **Dark Mode**: Evaluated via system settings (`prefers-color-scheme`) or overridden with the `.theme-dark` class.
96
+ - **E-Ink Mode** (`.standard-eink`): Strips out all transforms, blurs, and animations, switching colors to pure high-contrast black and white to prevent ghosting on e-readers.
80
97
 
81
98
  ---
82
99
 
@@ -86,9 +103,11 @@ In your main SCSS stylesheet or Astro entry point:
86
103
 
87
104
  ```scss
88
105
  // Load standard variables and layouts
89
- import "@stnd/styles/standard.scss";
106
+ @use "@stnd/styles/standard.scss";
90
107
  ```
91
108
 
109
+ > Most apps never need this — the Gold Standard `@stnd/modules/styles` module injects the stylesheet automatically. Import it manually only when composing your own SCSS entry point.
110
+
92
111
  ### Style Files Anatomy
93
112
  - `standard.scss`: Framework index.
94
113
  - `_standard-01-token.scss`: Variable dictionary.
@@ -100,17 +119,91 @@ import "@stnd/styles/standard.scss";
100
119
 
101
120
  ---
102
121
 
103
- ## What's next — open
104
-
105
- - [ ] **CSS framework audit / cleanup** — verify that everything is still up to our standard (the initial draft is old; a cleanup is likely possible).
122
+ ## Notes / Observations
123
+
124
+ *(jot down anything noticed here — quirks, gotchas, ideas)*
125
+
126
+ ### Audit log (2026-07-14 → ongoing)
127
+
128
+ File-by-file pass, adding WHY-comments and checking for cascade/scope bugs. Fixed vs. flagged-only noted per item.
129
+
130
+ **Fixed:**
131
+ - **`$stnd-scope: ":root, body"` silently blocked frontmatter overrides.**
132
+ A token declared on both `:root` and `body` always resolves to `body`'s own copy for anything read by a non-inherited property at-or-below `<body>` (its own `max-width`/`padding`) — inheritance never kicks in because `body` already has an explicit declaration. Any `:root`-only override (exactly what a note's frontmatter `inlineStyle` produces) was silently ineffective for `--body-max-width`, `--line-width`, `--gap-body`/`--gap-header`/`--gap-footer`. Root cause fixed at the scope itself (`$stnd-scope` → `:root`-only) rather than patched per-token. Caught via a live production repro on francisfontaine.com.
133
+ - **`$stnd-scope` vs `$stnd-theme-scope`** — two SCSS variables, always set
134
+ to the identical selector in every build config (`:root` on web, `body.stnd-theme` in Obsidian) since the fix above. Pure redundancy — consolidated to one (`$stnd-theme-scope`, the more widely-used name).
135
+ - **`$elements-boxed`** (`_standard-00-variables.scss`) — defined, never
136
+ consumed anywhere. Deleted.
137
+ - **Duplicate `--ease-aggressive`** — identical value declared twice in
138
+ `_standard-01-token.scss`. Deleted the redundant copy.
139
+ - **`$mobile` docblock drift** — comment claimed `480px`, actual value is
140
+ `600px` (confirmed correct). Comment fixed to match code.
141
+ - **`obsidian.scss` docblock drift** — claimed tokens live "inside :root";
142
+ actually scoped to `body.stnd-theme` (deliberately, for namespacing in Obsidian's shared window). Comment corrected.
143
+ - **`body`'s own dead `--max-width` fallback** (`_standard-07-base.scss`)
144
+ — `max-width: var(--body-max-width, var(--max-width))`, left over from *my own* `--max-width` removal earlier this session (missed this one file at the time). `--body-max-width` always has a value, so the fallback never fired — harmless, but stale. Now matches `.prose`'s equivalent rule (`var(--body-max-width)`, no fallback).
145
+ - **Garbled leftover comment** (`_standard-07-base.scss`) — a `[id]`
146
+ block's comment repeated the same incomplete CSS fragment (`background: var(--color-surface-highest);`) four times, pure noise. Replaced with an actual explanation of what `scroll-margin-top` there is for (keeps anchor-linked headings clear of the sticky header).
147
+ - **`.negate-body-padding*` docblock described a nonexistent API**
148
+ (`_standard-07-base.scss`) — those three class names, and the usage example, don't match the real implementation (`.no-body-margin`, and far more restrictive: only `<footer>`/`<header>` that are direct children of `<body>` and first/last-of-type). Neither name is used anywhere in `apps/` today, so nothing broke in practice, but the docs would have misled whoever reached for it next. Rewrote to match reality.
149
+ - **Duplicate identical `font-family` on `select`** (`_standard-11-forms.scss`)
150
+ — same line twice, zero behavior difference either way. Removed one.
151
+ - **Stale file reference** (`_standard-12-code.scss`) — comment pointed to
152
+ `standard-98-utilities.scss`, which doesn't exist; real file is `_standard-50-utilities.scss`. Corrected.
153
+ - **`.bg-surface` defined three times, identically** (`_standard-50-utilities.scss`) — same declaration, zero behavior difference. Consolidated to one; verified the computed color is unchanged.
154
+
155
+ **Fixed — round 2 (2026-07-14, same day, follow-up pass on everything round 1 had flagged):**
156
+ Every flagged item below got fixed except three, which are real judgment calls and stayed open on purpose (see the next section). Grouped by file:
157
+ - `_standard-01-token.scss`: `--z-launher` → `--z-launcher` (typo fixed; still unused, but spelled correctly).
158
+ - `_standard-02-color.scss`: dark-mode purple/pink/brown now reassign to their `--color-dark-*` counterparts (in both the `prefers-color-scheme: dark` block and the `[data-color-mode="dark"]` blocks); added the missing Stage 8 non-OKLCH fallback hex for all three; deleted the dead `0 solid transparent` `--border` line (kept `none` — see deferred items, the *value* wasn't touched); collapsed `--shadow`'s duplicated `--shadow-ambient` layer to one.
159
+ - `_standard-03-typography.scss`: `grid-line-height` mixin now reads `var(--font-header-line-height, ...)` instead of ignoring the token outright — headings actually respond to the frontmatter token now; deleted the dead hardcoded second `.font-interface` block.
160
+ - `_standard-04-grid.scss`: deleted the dead `--grid-gap` copy of `.grid.compact`/`.relaxed`; replaced every `[class^="grid-"]`/`[class|="grid"]` attribute selector with an explicit, order-independent `$grid-selectors` list (confirmed fix against real markup: `apps/stnd.build/modules/core/routes/index.astro`'s `class="cover grid-12"`).
161
+ - `_standard-06-prose.scss`: `.mycelial-graft` now uses real tokens (`--color-muted`, `--color-accent`, `--color-surface-high`); deleted the stale `h1:first-child` comment.
162
+ - `_standard-07-base.scss`: mobile header padding-negation now sets `margin-block-start` (matching the desktop rule and the footer's symmetric block), not `margin-block-end`.
163
+ - `_standard-08-media.scss`: deleted the dead `--gap-body` padding line on `.image-zoom-overlay`; hardcoded `768px` → `#{$small}`.
164
+ - `_standard-09-lists.scss` / `_standard-50-utilities.scss`: removed all 5 dead `--base-gap` lines; `.display-flex` → `.flex` (the real class).
165
+ - `_standard-10-tables.scss`: `min-height: var(--line-height)` (invalid, unitless) → `min-height: calc(1em * var(--line-height-compact))`.
166
+ - `_standard-11-forms.scss`: `--color-on-cce` typo → `--color-on-accent`; deleted the flat `background` override that was silently killing "THE FILL MAGIC" slider gradient (confirmed live: `Slider.astro` sets `--slider-value` via JS), added a `50%` fallback to both gradient stops.
167
+ - `_standard-13-components.scss`: deleted the pointless `@each $type` badge loop (zero effect on output); `--alert-border-color` → `--color-alert`.
168
+ - `_standard-14-analog.scss`: hardcoded `z-index: 9999` → `var(--z-image-zoom)`.
169
+ - `_standard-30-contrast.scss` / `_standard-32-eink.scss`: added `html::after` to both grain-hiding selector lists (the overlay actually lives there, not on `body::before/after`).
170
+ - `_standard-31-print.scss`: dead `--body-padding` → real `--gap-body`/`--gap-header`/`--gap-footer` overrides.
171
+ - `_standard-32-eink.scss`: added the missing `@use "standard-00-variables" as *;`; `.card, .button, .image` → `.card, :where(button), a.btn, img` (real selectors); `--text-accent` → `--color-accent`.
172
+ - `_standard-50-utilities.scss`: `.line-s`/`.line-l`/`.columns-auto` → `--line-width-sm`/`--line-width-lg`; `.purple`/`.pink`/`.bg-purple`/`.bg-pink` → their real distinct tokens (no longer both rendering as magenta); `@supports not (display: grid)` fallback → `var(--gap)`; deleted the dead `[class|="columns"].compact`/`.relaxed` pair; removed dead `--color-msg` lines from all 4 alert variants.
173
+ - `_standard-99-debug.scss`: `--gap-grid` (undefined) → `var(--gap)` everywhere (the debug overlay's own column math now actually works); `--z-tooltip` (undefined) → hardcoded `10000` matching the file's own baseline.
174
+
175
+ All 17 files verified via a running dev server (both `stnd.gd` and `stnd.build`): zero compile errors, pixel-identical baseline screenshots, plus targeted computed-style spot-checks on the trickiest fixes (purple/pink/brown dark-mode switching, the grid attribute-selector fix against real production markup, the slider gradient rendering, `--font-header-line-height` genuinely driving heading line-height).
176
+
177
+ **Flagged — deliberately left as judgment calls, not bugs to silently fix:**
178
+ - **`--border` currently resolves to `none` sitewide** (`_standard-02-color.scss`) — affects cards, buttons, inputs, tables. The dead duplicate declaration is gone, but the final value was left alone: making it visible would be a real, sitewide visual design change (dozens of components), not a bug fix.
179
+ - **`.rhythm`'s base 1x-spacing rule has no `>` combinator; every other rule in the same block does** (`_standard-05-rhythm.scss`) — applies at any nesting depth instead of direct children only. Left alone: adding `>` risks a real regression on nested content (e.g. a paragraph inside a `.callout` inside `.rhythm`) that's impossible to fully rule out without a visual pass over every place `.rhythm` is used.
180
+ - **`.compact`/`.relaxed` are unnamespaced and collide across `_standard-09-lists.scss` and `_standard-50-utilities.scss`** — resolving this properly means renaming part of the framework's public class API, which is an architectural decision, not a mechanical fix.
181
+
182
+ **Documented, not a bug:**
183
+ - The `generate-scale` mixin's `"trim"`/`"leading"` scale keys (feeding `.mt-trim`, `.p-leading`, etc.) use `--size-2xs`/`--size-xs` — not the real `--trim`/`--leading` rhythm tokens that happen to share the same words. `.mt-trim` does not use `--trim`. A naming collision worth knowing about, not something to change.
184
+
185
+ **Where the mechanism is real but the hook is currently unused:**
186
+ - `--corner` (theme override for `--radius`) — documented, no theme sets
187
+ it yet. Not dead, just unclaimed.
188
+
189
+ ### How to keep this going
190
+
191
+ Batches (see `packages/styles/*.scss`, foundation → layout → elements → components → modes → utilities): work through in dependency order, add WHY-comments for anything non-obvious, append findings above as they surface. Ask before silently fixing anything with real blast radius; docblock drift / dead code / pure redundancy are safe to just fix inline.
192
+
193
+ **Gotcha for whoever writes the comments**: Sass block comments (`/* */`) are interpolation-aware — `#{$i}` (or any `#{...}`) written literally inside a comment, describing a `@for` loop's output, gets evaluated as real Sass and breaks the build with "Undefined variable" if that variable isn't in scope at the comment's location. Learned this the hard way auditing `_standard-04-grid.scss` (2026-07-14) — write `.grid-N`, not `.grid-#{$i}`, when a comment needs to describe generated class names.
194
+
195
+ ## Todo
196
+
197
+ - [x] **CSS framework audit / cleanup** *(completed 2026-07-14 — all 8 batches, foundation through utilities/debug, plus a same-day round-2 fix pass — see Audit log above. ~15 items fixed inline during the audit itself, then ~33 more of the ~36 flagged findings fixed in round 2 (undefined/typo'd custom properties, dead code, the grid attribute-selector footgun, several "duplicate declaration silently kills the first" cases). 3 left as deliberate judgment calls (`--border`'s value, `.rhythm`'s missing `>` combinator, `.compact`/`.relaxed` naming collision) — real behavior/API changes, not obviously safe to auto-fix. Every edit verified against a running dev server on both `stnd.gd` and `stnd.build`; nothing here changed the site's actual rendered output except the two root-cause bugs fixed early on (the `:root, body` scope bug and its `--max-width` cleanup) and the intentional restorations listed above (e.g. `--font-header-line-height` and the slider gradient now actually work).)*
198
+ - [ ] Feeds into the future theme creation/editing UX (see `@stnd/themes` Todo) — that UX will need to expose these tokens live. [priority:: 3] [token_scale:: 3] [created:: 2026-07-14] [area:: framework]
106
199
 
107
200
  ---
108
201
 
109
202
  ## 🔗 Liens & Normes
110
203
 
111
- Ce paquet de styles implémente la charte visuelle et les tokens de l'écosystème Standard. Pour plus de détails sur les spécifications graphiques et de code, consultez :
204
+ Ce paquet de styles implémente la charte visuelle et les tokens de l’écosystème Standard. Pour plus de détails sur les spécifications graphiques et de code, consultez :
112
205
  - **Architecture Système** : [4.1 Architecture](../../apps/stnd.build/modules/manual/content/4-system/4.1-architecture.md)
113
206
  - **Principes de Code** : [4.2 Code Standards](../../apps/stnd.build/modules/manual/content/4-system/4.2-code-standards.md)
114
207
  - **Normes de Documentation** : [4.9 Normes README](../../apps/stnd.build/modules/manual/content/4-system/4.9-readme-standard.md)
115
- - **Pilier Central** : [STANDARD.md](../../STANDARD.md)
208
+ - **Le Standard** : [packages/README.md](../README.md)
116
209
  - **Charte Graphique** : [3.1 Color System](../../apps/stnd.build/modules/manual/content/3-graphics/3.1-color-system.md) et [3.2 Typography](../../apps/stnd.build/modules/manual/content/3-graphics/3.2-typography-and-typefaces.md)
package/TOKENS.md CHANGED
@@ -1,3 +1,15 @@
1
+ ---
2
+ aliases: []
3
+ created: 2026-03-16 08:07
4
+ modified: 2026-07-03 16:26
5
+ mode: read
6
+ publish: false
7
+ tags: []
8
+ theme:
9
+ type: note
10
+ visibility: private
11
+ ---
12
+
1
13
  # Standard Design Tokens
2
14
 
3
15
  > Canonical reference for all CSS custom properties exposed by `@stnd/styles`.
@@ -32,7 +44,6 @@ For example, `foreground: "#1a1a1a"` becomes `--foreground: #1a1a1a`. See `packa
32
44
  | `--leading` | `calc((line-height - 1) * font-size)` | Space between cap-height and next baseline |
33
45
  | `--nl` | `calc(leading * line-height)` | Newline — full vertical unit |
34
46
  | `--trim` | `calc(leading / 2)` | Half-leading trim |
35
- | `--max-width` | `1024px` | Maximum content width |
36
47
  | `--font-size-mobile` | `1.1rem` | Font size override on mobile |
37
48
 
38
49
  ## Spacing Scale
@@ -83,10 +94,17 @@ Powered by `pow(var(--optical-ratio), N)`.
83
94
  | `--size-5xl` | `--scale-7` |
84
95
  | `--size-6xl` | `--scale-8` |
85
96
 
86
- ## Line Widths
97
+ ## Layout Widths
98
+
99
+ Two independent scopes. `.prose`'s own box reads `--body-max-width`
100
+ directly, so `.hero`/`.full` breakout elements grow all the way to the page
101
+ shell. `.feature` and tables/`.editorial` don't reference either width
102
+ token — they break out by a fixed rhythm increment off `--line-width`
103
+ (`--space-2` / `--space-4` each side).
87
104
 
88
105
  | Token | Default | Description |
89
106
  | ------------------- | --------------------------------- | --------------------------------------------- |
107
+ | `--body-max-width` | `900px` | The whole page shell — header, footer, content, and the ceiling `.hero`/`.full` grow into |
90
108
  | `--line-width-xs` | `24rem` | Extra small |
91
109
  | `--line-width-sm` | `32rem` | Small |
92
110
  | `--line-width-md` | `42rem` | Medium (default reading width) |
@@ -3,6 +3,10 @@
3
3
  /* =========================== */
4
4
 
5
5
  /* Disable view transition animations - instant page swaps
6
+ Superseded by the fade in/out ::view-transition-old(root) /
7
+ ::view-transition-new(root) rules in _standard-01-token.scss — kept here
8
+ commented out as the "instant, no animation" alternative if that fade
9
+ is ever reverted.
6
10
  ::view-transition {
7
11
  animation-duration: 0s !important;
8
12
  }
@@ -22,19 +26,48 @@
22
26
  scrollbar-width: thin;
23
27
  }
24
28
 
25
- /*
29
+ /*
26
30
  * Modern targeted reset (replaces the old `* { margin: 0; padding: 0 }`).
27
- * This prevents the framework from destroying the native margins/paddings of complex
28
- * embedded editors (like CodeMirror/Obsidian) or third-party web widgets, while still
31
+ * This prevents the framework from destroying the native margins/paddings of complex
32
+ * embedded editors (like CodeMirror/Obsidian) or third-party web widgets, while still
29
33
  * perfectly resetting the standard web typography and layout elements.
30
34
  */
31
- html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6, img, span, a {
35
+ :where(
36
+ html,
37
+ body,
38
+ p,
39
+ ol,
40
+ ul,
41
+ li,
42
+ dl,
43
+ dt,
44
+ dd,
45
+ blockquote,
46
+ figure,
47
+ fieldset,
48
+ legend,
49
+ textarea,
50
+ pre,
51
+ iframe,
52
+ hr,
53
+ h1,
54
+ h2,
55
+ h3,
56
+ h4,
57
+ h5,
58
+ h6,
59
+ img,
60
+ span,
61
+ a
62
+ ) {
32
63
  margin: 0;
33
64
  padding: 0;
34
65
  border: 0 solid;
35
66
  }
36
67
 
37
- button, input, select {
68
+ button,
69
+ input,
70
+ select {
38
71
  margin: 0;
39
72
  }
40
73
 
@@ -54,6 +87,8 @@ object {
54
87
  display: block;
55
88
  vertical-align: middle;
56
89
  }
90
+ /* inline-block, not block like img/video above — svgs are used inline
91
+ within text/buttons/icons far more often than as standalone media. */
57
92
  svg {
58
93
  display: inline-block;
59
94
  vertical-align: middle;
@@ -65,10 +100,16 @@ video {
65
100
  height: auto;
66
101
  }
67
102
 
103
+ /* [hidden] forced off, but hidden="until-found" is deliberately excluded —
104
+ that's the browser's native find-in-page reveal mechanism (Ctrl/Cmd+F);
105
+ force-hiding it here would break the browser's ability to un-hide it. */
68
106
  [hidden]:where(:not([hidden="until-found"])) {
69
107
  display: none !important;
70
108
  }
71
109
 
110
+ /* Browsers never render <script> content by default — this guards against
111
+ some other broad selector (a component lib, a CMS export) accidentally
112
+ setting display on everything and making inline script text visible. */
72
113
  script {
73
114
  display: none !important;
74
115
  }
@@ -5,7 +5,7 @@
5
5
  * vertical rhythm and spacing across all elements. These mixins ensure proper
6
6
  * spacing application for rhythm-aware components.
7
7
  *
8
- * @prop {variable} $mobile Mobile breakpoint (480px)
8
+ * @prop {variable} $mobile Mobile breakpoint (600px)
9
9
  * @prop {variable} $small Small screen breakpoint (768px)
10
10
  * @prop {variable} $large Large screen breakpoint (1024px)
11
11
  * @prop {variable} $wide Wide screen breakpoint (1440px)
@@ -30,14 +30,26 @@ $small: 768px;
30
30
  $large: 1024px;
31
31
  $wide: 1440px;
32
32
 
33
+ // Text elements needing text-box-trim (removes leading/trailing font
34
+ // ascender/descender space so line-height math lines up with the baseline
35
+ // grid) — consumed once in _standard-01-token.scss's #{$text-elements} rule.
33
36
  $text-elements: "a, kbd, div, span, mark, callout-title::before, span, li::before, button, legend, fieldset, label, li, h1, h2, h3, h4, h5, h6, p:not(:has(img)), figcaption, dt, dd, label, td, th, .callout, code, .lined, aside";
34
37
 
38
+ // Vertical rhythm system (_standard-05-rhythm.scss): consecutive "simple"
39
+ // elements get 1x --gap margin between them; the moment either neighbor is
40
+ // a "double" (heavier block-level: tables, cards, figures, sections...) the
41
+ // margin becomes --gap * --gap-multiplicator (2x by default) — extra
42
+ // breathing room around visually heavier blocks. $rhythm-tags is the union,
43
+ // used for the heading-follows-anything spacing rules.
35
44
  $rhythm-simple-tags: ".alert, #comments, h1, h2, h3, h4, h5, h6, blockquote, ul, ol, li, dl, dt, dd, p, pre, figure, hr, form, fieldset, button, aside, .callout, .card, .box, .btn, .grid";
36
45
  $rhythm-double-tags: "table, blockquote, div:has(.video), section, article, header, footer, hr, #comments, .callout, pre, figure, p:has(img), section, .box, .card, .small, .editorial, .feature, .hero, .full, .scroll, hr, aside, .stnd-code-block";
37
46
  $rhythm-tags: $rhythm-simple-tags + ", div, " + $rhythm-double-tags;
38
47
 
39
- $elements-boxed: "blockquote, pre, .alert, aside, .card, .callout, img, iframe, .outset";
40
-
48
+ // Reusable style fragments via @extend (not applied directly — SCSS
49
+ // placeholder selectors emit no CSS of their own until extended).
50
+ // %surface: card/panel look — _standard-13-components.scss.
51
+ // %padding-text: form-control text padding — _standard-11-forms.scss,
52
+ // _standard-13-components.scss.
41
53
  %surface {
42
54
  border: none;
43
55
  /* Raised effect for all surfaces */
@@ -50,5 +62,14 @@ $elements-boxed: "blockquote, pre, .alert, aside, .card, .callout, img, iframe,
50
62
  padding: var(--space-d4) var(--space-d2);
51
63
  }
52
64
 
53
- $stnd-scope: ":root, body" !default;
65
+ // Single-target on purpose (not ":root, body") — a token declared on both
66
+ // would always win on <body>'s own cascade resolution over anything set at
67
+ // :root/html, silently blocking any :root-only override (which is exactly
68
+ // what a note's frontmatter inlineStyle produces). See _standard-01-token.scss.
69
+ //
70
+ // Used to be two variables ($stnd-scope + $stnd-theme-scope) with different
71
+ // defaults (":root, body" vs ":root"). Consolidated to one (2026-07-14) once
72
+ // $stnd-scope became single-target too — nothing ever set them to different
73
+ // selectors (obsidian.scss configures both identically), so the split was
74
+ // pure redundancy.
54
75
  $stnd-theme-scope: ":root" !default;
@@ -7,7 +7,7 @@
7
7
  * Includes mathematical ratios, modular scales, spacing system, and animation curves.
8
8
  */
9
9
 
10
- #{$stnd-scope} {
10
+ #{$stnd-theme-scope} {
11
11
  /* ===== COLOR SEEDS =====
12
12
  The two primary seeds from which everything grows.
13
13
  Set these and the color file (_standard-02-color.scss) does the rest:
@@ -36,7 +36,13 @@
36
36
  --tooltip-background: #1a1a1a;
37
37
  --tooltip-text: #ffffff;
38
38
 
39
- /* Base measurements & ratios */
39
+ /* Base measurements & ratios. --font-ratio / --font-density are the
40
+ theme-authoring hooks (set by ~a dozen packages/themes/*.scss files,
41
+ e.g. --font-ratio: 1.414) — --optical-ratio / --line-height are the
42
+ resolved, framework-consumed values. A note's frontmatter can also
43
+ override --optical-ratio directly (it's the registered token name),
44
+ which bypasses --font-ratio entirely since the more specific
45
+ declaration wins regardless of this fallback chain. */
40
46
  --font-size: 1rem;
41
47
  --optical-ratio: var(--font-ratio, var(--ratio-silver));
42
48
  --line-height: var(--font-density, var(--optical-ratio));
@@ -50,7 +56,7 @@
50
56
  --nl: calc(var(--leading) * var(--line-height));
51
57
 
52
58
  /* Gap, space between blocks in rhythm, goes to --space in mobile */
53
- --gap: var(--space);
59
+ --gap: calc(var(--space) * var(--optical-ratio));
54
60
  --gap-body: var(--space-2);
55
61
  --gap-header: var(--space-8);
56
62
  --gap-footer: calc(var(--gap-body) * 1.5);
@@ -62,7 +68,6 @@
62
68
  --breakpoint-lg: #{$large};
63
69
  --breakpoint-wide: #{$wide};
64
70
 
65
- --content-width: min(var(--line-width), 100%);
66
71
  --content-width-sm: max(calc(var(--space-2) - var(--space)), var(--space));
67
72
  --content-width-editorial: minmax(0, var(--space-2));
68
73
  --content-width-feature: minmax(0, var(--space-4));
@@ -73,6 +78,9 @@
73
78
  --filter-glass: blur(20px);
74
79
  --stroke-width: max(1px, 0.06rem);
75
80
  --stroke-width-lg: calc(var(--stroke-width) * 2);
81
+ /* --corner is a documented theme-authoring hook (TOKENS.md) — no theme
82
+ currently sets it, so --radius always resolves through --leading
83
+ (proportional to line-height/font-size) today. Not dead, just unused. */
76
84
  --radius: var(--corner, var(--leading));
77
85
  --radius-sm: min(8px, var(--radius));
78
86
 
@@ -83,29 +91,39 @@
83
91
  --ratio-quarterstep: 1.128;
84
92
  --ratio-eighthstep: 1.062;
85
93
 
86
- /* Content area tokens */
94
+ /* Layout width — body-max-width is the whole page shell (header, footer,
95
+ content); .prose's own box reads it directly, so .hero/.full breakout
96
+ elements grow into it too. line-width is a single line of readable
97
+ text — .feature and tables/.editorial break out by a fixed rhythm
98
+ increment off this (space-2 / space-4 each side), not off
99
+ body-max-width. */
100
+ --body-max-width: 900px;
101
+
87
102
  --line-width-xs: 24rem;
88
103
  --line-width-sm: 32rem;
89
104
  --line-width-md: 42rem;
90
105
  --line-width-lg: 50rem;
91
106
  --line-width-xl: 60rem;
92
107
  --line-width-full: calc(100vw - (var(--space) * 2));
108
+ /* --font-line-width is the theme-authoring hook (e.g. humanist, book,
109
+ 2064 themes); --measure is a second, editor-specific override read by
110
+ apps/stnd.gd's Writer component. Same override-ladder shape as
111
+ --font-ratio above — a note's frontmatter can also set --line-width
112
+ directly, bypassing both. */
93
113
  --line-width: var(--font-line-width, var(--measure, var(--line-width-md)));
94
114
 
115
+ --content-width: min(var(--line-width), 100%);
116
+
95
117
  --line-height-compact: calc(1 + (var(--line-height) - 1) / 2);
96
118
  --line-height-relaxed: calc(1 + (var(--line-height) - 1) * 1.5);
97
119
 
98
- --max-width: 900px;
99
-
100
- /* Named width tokens */
101
- --body-max-width: var(--max-width);
102
- --prose-max-width: var(--max-width);
103
-
104
120
  --tracking-tight: -0.01em;
105
121
  --tracking-neutral: 0em;
106
122
  --tracking-open: 0.01em;
107
123
 
108
- /* Spacing scale (derived from baseline) */
124
+ /* Spacing scale (derived from baseline). "d" prefix = divide (space-d4 =
125
+ space / 4), plain number = multiply (space-4 = space * 4) — same "d"
126
+ convention repeats below in the type scale. */
109
127
  --space: var(--baseline);
110
128
  --space-half: calc(var(--baseline)/2);
111
129
 
@@ -114,12 +132,18 @@
114
132
  --space-#{$i}: calc(var(--space) * #{$i});
115
133
  }
116
134
 
117
- /* Optical harmony scale */
118
- --scale-d5: max(calc(var(--font-size) / (var(--optical-ratio) * var(--optical-ratio))), 11px);
119
- --scale-d4: max(
120
- calc(var(--font-size) / (var(--optical-ratio) * 1.25)),
135
+ /* Optical harmony scale. --scale-2 upward is a clean geometric progression
136
+ (each step = previous * --optical-ratio). Below base (d5..d2) the
137
+ divisor is deliberately NOT the mirrored geometric inverse (ratio^-1,
138
+ ratio^-2...) — it's flattened (ratio*1.25, then a 0.5-blended exponent
139
+ for d2) so small text doesn't shrink as aggressively as a pure
140
+ geometric scale would, staying legible; each step also floors at 11px
141
+ regardless of ratio math. */
142
+ --scale-d5: max(
143
+ calc(var(--font-size) / (var(--optical-ratio) * var(--optical-ratio))),
121
144
  11px
122
145
  );
146
+ --scale-d4: max(calc(var(--font-size) / (var(--optical-ratio) * 1.25)), 11px);
123
147
  --scale-d3: max(calc(var(--font-size) / var(--optical-ratio)), 11px);
124
148
  --scale-d2: max(
125
149
  calc(var(--font-size) / (1 + (var(--optical-ratio) - 1) * 0.5)),
@@ -160,7 +184,9 @@
160
184
  --z-modal: 1200;
161
185
  --z-toast: 2000;
162
186
  --z-header: 900;
163
- --z-launher: 1000;
187
+ /* Fixed 2026-07-14 — was --z-launher (typo for launcher), renamed. Still
188
+ unused/unreferenced anywhere, but at least spelled correctly now. */
189
+ --z-launcher: 1000;
164
190
  --z-image-zoom: 9999;
165
191
 
166
192
  /* The *“Snappy”* - for small icons or toggles (Short duration) */
@@ -186,7 +212,10 @@
186
212
  /* Analog : It starts with a burst of energy (the push) and spends 80% of its time slowly losing that energy. */
187
213
  --ease-friction: cubic-bezier(0.22, 1, 0.36, 1);
188
214
 
189
- /* Animation
215
+ /* Reference notes only, not live code — mixes prose with invalid CSS
216
+ (e.g. "Soft Fade Out" as a bare declaration) on purpose, scratch
217
+ rationale for the eases defined around it, not meant to be uncommented.
218
+ Animation
190
219
  a {
191
220
  text-decoration-color: rgba(0,0,0,0);
192
221
  transition: text-decoration-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
@@ -245,6 +274,14 @@ a {
245
274
  text-box-edge: cap alphabetic;
246
275
  }
247
276
 
277
+ /* Table cells opt back out of text-box-trim — vertical-align/padding math
278
+ in table cells doesn't play well with the trimmed ascender/descender
279
+ box, so cells keep normal line-box sizing instead. */
280
+ td,
281
+ th {
282
+ text-box-trim: none;
283
+ }
284
+
248
285
  /* Responsive adjustments */
249
286
  @media only screen and (max-width: #{$small}) {
250
287
  #{$stnd-theme-scope} {
@@ -255,10 +292,6 @@ a {
255
292
  }
256
293
  }
257
294
 
258
- #{$stnd-theme-scope} {
259
- --ease-aggressive: cubic-bezier(0.7, 0, 0.3, 1);
260
- }
261
-
262
295
  ::view-transition-old(root),
263
296
  ::view-transition-new(root) {
264
297
  animation-duration: 500ms;