| 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 help text under a control is the reason this screen exists; keep it |
| 131 |
readable rather than letting it stretch across a wide monitor. */ |
| 132 |
.cryptx-field .components-base-control__help, |
| 133 |
.cryptx-field .components-radio-control__option label { |
| 134 |
max-width: 62ch; |
| 135 |
} |
| 136 |
|
| 137 |
.cryptx-field .components-base-control__help { |
| 138 |
font-style: normal; |
| 139 |
color: var(--cryptx-muted); |
| 140 |
} |
| 141 |
|
| 142 |
/* --------------------------------------------------------------- preview -- */ |
| 143 |
|
| 144 |
.cryptx-preview__block + .cryptx-preview__block { |
| 145 |
margin-top: var(--cryptx-gap); |
| 146 |
} |
| 147 |
|
| 148 |
.cryptx-preview h3 { |
| 149 |
margin: 0 0 6px; |
| 150 |
font-size: 12px; |
| 151 |
text-transform: uppercase; |
| 152 |
letter-spacing: 0.04em; |
| 153 |
color: var(--cryptx-muted); |
| 154 |
} |
| 155 |
|
| 156 |
/* This box stands in for the visitor's page, so it is light whatever the |
| 157 |
phone is set to -- and it states its own text colour rather than inheriting |
| 158 |
one that might not suit the background. */ |
| 159 |
.cryptx-preview__rendered { |
| 160 |
padding: 12px; |
| 161 |
border: 1px solid var(--cryptx-border-light); |
| 162 |
border-radius: var(--cryptx-radius); |
| 163 |
background: var(--cryptx-surface); |
| 164 |
color: var(--cryptx-text); |
| 165 |
word-break: break-word; |
| 166 |
} |
| 167 |
|
| 168 |
.cryptx-preview__source { |
| 169 |
margin: 0; |
| 170 |
padding: 12px; |
| 171 |
border-radius: var(--cryptx-radius); |
| 172 |
background: var(--cryptx-code-bg); |
| 173 |
color: var(--cryptx-code-text); |
| 174 |
font-size: 12px; |
| 175 |
line-height: 1.6; |
| 176 |
/* The encrypted payload is one long unbreakable run of characters, and on |
| 177 |
a phone it filled the whole screen. Capped and scrollable instead. */ |
| 178 |
max-height: 40vh; |
| 179 |
overflow: auto; |
| 180 |
white-space: pre-wrap; |
| 181 |
word-break: break-all; |
| 182 |
} |
| 183 |
|
| 184 |
.cryptx-preview__verdict { |
| 185 |
display: flex; |
| 186 |
align-items: flex-start; |
| 187 |
gap: 8px; |
| 188 |
margin: var(--cryptx-gap) 0 0; |
| 189 |
padding: 10px 12px; |
| 190 |
border-radius: var(--cryptx-radius); |
| 191 |
border-left: 4px solid transparent; |
| 192 |
font-weight: 500; |
| 193 |
} |
| 194 |
|
| 195 |
.cryptx-preview__verdict::before { |
| 196 |
font-weight: 700; |
| 197 |
line-height: 1.5; |
| 198 |
} |
| 199 |
|
| 200 |
.cryptx-preview__verdict.is-good { |
| 201 |
border-left-color: #00a32a; |
| 202 |
background: #edfaef; |
| 203 |
color: #00450c; |
| 204 |
} |
| 205 |
|
| 206 |
.cryptx-preview__verdict.is-good::before { |
| 207 |
content: "✓"; |
| 208 |
} |
| 209 |
|
| 210 |
.cryptx-preview__verdict.is-warning { |
| 211 |
border-left-color: #dba617; |
| 212 |
background: #fcf9e8; |
| 213 |
color: #614f00; |
| 214 |
} |
| 215 |
|
| 216 |
.cryptx-preview__verdict.is-warning::before { |
| 217 |
content: "!"; |
| 218 |
} |
| 219 |
|
| 220 |
/* Not the same as a warning: here the plugin is doing nothing at all for this |
| 221 |
address, and the colour should say so before the sentence does. */ |
| 222 |
.cryptx-preview__verdict.is-bad { |
| 223 |
border-left-color: #d63638; |
| 224 |
background: #fcf0f1; |
| 225 |
color: #8a2424; |
| 226 |
} |
| 227 |
|
| 228 |
.cryptx-preview__verdict.is-bad::before { |
| 229 |
content: "✕"; |
| 230 |
} |
| 231 |
|
| 232 |
.cryptx-preview__error { |
| 233 |
color: #8a2424; |
| 234 |
} |
| 235 |
|
| 236 |
/* ---------------------------------------------------------------- fields -- */ |
| 237 |
|
| 238 |
.cryptx-color { |
| 239 |
display: flex; |
| 240 |
align-items: center; |
| 241 |
gap: 8px; |
| 242 |
} |
| 243 |
|
| 244 |
.cryptx-color input[type="color"] { |
| 245 |
width: 44px; |
| 246 |
height: 40px; |
| 247 |
padding: 2px; |
| 248 |
border: 1px solid #949494; |
| 249 |
border-radius: var(--cryptx-radius); |
| 250 |
background: none; |
| 251 |
cursor: pointer; |
| 252 |
flex: 0 0 auto; |
| 253 |
} |
| 254 |
|
| 255 |
.cryptx-color .components-base-control { |
| 256 |
flex: 1 1 auto; |
| 257 |
margin: 0; |
| 258 |
} |
| 259 |
|
| 260 |
.cryptx-media__preview { |
| 261 |
max-width: 160px; |
| 262 |
height: auto; |
| 263 |
border: 1px solid var(--cryptx-border-light); |
| 264 |
border-radius: var(--cryptx-radius); |
| 265 |
} |
| 266 |
|
| 267 |
.cryptx-media__buttons { |
| 268 |
display: flex; |
| 269 |
flex-wrap: wrap; |
| 270 |
gap: 8px; |
| 271 |
} |
| 272 |
|
| 273 |
/* --------------------------------------------------------------- actions -- */ |
| 274 |
|
| 275 |
.cryptx-settings__actions { |
| 276 |
margin-top: var(--cryptx-gap); |
| 277 |
padding: 12px 0; |
| 278 |
border-top: 1px solid var(--cryptx-border-light); |
| 279 |
background: transparent; |
| 280 |
} |
| 281 |
|
| 282 |
/* |
| 283 |
* The bar only follows the scroll while there is something to save. A bar that |
| 284 |
* sticks permanently covers the last option on a phone -- which it did -- and |
| 285 |
* it does so to offer a button that cannot be pressed. |
| 286 |
*/ |
| 287 |
.cryptx-settings__actions.is-dirty { |
| 288 |
position: sticky; |
| 289 |
bottom: 0; |
| 290 |
z-index: 10; |
| 291 |
padding: 12px; |
| 292 |
margin-inline: -4px; |
| 293 |
background: var(--cryptx-surface); |
| 294 |
border-top: 1px solid var(--cryptx-border); |
| 295 |
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08); |
| 296 |
padding-bottom: calc(12px + env(safe-area-inset-bottom)); |
| 297 |
} |
| 298 |
|
| 299 |
.cryptx-settings__status { |
| 300 |
margin: 8px 0 0; |
| 301 |
font-size: 12px; |
| 302 |
color: var(--cryptx-muted); |
| 303 |
} |
| 304 |
|
| 305 |
.cryptx-settings__status.is-dirty { |
| 306 |
color: #614f00; |
| 307 |
font-weight: 500; |
| 308 |
} |
| 309 |
|
| 310 |
.cryptx-loading { |
| 311 |
display: flex; |
| 312 |
align-items: center; |
| 313 |
gap: 8px; |
| 314 |
padding: 24px 0; |
| 315 |
color: var(--cryptx-muted); |
| 316 |
} |
| 317 |
|
| 318 |
/* ------------------------------------------------------------------ help -- */ |
| 319 |
|
| 320 |
.cryptx-help__snippet { |
| 321 |
margin: 0 0 12px; |
| 322 |
padding: 12px; |
| 323 |
border-radius: var(--cryptx-radius); |
| 324 |
background: var(--cryptx-code-bg); |
| 325 |
color: var(--cryptx-code-text); |
| 326 |
border: 1px solid var(--cryptx-code-bg); |
| 327 |
font-size: 12px; |
| 328 |
line-height: 1.6; |
| 329 |
/* Wrapped rather than scrolled sideways. A shortcode is meant to be read |
| 330 |
and copied, and on a phone the tail of it was simply off the edge with |
| 331 |
nothing to suggest it could be dragged into view. Line breaks written |
| 332 |
into the snippet are kept. */ |
| 333 |
white-space: pre-wrap; |
| 334 |
overflow-wrap: anywhere; |
| 335 |
} |
| 336 |
|
| 337 |
.cryptx-help__note { |
| 338 |
margin: 0; |
| 339 |
color: var(--cryptx-muted); |
| 340 |
font-size: 12px; |
| 341 |
} |
| 342 |
|
| 343 |
.cryptx-help__release + .cryptx-help__release { |
| 344 |
margin-top: var(--cryptx-gap); |
| 345 |
padding-top: var(--cryptx-gap); |
| 346 |
border-top: 1px solid var(--cryptx-border-light); |
| 347 |
} |
| 348 |
|
| 349 |
.cryptx-help__release h3 { |
| 350 |
display: flex; |
| 351 |
align-items: center; |
| 352 |
gap: 8px; |
| 353 |
margin: 0 0 8px; |
| 354 |
font-size: 14px; |
| 355 |
font-weight: 600; |
| 356 |
color: var(--cryptx-text); |
| 357 |
} |
| 358 |
|
| 359 |
.cryptx-help__badge { |
| 360 |
padding: 1px 8px; |
| 361 |
border-radius: 10px; |
| 362 |
background: #edfaef; |
| 363 |
color: #00450c; |
| 364 |
font-size: 11px; |
| 365 |
font-weight: 500; |
| 366 |
letter-spacing: 0.02em; |
| 367 |
text-transform: lowercase; |
| 368 |
} |
| 369 |
|
| 370 |
.cryptx-help__changelog ul { |
| 371 |
margin: 0; |
| 372 |
padding-left: 20px; |
| 373 |
list-style: disc; |
| 374 |
} |
| 375 |
|
| 376 |
.cryptx-help__changelog li { |
| 377 |
margin-bottom: 6px; |
| 378 |
line-height: 1.6; |
| 379 |
/* A bare support-forum URL in the older entries is longer than the column |
| 380 |
and pushed the whole card sideways. */ |
| 381 |
overflow-wrap: anywhere; |
| 382 |
} |
| 383 |
|
| 384 |
.cryptx-help__changelog code { |
| 385 |
padding: 1px 4px; |
| 386 |
border-radius: 2px; |
| 387 |
background: #f0f0f1; |
| 388 |
font-size: 12px; |
| 389 |
} |
| 390 |
|
| 391 |
.cryptx-help__older { |
| 392 |
margin-top: var(--cryptx-gap); |
| 393 |
padding-top: var(--cryptx-gap); |
| 394 |
border-top: 1px solid var(--cryptx-border-light); |
| 395 |
} |
| 396 |
|
| 397 |
.cryptx-help__older > summary { |
| 398 |
/* Large enough to hit with a thumb, and obviously a control rather than a |
| 399 |
heading that happens to have a triangle next to it. */ |
| 400 |
min-height: 44px; |
| 401 |
display: flex; |
| 402 |
align-items: center; |
| 403 |
cursor: pointer; |
| 404 |
color: var(--wp-admin-theme-color, #2271b1); |
| 405 |
font-weight: 500; |
| 406 |
} |
| 407 |
|
| 408 |
.cryptx-help__older > summary:focus-visible { |
| 409 |
outline: 2px solid var(--wp-admin-theme-color, #2271b1); |
| 410 |
outline-offset: 2px; |
| 411 |
border-radius: 2px; |
| 412 |
} |
| 413 |
|
| 414 |
.cryptx-help__older[open] > summary { |
| 415 |
margin-bottom: var(--cryptx-gap); |
| 416 |
} |
| 417 |
|
| 418 |
/* ----------------------------------------------------- wider than a phone -- */ |
| 419 |
|
| 420 |
@media (min-width: 783px) { |
| 421 |
.cryptx-settings { |
| 422 |
padding-inline: 0; |
| 423 |
} |
| 424 |
|
| 425 |
.cryptx-settings__header h1 { |
| 426 |
font-size: 2rem; |
| 427 |
} |
| 428 |
|
| 429 |
.cryptx-section__fields { |
| 430 |
gap: 28px; |
| 431 |
} |
| 432 |
|
| 433 |
.cryptx-tabs { |
| 434 |
/* Everything fits, so the scroll hint has nothing to announce. */ |
| 435 |
mask-image: none; |
| 436 |
} |
| 437 |
|
| 438 |
.cryptx-tabs__tab { |
| 439 |
padding: 12px 14px; |
| 440 |
} |
| 441 |
|
| 442 |
.cryptx-settings__actions.is-dirty { |
| 443 |
margin-inline: 0; |
| 444 |
padding-inline: 0; |
| 445 |
box-shadow: none; |
| 446 |
} |
| 447 |
} |
| 448 |
|
| 449 |
/* --------------------------------------------------------- reduced motion -- */ |
| 450 |
|
| 451 |
@media (prefers-reduced-motion: reduce) { |
| 452 |
.cryptx-tabs { |
| 453 |
scroll-behavior: auto; |
| 454 |
} |
| 455 |
} |
| 456 |
|