@ninjainfosys/site-kit 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -91,6 +91,14 @@ On every post page the kit also adds: a "#" link on hover or focus beside each H
91
91
 
92
92
  The article styles use only the site's tokens: `--canvas --surface --subtle --line --ink --ink-muted --link --mark --warn-bg --warn-ink --font-sans --font-display --font-mono --font-serif --radius-panel --radius-control`. `--mark` is the accent for bullets and the progress bar. `--warn-bg` and `--warn-ink` are the warning panel (keep the text at AA contrast). A site that is strictly black and white points them at its greys.
93
93
 
94
+ ## Glossary
95
+
96
+ `/glossary` shows the term count, a search box that filters as you type (term, full name, aliases and definition; the full list shows without JavaScript), topic chips when terms carry `topic`, a sticky A-Z bar that marks the letter in view, the terms with `sections` first as "In-depth guides", and every term as a card under its letter.
97
+
98
+ `/glossary/<slug>` uses the blog post layout: breadcrumbs (Glossary, then the letter), the title, a meta line (aliases from `aka`, reading time, `updated` when set), the quotable definition with a "Copy definition" button, the article with an "On this page" rail built from `sections` and `faq`, related terms as cards, guides as story cards, and previous and next term. The article styles, callout and link rules of posts apply. DefinedTerm, DefinedTermSet, TechArticle, FAQPage and BreadcrumbList data are unchanged apart from the letter step in the breadcrumb.
99
+
100
+ Term fields the kit reads: `slug term full short body related product aka published updated title description sections faq` and the optional `topic`. A term whose `published` date is in the future stays out of the build. `kit.glossary.heading` sets the front's h1 (default "Glossary").
101
+
94
102
  ## Commands
95
103
 
96
104
  `site-kit <command>` runs from the site's root and reads `site-kit.config.mjs` there.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninjainfosys/site-kit",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Shared blog, glossary, SEO, layout and build tooling for the Ninja Infosys Astro marketing sites.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -152,7 +152,7 @@ const current = (href: string) => (path === href || path.startsWith(`${href}/`)
152
152
 
153
153
  .bar { display: flex; align-items: center; gap: var(--space-7); height: 72px; }
154
154
  .logo { flex: none; display: block; }
155
- .logo img { width: 128px; height: auto; }
155
+ :where(.logo img) { width: 128px; height: auto; }
156
156
  .logo-dark { display: none; }
157
157
 
158
158
  .nav-wide { flex: 1; align-self: stretch; }
@@ -303,7 +303,7 @@ const current = (href: string) => (path === href || path.startsWith(`${href}/`)
303
303
  .u-row { justify-content: center; }
304
304
  }
