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