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