305
305
  @media (max-width: 399px) {
306
- .logo img { width: 112px; }
306
+ :where(.logo img) { width: 112px; }
307
307
  .actions { gap: var(--space-2); }
308
308
  .actions .btn { padding: 0 var(--space-3); }
309
309
  .mobile-label { display: none; }
package/src/contract.ts CHANGED
@@ -168,6 +168,8 @@ export interface KitConfig {
168
168
  cta: { heading: string; actions: { href: string; label: string; class: string }[] };
169
169
  og: OgConfig;
170
170
  glossary: {
171
+ /** The h1 of the glossary front; default 'Glossary'. */
172
+ heading?: string;
171
173
  name: string;
172
174
  ogTitle: string;
173
175
  indexTitle: string;
@@ -0,0 +1,64 @@
1
+ // Browser behaviour shared by the blog post and the glossary term page: section
2
+ // links on H2s, "Copy link" buttons, a reading-progress bar and the contents
3
+ // rail that marks the section being read.
4
+ export function initArticle() {
5
+ // A link icon beside each H2 copies that section's address.
6
+ document.querySelectorAll<HTMLElement>('.article-body h2[id]').forEach((h) => {
7
+ const a = document.createElement('a');
8
+ a.className = 'anchor';
9
+ a.href = `#${h.id}`;
10
+ a.textContent = '#';
11
+ a.setAttribute('aria-label', `Link to the section ${h.textContent}`);
12
+ a.addEventListener('click', () => { navigator.clipboard?.writeText(`${location.origin}${location.pathname}#${h.id}`).catch(() => {}); });
13
+ h.append(a);
14
+ });
15
+ // Copy the post's address; the button says so for a moment.
16
+ document.querySelector<HTMLButtonElement>('[data-copy-link]')?.addEventListener('click', (e) => {
17
+ const b = e.currentTarget as HTMLButtonElement;
18
+ navigator.clipboard?.writeText(location.href.split('#')[0]).then(() => {
19
+ b.textContent = 'Copied';
20
+ setTimeout(() => { b.textContent = 'Copy link'; }, 2000);
21
+ }).catch(() => {});
22
+ });
23
+ // Reading progress: how far down the article the page has scrolled.
24
+ const bar = document.querySelector<HTMLElement>('.read-progress i');
25
+ const article = document.querySelector<HTMLElement>('.article-body');
26
+ if (bar && article && !matchMedia('(prefers-reduced-motion: reduce)').matches) {
27
+ let tick = 0;
28
+ const update = () => {
29
+ tick = 0;
30
+ const box = article.getBoundingClientRect();
31
+ const total = box.height - innerHeight * 0.5;
32
+ bar.style.setProperty('--p', String(Math.min(1, Math.max(0, (innerHeight * 0.25 - box.top) / total))));
33
+ };
34
+ addEventListener('scroll', () => { if (!tick) tick = requestAnimationFrame(update); }, { passive: true });
35
+ update();
36
+ }
37
+ // The side contents list marks the section being read.
38
+ const links = new Map([...document.querySelectorAll<HTMLAnchorElement>('[data-toc]')].map((a) => [a.dataset.toc!, a]));
39
+ if (links.size) {
40
+ const seen = new Set<string>();
41
+ const mark = () => {
42
+ const order = [...links.keys()];
43
+ const current = order.filter((id) => seen.has(id)).at(0) ?? null;
44
+ links.forEach((a, id) => a.toggleAttribute('aria-current', id === current));
45
+ };
46
+ const io = new IntersectionObserver((entries) => {
47
+ entries.forEach((e) => (e.isIntersecting ? seen.add(e.target.id) : seen.delete(e.target.id)));
48
+ mark();
49
+ }, { rootMargin: '-96px 0px -60% 0px' });
50
+ links.forEach((_, id) => { const h = document.getElementById(id); if (h) io.observe(h); });
51
+ }
52
+ // Closing the mobile contents list after a jump keeps the text in view.
53
+ document.querySelectorAll('.toc-inline a').forEach((a) => a.addEventListener('click', () => a.closest('details')?.removeAttribute('open')));
54
+ // "Copy definition": copies the text in the button's data-copy attribute.
55
+ document.querySelectorAll<HTMLButtonElement>('[data-copy]').forEach((b) => {
56
+ const label = b.textContent;
57
+ b.addEventListener('click', () => {
58
+ navigator.clipboard?.writeText(b.dataset.copy ?? '').then(() => {
59
+ b.textContent = 'Copied';
60
+ setTimeout(() => { b.textContent = label; }, 2000);
61
+ }).catch(() => {});
62
+ });
63
+ });
64
+ }
@@ -8,6 +8,8 @@ export interface Term {
8
8
  related: string[];
9
9
  /** Product page this term leads to. */
10
10
  product?: string;
11
+ /** Group for the index's topic filter ("Cameras", "Storage"). Leave out when terms are not grouped. */
12
+ topic?: string;
11
13
  /** Other names people search for, marked up as alternate names. */
12
14
  aka?: string[];
13
15
  /** Day the term goes live (YYYY-MM-DD). Builds before this day leave it out; no date means always live. */
package/src/lib/seo.ts CHANGED
@@ -76,7 +76,7 @@ export function websiteJsonLd() {
76
76
  };
77
77
  }
78
78
 
79
- export function breadcrumbJsonLd(items: { name: string; path: string }[]) {
79
+ export function breadcrumbJsonLd(items: { name: string; path: string; url?: string }[]) {
80
80
  const all = [{ name: 'Home', path: '/' }, ...items];
81
81
  return {
82
82
  '@context': 'https://schema.org',
@@ -85,7 +85,7 @@ export function breadcrumbJsonLd(items: { name: string; path: string }[]) {
85
85
  '@type': 'ListItem',
86
86
  position: i + 1,
87
87
  name: it.name,
88
- item: canonicalFor(it.path),
88
+ item: it.url ?? canonicalFor(it.path),
89
89
  })),
90
90
  };
91
91
  }
@@ -3,6 +3,7 @@ import ChevronDown from '@lucide/astro/icons/chevron-down';
3
3
  import { render } from 'astro:content';
4
4
  import blogImages from 'virtual:site-kit/blog-images';
5
5
  import '../../styles/article.css';
6
+ import '../../styles/article-layout.css';
6
7
  import { Image, getImage } from 'astro:assets';
7
8
  import { LICENCES } from '../../lib/blog-schema';
8
9
  import Base from '@site/layouts/Base.astro';
@@ -157,107 +158,21 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
157
158
  </Base>
158
159
 
159
160
  <script>
160
- // A link icon beside each H2 copies that section's address.
161
- document.querySelectorAll<HTMLElement>('.article-body h2[id]').forEach((h) => {
162
- const a = document.createElement('a');
163
- a.className = 'anchor';
164
- a.href = `#${h.id}`;
165
- a.textContent = '#';
166
- a.setAttribute('aria-label', `Link to the section ${h.textContent}`);
167
- a.addEventListener('click', () => { navigator.clipboard?.writeText(`${location.origin}${location.pathname}#${h.id}`).catch(() => {}); });
168
- h.append(a);
169
- });
170
- // Copy the post's address; the button says so for a moment.
171
- document.querySelector<HTMLButtonElement>('[data-copy-link]')?.addEventListener('click', (e) => {
172
- const b = e.currentTarget as HTMLButtonElement;
173
- navigator.clipboard?.writeText(location.href.split('#')[0]).then(() => {
174
- b.textContent = 'Copied';
175
- setTimeout(() => { b.textContent = 'Copy link'; }, 2000);
176
- }).catch(() => {});
177
- });
178
- // Reading progress: how far down the article the page has scrolled.
179
- const bar = document.querySelector<HTMLElement>('.read-progress i');
180
- const article = document.querySelector<HTMLElement>('.article-body');
181
- if (bar && article && !matchMedia('(prefers-reduced-motion: reduce)').matches) {
182
- let tick = 0;
183
- const update = () => {
184
- tick = 0;
185
- const box = article.getBoundingClientRect();
186
- const total = box.height - innerHeight * 0.5;
187
- bar.style.setProperty('--p', String(Math.min(1, Math.max(0, (innerHeight * 0.25 - box.top) / total))));
188
- };
189
- addEventListener('scroll', () => { if (!tick) tick = requestAnimationFrame(update); }, { passive: true });
190
- update();
191
- }
192
- // The side contents list marks the section being read.
193
- const links = new Map([...document.querySelectorAll<HTMLAnchorElement>('[data-toc]')].map((a) => [a.dataset.toc!, a]));
194
- if (links.size) {
195
- const seen = new Set<string>();
196
- const mark = () => {
197
- const order = [...links.keys()];
198
- const current = order.filter((id) => seen.has(id)).at(0) ?? null;
199
- links.forEach((a, id) => a.toggleAttribute('aria-current', id === current));
200
- };
201
- const io = new IntersectionObserver((entries) => {
202
- entries.forEach((e) => (e.isIntersecting ? seen.add(e.target.id) : seen.delete(e.target.id)));
203
- mark();
204
- }, { rootMargin: '-96px 0px -60% 0px' });
205
- links.forEach((_, id) => { const h = document.getElementById(id); if (h) io.observe(h); });
206
- }
207
- // Closing the mobile contents list after a jump keeps the text in view.
208
- document.querySelectorAll('.toc-inline a').forEach((a) => a.addEventListener('click', () => a.closest('details')?.removeAttribute('open')));
161
+ import { initArticle } from '../../lib/article-client';
162
+ initArticle();
209
163
  </script>
210
164
 
211
165
 
212
166
  <style>
213
- /* Reading layout: one text column (about 68 characters a line) and, on wide
214
- screens, a sticky "On this page" rail. Phones get the same order with a
215
- tap-to-open contents list. */
216
- .post { padding-block: var(--space-6) var(--space-9); }
217
- /* Breadcrumb trail: section and topic, the title follows as the heading. */
218
- .crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); list-style: none; margin: 0; padding: 0; font-size: 14px; }
219
- .crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
220
- .crumbs li + li::before { content: '›'; color: var(--ink-muted); }
221
- .crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-muted); text-decoration: none; }
222
- .crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
223
- .crumbs li:last-child a { color: var(--link); font-weight: 500; }
224
- .title { margin: var(--space-4) 0 var(--space-3); max-width: 26ch; font-weight: 600; font-size: clamp(1.875rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; }
225
- .meta { margin: 0 0 var(--space-6); font-size: 15px; color: var(--ink-muted); }
226
- .draft { color: var(--error); }
227
167
  /* Header, cover and text share the page's left edge; the cover spans text and rail. */
228
168
  .cover { margin: 0 0 var(--space-7); }
229
169
  .cover :global(img) { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-panel); background: var(--surface); }
