|
9 | 9 | font-size: 27px; |
10 | 10 | } |
11 | 11 |
|
| 12 | +/* Lets the card grid below adapt to the width of this column of the page. */ |
| 13 | +.casestudies > .container { |
| 14 | + container-type: inline-size; |
| 15 | +} |
| 16 | + |
| 17 | +/* Cards share title / image / text rows via subgrid, so images line up however |
| 18 | + a translated title wraps; `1fr` text rows keep the cards the same height. */ |
12 | 19 | .casestudies-box-container { |
13 | | - display: flex; |
14 | | - flex-wrap: wrap; |
15 | | - justify-content: center; |
| 20 | + display: grid; |
| 21 | + grid-template-columns: repeat(auto-fit, minmax(min(275px, 100%), 350px)); |
| 22 | + grid-auto-rows: auto auto 1fr; |
| 23 | + justify-content: space-around; |
16 | 24 | } |
17 | 25 |
|
18 | 26 | .casestudies-box-content { |
19 | | - height: 450px; |
20 | | - min-width: 275px; |
21 | | - width: 350px; |
22 | | - margin: 30px auto; |
| 27 | + display: grid; |
| 28 | + grid-row: span 3; |
| 29 | + grid-template-rows: subgrid; |
| 30 | + margin: 30px 0; |
23 | 31 | border-radius: 3px; |
24 | 32 | } |
25 | 33 |
|
| 34 | +/* With room for three 350px columns, centre a card left alone on the last row. */ |
| 35 | +@container (min-width: 1050px) { |
| 36 | + .casestudies-box-content:last-child:nth-child(3n + 1) { |
| 37 | + grid-column: 2; |
| 38 | + } |
| 39 | +} |
| 40 | + |
26 | 41 | .casestudies-box-title { |
27 | | - line-height: 1.5em; |
28 | | - height: 3.0em; |
29 | 42 | margin: 15px; |
30 | 43 | font-size: 16px; |
31 | 44 | text-transform: uppercase; |
32 | 45 | } |
33 | 46 |
|
| 47 | +/* Same shape for every image, whatever the aspect ratio of the file. */ |
34 | 48 | .casestudies-box-content img { |
| 49 | + width: 100%; |
| 50 | + aspect-ratio: 8 / 5; |
35 | 51 | object-fit: cover; |
36 | | - width: 350px; |
37 | | - height: 218.5px; |
38 | 52 | } |
39 | 53 |
|
40 | 54 | .casestudies-box-text { |
41 | 55 | margin: 30px 15px; |
42 | 56 | font-size: 14px; |
43 | 57 | } |
44 | 58 |
|
45 | | -@media only screen and (max-width: 1300px) { |
46 | | - .casestudies-box-container { |
47 | | - justify-content: center; |
48 | | - } |
49 | | -} |
50 | | - |
51 | | -@media only screen and (min-width: 600px) and (max-width: 700px) { |
52 | | - .casestudies-box-container { |
53 | | - flex-direction: column; |
54 | | - align-items: center; |
55 | | - } |
56 | | -} |
57 | | - |
58 | 59 | .casestudies-underline { |
59 | | - display: inline-block; |
60 | 60 | -webkit-transform: perspective(1px) translateZ(0); |
61 | 61 | transform: perspective(1px) translateZ(0); |
62 | 62 | border: .02em solid var(--pst-color-border); |
|
0 commit comments