]> git.draconx.ca Git - homepage.git/blob - content/style.scss
Let's start a blog!
[homepage.git] / content / style.scss
1 /*
2  * Nick's web site: default stylesheet
3  *
4  * Copyright © 2018-2020 Nick Bowler
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19
20 // colour definitions
21 $backgroundcolour:  #ffffff;
22 $foregroundcolour:  #000000;
23
24 $linkdefaultcolour: #0000cd;
25 $linkactivecolour:  #ff0000;
26 $linkvisitedcolour: #800080;
27
28 $ruledefaultcolour: #d3d3d3;
29 $rulestrongcolour:  #696969;
30
31 $annotationcolour:  #708090;
32
33 $tableshadecolour:  #f5f5f5;
34
35 @mixin header_size($maxwidth, $fontsize) {
36     font-size: $fontsize;
37     max-width: 1em * ($maxwidth / $fontsize);
38 }
39
40 body {
41     background-color: $backgroundcolour;
42     color: $foregroundcolour;
43     font-family: sans-serif;
44     margin: 1em;
45 }
46
47 a:link { color: $linkdefaultcolour; }
48 a:visited { color: $linkvisitedcolour; }
49 a:active { color: $linkactivecolour; }
50
51 h1 { @include header_size(60em, 2em); }
52 h2 { @include header_size(60em, 1.5em); }
53 h5 { @include header_size(60em, 1em); }
54
55 p>img { max-width: 40em; width: 100%; height: auto; }
56
57 p, dt, dd, li {
58     text-align: justify;
59     padding: 0;
60     margin: 0;
61 }
62
63 p, table, div, ul, ol, dl, hr {
64     max-width: 50em;
65     padding: 0;
66     margin: 0;
67 }
68
69 p, table, body>div, h5 { margin: 1em 0; }
70
71 li { margin: 0 0 0 2em; }
72 dd { margin: 0 0 0 1em; }
73
74 hr {
75     clear: both;
76     margin: 0.5em 0;
77     border: 0;
78     border-top: 1px solid $ruledefaultcolour;
79 }
80
81 kbd {
82     font-family: monospace;
83     font-size: 0.95em;
84     &:before { content: "% "; }
85 }
86
87 .permalink {
88     font-size: small;
89     color: $annotationcolour;
90
91     a:link, a:visited { color: inherit; }
92 }
93 @media not screen {
94     .permalink { visibility: hidden; }
95 }
96
97 // General table styles.
98 table {
99     border: 1px solid $ruledefaultcolour;
100     border-collapse: collapse;
101     width: 100%;
102 }
103
104 table>* { font-size: 0.9em; }
105 caption {
106     caption-side: top;
107     font-weight: bold;
108     font-size: 1em;
109     text-align: left;
110     margin: 0 0 0.5em 0;
111 }
112
113 td, th {
114     vertical-align: middle;
115     text-align: left;
116     padding: 1ex;
117     margin: 0;
118 }
119
120 thead>tr, tbody>tr { border: solid $ruledefaultcolour; }
121 th, thead>tr { border-bottom: 1px solid $rulestrongcolour; }
122 *>table, *>th { border: none; }
123 thead>tr { border-width: 1px; }
124 tbody>tr { border-width: 0 1px; }
125
126 td + td { box-shadow: -1px 0 $backgroundcolour; }
127
128 tbody>tr {
129     &:nth-of-type(even) { background-color: $tableshadecolour; }
130     &:last-child { border-bottom: solid 1px $ruledefaultcolour; }
131 }
132
133 // Specific table styles
134 table.cc {
135     &>tr>*:first-child, &>*>tr>*:first-child {
136         &+* { text-align: center; }
137         text-align: center;
138     }
139 }
140
141 // Site header rules
142 #breadcrumbs>*, #sitetitle>* { font-size: 0.8em; }
143 #breadcrumbs {
144     * {
145         display: inline;
146         list-style-type: none;
147         vertical-align: top;
148         padding: 0;
149         margin: 0;
150     }
151
152     li + li:before { content: "/ "; }
153 }
154 #sitetitle * {
155     display: inline-block;
156     float: right;
157 }
158
159 // Site footer rules
160 #footer, #article-info {
161     text-align: center;
162     max-width: 44em;
163     padding: 0 3em;
164     margin: 0;
165
166     p {
167         display: inline-block;
168         font-size: 0.8em;
169         max-width: 100%;
170         margin: 0.2em 0;
171     }
172 }
173
174 #footer p { color: $annotationcolour; }
175 #article-info p { font-style: italic; }
176
177 // "unordered" lists with explicit ordering in content
178 ul.ordered > {
179     li { list-style: none; }
180     li>span:first-child, li>*:first-child>span:first-child {
181         display: inline-block;
182         text-align: right;
183         margin-left: -1.8em;
184         min-width: 1.8em;
185     }
186 }
187
188 @media (max-width: 512px) {
189     body { margin: 0.6em; }
190     ul ul { margin-left: -1.2em; }
191     dd { margin: 0; }
192 }
193
194 @media (max-width: 35em) {
195     #sitetitle * { float: none; }
196     #footer { padding: 0 1em; }
197 }
198 @media (max-width: 28em) {
199     * { text-align: left; }
200 }