230
-
231
- .grid { display: grid; grid-template-columns: minmax(0, 680px) 240px; justify-content: space-between; gap: var(--space-9); }
232
- .col { min-width: 0; }
233
-
234
170
  /* Key takeaways: a light list between two rules, no box. */
235
171
  .takeaways { margin: 0 0 var(--space-6); padding: var(--space-5) 0; border-block: 1px solid var(--line); }
236
172
  .takeaways h2 { margin: 0 0 var(--space-3); font-size: 1rem; line-height: 1.3; }
237
173
  .takeaways ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--space-2); }
238
174
  .takeaways li { font-size: 1.0625rem; line-height: 1.6; padding-left: 0.2em; }
239
175
  .takeaways li::marker { color: var(--mark); font-size: 1.1em; }
240
-
241
- /* Contents on the right, sticky, current section in ink. */
242
- .rail { position: relative; }
243
- .toc { position: sticky; top: 104px; max-height: calc(100vh - 128px); overflow-y: auto; }
244
- .toc h2, .toc-inline summary { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 var(--space-3); }
245
- .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
246
- .toc a { display: block; margin-left: -1px; padding: 7px 0 7px var(--space-4); border-left: 2px solid transparent; color: var(--ink-muted); font-size: 14px; line-height: 1.45; text-decoration: none; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
247
- .toc a:hover { color: var(--ink); }
248
- .toc a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--mark); }
249
-
250
- /* Tablet and phone: no rail; contents fold into a list under the takeaways. */
251
- .toc-inline { display: none; margin: 0 0 var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
252
- .toc-inline summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin: 0; padding: 0 var(--space-4); cursor: pointer; list-style: none; }
253
- .toc-inline summary::-webkit-details-marker { display: none; }
254
- .toc-inline summary :global(svg) { transition: transform var(--fast) var(--ease); }
255
- .toc-inline[open] summary :global(svg) { transform: rotate(180deg); }
256
- .toc-inline ol { list-style: none; margin: 0; padding: 0 var(--space-4) var(--space-2); }
257
- .toc-inline li + li { border-top: 1px solid var(--line); }
258
- .toc-inline a { display: flex; align-items: center; min-height: 44px; padding-block: var(--space-2); color: var(--ink); font-size: 15px; line-height: 1.4; text-decoration: none; }
259
- .toc-inline a:hover { color: var(--link); }
260
-
261
176
  .credits { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--ink-muted); }
262
177
  .credits h2 { font-size: 15px; margin: 0 0 var(--space-2); color: var(--ink); }
263
178
  .credits ul { margin: 0; padding-left: var(--space-5); }
@@ -273,13 +188,7 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
273
188
  .next a:hover span { color: var(--link); }
274
189
  .next time { font-size: 14px; color: var(--ink-muted); }
275
190
 
276
- @media (max-width: 1099px) {
277
- .grid { grid-template-columns: minmax(0, 680px); gap: 0; }
278
- .rail { display: none; }
279
- .toc-inline { display: block; }
280
- }
281
191
  @media (max-width: 599px) {
282
- .post { padding-top: var(--space-4); }
283
192
  .cover { margin: 0 calc(-1 * var(--gutter)) var(--space-6); }
284
193
  .cover :global(img) { border-radius: 0; aspect-ratio: 3 / 2; }
285
194
  }
@@ -1,19 +1,31 @@
1
1
  ---
2
+ // One glossary term, laid out like a blog post: breadcrumbs, title, meta line,
3
+ // the quotable definition, the article with a contents rail, related terms as
4
+ // cards, previous and next term, and the guides that cover it.
5
+ import ChevronDown from '@lucide/astro/icons/chevron-down';
6
+ import ArrowLeft from '@lucide/astro/icons/arrow-left';
7
+ import ArrowRight from '@lucide/astro/icons/arrow-right';
2
8
  import Base from '@site/layouts/Base.astro';
3
9
  import Related from '../../components/site/Related.astro';
4
10
  import CtaBand from '../../components/site/CtaBand.astro';
5
- import ArrowLeft from '@lucide/astro/icons/arrow-left';
11
+ import Story from '../../components/blog/Story.astro';
6
12
  import { glossary, termBySlug, type Term } from '../../lib/glossary';
7
13
  import { productLink, productTags } from '@site/data/links';
8
14
  import { posts } from '../../lib/posts';
15
+ import { SITE_URL } from '../../config';
9
16
  import hiddenPosts from 'virtual:site-kit/hidden-posts';
