PluginProbe
CryptX / 4.2.0
CryptX v4.2.0
4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 92 releases
cryptx / src / index.css

index.css in CryptX 4.2.0, at src/index.css

481 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2 * Styles for the CryptX settings screen.
3 *
4 * Mobile first: the rules below the media query describe the phone, and the
5 * query adds what a wider screen allows.
6 *
7 * On colour there is one rule worth stating, because getting it wrong was
8 * visible on the first attempt: this screen must NOT react to
9 * prefers-color-scheme. The WordPress admin has no dark mode of its own, so on
10 * a phone set to dark the page around us stays light. Rules behind that query
11 * gave us dark boxes with the page's dark text inside -- unreadable. Anything
12 * dark here is dark on purpose, at every setting, and always sets its own text
13 * colour alongside its background.
14 *
15 * Accent colours come from --wp-admin-theme-color so the screen follows the
16 * chosen admin colour scheme. That variable is for accents only: borders,
17 * active states, links. Body text uses the admin greys, never the accent.
18 */
19
20 .cryptx-settings {
21 --cryptx-gap: 16px;
22 --cryptx-radius: 4px;
23 --cryptx-text: #1d2327;
24 --cryptx-muted: #50575e;
25 --cryptx-border: #c3c4c7;
26 --cryptx-border-light: #dcdcde;
27 --cryptx-surface: #fff;
28 --cryptx-code-bg: #1d2327;
29 --cryptx-code-text: #f0f0f1;
30 max-width: 900px;
31 margin-inline: auto;
32 padding-inline: 4px;
33 color: var(--cryptx-text);
34 }
35
36 .cryptx-settings__header h1 {
37 margin-bottom: 4px;
38 font-size: 1.6rem;
39 line-height: 1.3;
40 }
41
42 .cryptx-settings__intro {
43 margin: 0 0 var(--cryptx-gap);
44 max-width: 60ch;
45 /* Body text, not an accent. This used to pull the admin theme colour and
46 rendered the whole introduction in link blue. */
47 color: var(--cryptx-muted);
48 }
49
50 /* ------------------------------------------------------------------ tabs -- */
51
52 .cryptx-tabs {
53 position: relative;
54 display: flex;
55 gap: 2px;
56 overflow-x: auto;
57 scrollbar-width: thin;
58 border-bottom: 1px solid var(--cryptx-border);
59 margin-bottom: var(--cryptx-gap);
60 -webkit-overflow-scrolling: touch;
61 /* Tells the reader there is more to the right, instead of letting a tab
62 end mid-word with no explanation. */
63 mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
64 }
65
66 /* Once the last tab is reached the hint would be a lie, so it is removed. */
67 .cryptx-tabs.is-scrolled-end {
68 mask-image: none;
69 }
70
71 .cryptx-tabs__tab {
72 flex: 0 0 auto;
73 appearance: none;
74 background: none;
75 border: 0;
76 border-bottom: 3px solid transparent;
77 /* Tight enough that all five tabs fit a 390px phone without scrolling; the
78 scroll behaviour stays for narrower screens and longer translations. */
79 padding: 12px 10px;
80 font-size: 14px;
81 font-weight: 500;
82 color: var(--cryptx-muted);
83 cursor: pointer;
84 /* Comfortably tappable without hunting for it. */
85 min-height: 44px;
86 white-space: nowrap;
87 scroll-margin-inline: 16px;
88 }
89
90 .cryptx-tabs__tab:hover {
91 color: var(--wp-admin-theme-color, #2271b1);
92 }
93
94 .cryptx-tabs__tab.is-active {
95 border-bottom-color: var(--wp-admin-theme-color, #2271b1);
96 color: var(--wp-admin-theme-color, #2271b1);
97 }
98
99 .cryptx-tabs__tab:focus-visible {
100 outline: 2px solid var(--wp-admin-theme-color, #2271b1);
101 outline-offset: -2px;
102 border-radius: 2px;
103 }
104
105 .cryptx-settings__tab-description {
106 margin: 0 0 var(--cryptx-gap);
107 max-width: 60ch;
108 color: var(--cryptx-muted);
109 }
110
111 /* -------------------------------------------------------------- sections -- */
112
113 .cryptx-section,
114 .cryptx-preview {
115 margin-bottom: var(--cryptx-gap);
116 }
117
118 .cryptx-section__title {
119 margin: 0;
120 font-size: 14px;
121 font-weight: 600;
122 color: var(--cryptx-text);
123 }
124
125 .cryptx-section__fields {
126 display: grid;
127 gap: 24px;
128 }
129
130 /* The secrets card explains before it offers. Same reading width as the help
131 texts below, for the same reason. */
132 .cryptx-secrets__notice,
133 .cryptx-secrets__confirm {
134 margin: 16px 0;
135 }
136
137 .cryptx-secrets__last {
138 color: var(--cryptx-muted, #646970);
139 font-size: 13px;
140 }
141
142 .cryptx-secrets__confirm {
143 display: flex;
144 flex-wrap: wrap;
145 align-items: center;
146 gap: 8px;
147 }
148
149 .cryptx-secrets__confirm p {
150 flex-basis: 100%;
151 margin: 0;
152 font-weight: 600;
153 }
154
155 /* The help text under a control is the reason this screen exists; keep it
156 readable rather than letting it stretch across a wide monitor. */
157 .cryptx-field .components-base-control__help,
158 .cryptx-field .components-radio-control__option label {
159 max-width: 62ch;
160 }
161
162 .cryptx-field .components-base-control__help {
163 font-style: normal;
164 color: var(--cryptx-muted);
165 }
166
167 /* --------------------------------------------------------------- preview -- */
168
169 .cryptx-preview__block + .cryptx-preview__block {
170 margin-top: var(--cryptx-gap);
171 }
172
173 .cryptx-preview h3 {
174 margin: 0 0 6px;
175 font-size: 12px;
176 text-transform: uppercase;
177 letter-spacing: 0.04em;
178 color: var(--cryptx-muted);
179 }
180
181 /* This box stands in for the visitor's page, so it is light whatever the
182 phone is set to -- and it states its own text colour rather than inheriting
183 one that might not suit the background. */
184 .cryptx-preview__rendered {
185 padding: 12px;
186 border: 1px solid var(--cryptx-border-light);
187 border-radius: var(--cryptx-radius);
188 background: var(--cryptx-surface);
189 color: var(--cryptx-text);
190 word-break: break-word;
191 }
192
193 .cryptx-preview__source {
194 margin: 0;
195 padding: 12px;
196 border-radius: var(--cryptx-radius);
197 background: var(--cryptx-code-bg);
198 color: var(--cryptx-code-text);
199 font-size: 12px;
200 line-height: 1.6;
201 /* The encrypted payload is one long unbreakable run of characters, and on
202 a phone it filled the whole screen. Capped and scrollable instead. */
203 max-height: 40vh;
204 overflow: auto;
205 white-space: pre-wrap;
206 word-break: break-all;
207 }
208
209 .cryptx-preview__verdict {
210 display: flex;
211 align-items: flex-start;
212 gap: 8px;
213 margin: var(--cryptx-gap) 0 0;
214 padding: 10px 12px;
215 border-radius: var(--cryptx-radius);
216 border-left: 4px solid transparent;
217 font-weight: 500;
218 }
219
220 .cryptx-preview__verdict::before {
221 font-weight: 700;
222 line-height: 1.5;
223 }
224
225 .cryptx-preview__verdict.is-good {
226 border-left-color: #00a32a;
227 background: #edfaef;
228 color: #00450c;
229 }
230
231 .cryptx-preview__verdict.is-good::before {
232 content: "✓";
233 }
234
235 .cryptx-preview__verdict.is-warning {
236 border-left-color: #dba617;
237 background: #fcf9e8;
238 color: #614f00;
239 }
240
241 .cryptx-preview__verdict.is-warning::before {
242 content: "!";
243 }
244
245 /* Not the same as a warning: here the plugin is doing nothing at all for this
246 address, and the colour should say so before the sentence does. */
247 .cryptx-preview__verdict.is-bad {
248 border-left-color: #d63638;
249 background: #fcf0f1;
250 color: #8a2424;
251 }
252
253 .cryptx-preview__verdict.is-bad::before {
254 content: "✕";
255 }
256
257 .cryptx-preview__error {
258 color: #8a2424;
259 }
260
261 /* ---------------------------------------------------------------- fields -- */
262
263 .cryptx-color {
264 display: flex;
265 align-items: center;
266 gap: 8px;
267 }
268
269 .cryptx-color input[type="color"] {
270 width: 44px;
271 height: 40px;
272 padding: 2px;
273 border: 1px solid #949494;
274 border-radius: var(--cryptx-radius);
275 background: none;
276 cursor: pointer;
277 flex: 0 0 auto;
278 }
279
280 .cryptx-color .components-base-control {
281 flex: 1 1 auto;
282 margin: 0;
283 }
284
285 .cryptx-media__preview {
286 max-width: 160px;
287 height: auto;
288 border: 1px solid var(--cryptx-border-light);
289 border-radius: var(--cryptx-radius);
290 }
291
292 .cryptx-media__buttons {
293 display: flex;
294 flex-wrap: wrap;
295 gap: 8px;
296 }
297
298 /* --------------------------------------------------------------- actions -- */
299
300 .cryptx-settings__actions {
301 margin-top: var(--cryptx-gap);
302 padding: 12px 0;
303 border-top: 1px solid var(--cryptx-border-light);
304 background: transparent;
305 }
306
307 /*
308 * The bar only follows the scroll while there is something to save. A bar that
309 * sticks permanently covers the last option on a phone -- which it did -- and
310 * it does so to offer a button that cannot be pressed.
311 */
312 .cryptx-settings__actions.is-dirty {
313 position: sticky;
314 bottom: 0;
315 z-index: 10;
316 padding: 12px;
317 margin-inline: -4px;
318 background: var(--cryptx-surface);
319 border-top: 1px solid var(--cryptx-border);
320 box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
321 padding-bottom: calc(12px + env(safe-area-inset-bottom));
322 }
323
324 .cryptx-settings__status {
325 margin: 8px 0 0;
326 font-size: 12px;
327 color: var(--cryptx-muted);
328 }
329
330 .cryptx-settings__status.is-dirty {
331 color: #614f00;
332 font-weight: 500;
333 }
334
335 .cryptx-loading {
336 display: flex;
337 align-items: center;
338 gap: 8px;
339 padding: 24px 0;
340 color: var(--cryptx-muted);
341 }
342
343 /* ------------------------------------------------------------------ help -- */
344
345 .cryptx-help__snippet {
346 margin: 0 0 12px;
347 padding: 12px;
348 border-radius: var(--cryptx-radius);
349 background: var(--cryptx-code-bg);
350 color: var(--cryptx-code-text);
351 border: 1px solid var(--cryptx-code-bg);
352 font-size: 12px;
353 line-height: 1.6;
354 /* Wrapped rather than scrolled sideways. A shortcode is meant to be read
355 and copied, and on a phone the tail of it was simply off the edge with
356 nothing to suggest it could be dragged into view. Line breaks written
357 into the snippet are kept. */
358 white-space: pre-wrap;
359 overflow-wrap: anywhere;
360 }
361
362 .cryptx-help__note {
363 margin: 0;
364 color: var(--cryptx-muted);
365 font-size: 12px;
366 }
367
368 .cryptx-help__release + .cryptx-help__release {
369 margin-top: var(--cryptx-gap);
370 padding-top: var(--cryptx-gap);
371 border-top: 1px solid var(--cryptx-border-light);
372 }
373
374 .cryptx-help__release h3 {
375 display: flex;
376 align-items: center;
377 gap: 8px;
378 margin: 0 0 8px;
379 font-size: 14px;
380 font-weight: 600;
381 color: var(--cryptx-text);
382 }
383
384 .cryptx-help__badge {
385 padding: 1px 8px;
386 border-radius: 10px;
387 background: #edfaef;
388 color: #00450c;
389 font-size: 11px;
390 font-weight: 500;
391 letter-spacing: 0.02em;
392 text-transform: lowercase;
393 }
394
395 .cryptx-help__changelog ul {
396 margin: 0;
397 padding-left: 20px;
398 list-style: disc;
399 }
400
401 .cryptx-help__changelog li {
402 margin-bottom: 6px;
403 line-height: 1.6;
404 /* A bare support-forum URL in the older entries is longer than the column
405 and pushed the whole card sideways. */
406 overflow-wrap: anywhere;
407 }
408
409 .cryptx-help__changelog code {
410 padding: 1px 4px;
411 border-radius: 2px;
412 background: #f0f0f1;
413 font-size: 12px;
414 }
415
416 .cryptx-help__older {
417 margin-top: var(--cryptx-gap);
418 padding-top: var(--cryptx-gap);
419 border-top: 1px solid var(--cryptx-border-light);
420 }
421
422 .cryptx-help__older > summary {
423 /* Large enough to hit with a thumb, and obviously a control rather than a
424 heading that happens to have a triangle next to it. */
425 min-height: 44px;
426 display: flex;
427 align-items: center;
428 cursor: pointer;
429 color: var(--wp-admin-theme-color, #2271b1);
430 font-weight: 500;
431 }
432
433 .cryptx-help__older > summary:focus-visible {
434 outline: 2px solid var(--wp-admin-theme-color, #2271b1);
435 outline-offset: 2px;
436 border-radius: 2px;
437 }
438
439 .cryptx-help__older[open] > summary {
440 margin-bottom: var(--cryptx-gap);
441 }
442
443 /* ----------------------------------------------------- wider than a phone -- */
444
445 @media (min-width: 783px) {
446 .cryptx-settings {
447 padding-inline: 0;
448 }
449
450 .cryptx-settings__header h1 {
451 font-size: 2rem;
452 }
453
454 .cryptx-section__fields {
455 gap: 28px;
456 }
457
458 .cryptx-tabs {
459 /* Everything fits, so the scroll hint has nothing to announce. */
460 mask-image: none;
461 }
462
463 .cryptx-tabs__tab {
464 padding: 12px 14px;
465 }
466
467 .cryptx-settings__actions.is-dirty {
468 margin-inline: 0;
469 padding-inline: 0;
470 box-shadow: none;
471 }
472 }
473
474 /* --------------------------------------------------------- reduced motion -- */
475
476 @media (prefers-reduced-motion: reduce) {
477 .cryptx-tabs {
478 scroll-behavior: auto;
479 }
480 }
481