UNPKG

3.02 kBCSSView Raw
1@import "../props.media.css";
2@import "../props.gray-hsl.css";
3
4:where(button,input:is([type="button"],[type="submit"],[type="reset"])),
5:where(input[type="file"])::-webkit-file-upload-button,
6:where(input[type="file"])::file-selector-button {
7 --_accent: initial /* your color */;
8 --_text: initial /* your text color */;
9 --_size: initial /* your size */;
10
11 --_bg: white;
12 --_border: var(--surface-3);
13
14 --_highlight-size: 0;
15 --_highlight: hsl(var(--gray-5-hsl) / 25%);
16
17 --_ink-shadow: 0 1px 0 var(--gray-3);
18
19 --_icon-size: 2ch;
20 --_icon-color: var(--_accent, var(--link));
21
22 font-size: var(--_size);
23 background: var(--_bg);
24 color: var(--_text);
25 border: var(--border-size-2) solid var(--_border);
26 box-shadow:
27 var(--shadow-2),
28 0 1px var(--surface-3),
29 0 0 0 var(--_highlight-size) var(--_highlight)
30 ;
31 text-shadow: var(--_ink-shadow);
32
33 display: inline-flex;
34 justify-content: center;
35 align-items: center;
36 text-align: center;
37 gap: var(--size-2);
38
39 font-weight: var(--font-weight-7);
40 border-radius: var(--radius-2);
41 padding-block: .75ch;
42 padding-inline: 1.75ch;
43
44 user-select: none;
45 -webkit-tap-highlight-color: transparent;
46 -webkit-touch-callout: none;
47
48 transition: border-color .5s var(--ease-3) 3s;
49
50 @media (--motionOK) {
51 transition:
52 border-color .5s var(--ease-3) 3s,
53 box-shadow 145ms var(--ease-4),
54 outline-offset 145ms var(--ease-4);
55 }
56}
57
58:where(button,input:is([type="button"],[type="submit"],[type="reset"])) {
59 /* disabled */
60 &[disabled] {
61 --_bg: none;
62 --_text: var(--gray-6);
63 cursor: not-allowed;
64 box-shadow: var(--shadow-1);
65 }
66
67 /* pressing */
68 &:where(:not(:active):hover) {
69 --_highlight-size: var(--size-2);
70 transition-delay: 0s;
71 transition-duration: .25s;
72 }
73
74 /* icons */
75 & > :where(svg) {
76 flex-shrink: 0;
77 filter: drop-shadow(var(--_ink-shadow));
78 block-size: var(--_icon-size);
79 inline-size: var(--_icon-size);
80 }
81
82 & > :where(svg > *) {
83 stroke: var(--_icon-color);
84 stroke-width: var(--border-size-2);
85 }
86}
87
88/* adaptive indigo text */
89:where([type="submit"], form button:not([type],[disabled])) {
90 --_text: var(--_accent, var(--link));
91}
92
93/* red reset */
94:where([type="reset"]) {
95 --_text: var(--red-6);
96 --_border: var(--red-3);
97
98 &:focus-visible {
99 outline-color: var(--red-6);
100 }
101}
102
103/* submit, form > button, reset matching hover border color */
104:where([type="submit"], [type="reset"], form button:not([type])):is(:hover, :focus-visible):not([disabled]) {
105 --_border: currentColor;
106}
107
108/* file input */
109:where(input[type="file"]) {
110 max-inline-size: 100%;
111 padding: 0;
112 cursor: initial;
113 align-self: flex-start;
114 border-radius: var(--radius-2);
115 border: var(--border-size-1) solid var(--surface-2);
116 box-shadow: var(--inner-shadow-4);
117 color: var(--text-2);
118}
119
120:where(input[type="file"])::-webkit-file-upload-button,
121:where(input[type="file"])::file-selector-button {
122 margin-inline-end: 1.75ch;
123 cursor: pointer;
124}