10
17
  import { breadcrumbJsonLd, definedTermJsonLd, faqJsonLd, termArticleJsonLd } from '../../lib/seo';
18
+ import '../../styles/article.css';
19
+ import '../../styles/article-layout.css';
11
20
 
12
21
  export function getStaticPaths() {
13
- return glossary.map((t) => ({ params: { slug: t.slug }, props: { t } }));
22
+ const sorted = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
23
+ return sorted.map((t, i) => ({ params: { slug: t.slug }, props: { t, prev: sorted[i - 1] ?? null, next: sorted[i + 1] ?? null } }));
14
24
  }
15
- const { t } = Astro.props as { t: Term };
25
+ const { t, prev, next } = Astro.props as { t: Term; prev: Term | null; next: Term | null };
16
26
  const path = `/glossary/${t.slug}`;
27
+ const letter = /^[A-Za-z]/.test(t.term) ? t.term[0].toUpperCase() : '#';
28
+ const letterId = `letter-${letter === '#' ? 'num' : letter.toLowerCase()}`;
17
29
  const heading = t.full ? `What is ${t.term} (${t.full})?` : `What is ${/^[A-Z]{2,}/.test(t.term) ? t.term : `a ${t.term.toLowerCase()}`}?`;
18
30
  const related = t.related.map(termBySlug).filter((x): x is Term => !!x);
19
31
  const product = t.product ? productLink(t.product) : null;
@@ -27,11 +39,15 @@ const description = t.description ?? (t.short.length <= 160 ? t.short : `${t.sho
27
39
  const strip = (x: string) => x.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
28
40
  const words = [t.short, ...t.body, ...sections.flatMap((x) => [x.h, ...x.p, ...(x.list ?? [])]), ...(t.faq ?? []).flatMap((f) => [f.q, f.a])]
29
41
  .map(strip).join(' ').split(/\s+/).length;
42
+ const minutes = Math.max(1, Math.round(words / 220));
43
+ const fmt = (d: string) => new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });
30
44
  // Copy is ours; escape it, then turn [text](/path) into internal links.
31
45
  const esc = (x: string) => x.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
32
46
  // A link to a glossary term that is not live yet, or to a post that is not built, renders as plain text.
33
47
  const md = (x: string) => esc(x).replace(/\[([^\]]+)\]\((\/[^)\s]*)\)/g, (_, text, href) =>
34
48
  (href.startsWith('/glossary/') && !termBySlug(href.slice(10).split('#')[0])) || (href.startsWith('/blog/') && hiddenPosts.includes(href.slice(6).split(/[#?]/)[0].replace(/\/$/, ''))) ? text : `<a href="${href}">${text}</a>`);
49
+ const toc = [...sections.map((x) => ({ id: x.id, h: x.h })), ...(t.faq?.length ? [{ id: 'faq', h: 'Questions people ask' }] : [])];
50
+ const hasToc = toc.length >= 3;
35
51
  ---
36
52
  <Base
37
53
  title={title}
@@ -41,86 +57,123 @@ const md = (x: string) => esc(x).replace(/\[([^\]]+)\]\((\/[^)\s]*)\)/g, (_, tex
41
57
  definedTermJsonLd(t),
42
58
  ...(sections.length && t.updated ? [termArticleJsonLd({ slug: t.slug, term: t.term, title, description, published: t.published ?? t.updated, updated: t.updated, sections, words })] : []),
43
59
  faqJsonLd(faq.map((f) => ({ q: f.q, a: strip(f.a) }))),
44
- breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }, { name: t.term, path }]),
60
+ breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }, { name: letter, path: '/glossary', url: `${SITE_URL}/glossary#${letterId}` }, { name: t.term, path }]),
45
61
  ]}
46
62
  >
47
- <article class="term">
48
- <div class="wrap">
63
+ <div class="read-progress" aria-hidden="true"><i></i></div>
64
+ <article class="post">
65
+ <header class="wrap head">
66
+ <nav class="crumbs" aria-label="Breadcrumb" data-enter>
67
+ <ol>
68
+ <li><a href="/glossary">Glossary</a></li>
69
+ <li><a href={`/glossary#${letterId}`}>{letter}</a></li>
70
+ </ol>
71
+ </nav>
72
+ <h1 class="title" data-enter>{heading}</h1>
73
+ <p class="meta" data-enter>
74
+ {t.aka?.length ? <>Also called: {t.aka.join(', ')} · </> : null}{minutes} min read{t.updated && <> · Updated <time datetime={t.updated}>{fmt(t.updated)}</time></>}
75
+ </p>
76
+ </header>
77
+ <div class="wrap grid">
49
78
  <div class="col">
50
- <a class="back" href="/glossary" data-enter><ArrowLeft size={18} stroke-width={2} aria-hidden="true" /> Glossary</a>
51
- <h1 data-enter>{heading}</h1>
52
- <p class="def" data-enter><dfn>{t.term}</dfn>{t.short.slice(t.term.length)}</p>
53
- <div class="prose body" data-enter>
54
- {t.body.map((p) => <p set:html={md(p)} />)}
79
+ <div class="def" data-enter>
80
+ <p><dfn>{t.term}</dfn>{t.short.slice(t.term.length)}</p>
81
+ <button type="button" class="copy-def" data-copy={t.short}>Copy definition</button>
55
82
  </div>
