commun.css (9350B)
1 /* TODO: use a preprocessor, if only to be able to say 2 "wide-layout-threshold" instead of "50em", and 3 "xwide-layout-threshold" instead of "80em". */ 4 body { 5 --gold: #BE8B00; 6 7 margin: 0; 8 background-color: white; 9 font-family: 'Open Sans', sans-serif; 10 } 11 12 a { 13 color: inherit; 14 } 15 a.current { 16 color: var(--gold); 17 } 18 19 header a { 20 text-decoration: none; 21 } 22 nav a:hover, nav a:focus { 23 color: var(--gold); 24 background: white; 25 } 26 27 header.banner a { 28 display: flex; 29 align-items: center; 30 } 31 header.banner img { 32 height: var(--banner-logo-height); 33 margin: 0.6rem; 34 } 35 header.banner h1 { 36 margin: 0; 37 max-width: 6em; /* Force linebreak. */ 38 font-size: var(--banner-name-height); 39 font-weight: normal; 40 font-family: 'Cormorant', serif; 41 } 42 43 header.banner img, .social img { 44 filter: brightness(0); 45 } 46 header.banner a:hover img, .social a:hover img, 47 header.banner a:focus img, .social a:focus img { 48 filter: none; 49 } 50 header.banner:hover, header.banner:focus-within { 51 color: var(--gold); 52 } 53 54 header.menu > nav a { 55 font-size: 1.2rem; 56 font-weight: 600; 57 } 58 59 nav ol, nav ul { 60 list-style-type: none; 61 } 62 63 main { 64 color: #353535; 65 } 66 67 main h1 { 68 font-size: 1.4em; 69 } 70 main h2 { 71 font-size: 1.2em; 72 } 73 74 footer.social a { 75 text-decoration: none; 76 font-size: 1.2rem; 77 font-weight: 600; 78 } 79 footer.social a.contact:hover, footer.social a.contact:focus { 80 color: var(--gold); 81 background: white; 82 } 83 84 a.lang { 85 border: 0.15rem solid black; 86 border-radius: 50%; 87 } 88 a.lang:hover, a.lang:focus { 89 color: white; 90 background: var(--gold); 91 border: 0.15rem solid var(--gold); 92 } 93 94 footer.social a.lang { 95 display: block; 96 padding: 0.5rem; 97 font-size: 1rem; 98 } 99 100 footer.social { 101 display: flex; 102 flex-direction: column; 103 align-items: center; 104 } 105 106 footer.legal { 107 grid-column: 1 / -1; 108 width: 100%; 109 text-align: center; 110 margin: auto; 111 font-size: 75%; 112 } 113 114 @media (min-width: 50em) { 115 body { 116 --banner-logo-height: 8.5rem; 117 --banner-name-height: 2rem; 118 --menu-top-margin: calc((var(--banner-logo-height) 119 - 2 * var(--banner-name-height)) 120 / 2); 121 122 min-height: 100vh; 123 display: grid; 124 grid-template-columns: 2fr 1fr 4fr 2fr auto; 125 grid-template-rows: auto 1fr auto; 126 } 127 128 header.slidingmenu { 129 display: none; 130 } 131 132 header.banner { 133 grid-column: 1; 134 } 135 136 header.menu { 137 grid-column: 3; 138 } 139 140 header.menu nav { 141 margin-top: var(--menu-top-margin); 142 } 143 144 nav > ol { 145 display: grid; 146 align-items: center; 147 align-content: stretch; 148 text-align: center; 149 margin: 0; 150 } 151 nav ol, nav ul { 152 padding-left: 0; 153 } 154 155 /* I'd like to make sure the grid only ever has an even number of 156 * columns. No idea how to do that with one single neat rule, so… 157 * 🤖 Go Go Gadget Mediaquery 🤖 */ 158 159 nav > ol { 160 grid-template-columns: repeat(2, minmax(8em, 1fr)); 161 } 162 163 @media (min-width: 60em) { 164 nav > ol { 165 grid-template-columns: repeat(4, minmax(8em, 1fr)); 166 } 167 } 168 169 nav > ol > li > a { 170 display: block; 171 padding: 0.5em 0.1em; 172 } 173 174 nav li.dropdown { 175 position: relative; 176 } 177 nav li.dropdown ul { 178 position: absolute; 179 width: 100%; 180 background: #ddd8; 181 z-index: 1; 182 183 overflow: hidden; 184 max-height: 0; 185 transition: max-height 0.5s; 186 } 187 nav li.dropdown:hover > a, nav li.dropdown:focus-within > a { 188 background: white; 189 color: var(--gold); 190 } 191 nav li.dropdown:hover ul, nav li.dropdown:focus-within ul { 192 /* ⚠ Magic constant: must be big enough to show the whole dropdown, 193 but not too big otherwise the transition will be "delayed". */ 194 max-height: 20rem; 195 } 196 nav li.dropdown > ul > li { 197 list-style-type: none; 198 } 199 nav li.dropdown > ul > li:hover, nav li.dropdown > ul > li:focus { 200 background: white; 201 } 202 nav li.dropdown > ul > li a { 203 display: block; /* Make link span whole containing block. */ 204 } 205 206 main { 207 grid-row: 2; 208 grid-column: 1 / -2; 209 font-size: 1.2rem; 210 margin-left: 4em; 211 } 212 213 footer.social { 214 grid-row: 1 / -2; 215 grid-column: 5; 216 margin: var(--menu-top-margin) 1em 0; 217 } 218 219 footer.social a { 220 display: block; 221 margin: 1rem; 222 } 223 224 footer.social a > img { 225 width: 2.2rem; 226 } 227 228 footer.social > a.contact { 229 /* Ideally should be just: 230 * writing-mode: sideways-lr; 231 * but of course We Can't Have Nice Things. */ 232 writing-mode: vertical-rl; 233 transform: rotate(180deg); 234 padding: 1rem 0.5rem; 235 margin: 0; /* Compensate padding. */ 236 /* For some reason, Chrome 89 misaligns this element if we don't 237 * ropecast an align-items on it. */ 238 display: flex; 239 align-items: center; 240 /* For some reason, Chrome 89 (🤨) takes a much wider space than 241 * necessary on this element if we don't ropecast a max-width 242 * on it. */ 243 max-width: 2em; 244 } 245 } 246 247 @media not all and (min-width: 50em) { 248 body { 249 --banner-logo-height: 6rem; 250 --banner-name-height: 1.8rem; 251 252 display: grid; 253 grid-template-columns: 3rem 1fr; 254 grid-template-rows: 3rem auto 1fr auto; 255 min-height: 100vh; 256 } 257 258 header.menu, footer.social { 259 display: none; 260 } 261 262 header.slidingmenu { 263 grid-column: 1; 264 grid-row: 1; 265 } 266 body > header.banner { 267 grid-column: 2; 268 grid-row: 1 / 3; 269 justify-self: start; 270 } 271 main { 272 grid-row: 3; 273 grid-column: 1 / -1; 274 margin: 0.8em; 275 } 276 footer.legal { 277 grid-column: 1 / -1; 278 grid-row: -1; 279 } 280 281 header.slidingmenu { 282 position: relative; 283 /* Bump this whenever the z-index arms race in <main> escalates. */ 284 --slidingmenu-z-index: 2; 285 } 286 header.slidingmenu > input { 287 position: relative; 288 width: 100%; 289 height: 100%; 290 margin: 0; 291 z-index: calc(var(--slidingmenu-z-index) + 1); 292 opacity: 0; 293 cursor: pointer; 294 } 295 header.slidingmenu img.button { 296 position: absolute; 297 top: 0; 298 left: 0; 299 padding: 0.3rem; 300 width: 2.4rem; 301 height: 2.4rem; 302 } 303 header.slidingmenu img.button { 304 filter: brightness(0); 305 } 306 header.slidingmenu > input:hover ~ img.button.open, 307 header.slidingmenu > input:focus ~ img.button.open, 308 header.slidingmenu > input:hover ~ .content > img.button.close, 309 header.slidingmenu > input:focus ~ .content > img.button.close { 310 filter: none; 311 } 312 313 header.slidingmenu > .content { 314 position: fixed; 315 overflow: auto; 316 width: 100vw; 317 height: 100vh; 318 top: 0; 319 left: 0; 320 margin: 0; 321 322 background: #eeee; 323 color: initial; 324 325 transform-origin: left; 326 transform: translate(-100vw); 327 transition: transform 0.5s; 328 z-index: var(--slidingmenu-z-index); 329 330 display: grid; 331 grid-template-columns: 3rem 1fr 3.6rem; 332 grid-template-rows: 3.6rem repeat(4, auto); 333 } 334 header.slidingmenu > .content > img.button.close { 335 grid-column: 1; 336 grid-row: 1; 337 position: fixed; 338 } 339 header.slidingmenu > .content header.banner { 340 grid-column: 2; 341 grid-row: 1 / 3; 342 justify-self: start; 343 } 344 header.slidingmenu > .content > a.lang { 345 grid-column: -2; 346 grid-row: 1; 347 348 display: flex; 349 align-self: center; 350 justify-self: center; 351 align-items: center; 352 justify-content: center; 353 354 padding: 0.4rem; 355 font-size: 1rem; 356 } 357 header.slidingmenu > .content > nav.menu, 358 header.slidingmenu > .content > nav.social { 359 grid-column: 2; 360 } 361 362 header.slidingmenu > .content nav ol, 363 header.slidingmenu > .content nav ul { 364 margin-top: 0.2em; 365 padding-left: 0; 366 } 367 header.slidingmenu > .content > nav.menu li > a { 368 display: block; 369 padding: 0.5em; 370 } 371 header.slidingmenu > .content > nav.menu li.dropdown > a { 372 display: flex; 373 } 374 header.slidingmenu > .content > nav.menu li.dropdown li > a { 375 padding: 0.2em; 376 padding-left: 2em; 377 } 378 379 header.slidingmenu > .content > nav.social > ul { 380 display: flex; 381 padding-left: 0; 382 } 383 header.slidingmenu > .content > nav.social > ul > li:not(:first-child) { 384 margin-left: 1em; 385 } 386 header.slidingmenu > .content > nav.social > ul > li > a { 387 display: flex; 388 align-items: center; 389 padding: 0.5em; 390 } 391 header.slidingmenu > .content > nav.social > ul > li > a > img { 392 width: 2em; 393 height: 2em; 394 } 395 396 header.slidingmenu > input:checked { 397 position: fixed; 398 width: 3rem; 399 height: 3rem; 400 } 401 header.slidingmenu > input:checked ~ .content { 402 transform: none; 403 } 404 header.slidingmenu > input:checked ~ img.button.open { 405 opacity: 0; 406 } 407 }