/* Divine Idiot: paper, ink, one rubric red, EB Garamond. */

:root {
  --paper: #F4EFE6;
  --ink: #1C1A17;
  --ink-soft: #3A362F;
  --muted: #6B645A;
  --rule: #D8CFBF;
  --red: #9E2B1F;

  --frame: 1200px;
  --gutter: 32px;
  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }

::selection { background: var(--red); color: var(--paper); }

.sc { font-variant: small-caps; letter-spacing: .08em; }
.red { color: var(--red); }

.frame {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus { left: 50%; transform: translateX(-50%); top: 4px; background: var(--paper); padding: 4px 8px; }

/* Visually hidden, still read by screen readers */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 24px;
  font-size: 17px;
}
.site-header nav { display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); }
.site-header nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -1px var(--red); }

/* Home hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 40px 64px;
  align-items: end;
  padding: clamp(56px, 9vw, 128px) 0 clamp(40px, 6vw, 88px);
}
.hero .kind { font-size: 17px; margin: 0 0 6px; }
.hero h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(56px, 10.5vw, 136px);
  line-height: 1;
  letter-spacing: -.01em;
}
.lev {
  display: inline-block;
  position: relative;
  transform: translateY(-.18em);
}
.lev::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -.21em;
  height: max(2px, .025em);
  border-radius: 50%;
  background: var(--ink);
  opacity: .12;
}
.hero .lede {
  max-width: 30em;
  margin: 28px 0 0;
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.5;
  color: var(--ink-soft);
}
.actions { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 26px; font-size: 18px; }
.actions .primary { border-bottom: 1px solid var(--red); padding-bottom: 2px; }
.actions .secondary { color: var(--ink-soft); }

.excerpt { margin: 0; padding-bottom: 4px; }
.excerpt blockquote { margin: 0; font-size: 19px; line-height: 1.55; }
.excerpt .stanza { margin: 0; }
.excerpt figcaption { margin-top: 14px; font-size: 16px; color: var(--muted); }
.excerpt figcaption a { color: var(--ink-soft); border-bottom: 1px solid var(--rule); }
.excerpt figcaption a:hover { color: var(--red); }

/* The four sections */

.sections-strip ol {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: .5px solid var(--rule);
}
.sections-strip li { border-right: .5px solid var(--rule); }
.sections-strip li:last-child { border-right: 0; }
.sections-strip a { display: block; padding: 22px 24px 24px; }
.sections-strip li:first-child a { padding-left: 0; }
.sections-strip .num { display: block; font-size: 30px; line-height: 1.2; color: var(--red); }
.sections-strip .count { display: block; font-size: 17px; color: var(--ink-soft); }
.sections-strip a:hover .count { color: var(--red); }

/* Credits strip */

.credits {
  border-top: .5px solid var(--rule);
  padding: 18px 0;
  font-size: 17px;
  line-height: 1.7;
  color: var(--muted);
}
.credits .sc { color: var(--ink); }
.credits a.red:hover { text-decoration: underline; }

/* Footer */

.site-footer {
  border-top: .5px solid var(--rule);
  margin-top: 0;
  padding: 18px 0 40px;
  font-size: 17px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }

/* Inner pages */

.page { padding: clamp(48px, 7vw, 96px) 0 clamp(48px, 6vw, 80px); }
.page h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(44px, 6.5vw, 84px);
  line-height: 1.02;
  letter-spacing: -.01em;
}
.page .lede {
  max-width: 32em;
  margin: 20px 0 0;
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Contents */

.contents { margin-top: clamp(40px, 5vw, 72px); }
.contents section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px 32px;
  border-top: .5px solid var(--rule);
  padding: 24px 0 32px;
}
.contents h2 { margin: 0; font-weight: 400; font-size: 18px; color: var(--ink-soft); }
.contents h2 .num { display: block; font-size: 30px; line-height: 1.2; color: var(--red); }
.contents h2 .count { display: block; font-size: 17px; color: var(--muted); }
.contents ol { list-style: none; margin: 0; padding: 0; max-width: 36em; }
.contents li { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; }
.contents li a { font-size: 20px; }
.contents li .where { font-size: 17px; font-style: italic; color: var(--muted); text-align: right; padding-top: 3px; }

