]> git.cworth.org Git - lmno.games/blob - style.css
Empathy: Let React now I'm a good boy and I won't mutate state
[lmno.games] / style.css
1 /* Because this is the only sizing that is sane, make it global. */
2 * {
3     box-sizing: border-box;
4 }
5
6 /*\
7 |*|
8 |*| Properties for the page: colors, etc.
9 |*|
10 |*| This is intended to be the easiest section to edit
11 |*| some easy custom theming, (a custom color scheme, etc.).
12 |*|
13 \*/
14
15 :root {
16     /* Standard colors for text. */
17     --text-fg-color: #333738;
18     --text-fg-color-max-contrast: black;
19     --text-bg-color: white;
20     --outside-page-bg-color: #333738;
21
22     /* A little color to avoid a fully monochromatic theme. */
23     --accent-color: #287789;
24     --accent-color-bright: #44c7ef;
25     --text-fg-on-accent: white;
26     --text-fg-on-accent-bright: #333738;
27
28     /* Some colors intended to convey semnatics. */
29     --warning-color: #ffa92a;
30     --danger-color: #f56257;
31     --danger-color-dark: #bc2822;
32
33     /* Page layout */
34     --page-max-width: 720px;
35     --page-max-pad: 50px;
36     --page-max-width-padded: calc(var(--page-max-width) + 2 * var(--page-max-pad));
37 }
38
39 /*\
40 |*|
41 |*| Core elements: Sizing, padding, and application of theme colors
42 |*|
43 \*/
44
45 body {
46     line-height: 1.25;
47     font-family: sans-serif;
48     color: var(--text-fg-color-max-contrast);
49 }
50
51 h1,h2 {
52     color: var(--text-fg-color);
53     font-weight: bold;
54 }
55
56 h1 {
57     font-size: 150%;
58 }
59
60 h2 {
61     font-size: 110%;
62 }
63
64 /* Don't underline links in headers */
65 h1 a {
66     text-decoration: none;
67 }
68
69 p,dl,dd,form {
70     margin-bottom: 1em;
71 }
72
73 ul li {
74     margin-left: 1em;
75     list-style-type: disc;
76     margin-bottom: 0.5em;
77 }
78
79 a:link    {
80     color: var(--accent-color);
81 }
82 a:visited {
83     color: var(--accent-color);
84 }
85 @media (hover:hover) {
86     a:hover   {
87         color: var(--accent-color-bright);
88     }
89 }
90 a:active  {
91     color: var(--accent-color-bright);
92 }
93
94 /*\
95 |*|
96 |*| Overall page layout
97 |*|
98 |*| Assumes: Top-level div with id="page" for all content
99 |*|
100 \*/
101
102 /* Mobile-first: At small sized we have a white background and use the
103  * entire screen width for the page (so the background color of the
104  * body is not visible anywhere). */
105 body {
106     background-color: var(--outside-page-bg-color);
107 }
108
109 #page {
110     background-color: var(--text-bg-color);
111 }
112
113 /* For a small screen (in either width or height) change the
114  * background of the body element to white so the application always
115  * appears as if it is "full screen".
116  */
117 @media screen and (max-width: 500px) and (max-height: 860px) {
118     body {
119         background-color: var(--text-bg-color);
120     }
121 }
122
123 /* We never let the page content get larger than a large fixed width.
124  *
125  * And when the screen is wide enough, we can afford some "wasted"
126  * space on either side of the page content, (up to --page-max-pad).
127  *
128  * Note: This --page-max-width-padded for the page includes the
129  * padding so the actual content is only ever as wide as
130  * --page-max-width.
131  *
132  * Wider than that and we start to see the background on either side
133  * of the page content.
134  */
135 #page {
136     max-width: var(--page-max-width-padded);
137     margin-left: auto;
138     margin-right: auto;
139     padding-top: 0;
140     padding-bottom: 2em;
141     padding-left: 1em;
142     padding-right: 1em;
143 }
144
145 @media screen and (min-width: var(--page-max-width)) and (max-width: var(--page-max-width-padded)) {
146     #page {
147         padding-left: calc(1em + (100% - var(--page-max-width))/2);
148         padding-right: calc(1em + (100% - var(--page-pax-width))/2);
149     }
150 }
151
152 @media screen and (min-width: var(--page-pax-width-padded)) {
153     #page {
154         padding-left: calc(1em + var(--page-max-pad));
155         padding-right: calc(1em + var(--page-max-pad));
156     }
157 }
158
159 /* The calculations for height are different. We don't have any
160  * vertical centering, so instead we have only some fixed padding on
161  * the top. Then, the margin which allows the background to be visible
162  * on the top and bottom starts appearing at a viewport height of 648
163  * and tops out at a size of 36px.
164  */
165 #page {
166     min-height: 500px;
167     padding-top: 1em;
168 }
169
170 @media screen and (min-height: 648px) and (max-height: 720px) {
171     #page {
172         margin-top: calc((100vh - 648px)/2);
173         margin-bottom: calc((100vh - 648px)/2);
174     }
175 }
176
177 @media screen and (min-height: 720px) {
178     #page {
179         margin-top: 36px;
180         margin-bottom: 36px;
181     }
182 }
183
184 /*\
185 |*|
186 |*| Responsive form layout
187 |*|
188 \*/
189
190 /*
191  *
192  * Within the form, fields can be placed in <div> elements with
193  * class "form-field". Each can also have an additional class of one
194  * of "small", "medium", or "large". These classes will be used to
195  * select either a 1- or 2-column layout for each row depending on the
196  * width of the screen.
197  *
198  * Expected layout is as follows:
199  *
200  *   "large"   rows: 1-column on all devices
201  *
202  *   "medium"  rows: 2-column on wide displays (laptop/desktop/tablet)
203  *                   1-column on small display (phones)
204  *
205  *   "small"   rows: 2-column on all devices
206  *
207  * Finally, a class of either "left" or "right" will select which
208  * column the field should appear in for fields that end up in 2
209  * columns.
210  */
211 form {
212     max-width: 100%;
213     display: grid;
214     grid-template-columns: 1fr 1fr;
215     grid-column-gap: 1em;
216 }
217
218 .form-field.small.left,.form-field.medium.left {
219     grid-column-start: 1;
220 }
221
222 .form-field.small.right,.form-field.medium.right {
223     grid-column-start: 2;
224 }
225
226 .form-field.large {
227     grid-column-start: 1;
228     grid-column-end: span 2;
229 }
230
231 /* For a narrow screen, use a single-column for medium form fields. */
232 @media screen and (max-width: 600px) {
233     .form-field.medium.left,.form-field.medium.right {
234         grid-column-start: 1;
235         grid-column-end: span 2
236     }
237 }
238
239 /*\
240 |*|
241 |*| Styling for form input fields
242 |*|
243 \*/
244
245 label {
246     font-size: 125%;
247 }
248
249 input {
250     box-sizing: border-box;
251     font-size: 125%;
252     height: 40px;
253     padding: 0.5em;
254     width: 100%;
255     border: 1px solid var(--accent-color);
256     border-radius: 4px;
257 }
258
259 input:focus {
260     border: 2px solid var(--accent-color-bright);
261 }
262
263 button {
264     display: inline-block;
265     border-radius: 4px;
266     background-color: var(--accent-color);
267     border: none;
268     color: var(--text-fg-on-accent);
269     text-align: center;
270     font-size: 125%;
271     margin-top: .25em;
272     padding-top: 0.25em;
273     padding-bottom: 0.25em;
274     width: 200px;
275     cursor: pointer;
276 }
277
278 button.inline {
279     font-size: 72%;
280     font-weight: bold;
281     width: auto;
282 }
283
284 @media (hover:hover) {
285     button:hover {
286         transform: translateY(-1px);
287         background-color: var(--accent-color-bright);
288     }
289 }
290
291 :focus {
292     outline: none;
293 }
294
295 ::-moz-focus-inner {
296     border: 0;
297 }
298
299 /*\
300 |*|
301 |*| Styling for a message area
302 |*|
303 \*/
304
305 /* Default message severity is "info" but can be overriden. */
306 .message {
307     padding: 1em;
308     background-color: var(--accent-color-bright);
309     color: white;
310     transition: 0.3s;
311     margin-bottom: 0.5em;
312     font-weight: bold;
313     border-radius: 4px;
314     position: relative;
315 }
316
317 .success {
318     background-color: var(--accent-color-bright);
319 }
320
321 .warning {
322     background-color: var(--warning-color);
323 }
324
325 .danger {
326     background-color: var(--danger-color);
327 }
328
329 .hide-button {
330     color: white;
331     font-size: 125%;
332     font-weight: bold;
333     cursor: pointer;
334     position: absolute;
335     right: 0.5em;
336     top: 0;
337 }
338
339 @media (hover:hover) {
340     .hide-button:hover {
341         color: var(--danger-color-dark);
342     }
343 }
344
345 /*\
346 |*|
347 |*| Game-specific markup
348 |*|
349 \*/
350
351 .game-id, .players-header {
352     font-size: 110%;
353     font-weight: bold;
354 }