diff --git a/docs/.vuepress/styles/index.scss b/docs/.vuepress/styles/index.scss index baef2d0..7c55e08 100644 --- a/docs/.vuepress/styles/index.scss +++ b/docs/.vuepress/styles/index.scss @@ -298,12 +298,68 @@ body { border-bottom: 1px solid var(--ff-glass-border); } +// From the mobile breakpoint up to 1440px the full navbar does not fit: its +// ten links, the search label and the key hints need about 1400px. Show the +// search button as an icon, as the search plugin already does below 960px, +// and tighten the gap between links. The compact bar needs about 1240px. +// Range syntax, so a fractional width between 1279px and 1280px (browser +// zoom) gets the compact bar too. +@media (width > #{palette.$MQMobile}) and (width < 1440px) { + .vp-search-button { + border-radius: 50%; + } + + .vp-search-placeholder, + .vp-search-key-hints { + display: none; + } + + .vp-navbar .vp-navbar-item:not(:first-child) { + margin-inline-start: 1rem; + } +} + +// At the mobile breakpoint and below, the theme makes the site name a block +// as wide as the bar's free space (`width: calc(100vw - 11rem)`) so a long +// name can end in an ellipsis. A block inside the inline brand link stretches +// the link across the bar, so the empty bar was a link home and the focus +// ring ran across it. Inline-block keeps the cap and the ellipsis but lets +// the link hug the name. +@media (max-width: palette.$MQMobile) { + .vp-site-name { + display: inline-block; + width: auto; + max-width: calc(100vw - 11rem); + vertical-align: top; + } +} + // --------------------------------------------------------------------- // Sidebar — accent the active page, keep the rest quiet. // --------------------------------------------------------------------- .vp-sidebar { background: transparent; + // At the mobile breakpoint and below, the sidebar is a drawer laid over + // the page, so it needs a solid surface or the page shows through the menu. + // The theme only slides the closed drawer off screen, which leaves its + // links in the tab order. `visibility` takes them out until it opens; the + // delay keeps the drawer visible while it slides away (theme: 0.3s). + @media (max-width: palette.$MQMobile) { + background: var(--vp-c-bg); + visibility: hidden; + transition: + transform var(--vp-t-transform), + background-color var(--vp-t-color), + border-color var(--vp-t-color), + visibility 0s linear 0.3s; + + .vp-theme-container.sidebar-open & { + visibility: visible; + transition-delay: 0s; + } + } + .sidebar-item.active { color: var(--vp-c-accent); font-weight: 600; diff --git a/docs/.vuepress/styles/palette.scss b/docs/.vuepress/styles/palette.scss index fbdf2a0..a17904f 100644 --- a/docs/.vuepress/styles/palette.scss +++ b/docs/.vuepress/styles/palette.scss @@ -35,6 +35,16 @@ $ff-indigo: #818cf8; $ff-amber: #f59e0b; // retained for "warning" callout semantics only $ff-red: #ef4444; // retained for "danger" callout semantics only +// --------------------------------------------------------------------- +// Mobile breakpoint. The default theme reads it from this file; its own +// default is 719px. At this width and below, the navbar links move into +// the menu drawer. The navbar's ten links need about 1400px, or about +// 1240px in the compact form index.scss uses below 1440px. Narrower than +// that, the search button and the color-mode toggle were pushed off +// screen. Re-measure both when you add a top-level navbar item. +// --------------------------------------------------------------------- +$MQMobile: 1279px; + // ===================================================================== // DARK (default) — on :root so the first paint is dark. // =====================================================================