56
- {sections.length > 0 && (
57
- <nav class="toc" aria-label="On this page" data-enter>
58
- <span class="see-h">On this page</span>
59
- <ol>{sections.map((x) => <li><a href={`#${x.id}`}>{x.h}</a></li>)}</ol>
60
- </nav>
61
- )}
62
- {sections.map((x) => (
63
- <section class="prose body sec" id={x.id}>
64
- <h2>{x.h}</h2>
65
- {x.p.map((p) => <p set:html={md(p)} />)}
66
- {x.list && <ul>{x.list.map((li) => <li set:html={md(li)} />)}</ul>}
67
- </section>
68
- ))}
69
- {t.faq && t.faq.length > 0 && (
70
- <section class="prose body sec" id="faq">
71
- <h2>Questions people ask about {/^[A-Z]{2,}/.test(t.term) ? t.term : t.term.toLowerCase()}s</h2>
72
- {t.faq.map((f) => (
73
- <>
74
- <h3>{f.q}</h3>
75
- <p set:html={md(f.a)} />
76
- </>
77
- ))}
78
- </section>
83
+ {hasToc && (
84
+ <details class="toc-inline no-print" data-enter>
85
+ <summary>On this page<ChevronDown size={18} stroke-width={2} aria-hidden="true" /></summary>
86
+ <ol>{toc.map((x) => <li><a href={`#${x.id}`}>{x.h}</a></li>)}</ol>
87
+ </details>
79
88
  )}
80
- {t.updated && <p class="upd">Updated <time datetime={t.updated}>{new Date(t.updated).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}</time></p>}
89
+ <div class="prose body article-body" data-enter>
90
+ {t.body.map((p) => <p set:html={md(p)} />)}
91
+ {sections.map((x) => (
92
+ <section id={x.id}>
93
+ <h2 id={`${x.id}-h`}>{x.h}</h2>
94
+ {x.p.map((p) => <p set:html={md(p)} />)}
95
+ {x.list && <ul>{x.list.map((li) => <li set:html={md(li)} />)}</ul>}
96
+ </section>
97
+ ))}
98
+ {t.faq && t.faq.length > 0 && (
99
+ <section class="post-faq" id="faq" aria-labelledby="faq-h">
100
+ <h2 id="faq-h">Questions people ask about {/^[A-Z]{2,}/.test(t.term) ? t.term : t.term.toLowerCase()}s</h2>
101
+ {t.faq.map((f, i) => <details open={i === 0}><summary>{f.q}</summary><p set:html={md(f.a)} /></details>)}
102
+ </section>
103
+ )}
104
+ </div>
105
+
81
106
  {related.length > 0 && (
82
- <nav class="see" aria-label="Related terms" data-enter>
83
- <span class="see-h">Related terms</span>
84
- <ul>{related.map((r) => <li><a href={`/glossary/${r.slug}`}>{r.term}</a></li>)}</ul>
85
- </nav>
107
+ <section class="related-terms" aria-labelledby="rt-h">
108
+ <h2 id="rt-h">Related terms</h2>
109
+ <ul>
110
+ {related.map((r) => (
111
+ <li><a class="card" href={`/glossary/${r.slug}`}><span class="name">{r.term}</span><span class="short">{r.short}</span></a></li>
112
+ ))}
113
+ </ul>
114
+ </section>
86
115
  )}
116
+
117
+ <nav class="pn no-print" aria-label="Previous and next term">
118
+ {prev ? <a class="prev" href={`/glossary/${prev.slug}`} rel="prev"><ArrowLeft size={18} stroke-width={2} aria-hidden="true" /><span><small>Previous</small>{prev.term}</span></a> : <span></span>}
119
+ {next ? <a class="next" href={`/glossary/${next.slug}`} rel="next"><span><small>Next</small>{next.term}</span><ArrowRight size={18} stroke-width={2} aria-hidden="true" /></a> : <span></span>}
120
+ </nav>
87
121
  </div>
122
+ {hasToc && (
123
+ <aside class="rail no-print" aria-labelledby="rail-h">
124
+ <nav class="toc" aria-labelledby="rail-h">
125
+ <h2 id="rail-h">On this page</h2>
126
+ <ol>{toc.map((x) => <li><a href={`#${x.id}`} data-toc={`${x.id}-h`}>{x.h}</a></li>)}</ol>
127
+ </nav>
128
+ </aside>
129
+ )}
88
130
  </div>
89
131
  </article>
90
132
 
133
+ {guides.length > 0 && (
134
+ <section class="section-tight guides" aria-labelledby="g-h">
135
+ <div class="wrap">
136
+ <h2 id="g-h">Guides on this</h2>
137
+ <div class="cards">{guides.map((p) => <Story post={p} size="grid" />)}</div>
138
+ </div>
139
+ </section>
140
+ )}
141
+
91
142
  <Related groups={[
92
143
  { h: 'Where this matters', items: product ? [product] : [] },
93
- { h: 'Guides', items: guides.map((g) => ({ href: `/blog/${g.id}`, label: g.data.title })) },
94
144
  { h: 'More terms', items: glossary.filter((x) => x.slug !== t.slug && !t.related.includes(x.slug)).slice(0, 4).map((x) => ({ href: `/glossary/${x.slug}`, label: x.term })) },
95
145
  ]} />
96
146
  <CtaBand />
97
147
  </Base>
98
148
 
149
+ <script>
150
+ import { initArticle } from '../../lib/article-client';
151
+ initArticle();
152
+ </script>
153
+
99
154
  <style>
100
- .term { padding-block: var(--space-8) var(--space-9); }
101
- .col { max-width: 720px; }
102
- .back { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--ink-muted); text-decoration: none; font-size: 16px; }
103
- .back:hover { color: var(--ink); }
104
- h1 { margin: var(--space-5) 0 var(--space-5); font-family: var(--font-serif); font-weight: 600; font-size: clamp(2rem, 1.5rem + 2vw, 3rem); line-height: 1.12; }
105
- /* The quotable one-line answer, set apart from the explanation. */
106
- .def { margin: 0 0 var(--space-6); padding: var(--space-5) var(--space-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); font-size: 1.1875rem; line-height: 1.5; }
155
+ .post :global(.title) { max-width: 24ch; font-family: var(--font-serif); }
156
+ .def { margin: 0 0 var(--space-6); padding: var(--space-5) var(--space-6); border-radius: var(--radius-panel); background: var(--surface); }
157
+ .def p { margin: 0 0 var(--space-3); font-size: 1.25rem; line-height: 1.5; }
107
158
  dfn { font-style: normal; font-weight: 600; }
108
- .body { max-width: none; font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.5; }
109
- .body p { margin: 0 0 var(--space-4); }
110
- .toc { margin: var(--space-6) 0; padding: var(--space-5) var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
111
- .toc ol { margin: var(--space-3) 0 0; padding-left: var(--space-5); font-size: 16px; line-height: 1.5; }
112
- .toc li { margin: var(--space-1) 0; }
113
- .toc a { color: var(--link); }
114
- .sec { margin-top: var(--space-7); scroll-margin-top: var(--space-8); }
115
- .sec h2 { margin: 0 0 var(--space-4); font-weight: 600; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.12; }
116
- .sec h3 { margin: var(--space-5) 0 var(--space-2); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
117
- .sec ul { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
118
- .sec li { margin: 0 0 var(--space-2); }
119
- .body a { color: var(--link); }
120
- .upd { margin-top: var(--space-6); font-size: 15px; color: var(--ink-muted); }
121
- .see { margin-top: var(--space-6); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
122
- .see-h { font-size: 15px; font-weight: 600; color: var(--ink-muted); }
123
- .see ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
124
- .see a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); text-decoration: none; font-size: 15px; transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
125
- .see a:hover { border-color: var(--brand); color: var(--link); }
159
+ .copy-def { padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--canvas); color: var(--ink-muted); font: inherit; font-size: 14px; cursor: pointer; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
160
+ .copy-def:hover { color: var(--link); border-color: var(--link); }
161
+
162
+ .related-terms { margin-top: var(--space-7); }
163
+ .related-terms h2, .guides h2 { margin: 0 0 var(--space-4); font-size: 1.375rem; }
164
+ .related-terms ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
165
+ .card { display: grid; gap: var(--space-1); height: 100%; padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); text-decoration: none; transition: border-color var(--fast) var(--ease); }
166
+ .card:hover, .card:focus-visible { border-color: var(--brand); }
167
+ .name { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 600; }
168
+ .short { font-size: 15px; line-height: 1.5; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
169
+
170
+ .pn { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); }
171
+ .pn a { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 48px; color: var(--ink); text-decoration: none; font-weight: 600; }
172
+ .pn a:hover { color: var(--link); }
173
+ .pn small { display: block; font-size: 14px; font-weight: 400; color: var(--ink-muted); }
174
+ .pn .next { margin-left: auto; text-align: right; }
175
+
176
+ .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--space-5); }
177
+ @media (max-width: 959px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
178
+ @media (max-width: 599px) { .related-terms ul, .cards { grid-template-columns: 1fr; } .def { padding: var(--space-4) var(--space-5); } }
126
179
  </style>
@@ -1,11 +1,21 @@
1
1
  ---
2
+ // The glossary front: a search box, optional topic chips, the in-depth guides
3
+ // first, then every term as a card under its letter. A sticky A-Z bar jumps to
4
+ // a letter. Without JavaScript the full list shows.
2
5
  import Base from '@site/layouts/Base.astro';
3
- import ArrowRight from '@lucide/astro/icons/arrow-right';
4
- import { glossary } from '../../lib/glossary';
6
+ import { glossary, type Term } from '../../lib/glossary';
5
7
  import { kit } from '../../config';
6
8
  import { breadcrumbJsonLd, definedTermSetJsonLd } from '../../lib/seo';
7
9
 
8
10
  const terms = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
11
+ const letterOf = (t: Term) => (/^[A-Za-z]/.test(t.term) ? t.term[0].toUpperCase() : '#');
12
+ const groups = new Map<string, Term[]>();
13
+ for (const t of terms) groups.set(letterOf(t), [...(groups.get(letterOf(t)) ?? []), t]);
14
+ const alphabet = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '#'];
15
+ const guides = terms.filter((t) => t.sections?.length);
16
+ const topics = [...new Set(terms.map((t) => t.topic).filter((x): x is string => !!x))].sort();
17
+ const haystack = (t: Term) => [t.term, t.full, ...(t.aka ?? []), t.short].filter(Boolean).join(' ').toLowerCase();
18
+ const id = (l: string) => `letter-${l === '#' ? 'num' : l.toLowerCase()}`;
9
19
  ---
10
20
  <Base
11
21
  title={kit.glossary.indexTitle}
@@ -13,39 +23,142 @@ const terms = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
13
23
  path="/glossary"
14
24
  jsonLd={[definedTermSetJsonLd(terms), breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }])]}
