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