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