15
25
  >
16
- <section class="section blog-serif">
26
+ <section class="section blog-serif front">
17
27
  <div class="wrap">
18
- <h1 data-enter>Glossary</h1>
19
- <ul class="terms">
20
- {terms.map((t, i) => (
21
- <li data-enter style={`--d:${Math.min(i + 1, 8)}`}>
22
- <a href={`/glossary/${t.slug}`}>
23
- <span class="name">{t.term}{t.full && <span class="full"> · {t.full}</span>}</span>
24
- <span class="short">{t.short}</span>
25
- <ArrowRight class="go" size={18} stroke-width={2} aria-hidden="true" />
26
- </a>
27
- </li>
28
- ))}
29
- </ul>
28
+ <h1 data-enter>{kit.glossary.heading ?? 'Glossary'}</h1>
29
+ <p class="count" data-enter><span data-count>{terms.length}</span> terms</p>
30
+ <div class="tools" data-enter>
31
+ <input class="search" type="search" placeholder="Search terms" aria-label="Search the glossary" autocomplete="off" data-search />
32
+ {topics.length > 0 && (
33
+ <div class="chips" role="group" aria-label="Topics">
34
+ <button type="button" class="chip" aria-pressed="true" data-topic="">All</button>
35
+ {topics.map((tp) => <button type="button" class="chip" aria-pressed="false" data-topic={tp}>{tp}</button>)}
36
+ </div>
37
+ )}
38
+ </div>
39
+
40
+ <nav class="az" aria-label="A to Z">
41
+ {alphabet.map((l) => groups.has(l)
42
+ ? <a href={`#${id(l)}`} data-az={l}>{l}</a>
43
+ : <span aria-hidden="true" data-az={l} class="off">{l}</span>)}
44
+ </nav>
45
+
46
+ {guides.length > 0 && (
47
+ <section class="guides" aria-labelledby="guides-h" data-guides>
48
+ <h2 id="guides-h" class="block-h">In-depth guides</h2>
49
+ <ul class="guide-grid">
50
+ {guides.map((t) => (
51
+ <li data-term data-q={haystack(t)} data-topic={t.topic ?? ''}>
52
+ <a class="card big" href={`/glossary/${t.slug}`}>
53
+ <span class="name">{t.term}</span>
54
+ {t.full && <span class="full">{t.full}</span>}
55
+ <span class="short">{t.short}</span>
56
+ </a>
57
+ </li>
58
+ ))}
59
+ </ul>
60
+ </section>
61
+ )}
62
+
63
+ {[...groups.entries()].map(([l, items]) => (
64
+ <section class="letter" id={id(l)} data-letter={l} aria-labelledby={`${id(l)}-h`}>
65
+ <h2 class="big-letter" id={`${id(l)}-h`}>{l}</h2>
66
+ <ul class="grid">
67
+ {items.map((t) => (
68
+ <li data-term data-q={haystack(t)} data-topic={t.topic ?? ''}>
69
+ <a class="card" href={`/glossary/${t.slug}`}>
70
+ <span class="name">{t.term}</span>
71
+ {t.full && <span class="full">{t.full}</span>}
72
+ <span class="short">{t.short}</span>
73
+ </a>
74
+ </li>
75
+ ))}
76
+ </ul>
77
+ </section>
78
+ ))}
79
+ <p class="none" hidden data-none>No terms match your search.</p>
30
80
  </div>
