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