|
| 1 | +:where(html) { |
| 2 | + --gray-0-hsl: 210 17% 98%; |
| 3 | + --gray-1-hsl: 210 17% 95%; |
| 4 | + --gray-2-hsl: 210 16% 93%; |
| 5 | + --gray-3-hsl: 210 14% 89%; |
| 6 | + --gray-4-hsl: 210 14% 83%; |
| 7 | + --gray-5-hsl: 210 11% 71%; |
| 8 | + --gray-6-hsl: 210 7% 56%; |
| 9 | + --gray-7-hsl: 210 9% 31%; |
| 10 | + --gray-8-hsl: 210 10% 23%; |
| 11 | + --gray-9-hsl: 210 11% 15%; |
| 12 | + --gray-10-hsl: 214 14% 10%; |
| 13 | + --gray-11-hsl: 216 16% 6%; |
| 14 | + --gray-12-hsl: 210 40% 2% |
| 15 | +} |
| 16 | + |
| 17 | +:where(.btn, button, input:is([type=button], [type=submit], [type=reset])), |
| 18 | +:where(input[type=file])::-webkit-file-upload-button, |
| 19 | +:where(input[type=file])::file-selector-button { |
| 20 | + --_accent: initial; |
| 21 | + --_text: initial; |
| 22 | + --_size: initial; |
| 23 | + --_bg-light: #fff; |
| 24 | + --_bg-dark: var(--surface-3); |
| 25 | + --_bg: var(--_bg-light); |
| 26 | + --_border: var(--surface-3); |
| 27 | + --_highlight-size: 0; |
| 28 | + --_highlight-light: hsl(var(--gray-5-hsl)/25%); |
| 29 | + --_highlight-dark: hsl(var(--gray-12-hsl)/25%); |
| 30 | + --_highlight: var(--_highlight-light); |
| 31 | + --_ink-shadow-light: 0 1px 0 var(--gray-3); |
| 32 | + --_ink-shadow-dark: 0 1px 0 var(--surface-1); |
| 33 | + --_ink-shadow: var(--_ink-shadow-light); |
| 34 | + --_icon-size: var(--size-relative-7); |
| 35 | + --_icon-color: var(--_accent, var(--link)); |
| 36 | + -webkit-tap-highlight-color: transparent; |
| 37 | + -webkit-touch-callout: none; |
| 38 | + align-items: center; |
| 39 | + background: var(--_bg); |
| 40 | + border: var(--border-size-1) solid var(--_border); |
| 41 | + border-radius: 0; |
| 42 | + box-shadow: var(--shadow-1), 0 1px var(--surface-3), 0 0 0 var(--_highlight-size) var(--_highlight); |
| 43 | + color: var(--_text); |
| 44 | + display: inline-flex; |
| 45 | + font-size: var(--_size); |
| 46 | + font-weight: var(--font-weight-7); |
| 47 | + gap: var(--size-2); |
| 48 | + justify-content: center; |
| 49 | + padding-block: .75ch; |
| 50 | + padding-inline: var(--size-relative-6); |
| 51 | + text-align: center; |
| 52 | + text-shadow: var(--_ink-shadow); |
| 53 | + transition: border-color .5s var(--ease-3); |
| 54 | + user-select: none |
| 55 | +} |
| 56 | + |
| 57 | +@media (prefers-color-scheme:dark) { |
| 58 | + :where(.btn, button, input:is([type=button], [type=submit], [type=reset])), |
| 59 | + :where(input[type=file])::-webkit-file-upload-button, |
| 60 | + :where(input[type=file])::file-selector-button { |
| 61 | + --_highlight: var(--_highlight-dark); |
| 62 | + --_bg: var(--_bg-dark); |
| 63 | + --_ink-shadow: var(--_ink-shadow-dark) |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +@media (prefers-reduced-motion:no-preference) { |
| 68 | + :where(.btn, button, input:is([type=button], [type=submit], [type=reset])), |
| 69 | + :where(input[type=file])::-webkit-file-upload-button, |
| 70 | + :where(input[type=file])::file-selector-button { |
| 71 | + transition: border-color .5s var(--ease-3), box-shadow 145ms var(--ease-4), outline-offset 145ms var(--ease-4) |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +:where(.btn, button, input:is([type=button], [type=submit], [type=reset]))[disabled] { |
| 76 | + --_bg: none; |
| 77 | + --_text: var(--gray-6); |
| 78 | + box-shadow: var(--shadow-1); |
| 79 | + cursor: not-allowed |
| 80 | +} |
| 81 | + |
| 82 | +@media (prefers-color-scheme:dark) { |
| 83 | + :where(.btn, button, input:is([type=button], [type=submit], [type=reset]))[disabled] { |
| 84 | + --_text: var(--gray-5) |
| 85 | + } |
| 86 | +} |
| 87 | + |
| 88 | +:where(.btn, button, input:is([type=button], [type=submit], [type=reset])):where(:not(:active):hover) { |
| 89 | + --_highlight-size: var(--size-2); |
| 90 | + transition-duration: .25s |
| 91 | +} |
| 92 | + |
| 93 | +:where(.btn, button, input:is([type=button], [type=submit], [type=reset]))>:where(svg) { |
| 94 | + block-size: var(--_icon-size); |
| 95 | + filter: drop-shadow(var(--_ink-shadow)); |
| 96 | + flex-shrink: 0; |
| 97 | + inline-size: var(--_icon-size) |
| 98 | +} |
| 99 | + |
| 100 | +:where(.btn, button, input:is([type=button], [type=submit], [type=reset]))>:where(svg>*) { |
| 101 | + stroke: var(--_icon-color); |
| 102 | + stroke-width: var(--border-size-2) |
| 103 | +} |
| 104 | + |
| 105 | +:where([type=submit], form button:not([type], [disabled])) { |
| 106 | + --_text: var(--_accent, var(--link)) |
| 107 | +} |
| 108 | + |
| 109 | +:where([type=reset]) { |
| 110 | + --_text: var(--red-6); |
| 111 | + --_border: var(--red-3) |
| 112 | +} |
| 113 | + |
| 114 | +:where([type=reset]):focus-visible { |
| 115 | + outline-color: var(--red-6) |
| 116 | +} |
| 117 | + |
| 118 | +@media (prefers-color-scheme:dark) { |
| 119 | + :where([type=reset]) { |
| 120 | + --_text: var(--red-2); |
| 121 | + --_border: var(--surface-3) |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +:where([type=submit], [type=reset], form button:not([type])):is(:hover, :focus-visible):not([disabled]) { |
| 126 | + --_border: currentColor |
| 127 | +} |
| 128 | + |
| 129 | +:where(input[type=file]) { |
| 130 | + align-self: flex-start; |
| 131 | + border: var(--border-size-1) solid var(--surface-2); |
| 132 | + border-radius: var(--radius-2); |
| 133 | + box-shadow: var(--inner-shadow-4); |
| 134 | + color: var(--text-2); |
| 135 | + cursor: auto; |
| 136 | + max-inline-size: 100%; |
| 137 | + padding: 0 |
| 138 | +} |
| 139 | + |
| 140 | +:where(input[type=file])::-webkit-file-upload-button, |
| 141 | +:where(input[type=file])::file-selector-button { |
| 142 | + cursor: pointer; |
| 143 | + margin-inline-end: var(--size-relative-6) |
| 144 | +} |
| 145 | + |
| 146 | +@media (prefers-color-scheme:dark) { |
| 147 | + :where([disabled]), |
| 148 | + :where([type=reset]), |
| 149 | + :where([type=submit]), |
| 150 | + :where(form button:not([type=button])) { |
| 151 | + --_bg: var(--surface-1) |
| 152 | + } |
| 153 | +} |
0 commit comments