oficina / estilo Public

Clone
git clone https://amadan.net/oficina/estilo

Plain git — no account needed to clone.

Download

Download this file

1/* side.css: an app's side panel and the frame that puts it under the
2 * bar, beside <main>. Mapa's, copied (its level-up spec, §3.2); Contra is
3 * the second app to use it. Tokens only, so Calma and light/dark apply.
4 * Calma: only icons carry colour.
5 *
6 * Breakpoints are estilo's: 800px, where the bar stacks and the side
7 * appears, and 80rem, from which the side is open unless folded.
8 *
9 * Markup: <div estilo-side-frame="open|rail|"> holds <nav estilo-side>
10 * (the estilo-side template) and <main>. An empty value lets the width
11 * decide.
12 */
13
14[estilo-side-frame] {
15 --estilo-side-inline-size: 224px; /* PUBLIC: the side's width now, rail included */
16 --estilo-side-rail-inline-size: 56px; /* PUBLIC */
17 display: grid;
18 grid-template-columns: var(--estilo-side-inline-size) minmax(0, 1fr);
19 min-block-size: calc(100dvh - var(--estilo-bar-block-size, 56px));
20}
21/* The rail: by state, or by width when there is none (open from 80rem,
22 the rail below). */
23[estilo-side-frame~="rail"] { --estilo-side-inline-size: var(--estilo-side-rail-inline-size); }
24@media (max-width: 79.99rem) {
25 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) {
26 --estilo-side-inline-size: var(--estilo-side-rail-inline-size);
27 }
28}
29[estilo-side-frame] > main { min-inline-size: 0; }
30
31/* The places are the side's from 800px; estilo's Menu sheet carries them
32 below it. */
33@media (min-width: 800px) {
34 :root:has([estilo-side-frame]) [estilo-bar-nav] { display: none; }
35}
36
37/* ── The side: one grid per row, a 16px icon column and the label,
38 centred on one axis. ── */
39[estilo-side] {
40 box-sizing: border-box;
41 position: sticky;
42 inset-block-start: var(--estilo-bar-block-size, 56px);
43 block-size: calc(100dvh - var(--estilo-bar-block-size, 56px));
44 display: flex;
45 flex-direction: column;
46 gap: 1px; /* spacing-allow: a hairline between rows, so two highlighted rows never merge */
47 overflow: auto;
48 padding: var(--rst-sp-3) var(--rst-sp-2);
49 background: light-dark(#f8f9fb, #191b21);
50 border-inline-end: 1px solid var(--rst-line);
51 font-size: 13px;
52}
53[estilo-side-item] {
54 box-sizing: border-box;
55 position: relative;
56 display: grid;
57 grid-template-columns: 16px minmax(0, 1fr) auto;
58 align-items: center;
59 column-gap: var(--rst-sp-3);
60 inline-size: 100%;
61 min-block-size: 30px;
62 padding: 0 var(--rst-sp-2);
63 border: 0;
64 border-radius: 8px;
65 background: none;
66 color: var(--rst-text-muted);
67 font: inherit;
68 line-height: 18px;
69 text-align: start;
70 text-decoration: none;
71 cursor: pointer;
72}
73[estilo-side-item] > svg { inline-size: 16px; block-size: 16px; }
74[estilo-side-label] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
75[estilo-side-item]:hover { background: var(--rst-surface-2); color: var(--rst-text); }
76[estilo-side-item]:focus-visible { outline: 2px solid var(--rst-accent); outline-offset: -2px; }
77[estilo-side-item][aria-current] { background: var(--rst-accent-soft); color: var(--rst-text); font-weight: 600; }
78[estilo-side-item][aria-current] > svg { color: var(--rst-accent); }
79/* One full highlight: a place holding a page that has its own row is
80 drawn twice, and the open side shows the unlit one; the rail, which
81 hides the page rows, shows the lit one. The lit copy carries [hidden]
82 for a page read with no CSS; the rail's display: grid below outranks
83 the browser's own [hidden] rule. */
84[estilo-side-holds="rail"] { display: none; }
85/* A locked row (Mapa: a private note of your own): a lock at its end. */
86[estilo-side-lock] { display: inline-flex; color: var(--rst-text-muted); }
87[estilo-side-lock] > svg { inline-size: 12px; block-size: 12px; }
88[estilo-side-head] {
89 margin: var(--rst-sp-3) 0 var(--rst-sp-1);
90 padding: 0 var(--rst-sp-2);
91 color: var(--rst-text-faint, var(--rst-text-muted));
92 font-size: 11.5px;
93 font-weight: 600;
94 line-height: 22px;
95}
96[estilo-side-foot] { margin-block-start: auto; padding-block-start: var(--rst-sp-3); display: grid; gap: 1px; /* spacing-allow: the rows' hairline, as above */ }
97[estilo-side-foot] form { display: contents; }
98kbd[estilo-side-key] {
99 display: inline-flex;
100 align-items: center;
101 justify-content: center;
102 min-inline-size: 1.4em;
103 padding: 0 var(--rst-sp-1);
104 border: 1px solid var(--rst-line);
105 border-block-end-width: 2px;
106 border-radius: 5px;
107 background: var(--rst-surface);
108 color: var(--rst-text-muted);
109 font: 500 10.5px/14px var(--rst-font);
110}
111
112/* The fold: one button per state, shown by what is on screen. */
113[estilo-side-fold-to="open"] { display: none; }
114[estilo-side-frame~="rail"] [estilo-side-fold-to="rail"] { display: none; }
115[estilo-side-frame~="rail"] [estilo-side-fold-to="open"] { display: grid; }
116@media (max-width: 79.99rem) {
117 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-fold-to="rail"] { display: none; }
118 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-fold-to="open"] { display: grid; }
119}
120
121/* ── The rail: the same rows, icons only, on one axis. The label stays
122 in the accessibility tree and is the tooltip. The tooltip is fixed
123 where its row puts it (its static position, insets left auto), then
124 moved out beside the 40px row: a fixed box escapes the side's
125 scrolling, which clipped an absolute one. The tooltip is part of its
126 row, so the row stays hovered while the pointer is on it, and a
127 bridge (its ::before) spans the 10px gap so the pointer can cross to
128 it. side.js dismisses it on Escape (data-estilo-side-tip="off") until
129 the next hover or focus. ── */
130@media (min-width: 800px) {
131 [estilo-side-frame~="rail"] [estilo-side] { padding-inline: var(--rst-sp-2); align-items: center; }
132 [estilo-side-frame~="rail"] [estilo-side-item] {
133 grid-template-columns: 18px;
134 justify-content: center;
135 inline-size: 40px;
136 min-block-size: 38px;
137 padding: 0;
138 border-radius: 10px;
139 }
140 [estilo-side-frame~="rail"] [estilo-side-item] > svg { inline-size: 18px; block-size: 18px; }
141 [estilo-side-frame~="rail"] [estilo-side-item] > kbd,
142 [estilo-side-frame~="rail"] [estilo-side-head],
143 [estilo-side-frame~="rail"] [estilo-side-page] { display: none; }
144 [estilo-side-frame~="rail"] [estilo-side-item][aria-current] { background: none; }
145 [estilo-side-frame~="rail"] [estilo-side-holds="open"] { display: none; }
146 [estilo-side-frame~="rail"] [estilo-side-holds="rail"] { display: grid; }
147 [estilo-side-frame~="rail"] [estilo-side-item][aria-current]::before {
148 content: "";
149 position: absolute;
150 inset-inline-start: -8px;
151 inset-block-start: 10px;
152 inline-size: 3px;
153 block-size: 18px;
154 border-radius: 0 3px 3px 0;
155 background: var(--rst-accent);
156 }
157 [estilo-side-frame~="rail"] [estilo-side-label] {
158 position: fixed;
159 margin-inline-start: 50px; /* spacing-allow: the tooltip hangs 10px beside the 40px rail row it labels */
160 margin-block-start: 19px; /* spacing-allow: the middle of the 38px row, so the tooltip centres on it */
161 translate: 0 -50%;
162 z-index: 30;
163 padding: var(--rst-sp-1) var(--rst-sp-2);
164 border-radius: 6px;
165 background: var(--rst-text);
166 color: var(--rst-surface);
167 font-size: 12px;
168 font-weight: 500;
169 overflow: visible;
170 pointer-events: none;
171 opacity: 0;
172 clip-path: inset(50%);
173 }
174 [estilo-side-frame~="rail"] [estilo-side-label]::before {
175 content: "";
176 position: absolute;
177 inset-block: 0;
178 inset-inline-end: 100%;
179 inline-size: 12px;
180 }
181 [estilo-side-frame~="rail"] [estilo-side-item]:not([data-estilo-side-tip="off"]):hover [estilo-side-label],
182 [estilo-side-frame~="rail"] [estilo-side-item]:not([data-estilo-side-tip="off"]):focus-visible [estilo-side-label] {
183 opacity: 1;
184 clip-path: none;
185 pointer-events: auto;
186 }
187}
188@media (min-width: 800px) and (max-width: 79.99rem) {
189 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side] { padding-inline: var(--rst-sp-2); align-items: center; }
190 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item] {
191 grid-template-columns: 18px;
192 justify-content: center;
193 inline-size: 40px;
194 min-block-size: 38px;
195 padding: 0;
196 border-radius: 10px;
197 }
198 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item] > svg { inline-size: 18px; block-size: 18px; }
199 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item] > kbd,
200 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-head],
201 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-page] { display: none; }
202 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item][aria-current] { background: none; }
203 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-holds="open"] { display: none; }
204 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-holds="rail"] { display: grid; }
205 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item][aria-current]::before {
206 content: "";
207 position: absolute;
208 inset-inline-start: -8px;
209 inset-block-start: 10px;
210 inline-size: 3px;
211 block-size: 18px;
212 border-radius: 0 3px 3px 0;
213 background: var(--rst-accent);
214 }
215 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-label] {
216 position: fixed;
217 margin-inline-start: 50px; /* spacing-allow: the tooltip hangs 10px beside the 40px rail row it labels */
218 margin-block-start: 19px; /* spacing-allow: the middle of the 38px row, so the tooltip centres on it */
219 translate: 0 -50%;
220 z-index: 30;
221 padding: var(--rst-sp-1) var(--rst-sp-2);
222 border-radius: 6px;
223 background: var(--rst-text);
224 color: var(--rst-surface);
225 font-size: 12px;
226 font-weight: 500;
227 overflow: visible;
228 pointer-events: none;
229 opacity: 0;
230 clip-path: inset(50%);
231 }
232 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-label]::before {
233 content: "";
234 position: absolute;
235 inset-block: 0;
236 inset-inline-end: 100%;
237 inline-size: 12px;
238 }
239 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item]:not([data-estilo-side-tip="off"]):hover [estilo-side-label],
240 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-item]:not([data-estilo-side-tip="off"]):focus-visible [estilo-side-label] {
241 opacity: 1;
242 clip-path: none;
243 pointer-events: auto;
244 }
245}
246
247/* Where the engine anchors, each tooltip is tied to its own row
248 (anchor-scope keeps the name to that row), so it follows the rail as
249 it scrolls; a static position is fixed where layout put it. An app
250 anchoring something else to a row (Mapa's New team page popover)
251 names both: anchor-name: --its-own, --estilo-side-item. */
252@supports (anchor-name: --estilo-side-item) {
253 @media (min-width: 800px) {
254 [estilo-side-item] { anchor-name: --estilo-side-item; anchor-scope: --estilo-side-item; }
255 [estilo-side-frame~="rail"] [estilo-side-label] {
256 position-anchor: --estilo-side-item;
257 inset-block-start: anchor(center);
258 inset-inline-start: calc(anchor(end) + 10px);
259 margin: 0;
260 }
261 }
262 @media (min-width: 800px) and (max-width: 79.99rem) {
263 [estilo-side-frame]:not([estilo-side-frame~="open"], [estilo-side-frame~="rail"]) [estilo-side-label] {
264 position-anchor: --estilo-side-item;
265 inset-block-start: anchor(center);
266 inset-inline-start: calc(anchor(end) + 10px);
267 margin: 0;
268 }
269 }
270}
271
272/* Below 800px there is no side: its places are rows in estilo's Menu
273 sheet. Last, so it wins over [estilo-side]'s own display. */
274@media (max-width: 799.98px) {
275 [estilo-side-frame] { grid-template-columns: minmax(0, 1fr); }
276 [estilo-side] { display: none; }
277}
278