/* Design: a mid-century two-colour print. Red and black ink on warm peach
   stock; slanted hand-lettered titles in red with a black offset shadow;
   heavy geometric capitals for subheads; brushy black ground-strokes as rules.
   The books' own pen drawings carry the illustration. */

@font-face { font-family: "Bowlby One"; src: url("/assets/fonts/bowlby-one-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Jost"; font-weight: 500; src: url("/assets/fonts/jost-latin-500-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Jost"; font-weight: 700; src: url("/assets/fonts/jost-latin-700-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; src: url("/assets/fonts/libre-caslon-text-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-style: italic; src: url("/assets/fonts/libre-caslon-text-latin-400-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 700; src: url("/assets/fonts/libre-caslon-text-latin-700-normal.woff2") format("woff2"); font-display: swap; }

:root {
  --paper: #f4c28e;
  --paper-light: #f8d6ad;
  --paper-deep: #e9ad74;
  --ink: #1b1512;
  --ink-soft: #4a3a2e;
  --red: #d3281d;
  --red-deep: #a91c13;
  --measure: 36rem;

  --display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --caps: "Jost", "Futura", "Century Gothic", sans-serif;
  --body: "Libre Caslon Text", Georgia, "Times New Roman", serif;

  /* Paper grain: fine fractal noise multiplied into the stock. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .18 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Ground strokes: short black dashes like the brushwork under a figure. */
  --strokes: repeating-linear-gradient(90deg, var(--ink) 0 34px, transparent 34px 44px, var(--ink) 44px 58px, transparent 58px 66px, var(--ink) 66px 112px, transparent 112px 122px);
}

* { box-sizing: border-box; }
html { background: var(--paper) var(--grain); color: var(--ink); }
body { margin: 0; font: 400 1.125rem/1.7 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--red-deep); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
::selection { background: var(--red); color: var(--paper-light); }

/* ---- display lettering ------------------------------------------------- */

.display {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
  transform: skewX(-10deg) rotate(-3deg);
  transform-origin: left bottom;
  letter-spacing: .01em;
  line-height: .95;
}
.caps { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

/* ---- frame ----------------------------------------------------------- */

header.site, main, footer.site { max-width: calc(var(--measure) + 6rem); margin: 0 auto; padding: 0 1.5rem; }
header.site {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-top: 1.1rem; padding-bottom: 1rem; border-bottom: 3px solid var(--ink);
}
.wordmark { font-size: 1.6rem; text-decoration: none; display: inline-block; }
.wordmark:hover { color: var(--red); }
header.site nav { display: flex; gap: 1.25rem; }
header.site nav a { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; color: var(--ink); text-decoration: none; }
header.site nav a:hover { color: var(--red); }

footer.site { margin-top: 5rem; padding-top: 1.75rem; padding-bottom: 2.5rem; position: relative; font-family: var(--caps); font-weight: 500; font-size: .85rem; color: var(--ink-soft); }
footer.site::before { content: ""; position: absolute; left: 1.5rem; right: 1.5rem; top: 0; height: 5px; background: var(--strokes); }

/* ---- landing ----------------------------------------------------------- */

.landing { padding: 3.5rem 0 1rem; }
.landing h1 { font-size: clamp(3.4rem, 11vw, 6.2rem); margin: 0 0 1.4rem; display: inline-block; }
.landing h1 span { display: block; }
.landing h1 .line1 { font-size: .62em; margin-left: .1em; }
.landing .tagline { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; font-size: clamp(.95rem, 2.3vw, 1.2rem); line-height: 1.3; text-wrap: balance; margin: 0 0 2rem; }
.landing p { font-size: 1.2rem; }
section > h2.caps, .index h2 {
  font-size: 1.15rem; margin: 3rem 0 1rem; padding-bottom: .5rem; position: relative;
}
section > h2.caps::after { content: ""; position: absolute; left: 0; bottom: 0; width: 9rem; height: 4px; background: var(--strokes); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.cards a {
  display: block; padding: .9rem 1.1rem; background: var(--paper-light); border: 2.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); color: var(--ink); text-decoration: none;
  font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  transition: transform .08s, box-shadow .08s;
}
.cards a small { display: block; font-family: var(--body); font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: .9rem; }
.cards a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--red); color: var(--red-deep); }

/* ---- page heads ------------------------------------------------------- */

.crumbs { margin: 2rem 0 0; font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
.crumbs a { color: var(--ink); text-decoration: none; }
.crumbs a:hover { color: var(--red); }
.head { margin: 1.25rem 0 1.75rem; }
/* Pages with no breadcrumb above the title need their own clearance below the
   header rule. */
article > .head:first-child { margin-top: 2.2rem; }
.head .label { display: block; font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .95rem; margin-bottom: .7rem; }
/* Page titles (books, chapters, lessons) are set the way the print reference
   sets its secondary lines: plain geometric capitals, here in deep red. The
   poster lettering is kept for the site name on the home page. Size steps
   down with length. */
.head h1 { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--red-deep);
  font-size: clamp(1.75rem, 5.2vw, 2.5rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.head h1.long { font-size: clamp(1.5rem, 4.2vw, 2.05rem); line-height: 1.2; }
.head h1.longer { font-size: clamp(1.3rem, 3.4vw, 1.75rem); line-height: 1.25; text-wrap: pretty; }
.head .sub { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin: 1.4rem 0 0; }
.meta { font-family: var(--caps); font-weight: 500; font-size: .9rem; color: var(--ink-soft); }

/* ---- book text ----------------------------------------------------------- */

.text { position: relative; }
.text p, .text blockquote { margin: 0 0 1.05rem; position: relative; }
.text .centre { text-align: center; }
.text blockquote { margin-left: 1.5rem; padding-left: 1rem; border-left: 3px solid var(--ink); }
.text h2 {
  font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  font-size: 1.05rem; margin: 2.75rem 0 .9rem; padding-left: .9rem; border-left: 6px solid var(--red);
  line-height: 1.3;
}
.excerpt > h2 {
  font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  font-size: 1.2rem; margin: 3rem 0 1rem; padding-left: .9rem; border-left: 6px solid var(--red);
}
.byline { font-style: italic; color: var(--ink-soft); margin-top: -.3rem !important; }

/* Block numbers (for excerpt references) and printed page numbers in the margins. */
.bn { position: absolute; left: -2.6rem; width: 2rem; text-align: right; top: .35rem; font-family: var(--caps); font-weight: 500; font-size: .7rem; color: var(--paper-deep); text-decoration: none; }
.bn:hover { color: var(--ink-soft); }
.pg::before { content: "p. " attr(data-page); position: absolute; right: -4.6rem; font-family: var(--caps); font-weight: 700; font-size: .68rem; letter-spacing: .06em; color: var(--red-deep); font-style: normal; }
/* Two page breaks at one spot (a part-title page with no text of its own): stack the labels. */
.pg + .pg::before { margin-top: 1.1rem; }
@media (max-width: 56rem) { .bn, .pg::before { display: none; } }

figure { margin: 2rem 0; text-align: center; }
figure img { max-width: 100%; height: auto; mix-blend-mode: multiply; filter: sepia(.25) contrast(1.08); }
figcaption { margin-top: .4rem; font-family: var(--caps); font-weight: 500; font-size: .85rem; letter-spacing: .03em; color: var(--ink-soft); }
.table { overflow-x: auto; margin: 1.25rem 0; }
.table table { border-collapse: collapse; font-size: .95rem; background: var(--paper-light); }
.table td { border: 1.5px solid var(--ink); padding: .3rem .6rem; vertical-align: top; }
pre { white-space: pre-wrap; font-size: .9rem; }
.sc { font-variant: small-caps; letter-spacing: .02em; }
/* Illustrated initials float beside the opening paragraph; the letter they
   picture is in the text for reading aloud and search, hidden on screen. */
figure.initial { float: left; width: 6.2rem; margin: .35rem 1.1rem .4rem 0; }
figure.initial img { width: 100%; }
.dropletter { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
figure.initial + p { min-height: 9rem; }
/* Topic labels the old printings set at the page head or margin. */
.text .sidenote { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem;
  color: var(--red-deep); margin: 1.6rem 0 .5rem; clear: both; }
.table caption { font-weight: 700; padding: .4rem 0; text-align: left; }
.text .list { margin: 0 0 1.05rem; padding-left: 1.4rem; }
.text .list li { margin-bottom: .2rem; }
/* A chapter synopsis: the printed run of topics under a chapter title. The dots
   between topics are layout only. */
.text .synopsis { list-style: none; padding: 0; margin: 0 0 1.8rem; font-family: var(--caps); font-weight: 500; font-size: .82rem;
  letter-spacing: .06em; line-height: 1.7; color: var(--ink-soft); }
.text .synopsis li { display: inline; margin: 0; }
.text .synopsis li + li::before { content: "·"; margin: 0 .55em; color: var(--red); font-weight: 700; }
/* Footnotes: the reference is a small red letter; the note sits at the end of
   the chapter as the transcription places it, ruled off and smaller. */
sup.fn { line-height: 0; }
sup.fn a { font-family: var(--caps); font-weight: 700; font-size: .72em; color: var(--red-deep); text-decoration: none; padding: 0 .1em; }
.text .note { font-size: .9rem; color: var(--ink-soft); padding-top: .6rem; border-top: 1.5px solid var(--ink); }
.text .note + .note { border-top: 0; padding-top: 0; }
.fnmark { font-family: var(--caps); font-weight: 700; color: var(--red-deep); text-decoration: none; margin-right: .25rem; }
:target { scroll-margin-top: 1.5rem; }
.text .note:target, sup.fn a:target { background: var(--paper-light); }

/* ---- notices, citations ---------------------------------------------------- */

.dated {
  background: var(--paper-light); border: 2.5px solid var(--ink); box-shadow: 5px 5px 0 var(--red);
  padding: 1rem 1.2rem; margin: 0 0 2.5rem; font-size: 1rem;
}
.dated p { margin: 0 0 .5rem; }
.dated strong { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red-deep); }
.dated ul { margin: 0; padding-left: 1.2rem; font-family: var(--caps); font-weight: 500; font-size: .92rem; }

.excerpt { margin-bottom: 3rem; }
.cite {
  margin-top: 1.25rem; padding-top: .8rem; position: relative;
  font-family: var(--caps); font-weight: 500; font-size: .85rem; line-height: 1.55; color: var(--ink-soft);
}
.cite::before { content: ""; position: absolute; left: 0; top: 0; width: 6rem; height: 3px; background: var(--strokes); }
.cite cite { font-style: normal; font-weight: 700; color: var(--ink); }
.cite .by { display: block; }

.prevnext { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 3px solid var(--ink); }
.prevnext a { font-family: var(--caps); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; text-decoration: none; }
.toc { list-style: none; padding: 0; counter-reset: none; }

/* Header: keep the wordmark on one line and let the bar wrap on narrow screens. */
header.site { flex-wrap: wrap; padding-top: 1.5rem; }
.wordmark { white-space: nowrap; }
@media (max-width: 30rem) {
  header.site { padding-left: 1rem; padding-right: 1rem; }
  main, footer.site { padding-left: 1rem; padding-right: 1rem; }
  .wordmark { font-size: 1.2rem; }
  header.site nav { gap: .9rem; }
  header.site nav a { font-size: .75rem; }
  .landing { padding-top: 2.25rem; }
}

/* Logo in the header bar. */
.logo { display: block; line-height: 0; }
.logo img { height: 84px; width: auto; display: block; }
.logo:hover img { transform: rotate(-1deg); }
@media (max-width: 30rem) { .logo img { height: 56px; } }

/* Sign drawings sit beside the entry they illustrate, left or right as the
   book prints them; a run of small drawings (the moons) sits in a row. */
figure.float-l, figure.float-r { width: auto; max-width: 42%; margin: .3rem 0 .8rem; }
figure.float-l figcaption, figure.float-r figcaption { max-width: 14rem; }
figure.float-l { float: left; clear: left; margin-right: 1.2rem; }
figure.float-r { float: right; clear: right; margin-left: 1.2rem; }
figure.row { display: inline-block; width: 22%; margin: .5rem 1% 1rem; vertical-align: bottom; }
.text h2 { clear: both; }
.text p.translation { font-size: .9rem; color: var(--ink-soft); margin-top: -.6rem; }
img.glyph { height: 1.1em; width: auto; vertical-align: -.15em; mix-blend-mode: multiply; }
