@mospheremeaningful style README ↗

A way to write CSS, not a framework

Write the HTML once.
Let CSS compose the experience.

Atmosphere organizes plain CSS so one page can be read as a document, worked in as a workspace, or shown as slides by changing a single attribute. Nothing is re-rendered, so a half-written note, a selection and keyboard focus survive the switch. There is no build step: registered custom properties, container style queries and cascade layers do the work.

If you know Tailwind: Tailwind writes each decision into each element’s class list. Atmosphere writes what each element is into the markup, then makes the decisions once, in the stylesheet, from a few named choices.

1 · Try it

One page, three presentations.

  1. Write something in Keep a thought, below or beside the document.

  2. Switch to Workspace, then Presentation, in the bar at the top.

  3. Your words are still there. It is the same <textarea>; only CSS moved it.

Reading · Guide stays in the layout.

Explore the composition contract

Each control sets one custom property on <body>. An explicit choice outranks the experience’s recipe and stays in effect when you switch experiences. Choose “Experience default” to inherit again.

Guide navigates document. Notes support document. Brand identifies this experience.

The readout is computed CSS, not a JavaScript table. Relationships give subjects their jobs; CSS resolves the jobs into places, presence and paths.

01 / Name it

Say what each thing is.

This demo has three subjects: a guide, a document and your notes. The markup names them and says nothing about columns, drawers or slides.

<aside data-identity="guide">
<main  data-identity="document">
<aside data-identity="notes">
Give the subject a stable name before deciding where it belongs.

02 / Relate it

Say what job it does.

A guide navigates the document; notes support it. Declare the relationship, and one CSS rule turns it into a responsibility and a grid area.

GuidenavigatesDocument
[data-relation="navigates"] {
  --place: var(--place-navigator, supporting);
}
.scene > [data-relation] { grid-area: var(--place); }

03 / Compose it

Pick a recipe. Let the browser resolve it.

Reading, Workspace and Presentation are three CSS rules that set a few named choices. Style queries turn those choices into areas, drawers and slides.

[data-lens="presentation"] {
  --arrangement: focus;
  --path: slides;
}

Open Explore the composition contract and set Navigation to Keep in the layout. An explicit policy outranks the recipe.

2 · Compared with Tailwind

Same problem. A different home for decisions.

Tailwind and Atmosphere push back on the same thing: hand-written CSS that drifts into arbitrary values, invented class names and rules nobody can find. Tailwind moves styling into the markup, one utility at a time. Atmosphere keeps meaning in the markup and moves decisions into the cascade, where one rule serves every element that shares a meaning.

The task: the guide sits under the document while reading, takes a left column in a wide workspace, and becomes a drawer when presenting.

Tailwind Each element lists its own reactions
<body data-mode="workspace" class="group">
  <div class="grid gap-6
    group-data-[mode=workspace]:lg:grid-cols-[14rem_1fr_16rem]">
    <aside class="order-2 rounded-2xl border bg-white p-6
      group-data-[mode=workspace]:lg:order-none
      group-data-[mode=workspace]:max-lg:hidden
      group-data-[mode=presentation]:fixed
      group-data-[mode=presentation]:inset-y-0
      group-data-[mode=presentation]:left-0
      group-data-[mode=presentation]:z-50
      group-data-[mode=presentation]:w-80
      group-data-[mode=presentation]:-translate-x-full
      data-[open]:translate-x-0">
      …guide…
    </aside>
    <main class="…">…</main>
    <aside class="rounded-2xl border bg-white p-6">
      …notes…
    </aside>
  </div>
  <!-- …and the drawer classes again under max-lg:
       if a narrow workspace should keep the guide -->
</body>
  • Readable in place: the class list shows how this element looks in every context.
  • Every mode and breakpoint is spelled out on every element it affects.
  • A fourth mode means revisiting each of those elements.
Atmosphere Markup says what; the cascade says where
<body class="SimpleAtmosphere" data-lens="workspace">
  <div class="scene">
    <aside data-relation="navigates"
           data-target="document">…guide…</aside>
    <main data-place="stage">…</main>
    <aside data-relation="supports"
           data-target="document">…notes…</aside>
  </div>
