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