31
81
  </section>
32
82
  </Base>
33
83
 
84
+ <script>
85
+ const input = document.querySelector<HTMLInputElement>('[data-search]')!;
86
+ const count = document.querySelector<HTMLElement>('[data-count]')!;
87
+ const total = document.querySelectorAll('.letter [data-term]').length;
88
+ const items = [...document.querySelectorAll<HTMLElement>('[data-term]')];
89
+ const letters = [...document.querySelectorAll<HTMLElement>('.letter')];
90
+ const none = document.querySelector<HTMLElement>('[data-none]')!;
91
+ const guides = document.querySelector<HTMLElement>('[data-guides]');
92
+ const chips = [...document.querySelectorAll<HTMLButtonElement>('[data-topic][aria-pressed]')];
93
+ let topic = '';
94
+ const apply = () => {
95
+ const q = input.value.trim().toLowerCase();
96
+ items.forEach((li) => { li.hidden = !((!q || li.dataset.q!.includes(q)) && (!topic || li.dataset.topic === topic)); });
97
+ letters.forEach((s) => { s.hidden = ![...s.querySelectorAll('[data-term]')].some((li) => !(li as HTMLElement).hidden); });
98
+ if (guides) guides.hidden = ![...guides.querySelectorAll('[data-term]')].some((li) => !(li as HTMLElement).hidden);
99
+ const shown = document.querySelectorAll('.letter [data-term]:not([hidden])').length;
100
+ count.textContent = q || topic ? `${shown} of ${total}` : String(total);
101
+ none.hidden = shown > 0;
102
+ document.querySelectorAll<HTMLElement>('[data-az]').forEach((a) => {
103
+ const has = letters.some((s) => s.dataset.letter === a.dataset.az && !s.hidden);
104
+ a.classList.toggle('off', !has);
105
+ if (a instanceof HTMLAnchorElement) a.toggleAttribute('aria-disabled', !has);
106
+ });
107
+ };
108
+ input.addEventListener('input', apply);
109
+ chips.forEach((c) => c.addEventListener('click', () => {
110
+ topic = c.dataset.topic ?? '';
111
+ chips.forEach((o) => o.setAttribute('aria-pressed', String(o === c)));
112
+ apply();
113
+ }));
114
+ // The letter whose section is in view stays marked in the A-Z bar.
115
+ const azLinks = new Map([...document.querySelectorAll<HTMLAnchorElement>('a[data-az]')].map((a) => [a.dataset.az!, a]));
116
+ const seen = new Set<string>();
117
+ const io = new IntersectionObserver((entries) => {
118
+ entries.forEach((e) => { const l = (e.target as HTMLElement).dataset.letter!; if (e.isIntersecting) seen.add(l); else seen.delete(l); });
119
+ const first = letters.map((s) => s.dataset.letter!).find((l) => seen.has(l));
120
+ azLinks.forEach((a, l) => a.toggleAttribute('aria-current', l === first));
121
+ }, { rootMargin: '-140px 0px -60% 0px' });
122
+ letters.forEach((s) => io.observe(s));
123
+ </script>
124
+
34
125
  <style>