</body>
/* One rule per experience */
[data-lens="workspace"]    { --arrangement: alongside; }
[data-lens="presentation"] { --arrangement: focus;
                             --path: slides; }

/* One rule per relationship */
[data-relation="navigates"] {
  --place: var(--place-navigator, supporting);
}
.scene > [data-relation] { grid-area: var(--place); }

/* One rule per arrangement */
@container composition style(--arrangement: alongside) {
  .scene { --place-navigator: navigation;
           --scene-areas: "navigation work inspection"; }
}
  • The markup never mentions modes, breakpoints, left or drawer.
  • A fourth mode is one more recipe rule; the bindings already apply.
  • Locality moves to the rule: one place shows how “workspace” resolves.

What each approach optimizes

QuestionTailwindAtmosphere
How are arbitrary values prevented? A theme scale: p-4, not 13px. The escape hatch is p-[13px]. @property rejects choices outside the vocabulary. Quantities are named steps such as data-gap="open". There is no arbitrary-value syntax.
What must you name? Nothing. Utilities replace class names. Only meanings that a rule consumes: what a thing is, what it relates to, its parts. Never wrappers.
What does one element tell you? How it looks, in every context. What it is and how much room it asks for. How it looks is one rule away, shared by everything like it.
Where do responsive, theme and mode rules go? A variant per context on each element: lg:, dark:, group-data-[…]:. Named choices on the host, resolved once with @container style() and container size queries.
How do you restyle everything? Redefine theme variables (v4) to change the scale. Which step each element uses stays in its class list. A Look swaps tokens and density rescales steps. The markup does not change.
How do you add a presentation? Edit every element that should behave differently. Add one recipe. Existing bindings apply.
What tooling is required? A build step (CLI or bundler plugin), plus editor support. None. The browser evaluates plain CSS.
What does the browser need? A modern browser; v4 itself relies on cascade layers and @property. The same, plus container style queries on custom properties. Without them this page stays a readable document.

Translating Tailwind habits

If you would write…In Atmosphere, do thisHome
flex gap-4 p-6 on a card Name the kind (.release-task) and ask for quantity with named locals: data-gap="even" data-pad="open". Components, locals
lg:grid-cols-[14rem_1fr_16rem], col-span-2 Areas keyed to --arrangement. Children take grid-area: var(--place). Layout
hidden lg:block A presence policy, --navigation: auto | embedded | on-demand, resolved against available space. Layer
fixed inset-y-0 left-0 z-50 for a drawer The same element becomes a native [popover] in the top layer, and layout releases its slot. Layer
overflow-x-auto snap-x snap-mandatory --path: slides on the frame. Lattice
bg-white text-slate-800 dark:bg-slate-900 background: var(--surface); color: var(--ink); A Look or color scheme redefines the tokens. Look
transition-colors duration-200 motion-reduce:transition-none Declare transitions once, with one reduced-motion rule for the whole page. Life
@apply or a bundle of utilities A kind class plus data-part for its constituents. Each concern styles the parts it owns. Components
p-[13px] Nothing, on purpose. If a value cannot move when the look or density changes, it is a hardcode. Nowhere

3 · Compose your CSS

Seven moves, in the order you write them.

