diff --git a/apps/web/src/components/docs/DocsSidebar.astro b/apps/web/src/components/docs/DocsSidebar.astro index 41cd1f5..352b69e 100644 --- a/apps/web/src/components/docs/DocsSidebar.astro +++ b/apps/web/src/components/docs/DocsSidebar.astro @@ -99,8 +99,9 @@ const tree = buildTree(headings); diff --git a/apps/web/src/components/landing/HeroSection.astro b/apps/web/src/components/landing/HeroSection.astro index 108d1de..3793582 100644 --- a/apps/web/src/components/landing/HeroSection.astro +++ b/apps/web/src/components/landing/HeroSection.astro @@ -19,7 +19,7 @@ import CopyCommand from "./CopyCommand.astro"; Source on GitHub -

Needs Node 22 or newer. No account or API key to analyze.

+

Needs Node 22 or newer. An API key is optional and only adds the AI layer.

diff --git a/apps/web/src/pages/docs.astro b/apps/web/src/pages/docs.astro index 45cc4a1..441e0fb 100644 --- a/apps/web/src/pages/docs.astro +++ b/apps/web/src/pages/docs.astro @@ -31,6 +31,17 @@ const { Content, headings } = await render(entry); padding-block: 1.5rem 5rem; } + /* + * Below the grid breakpoint the slot only wraps the mobile contents bar. + * Letting its children belong to .docs-page gives that bar the full page + * height to stick within; as a box of its own it would never stick. + */ + @media (max-width: 759px) { + .docs-sidebar-slot { + display: contents; + } + } + @media (min-width: 760px) { .docs-page { display: grid; diff --git a/apps/web/src/styles/docs-prose.css b/apps/web/src/styles/docs-prose.css index f502354..5bcf95e 100644 --- a/apps/web/src/styles/docs-prose.css +++ b/apps/web/src/styles/docs-prose.css @@ -10,7 +10,16 @@ .docs-prose h4 { font-family: var(--font-display); color: var(--ink); - scroll-margin-top: 2rem; +} + +/* On phones the sticky contents bar also sits under the header. */ +@media (max-width: 759px) { + .docs-prose h1, + .docs-prose h2, + .docs-prose h3, + .docs-prose h4 { + scroll-margin-top: 4.5rem; + } } .docs-prose h1 { diff --git a/apps/web/src/styles/global.css b/apps/web/src/styles/global.css index 2dc7299..6cb2e74 100644 --- a/apps/web/src/styles/global.css +++ b/apps/web/src/styles/global.css @@ -26,6 +26,9 @@ --gutter: clamp(1.25rem, 5vw, 4rem); --section-space: clamp(4.5rem, 10vw, 8rem); --radius: 0.5rem; + --header-height: 4.5rem; + /* Sticky elements sit below the site header only while it is showing. */ + --sticky-offset: 0px; background: var(--paper); font-family: var(--font-body); @@ -42,7 +45,12 @@ html { scroll-behavior: smooth; - scroll-padding-top: 2rem; + /* Anchors land below the site header, which may be showing when they scroll. */ + scroll-padding-top: calc(var(--header-height) + 1.5rem); +} + +html[data-header="shown"] { + --sticky-offset: var(--header-height); } body {