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