Skip to content

Commit e927853

Browse files
committed
docs: port the sidebar styling to Zensical's nav and restore the slate canvas
Zensical's UI keeps Material's md-* class names but ships different stock nav styling (8px-radius pill rows with 7px 16px padding), which broke the sidebar design in two ways: section labels sat indented past their guide line (the label's inner anchor carries the pill padding), and the vertical rhythm doubled. Re-express the same design against the new stock rules, keeping Zensical's pill highlight for the active page. The dark scheme also swaps Zensical's near-black canvas back for the Material slate blue-grey this site shipped with; code blocks keep Zensical's own surfaces.
1 parent d629160 commit e927853

1 file changed

Lines changed: 34 additions & 27 deletions

File tree

docs/extra.css

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
/* Sidebar hierarchy + density for MkDocs Material 9.7.x.
2-
All rules scoped to the desktop sidebar breakpoint (>= 76.25em), matching
3-
Material's own scoping for navigation.sections, so the mobile drill-down
4-
drawer keeps stock styling. Colors use Material tokens, so the light and
5-
slate schemes both work without extra palette handling. */
1+
/* Sidebar hierarchy + density for Zensical's UI (Material-compatible md-*
2+
DOM, but different stock spacing: nav links are 8px-radius pills with
3+
7px 16px padding). All rules scoped to the desktop sidebar breakpoint
4+
(>= 76.25em) so the mobile drill-down drawer keeps stock styling. Colors
5+
use the md-* tokens, so the light and slate schemes both work without
6+
extra palette handling. */
67

78
@media screen and (min-width: 76.25em) {
8-
/* Section labels: smaller, uppercase, letter-spaced, muted. Covers both the
9-
clickable index-page headers and the bare API Reference label. */
9+
/* Section labels: smaller, uppercase, letter-spaced, muted, and flush
10+
with the guide line below them. The label is a container whose inner
11+
anchor carries the stock pill padding; zero both so the label text
12+
starts at the section's left edge. */
1013
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
14+
margin-top: 0;
15+
margin-left: 0;
16+
padding-left: 0;
1117
font-size: 0.62rem;
1218
font-weight: 700;
1319
text-transform: uppercase;
1420
letter-spacing: 0.1em;
1521
color: var(--md-default-fg-color--light);
1622
}
23+
.md-sidebar--primary .md-nav__item--section > .md-nav__link > a {
24+
padding: 2px 0;
25+
}
1726

18-
/* Indent section children and hang a guide line. Material outdents section
19-
children with [dir=ltr] ... margin-left: -0.6rem, which is why they sit
20-
flush under the header; restoring the margin re-exposes the stock 0.6rem
21-
list padding. The logical property ties Material's physical one at
22-
(0,3,0) specificity and wins on source order (extra_css loads last),
23-
while staying direction-agnostic. */
27+
/* Indent section children slightly and hang a guide line. */
2428
.md-sidebar--primary .md-nav__item--section > .md-nav {
2529
margin-inline-start: 0.1rem;
2630
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
@@ -32,22 +36,19 @@
3236
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
3337
}
3438

35-
/* Tighten vertical rhythm (stock: 0.625em link margins, 1.25em sections).
36-
The child combinator keeps this off anchors inside md-nav__container,
37-
which carry their own margin-top: 0 stock rule. */
39+
/* Tighten vertical rhythm: the stock pill rows (7px 16px padding plus
40+
6.3px top margins) read too airy for a deep nav; keep the pill shape
41+
and active highlight, just denser. */
3842
.md-sidebar--primary .md-nav__item > .md-nav__link {
39-
margin-top: 0.45em;
43+
padding: 4px 10px;
44+
margin-top: 2px;
4045
}
4146
.md-sidebar--primary .md-nav__item--section {
4247
margin: 1em 0;
4348
}
44-
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
45-
margin-top: 0;
46-
}
4749

48-
/* The current page stands out from its siblings. 700 because Material only
49-
loads Inter at 300/400/700; a 600 would silently substitute the 700 face
50-
anyway, but render lighter on the system-font fallback stack. */
50+
/* The current page stands out from its siblings (on top of the stock
51+
pill highlight). 700 because only Inter 300/400/700 are loaded. */
5152
.md-sidebar--primary .md-nav__link--active {
5253
font-weight: 700;
5354
}
@@ -60,10 +61,16 @@
6061
}
6162
}
6263

63-
/* Headings: Material's 300-weight light-gray defaults read washed out; use
64-
the full foreground color and a solid weight instead. 700, not 600: the
65-
Google Fonts request only carries Inter 300/400/700 (see the nav__link
66-
note above). */
64+
/* Dark scheme: Zensical's slate canvas is near-black (hsla(225,15%,5%)),
65+
harsher than the Material slate this site shipped with; restore that
66+
blue-grey. Code blocks and other surfaces keep Zensical's own tokens. */
67+
[data-md-color-scheme="slate"] {
68+
--md-default-bg-color: #1e2129;
69+
}
70+
71+
/* Headings: the 300-weight light-gray defaults read washed out; use the
72+
full foreground color and a solid weight instead. 700, not 600: only
73+
Inter 300/400/700 are loaded (see the nav__link note above). */
6774
.md-typeset h1,
6875
.md-typeset h2 {
6976
font-weight: 700;

0 commit comments

Comments
 (0)