/* Poem */

.poem { max-width: 34em; margin: 0 auto; padding: clamp(40px, 6vw, 88px) 0 clamp(40px, 6vw, 72px); }
.poem .crumb { font-size: 16px; color: var(--muted); margin: 0; }
.poem .crumb a:hover { color: var(--red); }
.poem h1 { margin: 6px 0 22px; font-weight: 400; font-size: 32px; line-height: 1.2; text-wrap: balance; }
.poem .dedication { margin: -10px 0 24px; font-style: italic; color: var(--muted); }
.poem .text { font-size: 19px; line-height: 1.55; }
.stanza { margin: 0 0 1em; }

/* Galen's own indents, from the spaces he typed, move the start of a line.
   A line too long for the screen wraps back to the margin, as in his manuscript. */
.line { display: block; text-indent: var(--i, 0em); }

.stanza.part { margin: 1.6em 0 1.1em; letter-spacing: .12em; color: var(--ink-soft); }

.poem-foot { margin-top: 30px; font-size: 17px; color: var(--muted); }
.poem-foot .credit { margin: 0 0 18px; }
.pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  border-top: .5px solid var(--rule);
  padding-top: 14px;
}
.pager a { display: block; font-size: 18px; color: var(--ink-soft); padding: 4px 0; }
.pager a:hover { color: var(--red); }
.pager .next { grid-column: 2; text-align: right; }
.pager .label { display: block; font-size: 14px; color: var(--muted); }

/* The end of the book, after the last poem */

.finis { text-align: center; margin: 64px 0 8px; }
.finis .title { margin: 0; font-size: clamp(44px, 6vw, 64px); line-height: 1.1; }
.finis .by { margin: 12px 0 30px; font-size: 17px; color: var(--ink-soft); }
.finis .then { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 28px; margin: 0; font-size: 17px; }
.finis .then a { color: var(--ink-soft); border-bottom: 1px solid var(--red); padding-bottom: 2px; }
.finis .then a:hover { color: var(--red); }

/* Published in */

.journals {
  list-style: none;
  margin: clamp(40px, 5vw, 72px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 48px;
}
.journals li { border-top: .5px solid var(--rule); padding: 18px 0 22px; }
.journals h2 { margin: 0; font-weight: 400; font-style: italic; font-size: 23px; line-height: 1.25; }
.journals .when { font-size: 17px; color: var(--muted); }
.journals .poems { margin: 6px 0 0; font-size: 18px; color: var(--ink-soft); }
.journals .poems a:hover { color: var(--red); }
.journals .visit { display: inline-block; margin-top: 6px; font-size: 17px; color: var(--muted); }

/* Wider screens */

@media (min-width: 721px) {
  /* Each poem is centred on its longest line, as books set poems. The footer doesn't
     widen the poem; under a narrow poem it grows evenly on both sides to 26em. */
  .poem { width: fit-content; }
  .poem-foot { contain: inline-size; margin-inline: min(0px, calc(50% - 13em)); }
  .contents h2 { position: sticky; top: 24px; align-self: start; }
}

@media (max-width: 1023px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}

/* Phone */

@media (max-width: 720px) {
  :root { --gutter: 20px; }
  body { font-size: 17px; }
  .site-header { flex-direction: column; gap: 6px; }
  .site-header nav { gap: 16px; }
  .sections-strip ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sections-strip li:nth-child(2) { border-right: 0; }
  .sections-strip li:nth-child(n+3) { border-top: .5px solid var(--rule); }
  .sections-strip li:nth-child(odd) a { padding-left: 0; }
  .contents section { grid-template-columns: 1fr; }
  .contents li { flex-direction: column; gap: 0; }
  .contents li .where { text-align: left; padding-top: 0; }
  .poem .text { font-size: 18px; }
  .poem h1 { font-size: 28px; }
  .pager { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pager .next { grid-column: 1; text-align: left; }
  .pager a { padding: 10px 0; }
  .journals { grid-template-columns: 1fr; }
}
