|
1 | | -// Put your custom SCSS code here |
| 1 | +// Put your custom SCSS code here |
| 2 | + |
| 3 | +// Shrink the top-right navbar icons (social links + color mode toggler) |
| 4 | +#socialMenu .social-link svg, |
| 5 | +#buttonColorMode svg { |
| 6 | + width: 20px; |
| 7 | + height: 20px; |
| 8 | +} |
| 9 | + |
| 10 | +// Skip link: the first focusable thing on the page, hidden until it has focus. |
| 11 | +// |
| 12 | +// Not Bootstrap's `.visually-hidden-focusable`, so this does not depend on that |
| 13 | +// utility surviving purgecss. Clipped rather than `display: none`, because a |
| 14 | +// display-none element cannot receive focus at all. |
| 15 | +.skip-link { |
| 16 | + position: absolute; |
| 17 | + top: 0; |
| 18 | + left: 0; |
| 19 | + z-index: 1080; // above the sticky navbar ($zindex-sticky is 1020) |
| 20 | + padding: 0.625rem 1rem; |
| 21 | + background: $primary; |
| 22 | + color: #fff; |
| 23 | + border-bottom-right-radius: 0.375rem; |
| 24 | + text-decoration: none; |
| 25 | + |
| 26 | + &:not(:focus) { |
| 27 | + // The standard visually-hidden recipe: out of sight, still in the a11y tree. |
| 28 | + width: 1px; |
| 29 | + height: 1px; |
| 30 | + padding: 0; |
| 31 | + overflow: hidden; |
| 32 | + clip-path: inset(50%); |
| 33 | + white-space: nowrap; |
| 34 | + } |
| 35 | + |
| 36 | + &:focus { |
| 37 | + color: #fff; |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +// Keep the footer at the bottom of the viewport on short pages |
| 42 | +// (the homepage does not fill the screen otherwise). |
| 43 | +body { |
| 44 | + display: flex; |
| 45 | + flex-direction: column; |
| 46 | + min-height: 100vh; |
| 47 | +} |
| 48 | + |
| 49 | +// Flex items default to `min-width: auto`, so wide content (code blocks, |
| 50 | +// tables) could stretch the page instead of scrolling inside its own box |
| 51 | +// now that `body` is a flex container. |
| 52 | +body > * { |
| 53 | + min-width: 0; |
| 54 | +} |
| 55 | + |
| 56 | +.footer { |
| 57 | + margin-top: auto; |
| 58 | + |
| 59 | + // Doks sizes footer items at $font-size-base (16px) from `md` up, which is |
| 60 | + // heavy for a copyright line under an 18px body. No media query needed to |
| 61 | + // override it: same specificity, and this file is imported last. |
| 62 | + li { |
| 63 | + font-size: 0.8125rem; |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +// Scale the homepage headline with the viewport rather than wrapping it. |
| 68 | +.home h1.home-title { |
| 69 | + // `clamp()` passes through to CSS; Sass would try to evaluate `min()` |
| 70 | + // itself and fail on the mixed rem/vw units. |
| 71 | + font-size: clamp(1.5rem, 3.4vw, 3rem); |
| 72 | + // Doks pulls the home headline up by 1rem, which eats into the hero padding. |
| 73 | + margin-top: 0; |
| 74 | + margin-bottom: 1.75rem; |
| 75 | +} |
| 76 | + |
| 77 | +// One line, but only where one line fits. Below `sm` the headline would have to |
| 78 | +// drop to ~15px to fit 320px on a single line, so it wraps to two legible lines |
| 79 | +// instead — `nowrap` there ran off the right edge and scrolled the page |
| 80 | +// sideways. |
| 81 | +@include media-breakpoint-up(sm) { |
| 82 | + .home h1.home-title { |
| 83 | + white-space: nowrap; |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +// The one piece of prose on the page. Constrained because a full-width measure |
| 88 | +// under a centred headline reads as a caption rather than a statement. |
| 89 | +.home .lead { |
| 90 | + max-width: 40rem; |
| 91 | + margin-inline: auto; |
| 92 | + opacity: 0.75; |
| 93 | +} |
| 94 | + |
| 95 | +// The headline carries the top of the page alone, so give it room to sit in. |
| 96 | +// The slack comes out of the dead band above the footer, which the short |
| 97 | +// homepage leaves over anyway. |
| 98 | +.home { |
| 99 | + .section.container-fluid { |
| 100 | + // Scaled, not fixed: the headline itself scales with the viewport, and a |
| 101 | + // flat 5.5rem left 88px of air above a 20px headline on a phone. |
| 102 | + padding-top: clamp(2.5rem, 7vw, 5.5rem); |
| 103 | + padding-bottom: clamp(2rem, 5.5vw, 4.5rem); |
| 104 | + } |
| 105 | + |
| 106 | + .section-features { |
| 107 | + padding-top: 0; |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +// Brand mark in the navbar (top left), next to the site title |
| 112 | +.navbar-brand { |
| 113 | + display: inline-flex; |
| 114 | + align-items: center; |
| 115 | + gap: 0.5rem; |
| 116 | + |
| 117 | + &::before { |
| 118 | + content: ""; |
| 119 | + display: inline-block; |
| 120 | + flex: 0 0 auto; |
| 121 | + width: 32px; |
| 122 | + height: 32px; |
| 123 | + background: url("images/logo.png") no-repeat center / contain; |
| 124 | + border-radius: 50%; |
| 125 | + } |
| 126 | +} |
| 127 | + |
| 128 | +// Project cards on the homepage. |
| 129 | +// |
| 130 | +// Flex rather than grid or Bootstrap's row/col: seven cards never fill a row |
| 131 | +// evenly, and flex-wrap centres the short final row instead of leaving a hole |
| 132 | +// on one side. The explicit basis keeps every card the same width, which |
| 133 | +// `flex-grow` would not — the last row would stretch wider than the rows above. |
| 134 | +$feature-gap: 1.25rem; |
| 135 | + |
| 136 | +// Names the grid without shouting: smaller than the headline, uppercase and |
| 137 | +// tracked out so it reads as a label for the section rather than a second title |
| 138 | +// competing with the hero. |
| 139 | +// |
| 140 | +// Deliberately not called `.section-title` — the theme already uses that for the |
| 141 | +// "Related posts" heading on blog and legal pages (doks-core _posts.scss:55), and |
| 142 | +// this would have restyled those into tiny uppercase labels. |
| 143 | +.feature-grid-title { |
| 144 | + margin-top: 0; |
| 145 | + margin-bottom: 1.5rem; |
| 146 | + text-align: center; |
| 147 | + font-size: 0.8125rem; |
| 148 | + font-weight: 600; |
| 149 | + letter-spacing: 0.08em; |
| 150 | + text-transform: uppercase; |
| 151 | + // Not lower: at 13px this is normal-size text for WCAG, so it needs 4.5:1. |
| 152 | + // 0.5 measured 3.01:1 and failed; 0.7 measures 5.4:1. |
| 153 | + opacity: 0.7; |
| 154 | +} |
| 155 | + |
| 156 | +.feature-grid { |
| 157 | + display: flex; |
| 158 | + flex-wrap: wrap; |
| 159 | + justify-content: center; |
| 160 | + gap: $feature-gap; |
| 161 | + // It is a `ul` now, for the item count screen readers announce. Strip the |
| 162 | + // list affordances the browser adds; the cards are the visual affordance. |
| 163 | + padding-left: 0; |
| 164 | + margin-bottom: 0; |
| 165 | + list-style: none; |
| 166 | +} |
| 167 | + |
| 168 | +.feature-card { |
| 169 | + flex: 0 0 100%; |
| 170 | +} |
| 171 | + |
| 172 | +@include media-breakpoint-up(sm) { |
| 173 | + .feature-card { |
| 174 | + // Two per row: subtract the one gap between them. |
| 175 | + flex-basis: calc(50% - #{$feature-gap * 0.5}); |
| 176 | + } |
| 177 | +} |
| 178 | + |
| 179 | +@include media-breakpoint-up(lg) { |
| 180 | + .feature-card { |
| 181 | + // Four per row: three gaps spread across four cards. |
| 182 | + flex-basis: calc(25% - #{$feature-gap * 0.75}); |
| 183 | + } |
| 184 | +} |
| 185 | + |
| 186 | +.feature-card { |
| 187 | + padding: 1.5rem; |
| 188 | + // A warm tint rather than neutral grey: at these low alphas it barely reads |
| 189 | + // as colour, but it stops the cards from looking like grey wireframes. |
| 190 | + background: rgba($primary, 0.02); |
| 191 | + border: 1px solid rgba($primary, 0.14); |
| 192 | + border-radius: 0.75rem; |
| 193 | + transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; |
| 194 | + |
| 195 | + // `h3` rather than `h2`: the grid now sits under its own section heading, so |
| 196 | + // the card titles are one level deeper in the outline. |
| 197 | + h3 { |
| 198 | + // Doks puts a 2rem top margin on every heading, which leaves a gap |
| 199 | + // between the card's top edge and its title. |
| 200 | + margin-top: 0; |
| 201 | + margin-bottom: 0.5rem; |
| 202 | + display: flex; |
| 203 | + align-items: baseline; |
| 204 | + gap: 0.5rem; |
| 205 | + font-size: 1.125rem; |
| 206 | + |
| 207 | + a { |
| 208 | + color: inherit; |
| 209 | + text-decoration: none; |
| 210 | + } |
| 211 | + } |
| 212 | + |
| 213 | + // Decorative, and `aria-hidden` in the markup. `flex: 0 0 auto` stops a |
| 214 | + // wide emoji from being squeezed by a long project name. |
| 215 | + .feature-icon { |
| 216 | + flex: 0 0 auto; |
| 217 | + font-size: 1rem; |
| 218 | + line-height: 1; |
| 219 | + } |
| 220 | + |
| 221 | + p { |
| 222 | + margin-bottom: 0; |
| 223 | + font-size: 1rem; |
| 224 | + opacity: 0.78; |
| 225 | + } |
| 226 | + |
| 227 | + &:hover { |
| 228 | + border-color: rgba($primary, 0.6); |
| 229 | + box-shadow: 0 6px 20px rgba($primary, 0.12); |
| 230 | + transform: translateY(-2px); |
| 231 | + |
| 232 | + h3 a { |
| 233 | + color: $primary; |
| 234 | + } |
| 235 | + } |
| 236 | +} |
| 237 | + |
| 238 | +// The donation call to action. Deliberately unboxed: a panel here competed with |
| 239 | +// the project cards for attention and left a large empty band across the page. |
| 240 | +// A plain centred line separates it from the grid on whitespace alone. |
| 241 | +.feature-cta { |
| 242 | + // Separated by whitespace alone — no rule and no box. The gap is a little |
| 243 | + // wider than the grid's own row gap so the invitation still reads as the end |
| 244 | + // of the page rather than an eighth card that fell out of the row. |
| 245 | + margin-top: 3rem; |
| 246 | + text-align: center; |
| 247 | + |
| 248 | + .feature-cta-title { |
| 249 | + display: block; |
| 250 | + font-weight: 600; |
| 251 | + color: $primary; |
| 252 | + } |
| 253 | + |
| 254 | + p { |
| 255 | + margin: 0.125rem 0 0; |
| 256 | + font-size: 0.9375rem; |
| 257 | + opacity: 0.7; |
| 258 | + } |
| 259 | +} |
| 260 | + |
| 261 | +// GitHub star count, right-aligned on the card's title line |
| 262 | +.feature-stars { |
| 263 | + display: inline-flex; |
| 264 | + align-items: center; |
| 265 | + gap: 0.25rem; |
| 266 | + margin-left: auto; |
| 267 | + flex: 0 0 auto; |
| 268 | + font-size: 0.8125rem; |
| 269 | + font-weight: 500; |
| 270 | + |
| 271 | + svg { |
| 272 | + // A gold star, as GitHub draws it. The muting sits on the number instead of |
| 273 | + // the whole badge, so the colour is not washed out by an opacity of its own. |
| 274 | + color: #e3a008; |
| 275 | + // Nudge the star onto the text baseline |
| 276 | + margin-bottom: -0.125rem; |
| 277 | + } |
| 278 | + |
| 279 | + // The count stays in the body colour: yellow text this small would be hard to |
| 280 | + // read on white, and the star alone carries the colour. |
| 281 | + [data-stars-count] { |
| 282 | + opacity: 0.65; |
| 283 | + } |
| 284 | +} |
| 285 | + |
| 286 | +// No count yet: the build-time lookup failed and assets/js/custom.js has not |
| 287 | +// filled this in (or cannot reach the endpoint). Hide it rather than show a |
| 288 | +// bare star with no number. |
| 289 | +.feature-stars-pending { |
| 290 | + display: none; |
| 291 | +} |
0 commit comments