diff --git a/css/style.css b/css/style.css index 4cd977f..cb94eea 100644 --- a/css/style.css +++ b/css/style.css @@ -1,89 +1,214 @@ +/* variables */ :root { --font-size: 12pt; --line-height: 1.625; - --height-unit: calc(var(--font-size) * var(--line-height)); - --width-unit: 1ch; - --padding-left: calc(1 * var(--width-unit)); - --padding-right: calc(1 * var(--width-unit)); - --padding-top: calc(1 * var(--height-unit)); - --padding-bottom: calc(1 * var(--height-unit)); - --gap-vertical: calc(1 * var(--height-unit)); - --gap-horizontal: calc(2 * var(--width-unit)); - --column-width: clamp(32ch, 72ch, calc(100vw - var(--gap-horizontal) - var(--padding-left) - var(--padding-right) - var(--width-unit))); - font: var(--font-size)/var(--line-height) monospace; - color-scheme: light dark; + --font-family: monospace; + + /* font-derived vertical and horizontal units */ + --v-un: calc(var(--font-size) * var(--line-height)); + --h-un: 1ch; + + /* gaps and paddings */ + --body-padding-h: var(--h-un); + --body-padding-v: var(--v-un); + --main-gap-h: calc(2 * var(--h-un)); + --main-gap-v: 0; + + /* font-derived column width */ + --max-col-w: calc(100vw - (2 * var(--body-padding-h)) - var(--main-gap-h) - 1ch); + --col-w: clamp(32ch, 72ch, var(--max-col-w)); + + /* colors */ + --fg-c: #000000; + --bg-c: #ffffff; + --link-c: hsl(240 100% 50%); + --visited-c: hsl(270 100% 50%); + --active-c: hsl(0 100% 50%); +} + +@media (prefers-color-scheme: dark) { + :root { + --fg-c: #ffffff; + --bg-c: #000000; + --link-c: hsl(240 100% 75%); + --visited-c: hsl(270 100% 75%); + --active-c: hsl(0 100% 75%); + } } /* reset */ * { box-sizing: border-box; + margin: unset; + hyphens: auto; } -body { - color: light-dark(#000000, #ffffff); - background-color: light-dark(#ffffff, #000000); - margin: 0; + +/* root */ +:root { + color: var(--fg-c); + background-color: var(--bg-c); + font: var(--font-size)/var(--line-height) var(--font-family); } + +/* content sectioning */ +address { + font-style: unset; +} + h1, h2, h3, h4, h5, h6 { - font: inherit; + font-size: unset; + font-weight: bold; } -h1 { - font-weight: bold; - margin: var(--height-unit) var(--height-unit) 0 0; + +article { + counter-reset: heading; } -h2, h3, h4, h5, h6 { - font-style: italic; - margin: var(--height-unit) var(--height-unit) 0 0; + +article h1:before { + content: + counter(heading)". "; + counter-increment: heading; } -p { - margin: var(--height-unit) 0 0 0; - hyphens: auto; + +article h1 { + counter-reset: subheading; } + +article h2:before { + content: + counter(heading)"." + counter(subheading)". "; + counter-increment: subheading; +} + +article h2 { + counter-reset: subsubheading; +} + +article h3:before { + content: + counter(heading)"." + counter(subheading)"." + counter(subsubheading)". "; + counter-increment: subsubheading; +} + +article h3 { + counter-reset: subsubsubheading; +} + +article h4:before { + content: + counter(heading)"." + counter(subheading)"." + counter(subsubheading)"." + counter(subsubsubheading)". "; + counter-increment: subsubsubheading; +} + +article h4 { + counter-reset: subsubsubsubheading; +} + +article h5:before { + content: + counter(heading)"." + counter(subheading)"." + counter(subsubheading)"." + counter(subsubsubheading)"." + counter(subsubsubsubheading)". "; + counter-increment: subsubsubsubheading; +} + +article h5 { + counter-reset: subsubsubsubsubheading; +} + +article h6:before { + content: + counter(heading)"." + counter(subheading)"." + counter(subsubheading)"." + counter(subsubsubheading)"." + counter(subsubsubsubheading)"." + counter(subsubsubsubsubheading)". "; + counter-increment: subsubsubsubsubheading; +} + +/* text content */ +:is(blockquote, dl, figure, hr, menu, ol, p, pre, ul) + +:is(blockquote, dl, figure, hr, menu, ol, p, pre, ul) { + margin-block-start: var(--v-un); +} + blockquote { - margin: var(--height-unit) calc(2 * var(--width-unit)); + margin-inline: calc(4 * var(--h-un)); } -ul, ol { - margin: var(--height-unit) 0; - padding: 0 0 0 calc(4 * var(--width-unit)); + +ol, ul, menu { + padding-inline-start: calc(4 * var(--h-un)); } + +:is(ol, ul, menu) :is(ol, ul, menu) { + margin-block: unset; +} + ul>li::marker { content: "- "; } + hr { - color: inherit; - border: none; - margin: var(--height-unit) 0; -} -hr:after { - content: "---"; + color: unset; + border: unset; + border-top: var(--fg-c) dotted 0.1pt; } -/* main layout */ +/* inline text semantics */ +a { + cursor: pointer; + text-decoration: underline; +} + +a:link { + color: var(--link-c); +} + +a:link:active { + color: var(--active-c); +} + +a:visited { + color: var(--visited-c); +} + +a:visited:active { + color: var(--active-c); +} + +/* layout */ body { - padding: var(--height-unit) var(--width-unit); width: 100vw; height: 100vh; + padding: var(--body-padding-v) var(--body-padding-h); } -/* secondary grid */ body>main { height: 100%; display: grid; grid-auto-flow: column; - grid-template-columns: repeat(auto-fit, var(--column-width)); - grid-gap: var(--gap-horizontal); + grid-auto-columns: var(--col-w); + gap: var(--main-gap-v) var(--main-gap-h); overflow-x: scroll; - scroll-snap-type: x proximity; } + body>main>article { - scroll-snap-align: start; - scroll-snap-stop: always; - width: var(--column-width); overflow-y: scroll; } -body>main>article>header>h1 { - margin: unset; - display: inline-block; + +body>main>article>header { + margin-block-end: var(--v-un); } -body>main>article>article { - margin: var(--height-unit) 0 0 0; + +body>main>article>footer { + margin-block-start: var(--v-un); }