diff --git a/assets/css/app.css b/assets/css/app.css index 914656d..522267a 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -1,7 +1,26 @@ /* Colours and type for the whole app. The values are the ones Bootstrap gave the page before it was taken out, so nothing shifts. */ +/* Variable fonts, one file per style covering weights 400 to 800. They are + cut down to Latin, Greek and punctuation; Hebrew falls back to the next + font in the stack. */ +@font-face { + font-family: "EB Garamond"; + src: url("../fonts/EBGaramond.woff2") format("woff2"); + font-weight: 400 800; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "EB Garamond"; + src: url("../fonts/EBGaramond-Italic.woff2") format("woff2"); + font-weight: 400 800; + font-style: italic; + font-display: swap; +} + :root { - --font-body: Georgia, "Iowan Old Style", "Palatino Linotype", + --font-body: "EB Garamond", Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif; --text: #212529; --text-muted: rgb(33 37 41 / .75); @@ -24,13 +43,14 @@ /* flow-root keeps main's top margin inside the body. Let through, it moves the body's top edge down the page, and htmx scrolls a boosted page to that - edge, not to the very top. */ + edge, not to the very top. EB Garamond's x-height is a fifth smaller than + Georgia's, so it is set a size up to read the same. */ body { display: flow-root; margin: 0; font-family: var(--font-body); - font-size: 1rem; - line-height: 1.5; + font-size: 1.1875rem; + line-height: 1.55; color: var(--text); background: var(--background); -webkit-tap-highlight-color: transparent; @@ -131,7 +151,33 @@ a:hover { color: var(--link-hover); } } } -.sidebar-body { padding: calc(var(--corner) + 1rem); } +/* The title over a rule, then the selects, then the link back to the index + pushed down to the foot of the frame by the row between that takes up the + rest. */ +.sidebar-body { + display: grid; + grid-template-rows: auto auto auto 1fr auto; + height: 100%; + padding: calc(var(--corner) + 1rem); +} + +.sidebar-title { + font-size: 1.5rem; + text-align: center; +} + +/* A hairline, like the selects' boxes. */ +.sidebar-rule { + width: 100%; + margin: 0 0 1rem; + border: 0; + border-top: 1px solid #000; +} + +.sidebar-index { + grid-row: 5; + justify-self: center; +} .sidebar::backdrop { background: rgb(0 0 0 / .3); } @@ -214,15 +260,12 @@ a:hover { color: var(--link-hover); } } } +/* Each label on the left with its select set flush to the right. */ .reference { - display: flex; + display: grid; + grid-template-columns: 1fr auto; align-items: center; - gap: .25rem; -} - -.reference-book { - font-weight: 700; - margin-right: .25rem; + gap: .5rem 1rem; } /* A plain box in a hairline, square like the frame, with a small black @@ -246,15 +289,6 @@ a:hover { color: var(--link-hover); } outline-offset: 2px; } -.visually-hidden { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; -} - /* One reading column: the full width less a gutter on anything narrower than a laptop, and a measure that grows a step with the screen beyond that. The sidebar sizes itself from the same two values. */ @@ -291,6 +325,11 @@ main { text-decoration: none; } +/* Garamond's numbers are old-style by default; in a superscript or beside + the flourishes they sink below the line, so these use lining ones. */ +.v, +.chapter-number { font-variant-numeric: lining-nums; } + .v { font-size: .7em; font-weight: 700; @@ -315,7 +354,7 @@ main { font-family: "Day Leaf Initials", var(--font-body); font-size: 5em; line-height: .8; - margin: .06em .08em 0 0; + margin: .1em .08em 0 0; } /* The first line pulled in closer to the letter than the lines below it, so @@ -342,12 +381,10 @@ main { /* The book's title, centred with room around it. --u shrinks with the header on a phone. */ .book-header { - --u: min(1rem, 100cqi / 22); container-type: inline-size; display: grid; place-items: center; - padding: calc(var(--u) * 4.5) calc(var(--u) * 3.5); - margin: 1rem 0 2rem; + margin: 10rem 0; } .book-header h1 { @@ -382,7 +419,7 @@ main { font-size: 2rem; font-weight: 400; color: var(--text); - margin: 5rem 0 .75rem; + margin: 10rem 0 .75rem; } .chapter-number::before, @@ -391,9 +428,10 @@ main { flex: none; width: 3.2em; height: .8em; - /* Flex centres on the line box, which leaves room below for descenders; - numerals have none, so this lifts the flourish to their middle. */ - translate: 0 -.1em; + /* Flex centres on the line box. In EB Garamond its middle is .35em above + the baseline and a lining numeral's is .33em, so this lowers the + flourish the difference to sit level with the number. */ + translate: 0 .05em; background: currentColor; mask: url("../ornaments/group-l-49.svg") center / contain no-repeat; } @@ -438,10 +476,10 @@ main { } .footnotes { - font-size: .875rem; + font-size: .875em; color: var(--text-muted); } -.footnotes-title { font-size: 1rem; } +.footnotes-title { font-size: 1em; } .marker { font-weight: 700; } .noteref, @@ -472,7 +510,8 @@ main { } @media (max-width: 767.98px) { - .book { line-height: 1.45; } + body { font-size: 1.0625rem; } + .book { line-height: 1.5; } .book .p, .book .m, .book .pi, diff --git a/assets/fonts/EBGaramond-Italic.woff2 b/assets/fonts/EBGaramond-Italic.woff2 new file mode 100644 index 0000000..53a7dd0 Binary files /dev/null and b/assets/fonts/EBGaramond-Italic.woff2 differ diff --git a/assets/fonts/EBGaramond-OFL.txt b/assets/fonts/EBGaramond-OFL.txt new file mode 100644 index 0000000..132cf64 --- /dev/null +++ b/assets/fonts/EBGaramond-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2017 The EB Garamond Project Authors (https://github.com/octaviopardo/EBGaramond12) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/EBGaramond.woff2 b/assets/fonts/EBGaramond.woff2 new file mode 100644 index 0000000..d7f984b Binary files /dev/null and b/assets/fonts/EBGaramond.woff2 differ diff --git a/assets/sw.js b/assets/sw.js index 1c717a9..5fee29a 100644 --- a/assets/sw.js +++ b/assets/sw.js @@ -23,6 +23,8 @@ const PRECACHE = [ './manifest.webmanifest', './css/app.css', './fonts/DayLeafInitials.woff2', + './fonts/EBGaramond.woff2', + './fonts/EBGaramond-Italic.woff2', './ornaments/group-l-49.svg', './ornaments/mural-311a.svg', './ornaments/uniform-rule-corner-tl.svg', diff --git a/assets/templates/reference.njk b/assets/templates/reference.njk index 0e41c40..493db9e 100644 --- a/assets/templates/reference.njk +++ b/assets/templates/reference.njk @@ -1,6 +1,5 @@