Skip to content

Fluid type/space scale is viewport-relative while layout is container-relative #497

Description

@jackgranatowski

Finding

The fluid type and space scales (--sf-text-*, --sf-space-* in core/tokens.css:964-972, 1102-1110) compute via clamp() driven by 100vw — they respond to the browser viewport width. Meanwhile the framework's layout primitives (.sf-grid-cols-*, .sf-content-grid, .sf-bento in core/layout.css) respond to @container — they respond to their own parent's width.

Why this matters

Nest a section inside a narrow context (a sidebar, a 1/3 column, a card once .sf-card ships) and the two systems disagree: the layout primitive correctly adapts to the narrow container, but the text and spacing inside it still scale as if the element spans the full viewport, because vw-based clamps have no awareness of an ancestor container's actual width. This is an internal inconsistency between two core pillars of the same framework, not a cosmetic gap.

Scope

  • Investigate a container-relative variant of the fluid scale (cqi-based clamps) for components that opt in — likely not a wholesale replacement of the viewport-based default (that's the right choice for page-level type), but an additional token set or opt-in mechanism for nested/narrow contexts.
  • Needs design work on where the opt-in boundary lives (per-component class? a --sf-fluid-context: container switch?) before implementation.
  • Update docs/llm-guide.md if a new token role/mechanism ships, per repo CLAUDE.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions