|
27 | 27 | .dark .toggle-light { display: block; } |
28 | 28 | .dark .toggle-dark { display: none; } |
29 | 29 |
|
| 30 | +/* ── Cards shortcode grid ────────────────────────────────────────────── */ |
| 31 | +/* The module's `{{< cards >}}` shortcode emits |
| 32 | + <div class="hextra-cards hextra-cards-grid" style="--hextra-cols: N;"> |
| 33 | + Hextra's bundled CSS styles `.hextra-cards` (grid-template-columns based |
| 34 | + on `--hextra-cards-grid-cols`) but not `.hextra-cards-grid`, and our |
| 35 | + shortcode uses the different `--hextra-cols` variable name. Without |
| 36 | + these rules the container is just a regular block element and cards |
| 37 | + stack full-width with no gap. |
| 38 | + Mobile-first responsive: 1 col by default, 2 at sm, --hextra-cols (3 |
| 39 | + default) at lg. */ |
| 40 | +.hextra-cards-grid { |
| 41 | + display: grid; |
| 42 | + gap: 1rem; |
| 43 | + margin-top: 1rem; |
| 44 | + grid-template-columns: 1fr; |
| 45 | +} |
| 46 | +@media (min-width: 640px) { |
| 47 | + .hextra-cards-grid { |
| 48 | + grid-template-columns: repeat(2, 1fr); |
| 49 | + } |
| 50 | +} |
| 51 | +@media (min-width: 1024px) { |
| 52 | + .hextra-cards-grid { |
| 53 | + grid-template-columns: repeat(var(--hextra-cols, 3), minmax(0, 1fr)); |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +/* When a card is wrapped by another element — most commonly Goldmark's |
| 58 | + <p> around a card that itself lives inside a percent-form shortcode |
| 59 | + like `{{% version %}}{{< card >}}{{% /version %}}` — the wrapper |
| 60 | + becomes the direct grid child. CSS grid stretches the wrapper to the |
| 61 | + row's height, but the <a> card inside doesn't fill the wrapper. |
| 62 | + Result: a "short" card in an otherwise tall row. |
| 63 | + Force any single-card wrapper to be a transparent flex column so the |
| 64 | + card fills it. Scoped with :has() to single-child wrappers so plain |
| 65 | + text content inside <cards> isn't affected. */ |
| 66 | +.hextra-cards-grid > p:has(> .hextra-card:only-child) { |
| 67 | + display: flex; |
| 68 | + margin: 0; |
| 69 | +} |
| 70 | +.hextra-cards-grid > p:has(> .hextra-card:only-child) > .hextra-card { |
| 71 | + flex: 1; |
| 72 | +} |
| 73 | + |
30 | 74 | /* ── Version banner ──────────────────────────────────────────────────── */ |
31 | 75 | /* Matches old alert-info banner styling */ |
32 | 76 | .version-banner { |
@@ -348,6 +392,18 @@ html.sidebar-loading .hextra-sidebar-container .hextra-scrollbar { |
348 | 392 | visibility: hidden; |
349 | 393 | } |
350 | 394 |
|
| 395 | +/* Same FOUC-prevention pattern for the body when the URL has a #hash. |
| 396 | + Without this, the browser starts painting the top of the page before |
| 397 | + our JS scrolls to the anchor — the user perceives a "load at top, |
| 398 | + then jump" flash. head-end.html adds .hash-loading synchronously in |
| 399 | + <head> (only when window.location.hash is set), then removes it on |
| 400 | + DOMContentLoaded after scrolling to the anchor. A 2s safety timeout |
| 401 | + in the same script also removes the class, so a malformed hash or |
| 402 | + missing target never traps the user in a blank page. */ |
| 403 | +html.hash-loading body { |
| 404 | + visibility: hidden; |
| 405 | +} |
| 406 | + |
351 | 407 | /* Product logo in sidebar */ |
352 | 408 | .sidebar-product-logo { |
353 | 409 | padding: 0.5rem 0 1rem; |
@@ -403,6 +459,18 @@ html.sidebar-loading .hextra-sidebar-container .hextra-scrollbar { |
403 | 459 | max-width: 100%; |
404 | 460 | } |
405 | 461 |
|
| 462 | +/* Skip the white-card wrapper for images that ARE the dark variant. |
| 463 | + reuse-image and reuse-image-dark wrap their dark output in |
| 464 | + `<div class="toggle-light">` (shown only in dark mode). Those images |
| 465 | + are already dark-themed, so the surrounding white card both clashes |
| 466 | + visually and steals space from the SVG viewport (cutting off labels |
| 467 | + like "MARKER_IMAGE_DARK"). */ |
| 468 | +.dark .content .toggle-light img { |
| 469 | + background: transparent; |
| 470 | + padding: 0; |
| 471 | + border-radius: 0; |
| 472 | +} |
| 473 | + |
406 | 474 | /* ── Solo footer ─────────────────────────────────────────────────────── */ |
407 | 475 | .solo-footer { |
408 | 476 | border-top: 1px solid #e5e7eb; |
|
0 commit comments