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