-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.css
307 lines (264 loc) · 5.48 KB
/
styles.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*
The Rules of Acquisition @ ferengi.bible
Stylesheet
Copyright (C) 2024 Joey Parrish
Licensed under CC0 1.0 (see LICENSE)
*/
/* Basic colors, assuming light mode. */
body {
background: white;
color: black;
font-family: 'Roboto', serif;
font-weight: 400;
font-style: normal;
}
* {
color: black;
border-color: black;
}
/* Everything below is based on the root font size. Make that scale with the
* viewport. */
html {
font-size: calc(min(3vw,3vh));
}
/* Font for Ferengi glyphs. */
@font-face {
font-family: 'Ferengi';
src: url('Ferengi.woff2') format('woff2');
font-display: block;
}
.ferengi {
font-family: 'Ferengi';
}
/* Font for arrows. */
@font-face {
font-family: 'OpenArrow';
src: url('OpenArrow-Regular.woff2') format('woff2'),
font-weight: normal;
font-style: normal;
font-display: swap;
unicode-range: U+2190-21ff;
}
/* Always hidden. */
.hidden {
display: none;
}
/* Every page is hidden by default. */
.page {
display: none;
}
/* The upsell dialog is hidden by default. */
.upsell {
display: none;
}
/* A page whose input is checked is shown. */
input:checked + .page {
display: flex;
}
/* A premium page whose input is checked has the upsell shown. */
input:checked + .page.premium ~ .upsell {
display: flex;
}
/* Blur the rule in a "premium" page, and make the text unselectable. */
.page.premium .rule {
filter: blur(0.1em) url(#distort);
pointer-events: none;
user-select: none;
}
/* Margin around the body */
body {
margin: 1rem;
}
/* A smaller container for the main content. */
#container {
position: relative; /* container for absolute-positioned children */
max-width: 30rem;
margin: auto;
}
/* Each page of the book, including the cover. */
.page {
position: relative; /* container for absolute-positioned children */
flex-direction: column;
justify-content: center;
text-align: center;
border: 0.1rem solid;
padding: 2rem;
height: 24rem;
}
.number {
font-size: 4rem;
position: absolute;
top: 1rem;
left: 0;
right: 0;
}
.rule {
font-size: 2rem;
max-height: 6em;
}
/* Navigation links. */
.nav-left, .nav-right, .nav-cover {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
background: none;
border: 0.1rem solid;
border-radius: 0.5em;
cursor: pointer;
box-sizing: border-box;
z-index: 2;
/* The unicode symbols I'm using for these end up misaligned in Roboto.
* They look fine in Arial, but Android doesn't have that.
* Rather than load a web font for Arial or something like it, use a very
* small font that only contains arrow glyphs. */
font-family: 'OpenArrow';
/* With a consitent font for these symbols, now I can make some small
* alignment adjustments and know that it will always be correct. */
font-size: 1.3rem;
line-height: 1.3rem;
padding: 0.2rem 0.8rem;
padding-top: 0.45rem;
}
.nav-left {
left: 0.5rem;
bottom: 1em;
}
.nav-right {
right: 0.5rem;
bottom: 1em;
}
.nav-cover {
left: 0.5rem;
top: 0.5rem;
}
/* The upsell overlay for "premium" rules (that don't actually exist). */
.upsell {
position: absolute;
bottom: 1rem;
/* Not wall-to-wall, to ensure nav buttons are exposed: */
left: 1rem;
right: 1rem;
/* Padding around the text, so the background scrim covers some of the rule
* beneath */
padding: 1rem;
padding-top: 6rem;
padding-bottom: 3rem;
font-size: 1.5rem;
flex-direction: column;
justify-content: end;
background: linear-gradient(
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0.8) 25%,
rgba(255, 255, 255, 1));
text-align: center;
z-index: 1;
}
/* Cover material. */
#p0 {
justify-content: start;
}
.title {
font-size: 3rem;
filter: drop-shadow(0 0 1rem white);
}
.title.ferengi {
/* Put this text in the background, behind the English title. */
position: absolute;
opacity: 40%;
font-size: 2.5rem;
line-height: 140%;
top: 0rem;
left: 2rem;
right: 2rem;
pointer-events: none;
}
.author {
font-size: 1.5rem;
margin-top: 1rem;
}
.publisher {
margin-top: 1rem;
font-size: 0.7rem;
}
.promo {
position: absolute;
right: 1rem;
bottom: 2rem;
width: 10rem;
font-style: italic;
font-size: 1.5rem;
padding: 2rem;
}
.starburst {
position: absolute;
/* Combined with preserveAspectRatio="none", this stretches the SVG. */
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
/* Keep it under the promo text. */
z-index: -1;
fill: #bbb;
}
/* Sponsor dialog. */
#sponsorDialog {
/* Hidden by default. */
display: none;
/* Covering the page. */
background: white;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 2rem;
border: 0.1rem solid;
z-index: 3;
/* Same font size as the upsell dialog. */
font-size: 1.5rem;
}
#sponsorDialog.shown {
display: unset;
}
#sponsorDialog div {
margin-top: 1rem;
}
#sponsorDialog div:first-child {
margin-top: 2rem;
}
#sponsorDialog #sponsorClose {
position: absolute;
top: 1rem;
right: 1rem;
margin-top: 0;
}
/* Color tweaks for dark mode. */
@media (prefers-color-scheme: dark) {
body {
background: black;
color: white;
}
* {
color: white;
border-color: white;
}
.title {
filter: drop-shadow(0 0 1rem black);
}
.starburst {
/* This should look fine in both light and dark mode. */
fill: #888;
}
.upsell {
background: linear-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.8) 25%,
rgba(0, 0, 0, 1));
}
#sponsorDialog {
background: black;
}
}