Skip to content

Commit c8449b7

Browse files
committed
docs: rebuild the sidebar styling as one coordinate system
The previous rules chased text alignment with per-element compensations (zeroed paddings, a negative margin), which clipped the active pill flat against the scroll container's paint edge, left label pills hugging their text, and fought the list's stock flex gap with per-link margins. Derive everything from the pill inset instead: every row is a direct .md-nav__link child with the same 10px horizontal padding (inner anchors inside container wrappers zeroed), so all text shares one column and pills always paint with breathing room inside the clip edge; section rules carry typography only, eliminating the specificity coordination; and the flex gap becomes the single density knob (2px, restoring the ~30px row pitch the site shipped with on Material).
1 parent de9d8fa commit c8449b7

1 file changed

Lines changed: 24 additions & 39 deletions

File tree

docs/extra.css

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,48 @@
66
extra palette handling. */
77

88
@media screen and (min-width: 76.25em) {
9-
/* Tighten vertical rhythm: the stock pill rows (7px 16px padding plus
10-
6.3px top margins) read too airy for a deep nav; keep the pill shape
11-
and active highlight, just denser. Group rows that link to an index
12-
page wrap their anchor in an .md-nav__container div whose stock
13-
padding is 0 — densify the inner anchor, not the wrapper. The
14-
section items are excluded outright: their label is styled by the
15-
section rules below, and the :not() classes here would otherwise
16-
out-rank those on specificity. */
17-
.md-sidebar--primary .md-nav__item:not(.md-nav__item--section) > .md-nav__link:not(.md-nav__container) {
18-
padding: 4px 10px;
19-
margin-top: 2px;
9+
/* The sidebar is one coordinate system derived from the pill inset:
10+
every row — page links, group rows, section labels — is a direct
11+
.md-nav__link child of its item with the same 10px horizontal padding,
12+
so all text shares one column, and hover/active pills always paint
13+
10px of breathing room inside the scroll container (never clipped).
14+
Inner anchors inside .md-nav__container wrappers are zeroed; the row
15+
box owns the geometry. Vertical rhythm has a single knob: the nav
16+
list's flex gap (stock 0.2rem reads airy; 2px matches the density the
17+
site shipped with on Material, ~30px row pitch). */
18+
.md-sidebar--primary .md-nav__list {
19+
gap: 2px;
2020
}
21-
.md-sidebar--primary .md-nav__item:not(.md-nav__item--section) > .md-nav__container {
22-
margin-top: 2px;
21+
.md-sidebar--primary .md-nav__item > .md-nav__link {
22+
padding: 3px 10px;
23+
margin: 0;
2324
}
2425
.md-sidebar--primary .md-nav__container > .md-nav__link {
25-
padding: 4px 10px;
26+
padding: 0;
27+
margin: 0;
2628
}
29+
30+
/* Section labels: typography only — geometry comes from the row rule
31+
above, so no specificity coordination is needed. */
2732
.md-sidebar--primary .md-nav__item--section {
28-
margin: 1em 0;
33+
margin: 0.8em 0;
2934
}
30-
31-
/* Section labels: smaller, uppercase, letter-spaced, muted, and flush
32-
with the guide line below them. The label is a container whose inner
33-
anchor carries the stock pill padding; zero both so the label text
34-
starts at the section's left edge. */
3535
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
36-
margin-top: 0;
37-
margin-left: 0;
38-
padding: 2px 0;
3936
font-size: 0.62rem;
4037
font-weight: 700;
4138
text-transform: uppercase;
4239
letter-spacing: 0.1em;
4340
color: var(--md-default-fg-color--light);
4441
}
45-
.md-sidebar--primary .md-nav__item--section > .md-nav__link > a {
46-
padding: 2px 0;
47-
}
4842

49-
/* Indent section children slightly and hang a guide line. */
43+
/* Guide lines: 12px from the item box = 2px right of the label text
44+
(which sits at box + 10px pill inset); children indent past them. */
5045
.md-sidebar--primary .md-nav__item--section > .md-nav {
51-
margin-inline-start: 0.1rem;
46+
margin-inline-start: 12px;
5247
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
5348
}
54-
55-
/* Same guide line for collapsible groups inside the API Reference subtree
56-
(section items also carry --nested, so exclude them). */
5749
.md-sidebar--primary .md-nav__item--nested:not(.md-nav__item--section) > .md-nav {
50+
margin-inline-start: 12px;
5851
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
5952
}
6053

@@ -64,14 +57,6 @@
6457
font-weight: 700;
6558
}
6659

67-
/* Top-level pages outside any section (the homepage entry, Protocol
68-
versions, Troubleshooting, ...) share the left edge with the section
69-
labels: pull the link box left by its own pill padding, so the text
70-
is flush and the hover/active pill overhangs into the gutter. */
71-
.md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item:not(.md-nav__item--section) > .md-nav__link:not(.md-nav__container) {
72-
margin-inline-start: -10px;
73-
}
74-
7560
/* The sidebar repeats the site name right above the homepage nav entry;
7661
drop the title row on desktop (the mobile drawer still needs it for its
7762
drill-down back-navigation, hence the media-query scope). */

0 commit comments

Comments
 (0)