]> git.cworth.org Git - lmno.games/blob - style.css
Add simple JavaScript processing of game ID form submission
[lmno.games] / style.css
1 /*\
2 |*|
3 |*| Core elements: Sizing and padding
4 |*|
5 \*/
6
7 body {
8     line-height: 1.5;
9     font-family: sans-serif;
10 }
11
12 h1 {
13     font-size: 150%;
14     font-weight: bold;
15 }
16
17 h2 {
18     font-size: 110%;
19     font-weight: bold;
20 }
21
22 /*\
23 |*|
24 |*| Overall page layout
25 |*|
26 |*| Assumes: Top-level div with id="page" for all content
27 |*|
28 \*/
29
30 /* Mobile-first: At small sized we have a white background and use the
31  * entire screen width for the page (so the background color of the
32  * body is not visible anywhere). */
33 body {
34     background-color: #333738;
35 }
36
37 #page {
38     background-color: white;
39 }
40
41 /* For a small screen (in either width or height) change the
42  * background of the body element to white so the application always
43  * appears as if it is "full screen".
44  */
45 @media screen and (max-width: 500px) and (max-height: 860px) {
46     body {
47         background-color: white;
48     }
49 }
50
51 /* We never let the page content get larger than a large fixed width.
52  *
53  * And when the screen is wide enough, we can afford some "wasted"
54  * space on either side of the page content. This starts at 0 for a
55  * 620px wide page up to 50px on either side for a 720px wide page.
56  *
57  * Wider than that and we start to see the background on either side
58  * of the page content.
59  */
60 #page {
61     box-sizing: border-box;
62     max-width: 720px;
63     margin-left: auto;
64     margin-right: auto;
65     padding-top: 0;
66     padding-bottom: 0;
67     padding-left: 1em;
68     padding-right: 1em;
69 }
70
71 @media screen and (min-width: 620px) and (max-width: 720px) {
72     #page {
73         padding-left: calc(1em + (100% - 620px)/2);
74         padding-right: calc(1em + (100% - 620px)/2);
75     }
76 }
77
78 @media screen and (min-width: 720px) {
79     #page {
80         padding-left: calc(1em + 50px);
81         padding-right: calc(1em + 50px);
82     }
83 }
84
85 /* The calculations for height are different. We don't have any
86  * vertical centering, so instead we have only some fixed padding on
87  * the top. Then, the margin which allows the background to be visible
88  * on the top and bottom starts appearing at a viewport height of 648
89  * and tops out at a size of 36px.
90  */
91 #page {
92     min-height: 500px;
93     padding-top: 1em;
94 }
95
96 @media screen and (min-height: 648px) and (max-height: 720px) {
97     #page {
98         margin-top: calc((100vh - 648px)/2);
99         margin-bottom: calc((100vh - 648px)/2);
100     }
101 }
102
103 @media screen and (min-height: 720px) {
104     #page {
105         margin-top: 36px;
106         margin-bottom: 36px;
107     }
108 }
109
110 /*\
111 |*|
112 |*| Responsive form layout
113 |*|
114 \*/
115
116 /*
117  *
118  * Within the form, fields can be placed in <div> elements with
119  * class "form-field". Each can also have an additional class of one
120  * of "small", "medium", or "large". These classes will be used to
121  * select either a 1- or 2-column layout for each row depending on the
122  * width of the screen.
123  *
124  * Expected layout is as follows:
125  *
126  *   "large"   rows: 1-column on all devices
127  *
128  *   "medium"  rows: 2-column on wide displays (laptop/desktop/tablet)
129  *                   1-column on small display (phones)
130  *
131  *   "small"   rows: 2-column on all devices
132  *
133  * Finally, a class of either "left" or "right" will select which
134  * column the field should appear in for fields that end up in 2
135  * columns.
136  */
137 form {
138     max-width: 100%;
139     display: grid;
140     grid-template-columns: 1fr 1fr;
141     grid-column-gap: 1em;
142 }
143
144 .form-field.small.left,.form-field.medium.left {
145     grid-column-start: 1;
146 }
147
148 .form-field.small.right,.form-field.medium.right {
149     grid-column-start: 2;
150 }
151
152 .form-field.large {
153     grid-column-start: 1;
154     grid-column-end: span 2;
155 }
156
157 /* For a narrow screen, use a single-column for medium form fields. */
158 @media screen and (max-width: 600px) {
159     .form-field.medium.left,.form-field.medium.right {
160         grid-column-start: 1;
161         grid-column-end: span 2
162     }
163 }
164
165 /*\
166 |*|
167 |*| Styling for form input fields
168 |*|
169 \*/
170
171 label {
172     font-size: 125%;
173 }
174
175 input {
176     box-sizing: border-box;
177     font-size: 125%;
178     padding: 0.5em;
179     width: 100%;
180     border: 1px solid #287789;
181     border-radius: 4px;
182 }
183
184 input:focus {
185     border: 2px solid #44c7ef;
186 }
187
188 button {
189     display: inline-block;
190     border-radius: 4px;
191     background-color: #287789;
192     border: none;
193     color: white;
194     text-align: center;
195     font-size: 125%;
196     margin-top: .25em;
197     padding-top: 0.25em;
198     padding-bottom: 0.25em;
199     width: 200px;
200 }
201
202 button:hover {
203     transform: translateY(-1px);
204     background-color: #44c7ef;
205 }
206
207 :focus {
208     outline: none;
209 }
210
211 ::-moz-focus-inner {
212     border: 0;
213 }
214
215 /*\
216 |*|
217 |*| Styling for a message area
218 |*|
219 \*/
220
221 /* Default message severity is "info" but can be overriden. */
222 .message {
223     padding: 1em;
224     background-color: #44c7ef;
225     color: white;
226     transition: 0.3s;
227     margin-bottom: 0.5em;
228     font-weight: bold;
229     border-radius: 4px;
230     position: relative;
231 }
232
233 .success {
234     background-color: #44c7ef;
235 }
236
237 .warning {
238     background-color: #ffa92a;
239 }
240
241 .danger {
242     background-color: #f56257
243 }
244
245 .hide-button {
246     color: white;
247     font-size: 125%;
248     font-weight: bold;
249     cursor: pointer;
250     position: absolute;
251     right: 0.5em;
252     top: 0;
253 }
254
255 .hide-button:hover {
256     color: #bc2822;
257 }