oficina / sheets Public

Sheets' screens on the spacing scale, and the two gates

WIP: see the branch discussion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev eb88892202cb3992d981722ce3d6d4c9f596b393 parent 66e5391
9 files changed, +207 −19
  • .amadan/ci.d/15-spacing +6 −0
  • Makefile +15 −4
  • go.mod +7 −4
  • go.sum +6 −6
  • internal/sheets/rhythm_browser_test.go +80 −0
  • internal/sheets/static/brand/brand.css +1 −1
  • internal/sheets/static/sheets.css +3 −2
  • internal/sheets/static/tokens.css +84 −0
  • internal/sheets/templates/layout.html +5 −2

CI passed — run details

CI log
amadan: .amadan/timeout: this job's budget is 15m0s (this runner allows up to 30m0s)
=== vet ===
CGO_ENABLED=0 go vet ./...
go: downloading amadan.net/rastrillo/rastrillo v0.44.1
go: downloading amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
go: downloading amadan.net/rastrillo/fiesta v1.6.1
CGO_ENABLED=0 go vet -tags browser ./internal/sheets/
=== spacing ===
go tool fiesta spacing -skip 'vendor/*.css' -skip 'tokens.css' internal/sheets/static
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
=== migrations ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
?   	amadan.net/oficina/sheets/cmd/sheets	[no test files]
?   	amadan.net/oficina/sheets/cmd/sheets-contract	[no test files]
ok  	amadan.net/oficina/sheets/internal/guardstest	0.177s
ok  	amadan.net/oficina/sheets/internal/sheets	16.621s
ok  	amadan.net/oficina/sheets/internal/sheets/calc	0.019s
ok  	amadan.net/oficina/sheets/internal/sheets/format	0.003s
?   	amadan.net/oficina/sheets/internal/sheets/keymailtest	[no test files]
ok  	amadan.net/oficina/sheets/internal/sheets/live	0.056s
ok  	amadan.net/oficina/sheets/internal/sheets/seal	0.002s
ok  	amadan.net/oficina/sheets/internal/sheets/sealtest	0.002s
ok  	amadan.net/oficina/sheets/internal/sheets/store	6.489s
ok  	amadan.net/oficina/sheets/internal/sheets/teamstate	0.129s
ok  	amadan.net/oficina/sheets/internal/sheets/xlsx	4.987s
?   	amadan.net/oficina/sheets/tools/gencorpus	[no test files]
=== race ===
go test -race -count=1 ./internal/sheets/store/... ./internal/sheets/live/...
ok  	amadan.net/oficina/sheets/internal/sheets/store	72.398s
ok  	amadan.net/oficina/sheets/internal/sheets/live	1.065s
diff --git a/.amadan/ci.d/15-spacing b/.amadan/ci.d/15-spacing
new file mode 100755
index 0000000..dabf60e
--- /dev/null
+++ b/.amadan/ci.d/15-spacing
@@ -0,0 +1,6 @@
+#!/bin/sh
+# One step of Sheets' CI, like the others: a Makefile target, so CI and
+# `make test` are one definition. Fiesta's spacing check over Sheets'
+# own stylesheets.
+set -eu
+exec make test-spacing
diff --git a/Makefile b/Makefile
index ae42cc4..bfb122e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
comma := ,
export GOPRIVATE := $(if $(GOPRIVATE),$(GOPRIVATE)$(comma))amadan.net/oficina/estilo.git,amadan.net/oficina/agent-access.git
-.PHONY: build release test test-vet test-fmt test-build test-migrations test-go test-race test-browser
+.PHONY: build release test test-vet test-fmt test-spacing test-build test-migrations test-go test-race test-browser
# One binary, CGO_ENABLED=0, cgo-free SQLite (AGENTS.md / Deploys). Set
# per-target below rather than exported globally, because test-race is
@@ -61,7 +61,7 @@ release:
# test-migrations needs the app to compile but no database and no test
# suite, plain `go test` (tens of seconds, dominated by the store
# package) comes next, and -race — by far the slowest step — runs last.
-test: test-vet test-fmt test-build test-migrations test-go test-race
+test: test-vet test-fmt test-spacing test-build test-migrations test-go test-race
# Also vets the browser-tagged tests: they are outside `make test`, and a
# test behind a tag that nothing compiles rots silently.
@@ -79,6 +79,15 @@ test-fmt:
exit 1; \
fi
+
+# Fiesta's spacing check (Paul, 2026-11-22: no ad-hoc spacing): every
+# margin, padding and gap in Sheets' own stylesheets is a
+# var(--rst-sp-N), or says why not with /* spacing-allow: why */.
+# tokens.css is rastrillo's, re-copied on each upgrade, and vendor/ is
+# Jspreadsheet's and jSuites': neither is ours to space.
+test-spacing:
+ go tool fiesta spacing -skip 'vendor/*.css' -skip 'tokens.css' internal/sheets/static
+
test-build:
CGO_ENABLED=0 go build ./...
@@ -132,11 +141,13 @@ test-race:
# only; on a Mac set RASTRILLO_CHROME to Playwright's or Chrome's binary).
# Deliberately NOT part of `test`: the gate CI runs on every push must
# not need a browser. Run it before shipping a change to the CSS or to
-# rastrillo's pin. The filter runs four tests: OnTap matches both
+# rastrillo's pin. The filter runs five tests: OnTap matches both
# TestNoZoomOnTap (the iOS zoom-on-tap check) and TestFormatMenuFitsOnTap;
# TestDocumentStylesSurviveTheProductionCSP and TestSmartDoorInABrowser
# are served through rastrillo's production stack, so they see the real
# CSP. TestSmartDoorInABrowser forces the light scheme itself; the others
# measure whichever scheme the browser starts in.
+# TestEveryScreenKeepsTheRhythm is Fiesta's rhythm audit over every
+# screen but the grid's own surface, at 1280 and 390px.
test-browser:
- CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|DocumentStyles|SmartDoorInABrowser' ./internal/sheets/
+ CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|DocumentStyles|SmartDoorInABrowser|KeepsTheRhythm' ./internal/sheets/
diff --git a/go.mod b/go.mod
index d28cda0..92b02fb 100644
--- a/go.mod
+++ b/go.mod
@@ -4,13 +4,13 @@ go 1.26.0
require (
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000
- amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803
+ amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/handoff v0.0.0-20261121235253-98726fac99a7
amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2
- amadan.net/rastrillo/rastrillo v0.42.0
+ amadan.net/rastrillo/rastrillo v0.44.1
github.com/carlosframework/rastrillo v0.23.0
github.com/chromedp/cdproto v0.158.6
github.com/chromedp/chromedp v0.21.0
@@ -23,7 +23,7 @@ require (
)
require (
- amadan.net/rastrillo/fiesta v1.5.0 // indirect
+ amadan.net/rastrillo/fiesta v1.6.1 // indirect
amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/danieljoos/wincred v1.2.3 // indirect
@@ -69,4 +69,7 @@ require (
modernc.org/sqlite v1.55.0 // indirect
)
-tool amadan.net/rastrillo/rastrillo/cmd/rastrillo
+tool (
+ amadan.net/rastrillo/fiesta/cmd/fiesta
+ amadan.net/rastrillo/rastrillo/cmd/rastrillo
+)
diff --git a/go.sum b/go.sum
index 8e33cd0..71d2f20 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000 h1:L07nc+dmLI7c1PBkSkbnrjOK5f8p6OBbA/yTxznxCAw=
amadan.net/oficina/agent-access.git v0.0.0-20261024232549-8ed8ba826000/go.mod h1:Ph9PIa3VE1IEaUzZiQH6D+IQ6HThWWGfVr0ecMMgrFA=
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803 h1:yl1LyYZW3/722xRPnXMu5veg4sZGjyDMJFLqOWST0ws=
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e h1:g2EvXlQAleAEFsc4yIBvS7ycMG3GyuEySEOia0yo8nY=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7 h1:hytRIC++gbCt0rLcNn2O+EcPKkBdnfEodINDo8gT6jw=
amadan.net/oficina/home/connect v0.0.0-20261121235253-98726fac99a7/go.mod h1:B45bHBZF5AtFJqy4d1qSDNDOqYcNkSz1qD20TLF1DI8=
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816 h1:AFDuOio0MxNxN9ZWVc3lul1QHkNjNUCO56kXpe/Fw3I=
@@ -12,12 +12,12 @@ amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2 h1:yKUTS0nOiVw
amadan.net/oficina/home/roster v0.0.0-20261028171508-67c12e39a9d2/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2 h1:0PQiRUkC+9cbTHE67Y4/SmW1sPH1NNWNwTceNFyMjTY=
amadan.net/oficina/home/teammode v0.0.0-20261028171508-67c12e39a9d2/go.mod h1:dXBZeB2ic33SIZiGUCzafmviUT8TYWgzSYZvo2rM6zA=
-amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
-amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
+amadan.net/rastrillo/fiesta v1.6.1 h1:WYgHt652+uQj6eR0Y0JLin+XrdRPGk1WPW7o0lSrc94=
+amadan.net/rastrillo/fiesta v1.6.1/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3 h1:5EFx7BLJj/+G/rt8bTmeyMWVfF5s5Sns7ajTvX4w/I8=
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3/go.mod h1:ZaaxeE278dJltdrLwmwpxUjQ5wuKzqDAVSNRet+WupY=
-amadan.net/rastrillo/rastrillo v0.42.0 h1:RJ0ecpdb2kMqwW9216bBpUqzpboxLYKb/51wq/+ceyo=
-amadan.net/rastrillo/rastrillo v0.42.0/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
+amadan.net/rastrillo/rastrillo v0.44.1 h1:7RNROXSmxr1m9Ax/siyPxS2DEjppIHAj/jWectdoxVQ=
+amadan.net/rastrillo/rastrillo v0.44.1/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM=
amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
diff --git a/internal/sheets/rhythm_browser_test.go b/internal/sheets/rhythm_browser_test.go
new file mode 100644
index 0000000..8592b63
--- /dev/null
+++ b/internal/sheets/rhythm_browser_test.go
@@ -0,0 +1,80 @@
+//go:build browser
+
+package sheets
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "amadan.net/rastrillo/fiesta/check/rhythm"
+ "amadan.net/rastrillo/rastrillo/harness"
+ "github.com/chromedp/cdproto/emulation"
+ "github.com/chromedp/chromedp"
+)
+
+// TestEveryScreenKeepsTheRhythm: each of Sheets' own screens, read by
+// Fiesta's rhythm audit (Paul, 2026-11-22: "Can we somehow put
+// something in place to avoid weird spacing issues like this in
+// future?"), served through the production stack. Every gap between
+// two of a page's blocks is a step of the spacing scale, no text rests
+// on a control, and every heading sits closer to its own content than
+// to what comes before it, at a desktop width and a phone's.
+//
+// The audit reads around what is not the page's to space: the grid
+// (Jspreadsheet's canvas, its toolbar, menus and tab strip, which have
+// a density of their own) and the cells of the scriptless table view,
+// which are the sheet's.
+func TestEveryScreenKeepsTheRhythm(t *testing.T) {
+ app, cookies := signIn(t)
+ s, cells := newSheet(t, app, cookies, "Quarterly plan")
+ postCell(t, app, cookies, cells, `{"r":0,"c":0,"raw":"Revenue"}`)
+
+ rig := harness.New(t, func(string) http.Handler { return productionHandler(t, app) })
+ // Each screen is loaded once, at a desktop width, and read there and
+ // again at a phone's.
+ audit := func(name, path, ready string, skip []string) {
+ t.Helper()
+ for i, width := range []int64{1280, 390} {
+ ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second)
+ var found []rhythm.Finding
+ actions := []chromedp.Action[chromedp.Void]{
+ command(emulation.SetDeviceMetricsOverride, emulation.SetDeviceMetricsOverrideParams{Width: width, Height: 900, DeviceScaleFactor: 1}),
+ }
+ if i == 0 {
+ actions = append(actions, chromedp.Navigate(rig.Origin+path))
+ }
+ actions = append(actions,
+ chromedp.WaitVisible(chromedp.CSS(ready)),
+ evalInto(&found, rhythm.Expression("main", rhythm.Options{Skip: skip})))
+ err := chromedp.Do(ctx, actions...)
+ cancel()
+ if err != nil {
+ t.Fatalf("%s at %dpx: %v", name, width, err)
+ }
+ if len(found) > 0 {
+ t.Errorf("%s at %dpx: %s", name, width, rhythm.Report(found))
+ }
+ }
+ }
+
+ audit("the sign-in door", "/signin", `input[name="address"]`, nil)
+
+ var set []chromedp.Action[chromedp.Void]
+ for _, c := range cookies {
+ set = append(set, setCookie(rig.Origin, c))
+ }
+ rig.Run(set...)
+
+ sheet := fmt.Sprintf("/sheets/%d", s.ID)
+ audit("the list", "/sheets", `main`, nil)
+ audit("the sheet", sheet, `td[data-x="0"][data-y="0"]`,
+ []string{"[data-sheet-grid]", "[data-menubar]", "[data-toolbar]", "[data-tabstrip]"})
+ audit("share", sheet+"/share", `input[name=address], input[type=email]`, nil)
+ audit("comments", sheet+"/comments", `main textarea, main input[type=text]`, nil)
+ audit("history", sheet+"/history", `main`, nil)
+ audit("the table view", sheet+"/table", `table[data-cell-table]`, []string{"table[data-cell-table]"})
+ audit("import", "/sheets/import", `main input[type=file]`, nil)
+}
diff --git a/internal/sheets/static/brand/brand.css b/internal/sheets/static/brand/brand.css
index 27e25ad..475fb08 100644
--- a/internal/sheets/static/brand/brand.css
+++ b/internal/sheets/static/brand/brand.css
@@ -3,7 +3,7 @@
[estilo-brand] {
display: inline-flex;
align-items: center;
- gap: .5rem;
+ gap: var(--rst-sp-2);
min-block-size: 24px;
}
[estilo-brand-icon] {
diff --git a/internal/sheets/static/sheets.css b/internal/sheets/static/sheets.css
index 05fca0f..cac6347 100644
--- a/internal/sheets/static/sheets.css
+++ b/internal/sheets/static/sheets.css
@@ -71,6 +71,7 @@
* inline padding as estilo's items, so their labels line up with the
* item text above and below. */
[data-menubar] [estilo-menu] > [data-size-form] {
+ /* spacing-allow: estilo's own item inset (its value as the fallback), so the labels line up with the items' */
padding: var(--rst-sp-1) var(--estilo-item-padding-inline, 0.65rem);
}
@@ -161,7 +162,7 @@
display: inline-flex;
font: inherit;
font-size: var(--rst-fs-sm);
- gap: 0.1rem;
+ gap: 0.1rem; /* spacing-allow: a tool's glyph and its caret read as one mark */
justify-content: center;
min-block-size: 1.75rem;
min-inline-size: 1.75rem;
@@ -1145,7 +1146,7 @@
[data-cell-format] select {
font-size: var(--rst-fs-xs);
- padding-block: 0.15rem;
+ padding-block: 0.15rem; /* spacing-allow: the compact selects at the xs size, the row's density */
}
/* ── The list's thumbnails ───────────────────────────────────────────
diff --git a/internal/sheets/static/tokens.css b/internal/sheets/static/tokens.css
index 3ae9664..07f8b10 100644
--- a/internal/sheets/static/tokens.css
+++ b/internal/sheets/static/tokens.css
@@ -2476,6 +2476,90 @@ small.rst-field__hint, small[rst-field-hint] { display: block; font-size: var(--
and every caller writes by hand, is rst-form-bar now. */
.rst-form-foot, [rst-form-foot] { display: flex; gap: var(--rst-sp-3); margin-block-start: var(--rst-sp-3); }
+/* ── stack: a page's vertical rhythm ──────────────────────────────────
+ The blocks a screen is written in, a heading, a paragraph, a hint, a
+ card, a row of buttons, are spaced by the stack they sit in and by
+ nothing else. Hand-rolled margins gave every screen its own rhythm:
+ a heading further from its own text than from the section before
+ it, a hint resting on the button under it. So a stack is a flex
+ column, where no margin collapses, every child's own block margins
+ are zeroed, and the space before each child is read off one table
+ by what it is and what it follows (DESIGN.md, "Spacing"):
+
+ after a heading (h1 to h6) --rst-sp-2
+ before an actions row, a button --rst-sp-4
+ a label or hint, then its input, or an
+ input, then its hint --rst-sp-2
+ before h1, h2 or a section, or after
+ the page header --rst-sp-5
+ before h3 to h6 --rst-sp-4
+ anything else --rst-sp-3
+
+ Higher in the table wins. Each relation sets its own custom property
+ on the child, and the one margin rule reads them in the table's
+ order through var() fallbacks, so which rule wins is written in one
+ place rather than left to specificity. Every child resets all five
+ first, so a nested stack's child never inherits its parent's answer.
+ rst-section marks a child that opens a new section; a section that
+ holds blocks of its own is a stack too, <section rst-stack
+ rst-section>.
+
+ The column's gap is the table's smallest step, --rst-sp-2, and a
+ child's block-start margin is the rest of its answer. The gap is
+ the floor: it falls only between children that are drawn, so a
+ [hidden] child, which a sibling selector cannot see past, costs the
+ block after it its relation but never leaves it touching. A hidden
+ input, a form's CSRF field, is passed over the same way, so the
+ first block after one still opens the stack flush. */
+.rst-stack, [rst-stack] { display: flex; flex-direction: column; gap: var(--rst-sp-2); }
+.rst-stack > :not([hidden]), [rst-stack] > :not([hidden]) {
+ --rst-stack-actions: initial;
+ --rst-stack-heading: initial;
+ --rst-stack-control: initial;
+ --rst-stack-section: initial;
+ --rst-stack-sub: initial;
+ margin-block: 0;
+}
+.rst-stack > :not([hidden], [type="hidden"]) + :not([hidden]), [rst-stack] > :not([hidden], [type="hidden"]) + :not([hidden]) {
+ margin-block-start: calc(var(--rst-stack-heading, var(--rst-stack-actions, var(--rst-stack-control, var(--rst-stack-section, var(--rst-stack-sub, var(--rst-sp-3)))))) - var(--rst-sp-2));
+}
+/* A column stretches its children across; a button or a picture keeps
+ its own width. */
+.rst-stack > button, [rst-stack] > button, .rst-stack > .rst-btn, [rst-stack] > [rst-btn], .rst-stack > img, [rst-stack] > img { align-self: flex-start; }
+.rst-stack > :not([hidden], [type="hidden"]) + h3, [rst-stack] > :not([hidden], [type="hidden"]) + h3,
+.rst-stack > :not([hidden], [type="hidden"]) + h4, [rst-stack] > :not([hidden], [type="hidden"]) + h4,
+.rst-stack > :not([hidden], [type="hidden"]) + h5, [rst-stack] > :not([hidden], [type="hidden"]) + h5,
+.rst-stack > :not([hidden], [type="hidden"]) + h6, [rst-stack] > :not([hidden], [type="hidden"]) + h6 { --rst-stack-sub: var(--rst-sp-4); }
+.rst-stack > :not([hidden], [type="hidden"]) + h1, [rst-stack] > :not([hidden], [type="hidden"]) + h1,
+.rst-stack > :not([hidden], [type="hidden"]) + h2, [rst-stack] > :not([hidden], [type="hidden"]) + h2,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-section, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-section],
+.rst-stack > .rst-page-header + :not([hidden]), [rst-stack] > [rst-page-header] + :not([hidden]) { --rst-stack-section: var(--rst-sp-5); }
+.rst-stack > label + input:not([hidden]), [rst-stack] > label + input:not([hidden]),
+.rst-stack > label + select:not([hidden]), [rst-stack] > label + select:not([hidden]),
+.rst-stack > label + textarea:not([hidden]), [rst-stack] > label + textarea:not([hidden]),
+.rst-stack > .rst-field__help + input:not([hidden]), [rst-stack] > [rst-field-help] + input:not([hidden]),
+.rst-stack > .rst-field__help + select:not([hidden]), [rst-stack] > [rst-field-help] + select:not([hidden]),
+.rst-stack > .rst-field__help + textarea:not([hidden]), [rst-stack] > [rst-field-help] + textarea:not([hidden]),
+.rst-stack > input + .rst-field__help, [rst-stack] > input + [rst-field-help],
+.rst-stack > select + .rst-field__help, [rst-stack] > select + [rst-field-help],
+.rst-stack > textarea + .rst-field__help, [rst-stack] > textarea + [rst-field-help] { --rst-stack-control: var(--rst-sp-2); }
+.rst-stack > h1 + :not([hidden]), [rst-stack] > h1 + :not([hidden]),
+.rst-stack > h2 + :not([hidden]), [rst-stack] > h2 + :not([hidden]),
+.rst-stack > h3 + :not([hidden]), [rst-stack] > h3 + :not([hidden]),
+.rst-stack > h4 + :not([hidden]), [rst-stack] > h4 + :not([hidden]),
+.rst-stack > h5 + :not([hidden]), [rst-stack] > h5 + :not([hidden]),
+.rst-stack > h6 + :not([hidden]), [rst-stack] > h6 + :not([hidden]) { --rst-stack-heading: var(--rst-sp-2); }
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-foot, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-foot],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + button, [rst-stack] > :not([hidden], [type="hidden"]) + button,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-btn, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-btn] { --rst-stack-actions: var(--rst-sp-4); }
+/* The actions row: buttons, links styled as buttons, and the one-button
+ forms a POST action needs, side by side and wrapping on a phone. A
+ form stays a box (display: contents would make it one no driver can
+ see), and a one-button form is as wide as its button. */
+.rst-actions, [rst-actions] { align-items: center; display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); }
+
@media (prefers-reduced-motion: reduce) {
.rst-switch__track, [rst-switch-track], .rst-switch[data-rst-settle] .rst-switch__track, [rst-switch][data-rst-settle] [rst-switch-track], .rst-tblock > .rst-tblock__head[data-rst-settle] > .rst-switch__track, [rst-tblock] > [rst-tblock-head][data-rst-settle] > [rst-switch-track] { transition: none; }
}
diff --git a/internal/sheets/templates/layout.html b/internal/sheets/templates/layout.html
index 8cee111..1ebd150 100644
--- a/internal/sheets/templates/layout.html
+++ b/internal/sheets/templates/layout.html
@@ -58,11 +58,14 @@
the grid's <main> taking the rest (estilo chrome.css). That is why
the grid can fill the screen without this app subtracting a bar
height it would have to guess. The "main" block lets the grid page
- supply its own <main>, without rst-page's padding and max width. */}}
+ supply its own <main>, without rst-page's padding and max width.
+ Every other page's <main> is Fiesta's stack (rst-stack): it spaces
+ the page's blocks, its header, headings, prose, forms and buttons,
+ by one table, so no page sets a margin between them by hand. */}}
<div estilo-shell{{with .Frame.Shell}}="{{.}}"{{end}}>
<a rst-skip href="#main">{{.Frame.Chrome.Labels.Skip}}</a>
{{template "estilo-bar" .Frame.Chrome}}
-{{block "main" .}}<main rst-page id="main">{{template "content" .}}</main>{{end}}
+{{block "main" .}}<main rst-page rst-stack id="main">{{template "content" .}}</main>{{end}}
</div>
{{if .Frame.Shortcuts}}{{template "shortcuts-dialog" .Frame.Keys}}{{end}}
</body>