|
1 | | -/* The OpenCode nav menus (index.ts): the logo menu and the product menu, one card style, as opencode.ai's logo menu |
2 | | - (cards, blue hover). No panel; each item is a card on the see-through pop-up surface, its thumbnail, a divider, then |
3 | | - its label. The menus sit in the page's body (or the top layer), so only these rules style them. A host recolours |
4 | | - them by setting these on an ancestor of its triggers (the menu copies them when it opens): |
| 1 | +/* The OpenCode nav logo menu (index.ts) and shared header lockup: cards with blue hover, as on opencode.ai. |
| 2 | + No panel; each item is a card on the see-through pop-up surface, its thumbnail, a divider, then its label. The menu |
| 3 | + sits in the page's body (or the top layer), so only these rules style it. A host recolours it by setting these on an |
| 4 | + ancestor of its triggers (the menu copies them when it opens): |
5 | 5 | --nav-menu-ink strong text |
6 | 6 | --nav-menu-weak the labels' resting grey |
7 | 7 | --nav-menu-popover the pop-up surface |
8 | 8 | --nav-menu-link the link blue: hover and focus |
9 | | - --nav-menu-bar the current product's bar |
| 9 | + --nav-menu-bar the active bar |
10 | 10 | --nav-menu-icon the Brand, ZIP and Press drawings |
11 | 11 | --nav-menu-mono OpenTUI Mono (the host loads it) */ |
12 | 12 | [data-nav-menu] { |
|
49 | 49 | letter-spacing: 0; |
50 | 50 | text-align: start; |
51 | 51 | -webkit-font-smoothing: antialiased; |
52 | | - /* The whole box, its padding and the gaps between cards included, is the menu: the pointer can rest or cross |
53 | | - anywhere in it without the menu closing (index.ts closes a hover-opened menu only once the pointer has left it and |
54 | | - its trigger for 200ms). */ |
55 | 52 |
|
56 | 53 | &[data-scroll] { |
57 | 54 | overflow-y: auto; |
|
65 | 62 | pointer-events: none; |
66 | 63 | } |
67 | 64 |
|
68 | | - /* The 1px between the name and the menu's padding counts as the menu too, so the pointer crosses it while the menu |
69 | | - is open on hover; it stops short of the name, which stays clickable. */ |
70 | | - &[data-nav-menu="product"]::before { |
71 | | - content: ""; |
72 | | - position: absolute; |
73 | | - bottom: 100%; |
74 | | - inset-inline: 0; |
75 | | - height: 1px; |
76 | | - } |
77 | | - |
78 | 65 | [role="menuitem"] { |
79 | 66 | position: relative; |
80 | 67 | display: flex; |
|
130 | 117 | &:active { |
131 | 118 | scale: 0.98; |
132 | 119 | } |
133 | | - |
134 | | - /* The current product: its label at full strength, where the others rest muted. */ |
135 | | - &[aria-current="page"] { |
136 | | - color: var(--ink); |
137 | | - } |
138 | 120 | } |
139 | 121 |
|
140 | 122 | /* The thumbnail: 38 × 28; its inline-end edge is the divider. */ |
|
192 | 174 | box-shadow: 0 0 0 1px var(--link); |
193 | 175 | } |
194 | 176 |
|
195 | | - /* The product cards: the label alone, in capitals like the names beside the logo (the accessible names keep their |
196 | | - case), 12px in from both edges, so each card is as wide as its label. The current product's label is at full |
197 | | - strength, with the site's active bar on the card's leading edge, the link blue while hovered, focused or pressed. */ |
198 | | - &[data-nav-menu="product"] { |
199 | | - [role="menuitem"] { |
200 | | - padding-inline: 12px; |
201 | | - } |
202 | | - |
203 | | - [data-slot="label"] { |
204 | | - letter-spacing: 0; |
205 | | - text-transform: uppercase; |
206 | | - } |
207 | | - |
208 | | - [role="menuitem"][aria-current="page"]::before { |
209 | | - content: ""; |
210 | | - position: absolute; |
211 | | - top: 0; |
212 | | - bottom: 0; |
213 | | - inset-inline-start: -1px; |
214 | | - z-index: 1; |
215 | | - width: 2px; |
216 | | - background: var(--bar); |
217 | | - } |
218 | | - } |
219 | | - |
220 | 177 | [data-slot="meta"] { |
221 | 178 | color: var(--weak); |
222 | 179 | } |
|
233 | 190 | } |
234 | 191 | } |
235 | 192 |
|
236 | | -/* The product menu's chevron after the name, for touch screens (no hover), the same as the docs' split chevron after |
237 | | - DOCS (services/site docs-lockup.css reads these tokens too): --nav-chevron-width wide and --nav-chevron-gap after the |
238 | | - name's highlight, a --nav-chevron-glyph chevron that flips at once while the menu is open, a 44px tall target that |
239 | | - reaches --nav-chevron-reach further into the empty bar, the name fill on hover and the mark's inner grey pressed or |
240 | | - open. Hidden where a pointer can hover, where the name opens the menu. */ |
241 | | -[data-nav-product-toggle] { |
242 | | - all: unset; |
243 | | - position: relative; |
244 | | - display: none; |
245 | | - flex-shrink: 0; |
246 | | - align-items: center; |
247 | | - justify-content: center; |
248 | | - box-sizing: border-box; |
249 | | - width: var(--nav-chevron-width); |
250 | | - height: 100%; |
251 | | - min-height: 25px; |
252 | | - margin-inline-start: var(--nav-chevron-gap); |
253 | | - color: var(--nav-chevron-ink); |
254 | | - cursor: pointer; |
255 | | - -webkit-tap-highlight-color: transparent; |
256 | | - transition: |
257 | | - background-color 120ms ease, |
258 | | - color 120ms ease; |
259 | | - |
260 | | - &::before { |
261 | | - content: ""; |
262 | | - position: absolute; |
263 | | - inset-block: calc(50% - 22px); |
264 | | - inset-inline: 0 calc(-1 * var(--nav-chevron-reach)); |
265 | | - } |
266 | | - |
267 | | - svg { |
268 | | - display: block; |
269 | | - width: var(--nav-chevron-glyph); |
270 | | - height: var(--nav-chevron-glyph); |
271 | | - } |
272 | | - |
273 | | - @media (hover: hover) and (pointer: fine) { |
274 | | - &:hover { |
275 | | - background: var(--nav-chevron-hover); |
276 | | - color: var(--nav-menu-ink, var(--nav-chevron-ink)); |
277 | | - } |
278 | | - } |
279 | | - |
280 | | - &:active, |
281 | | - &[aria-expanded="true"] { |
282 | | - background: var(--nav-chevron-press); |
283 | | - color: var(--nav-menu-ink, var(--nav-chevron-ink)); |
284 | | - } |
285 | | - |
286 | | - &[aria-expanded="true"] svg { |
287 | | - scale: 1 -1; |
288 | | - } |
289 | | - |
290 | | - &:focus-visible { |
291 | | - outline: 2px solid var(--nav-menu-link, light-dark(#3b5cf6, #6b8fff)); |
292 | | - outline-offset: 2px; |
293 | | - } |
294 | | - |
295 | | - @media (hover: none), (pointer: coarse) { |
296 | | - display: inline-flex; |
297 | | - } |
298 | | -} |
299 | | - |
300 | 193 | /* The OpenCode bar's metrics, opencode.ai's (site.css: the logo 25px from the top and the start edge, in the box of |
301 | 194 | "[1]" at 15px; the 56px phone top bar with its 24 × 30 logo box), so a product's bar puts everything where |
302 | 195 | opencode.ai does and moving between them never jumps: |
|
309 | 202 | --nav-edge: 24px; |
310 | 203 | --nav-end: 17.5px; |
311 | 204 | --nav-rule: light-dark(hsl(0 0% 88%), hsl(0 0% 18%)); |
312 | | - /* The product name's one fill (hover, open and pressed), opencode.ai's lockup hover: the hover step of the shared |
313 | | - grey scale. Fixed, so it is the same on every page background. */ |
| 205 | + /* The product name's hover fill, opencode.ai's lockup hover: the hover step of the shared grey scale. Fixed, so it |
| 206 | + is the same on every page background. */ |
314 | 207 | --nav-name-hover: light-dark(#eeeeee, #242424); |
315 | | - /* The chevron after a product name (and the docs' after DOCS): its box, the gap after the name's highlight, the glyph, |
316 | | - how far its touch target reaches past it, and its colours. */ |
317 | | - --nav-chevron-width: 20px; |
318 | | - --nav-chevron-gap: 2px; |
319 | | - --nav-chevron-glyph: 10px; |
320 | | - --nav-chevron-reach: 24px; |
321 | | - --nav-chevron-ink: light-dark(#161616, #fafafa); |
322 | | - --nav-chevron-hover: var(--nav-name-hover); |
323 | | - --nav-chevron-press: light-dark(#d2d2d2, #4b4b4b); |
324 | 208 | /* The product name after the mark (and the docs' DOCS): its size, and the padding under it that puts OpenTUI Mono's |
325 | 209 | caps (0.69 of the size) where they belong in the 25px row. */ |
326 | 210 | --nav-name-size: 15px; |
327 | 211 | --nav-name-pad: 0.65px; |
328 | 212 |
|
329 | | - /* Phones: the docs sticky rows' 16px chevron, in an 18px box close to the name, its target reaching 26px past it so |
330 | | - it stays 44px wide. The name grows to 20px, its caps centred in the 25px row (5.5px above and below), within half |
331 | | - a pixel of the mark's inner rectangle. */ |
| 213 | + /* Phones: the name grows to 20px, its caps centred in the 25px row (5.5px above and below), within half a pixel of |
| 214 | + the mark's inner rectangle. */ |
332 | 215 | @media (max-width: 60rem) { |
333 | | - --nav-chevron-width: 18px; |
334 | | - --nav-chevron-glyph: 16px; |
335 | | - --nav-chevron-reach: 26px; |
336 | 216 | --nav-name-size: 20px; |
337 | 217 | --nav-name-pad: 1px; |
338 | 218 | } |
|
348 | 228 | } |
349 | 229 |
|
350 | 230 | /* The lockup: the logo (`data-nav-logo`, a 20 × 25 mark at whole pixels in its box, as on opencode.ai), then the |
351 | | - product's name (`data-nav-product`) 12px after the box: OpenTUI Mono Bold 15px caps whose 6px padding is the |
352 | | - highlight, --nav-name-hover while hovered, pressed or open (hovering opens the product menu, so it never steps darker). |
353 | | - Placed at --nav-edge, centred in the bar. */ |
| 231 | + product's name (`data-nav-name`) 12px after the box: OpenTUI Mono Bold 15px caps whose 6px padding is the |
| 232 | + highlight, --nav-name-hover while hovered or pressed. Placed at --nav-edge, centred in the bar. */ |
354 | 233 | [data-nav-lockup] { |
355 | 234 | --nav-lockup-ink: light-dark(#161616, #fafafa); |
356 | 235 | --nav-logo-inner: light-dark(#d2d2d2, #4b4b4b); |
|
390 | 269 | } |
391 | 270 | } |
392 | 271 |
|
393 | | - /* `data-nav-name` is a name with no product menu (the status page's). */ |
394 | | - :is([data-nav-product], [data-nav-name]):is([data-nav-product], [data-nav-name]) { |
| 272 | + :is([data-nav-name], [data-nav-product]):is([data-nav-name], [data-nav-product]) { |
395 | 273 | position: relative; |
396 | 274 | display: inline-flex; |
397 | 275 | align-items: center; |
|
433 | 311 | } |
434 | 312 | } |
435 | 313 |
|
436 | | - &:active, |
437 | | - &[aria-expanded="true"] { |
| 314 | + &:active { |
438 | 315 | background: var(--nav-name-hover); |
439 | 316 | } |
440 | 317 | } |
441 | 318 |
|
442 | | - :is([data-nav-logo], [data-nav-product], [data-nav-name]):focus-visible { |
| 319 | + :is([data-nav-logo], [data-nav-name], [data-nav-product]):focus-visible { |
443 | 320 | outline: 2px solid var(--nav-menu-link, light-dark(#3b5cf6, #6b8fff)); |
444 | 321 | outline-offset: 2px; |
445 | 322 | } |
446 | | - |
447 | | - [data-nav-product-toggle] { |
448 | | - height: 25px; |
449 | | - margin-top: var(--nav-lockup-inset); |
450 | | - } |
451 | 323 | } |