|
1 | 1 | /***** Header Nav Component *****/ |
2 | 2 |
|
3 | 3 | .c-headernav { |
4 | | - --headernav-section-padding: var(--space3); |
5 | | - --headernav-item-margin: var(--space3); |
6 | | - |
7 | 4 | .no-popover & { |
8 | 5 | ul ul { |
9 | 6 | display: none; |
10 | 7 | } |
11 | 8 | } |
12 | 9 |
|
13 | | - ul { |
| 10 | + /* ul { |
14 | 11 | margin: unset; |
15 | 12 | padding: unset; |
16 | 13 | list-style-type: none; |
| 14 | + } */ |
17 | 15 |
|
18 | | - li { |
19 | | - margin: unset; |
20 | | - padding: unset; |
21 | | - } |
| 16 | + /* li { |
| 17 | + margin: unset; |
| 18 | + padding: unset; |
| 19 | + } */ |
| 20 | + |
| 21 | + /* Panel columns (no columns, by default). These are set via 'columns-[#]' classes defined in the top-level menu items within WP Menus: */ |
| 22 | + .columns-2 > ul { |
| 23 | + column-count: 2; |
22 | 24 | } |
23 | 25 |
|
24 | | - @media (--min-width2) { |
25 | | - a { |
26 | | - display: block; |
27 | | - } |
28 | | - |
29 | | - /* Nav bar and top sections: */ |
30 | | - > ul { |
31 | | - display: flex; |
32 | | - } |
33 | | - |
34 | | - > ul > li { |
35 | | - flex: 1 1 auto; |
36 | | - anchor-scope: all; |
37 | | - |
38 | | - &:not(:last-child) { |
39 | | - border-inline-end: 1px solid oklch(55% 0 0deg); |
40 | | - } |
41 | | - } |
42 | | - |
43 | | - /* Nav bar links are anchors for popover panels: */ |
44 | | - > ul > li > a { |
45 | | - anchor-name: --headernav-anchor; |
46 | | - padding: var(--space1); |
47 | | - background: linear-gradient(oklch(95% 0 0deg), oklch(88% 0 0deg)); |
48 | | - color: oklch(36% 0 0deg); |
49 | | - text-align: center; |
50 | | - text-decoration: none; |
51 | | - |
52 | | - &:focus, |
53 | | - &:hover { |
54 | | - color: var(--color-blue); |
55 | | - text-decoration: underline; |
56 | | - } |
57 | | - } |
| 26 | + .columns-3 > ul { |
| 27 | + column-count: 3; |
58 | 28 | } |
| 29 | +} |
| 30 | + |
| 31 | +.c-headernav__section { |
| 32 | + flex: 1 1 auto; |
| 33 | + anchor-scope: all; |
| 34 | + |
| 35 | + &:not(:last-child) { |
| 36 | + border-inline-end: 1px solid oklch(55% 0 0deg); |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +/* Nav bar links are anchors for popover panels: */ |
59 | 41 |
|
60 | | - /* Popover panels: */ |
61 | | - [popover] { |
62 | | - position-anchor: --headernav-anchor; |
63 | | - top: anchor(bottom); |
64 | | - left: anchor(left); |
65 | | - margin: 0; |
66 | | - transition: opacity, display, overlay; |
67 | | - transition-duration: 0.3s; |
68 | | - transition-behavior: allow-discrete; |
69 | | - border: unset; |
70 | | - opacity: 0; |
71 | | - |
72 | | - &:popover-open { |
73 | | - opacity: 1; |
74 | | - |
75 | | - @starting-style { |
76 | | - opacity: 0; |
77 | | - } |
| 42 | +.c-headernav__link { |
| 43 | + anchor-name: --headernav-anchor; |
| 44 | + padding: var(--space1); |
| 45 | + background: linear-gradient(oklch(95% 0 0deg), oklch(88% 0 0deg)); |
| 46 | + color: oklch(36% 0 0deg); |
| 47 | + text-align: center; |
| 48 | + text-decoration: none; |
| 49 | + |
| 50 | + &:focus, |
| 51 | + &:hover { |
| 52 | + color: var(--color-blue); |
| 53 | + text-decoration: underline; |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +.c-headernav__popover { |
| 58 | + position-anchor: --headernav-anchor; |
| 59 | + top: anchor(bottom); |
| 60 | + left: anchor(left); |
| 61 | + margin: 0; |
| 62 | + transition: opacity, display, overlay; |
| 63 | + transition-duration: 0.3s; |
| 64 | + transition-behavior: allow-discrete; |
| 65 | + border: unset; |
| 66 | + opacity: 0; |
| 67 | + |
| 68 | + &:popover-open { |
| 69 | + opacity: 1; |
| 70 | + |
| 71 | + @starting-style { |
| 72 | + opacity: 0; |
78 | 73 | } |
79 | 74 | } |
80 | 75 |
|
81 | | - > ul > li > ul { |
82 | | - padding: var(--headernav-section-padding); |
83 | | - column-gap: calc(var(--headernav-section-padding) * 2); |
84 | | - column-rule: 1px solid oklch(88% 0 0deg); |
85 | | - column-width: 9.5em; |
86 | | - border-inline: 1px solid oklch(88% 0 0deg); |
87 | | - border-block-end: 1px solid oklch(88% 0 0deg); |
88 | | - background-color: oklch(95% 0 0deg); |
89 | | - box-shadow: 3px 3px 3px oklch(88% 0 0deg / 70%); |
| 76 | + /* ul { |
| 77 | + margin: unset; |
| 78 | + padding: unset; |
| 79 | + list-style-type: none; |
| 80 | + } */ |
| 81 | + |
| 82 | + /* li { |
| 83 | + margin: unset; |
| 84 | + padding: unset; |
| 85 | + } */ |
| 86 | + |
| 87 | + /* Sections: */ |
| 88 | + |
| 89 | + > li { |
| 90 | + border: solid red; |
90 | 91 | } |
91 | 92 |
|
92 | | - /* Panel columns (no columns, by default). These are set via 'columns-[#]' classes defined in the top-level menu items within WP Menus: */ |
93 | | - > ul > .columns-2 > ul { |
94 | | - column-count: 2; |
| 93 | + /* Section lists after the section heading link: */ |
| 94 | + |
| 95 | + > li > ul { |
| 96 | + break-inside: avoid; |
| 97 | + border: solid orange; |
95 | 98 | } |
96 | 99 |
|
97 | | - > ul > .columns-3 > ul { |
98 | | - column-count: 3; |
| 100 | + /* Keep section links together with section heading link: */ |
| 101 | + |
| 102 | + li { |
| 103 | + break-inside: avoid; |
99 | 104 | } |
100 | 105 |
|
101 | | - /* Panel lists: */ |
102 | | - > ul > li > ul > li { |
103 | | - break-inside: avoid; /* Firefox */ |
| 106 | + /* Section lists: */ |
| 107 | + |
| 108 | + li li { |
| 109 | + margin-block-end: 1rem; |
104 | 110 | } |
105 | 111 |
|
106 | | - /* Panel list links: */ |
107 | | - > ul > li > ul > li > a { |
| 112 | + /* Section heading links: */ |
| 113 | + |
| 114 | + > li > a { |
108 | 115 | margin-block-end: var(--headernav-item-margin); |
109 | 116 | color: var(--color-dark-red); |
| 117 | + } |
| 118 | + |
| 119 | + /* All section links: */ |
| 120 | + |
| 121 | + a { |
110 | 122 | text-decoration: none; |
111 | 123 |
|
112 | 124 | &:focus, |
|
115 | 127 | } |
116 | 128 | } |
117 | 129 |
|
118 | | - /* Panel sub-list 'heading' links: */ |
119 | | - > ul > li > ul > li > a:only-child { |
120 | | - color: var(--color-blue); |
121 | | - } |
| 130 | + /* Section heading links without a following list: */ |
122 | 131 |
|
123 | | - /* Panel sub-lists: */ |
124 | | - > ul > li > ul > li > ul { |
125 | | - padding-inline: var(--space1); |
126 | | - break-inside: avoid; /* Firefox */ |
| 132 | + > li > a:only-child { |
| 133 | + color: var(--color-blue); |
127 | 134 | } |
| 135 | +} |
128 | 136 |
|
129 | | - /* Panel sub-list links: */ |
130 | | - > ul > li > ul > li > ul > li > a { |
131 | | - text-decoration: none; |
| 137 | +.c-headernav__popover { |
| 138 | + padding: var(--space3); |
| 139 | + column-gap: calc(var(--space3) * 2); |
| 140 | + column-rule: 1px solid oklch(88% 0 0deg); |
| 141 | + column-width: 9.5em; |
| 142 | + border-inline: 1px solid oklch(88% 0 0deg); |
| 143 | + border-block-end: 1px solid oklch(88% 0 0deg); |
| 144 | + background-color: oklch(95% 0 0deg); |
| 145 | + box-shadow: 3px 3px 3px oklch(88% 0 0deg / 70%); |
| 146 | +} |
132 | 147 |
|
133 | | - &:focus, |
134 | | - &:hover { |
135 | | - text-decoration: underline; |
| 148 | +@media (--min-width2) { |
| 149 | + .c-headernav { |
| 150 | + a { |
| 151 | + display: block; |
136 | 152 | } |
137 | | - } |
138 | 153 |
|
139 | | - /* All panel list items: */ |
140 | | - > ul > li li { |
141 | | - margin-block-end: var(--headernav-item-margin); |
| 154 | + > ul { |
| 155 | + display: flex; |
| 156 | + } |
142 | 157 | } |
143 | 158 | } |
0 commit comments