35
- h1 { margin-bottom: var(--space-7); }
36
- .terms { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
37
- .terms a {
38
- display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) auto; gap: var(--space-6); align-items: baseline;
39
- padding: var(--space-5) 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
40
- }
41
- .name { font-family: var(--font-serif); font-size: 1.375rem; font-weight: 600; transition: color var(--fast) var(--ease); }
42
- .full { display: block; font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--ink-muted); margin-top: 2px; }
43
- .short { font-size: 16px; line-height: 1.5; color: var(--ink-muted); }
44
- .terms :global(.go) { color: var(--ink-muted); transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
45
- .terms a:hover .name { color: var(--link); }
46
- .terms a:hover :global(.go) { transform: translateX(4px); color: var(--link); }
47
- @media (max-width: 767px) {
48
- .terms a { grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); }
49
- .short { grid-column: 1 / -1; grid-row: 2; }
50
- }
126
+ .front { padding-block: var(--space-7) var(--space-9); }
127
+ h1 { margin: 0 0 var(--space-2); font-size: clamp(2rem, 1.5rem + 2vw, 3rem); }
128
+ .count { margin: 0 0 var(--space-5); color: var(--ink-muted); }
129
+ .tools { display: grid; gap: var(--space-3); margin-bottom: var(--space-5); }
130
+ .search { width: 100%; max-width: 520px; min-height: 48px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--canvas); color: var(--ink); font: inherit; font-size: 16px; }
131
+ .search:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
132
+ .chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
133
+ .chip { min-height: 36px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: transparent; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease); }
134
+ .chip:hover { border-color: var(--brand); }
135
+ .chip[aria-pressed='true'] { background: var(--subtle); border-color: var(--brand); font-weight: 600; }
136
+
137
+ .az { position: sticky; top: 72px; z-index: 5; display: flex; flex-wrap: wrap; gap: 2px; margin: 0 calc(-1 * var(--gutter)) var(--space-6); padding: var(--space-2) var(--gutter); background: var(--canvas); border-bottom: 1px solid var(--line); }
138
+ .az a, .az span { display: inline-grid; place-items: center; min-width: 32px; height: 36px; border-radius: var(--radius-control); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 15px; text-decoration: none; }
139
+ .az a:hover { background: var(--subtle); }
140
+ .az a[aria-current] { background: var(--ink); color: var(--canvas); }
141
+ .az .off { color: var(--ink-muted); opacity: 0.45; pointer-events: none; }
142
+
143
+ .block-h { margin: 0 0 var(--space-4); font-size: 1.375rem; }
144
+ .guides { margin-bottom: var(--space-8); scroll-margin-top: 140px; }
145
+ .guide-grid, .grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
146
+ .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
147
+ .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
148
+ .letter { margin-bottom: var(--space-7); scroll-margin-top: 140px; }
149
+ .big-letter { margin: 0 0 var(--space-4); font-size: 2.5rem; line-height: 1; }
150
+ [hidden] { display: none !important; }
151
+
152
+ .card { display: grid; align-content: start; gap: var(--space-1); height: 100%; padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); text-decoration: none; transition: border-color var(--fast) var(--ease); }
153
+ .card:hover, .card:focus-visible { border-color: var(--brand); }
154
+ .card.big { padding: var(--space-5); }
155
+ .name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
156
+ .card.big .name { font-size: 1.5rem; }
157
+ .full { font-size: 14px; color: var(--ink-muted); }
158
+ .short { margin-top: var(--space-1); font-size: 15px; line-height: 1.5; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
159
+ .card.big .short { -webkit-line-clamp: 3; }
160
+ .none { color: var(--ink-muted); }
161
+
162
+ @media (max-width: 959px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
163
+ @media (max-width: 599px) { .grid, .guide-grid { grid-template-columns: 1fr; } .az { top: 64px; } }
51
164
  </style>
@@ -0,0 +1,48 @@
1
+ /* Reading layout shared by the blog post and the glossary term page: breadcrumbs,
2
+ title and meta line, one text column (about 68 characters a line) and, on wide
3
+ screens, a sticky "On this page" rail. Phones get the same order with a
4
+ tap-to-open contents list. */
5
+ .post { padding-block: var(--space-6) var(--space-9); }
6
+ /* Breadcrumb trail: section and topic, the title follows as the heading. */
7
+ .post .crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); list-style: none; margin: 0; padding: 0; font-size: 14px; }
8
+ .post .crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
9
+ .post .crumbs li + li::before { content: '›'; color: var(--ink-muted); }
10
+ .post .crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-muted); text-decoration: none; }
11
+ .post .crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
12
+ .post .crumbs li:last-child a { color: var(--link); font-weight: 500; }
13
+ .post .title { margin: var(--space-4) 0 var(--space-3); max-width: 26ch; font-weight: 600; font-size: clamp(1.875rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; }
14
+ .post .meta { margin: 0 0 var(--space-6); font-size: 15px; color: var(--ink-muted); }
15
+ .post .draft { color: var(--error); }
16
+
17
+ .post .grid { display: grid; grid-template-columns: minmax(0, 680px) 240px; justify-content: space-between; gap: var(--space-9); }
18
+ .post .col { min-width: 0; }
19
+
20
+
21
+ /* Contents on the right, sticky, current section in ink. */
22
+ .post .rail { position: relative; }
23
+ .post .toc { position: sticky; top: 104px; max-height: calc(100vh - 128px); overflow-y: auto; }
24
+ .post .toc h2, .post .toc-inline summary { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 var(--space-3); }
25
+ .post .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
26
+ .post .toc a { display: block; margin-left: -1px; padding: 7px 0 7px var(--space-4); border-left: 2px solid transparent; color: var(--ink-muted); font-size: 14px; line-height: 1.45; text-decoration: none; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
27
+ .post .toc a:hover { color: var(--ink); }
28
+ .post .toc a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--mark); }
29
+
30
+ /* Tablet and phone: no rail; contents fold into a list under the takeaways. */
31
+ .post .toc-inline { display: none; margin: 0 0 var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
32
+ .post .toc-inline summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin: 0; padding: 0 var(--space-4); cursor: pointer; list-style: none; }
33
+ .post .toc-inline summary::-webkit-details-marker { display: none; }
34
+ .post .toc-inline summary svg { transition: transform var(--fast) var(--ease); }
35
+ .post .toc-inline[open] summary svg { transform: rotate(180deg); }
36
+ .post .toc-inline ol { list-style: none; margin: 0; padding: 0 var(--space-4) var(--space-2); }
37
+ .post .toc-inline li + li { border-top: 1px solid var(--line); }
38
+ .post .toc-inline a { display: flex; align-items: center; min-height: 44px; padding-block: var(--space-2); color: var(--ink); font-size: 15px; line-height: 1.4; text-decoration: none; }
39
+ .post .toc-inline a:hover { color: var(--link); }
40
+
41
+ @media (max-width: 1099px) {
42
+ .post .grid { grid-template-columns: minmax(0, 680px); gap: 0; }
43
+ .post .rail { display: none; }
44
+ .post .toc-inline { display: block; }
45
+ }
46
+ @media (max-width: 599px) {
47
+ .post { padding-top: var(--space-4); }
48
+ }