Each snippet is adapted from at.simple.css, the single stylesheet behind the demo above. Read that file top to bottom and you will meet these moves in this order.

  1. Declare the order of concerns once.

    Give each concern its own cascade layer. When two rules conflict, the later layer wins regardless of selector specificity, so you never need !important or longer selectors.

    Atmosphere’s Layer concern is named presence here so it is not confused with CSS @layer.

    @layer vocabulary, lens, components,
           layout, presence, lattice, look, life;
  2. Register a small vocabulary.

    Turn each decision into a registered custom property with a fixed list of values. The browser rejects anything else, so a typo falls back to the inherited or initial value instead of leaking into the layout. It is the constraint Tailwind gets from its theme, enforced by the engine.

    @property --navigation {
      syntax: "auto | embedded | on-demand";
      inherits: true;
      initial-value: auto;
    }
    /* --navigation: sideways;  → invalid, falls back to auto */
  3. Write each experience as plain defaults.

    A recipe, which Atmosphere calls a Lens, is a set of declarations in an early layer. Switching experience changes one attribute. Anything more explicit, such as an inline style set by a control, outranks it without a fight.

    @layer lens {
      [data-lens="workspace"]    { --arrangement: alongside; }
      [data-lens="presentation"] { --arrangement: focus;
                                   --path: slides; }
    }
    
    <!-- An explicit policy outranks any layered recipe -->
    <body data-lens="presentation" style="--navigation: embedded">
  4. Bind meaning to places, never positions.

    The markup declares relationships. One rule per relationship turns it into a responsibility and a named grid area. Each arrangement decides where those areas go. Nothing in the HTML says left, right or drawer.

    [data-relation="navigates"][data-target="document"] {
      --responsibility: navigator;
      --place: var(--place-navigator, supporting);
    }
    .scene > [data-relation] { grid-area: var(--place); }
  5. Resolve named choices with style queries.

    Give each tool one job. @container style() picks between named options, var() carries facts to the rules that use them, and calc() or clamp() compute quantities.

    @container composition style(--arrangement: alongside) {
      .scene {
        --place-navigator: navigation;
        --scene-areas: "navigation work inspection";
      }
    }
    .scene { grid-template-areas: var(--scene-areas); }
  6. Publish a token where concerns meet.

    Presence decides whether the guide stays in the layout; Layout owns the grid. Instead of one overriding the other, presence publishes a fact and layout reads it, releasing only the guide’s slot. The notes keep theirs.

    /* presence: decide, then publish */
    @container experience style(--navigation: on-demand) {
      .composition { --navigation-presence: on-demand; }
    }
    /* layout: consume */
    @container composition style(--arrangement: alongside)
                       and style(--navigation-presence: on-demand) {
      .scene { --scene-areas: "work inspection"; }
    }
  7. Scale with named steps; paint with tokens.

    Quantities are steps on a scale, never raw lengths. Change the rhythm and every consumer moves together. In the full system, call-site quantities use named locals such as data-gap="open". The razor: if changing the look or density cannot move a value, it is a hardcode.

    @container experience style(--rhythm: compact) {
      .composition { --space-scale: 0.7; }
    }
    @container experience style(--rhythm: spacious) {
      .composition { --space-scale: 1.4; }
    }
    
    .scene { gap: calc(var(--space-unit) * var(--space-scale)); }
    .scene > aside { background: var(--surface); }

4 · File each rule

Ask which question a declaration answers.

File by the decision, not the property name. Padding is usually Layout, but a part’s own intrinsic padding belongs to Components. When two homes need the same fact, one publishes a token and the other reads it.

HomeThe question it answersTypical declarations
Components What shape does a part need to hold its content? box-sizing, resets, intrinsic padding
Layout Where does each responsibility belong? display: grid | flex, grid-template-*, grid-area, gap, width, margin
Layer (presence here) What stays in place, floats or appears on demand? position: sticky | fixed, z-index, [popover], ::backdrop, <dialog>
Lattice How do I move through the content? overflow, scroll-snap-*, scroll timelines, view-transition-name
Look What does it look like? color, background, border, border-radius, font-*, shadows
Life How does it respond and change? transition, animation, hover feedback, prefers-reduced-motion
Lens What experience should these choices serve? Only defaults for the vocabulary, such as --arrangement and --path
Locals How much, right here? Named steps: data-gap, data-pad, data-cols (in at.local.css)

Before you commit a rule

5 · When it fits

Choose by how often the presentation changes.

Reach for Tailwind when…

  • Each page has one presentation.
  • Your team values fast, consistent styling at the call site and its ecosystem.
  • You are prototyping and the page will not need to recompose.

Reach for Atmosphere when…

  • The same content must be read, worked in and presented.
  • Themes, density and user preferences should restyle everything without touching markup.
  • Work in progress, such as drafts, selection and focus, must survive a change of presentation.
  • You want no build step and no dependency.

What it costs

  • Semantic HTML and a shared vocabulary that the team agrees on.
  • Container style queries on custom properties are newer than the rest of CSS. Test your target browsers and keep the fallback readable.