/* A Little Known Fact Productions: the almanac.
   Paper, ink and one oxblood. Serif carries the text, mono carries the numbers. */

:root {
  --paper: #f2eee4;
  --paper-deep: #e8e2d4;
  --ink: #1b1815;
  --ink-soft: #5a534b;
  --rule: #b9b0a1;
  --oxblood: #6e1b1f;
  --serif: 'Libre Caslon Text', Georgia, 'Times New Roman', serif;
  --display: 'Libre Caslon Display', 'Libre Caslon Text', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --measure: 34rem;
  --gutter: clamp(1rem, 4vw, 3rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

/* Paper grain. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.26;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%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 .4 0 0 0 0 .33 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration-color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--oxblood); }
a:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--paper); padding: 0.4rem 0.6rem; }

.dagger { color: var(--oxblood); font-family: var(--serif); text-decoration: none; }

/* TK: the printer's mark for copy still to come. */
.tk {
  font: 500 0.72em/1 var(--mono);
  color: var(--oxblood);
  border: 1px dashed var(--oxblood);
  padding: 0.1em 0.35em;
  letter-spacing: 0.04em;
  cursor: help;
}

h1, h2 { font-weight: 400; }
h2 { font: italic 400 1.3rem/1.3 var(--serif); margin: 2.4rem 0 0.4rem; }

/* ---------- Running head on inner pages ---------- */
.running-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 2rem;
  padding: 1.1rem var(--gutter) 0.9rem;
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 3px 0 -2px var(--ink); /* the double rule of an old title page */
  margin-bottom: 3px;
}
.house { font: 400 1.05rem/1.2 var(--display); text-decoration: none; }

.contents ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; }
.contents a { font-style: italic; text-decoration: none; }
.contents a:hover, .contents a[aria-current] { text-decoration: underline; text-decoration-color: var(--oxblood); }

/* ---------- Home: the title page ---------- */
.titlepage {
  position: relative;
  min-height: min(92vh, 52rem);
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
}
.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.titlepage-inner {
  position: relative;
  padding: 0 var(--gutter) clamp(2rem, 6vh, 4rem);
  width: 100%;
  pointer-events: none;
}
.titlepage-inner a { pointer-events: auto; }
.titlepage h1 {
  font: 400 clamp(2.9rem, 9.4vw, 8.6rem)/0.92 var(--display);
  letter-spacing: -0.015em;
  margin: 0 0 1.4rem;
  max-width: 11ch;
}
.titlepage h1 span { white-space: nowrap; }
.titlepage h1 .dagger { font-size: 0.55em; vertical-align: 0.75em; margin-left: 0.04em; }
.imprint-line { font-style: italic; margin: 0 0 1.4rem; color: var(--ink-soft); }
.titlepage .contents { padding-top: 0.8rem; border-top: 1px solid var(--rule); max-width: 40rem; }
.titlenote {
  margin: 2.2rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  max-width: 24rem;
}

/* ---------- The catalogue index ---------- */
.catalogue { padding: 3.5rem var(--gutter) 2rem; max-width: 62rem; }
.catalogue h2 { font: 400 clamp(1.7rem, 3.4vw, 2.4rem)/1.1 var(--display); font-style: normal; margin: 0 0 0.3rem; }
.cat-intro { margin: 0 0 2rem; color: var(--ink-soft); font-style: italic; }

.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.index li { border-bottom: 1px solid var(--rule); }
.index a {
  display: grid;
  grid-template-columns: 6.2rem auto 1fr auto 9.5rem;
  align-items: baseline;
  gap: 0 0.9rem;
  padding: 0.95rem 0 0.85rem;
  text-decoration: none;
}
.index .no, .catno, .plate-no, .ledger .no, .kind { font: 400 0.8rem/1 var(--mono); letter-spacing: 0.02em; }
.index .no { color: var(--oxblood); }
.index .t { font: 400 clamp(1.35rem, 2.6vw, 1.9rem)/1.15 var(--display); }
.index .leader { border-bottom: 1px dotted var(--ink-soft); translate: 0 -0.3em; min-width: 1rem; }
.index .m { font-style: italic; }
.index .s { font-size: 0.85rem; color: var(--ink-soft); text-align: right; }
.index a:hover .t { color: var(--oxblood); }
.index a:hover .leader { border-color: var(--oxblood); }

.submissions {
  margin: 2.6rem 0 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Entry pages: an encyclopedia article ---------- */
.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr);
  padding: 3rem var(--gutter) 4rem;
  row-gap: 0;
}
.entry > * { grid-column: 2; }
.entry-head { margin-bottom: 2rem; }
.catno { color: var(--oxblood); margin: 0 0 0.9rem; }
.entry h1 { font: 400 clamp(2.6rem, 7vw, 4.6rem)/0.98 var(--display); margin: 0 0 0.8rem; letter-spacing: -0.01em; }
.definition { margin: 0; font-style: italic; color: var(--ink-soft); }

.plate { grid-column: 1 / -1; margin: 0 auto 2.4rem; max-width: 52rem; width: 100%; }
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--ink);
  padding: 6px;
  background: var(--paper-deep);
}
.plate figcaption { margin-top: 0.55rem; font-size: 0.85rem; color: var(--ink-soft); }
.plate-no { color: var(--ink); margin-right: 0.3rem; }
.plate-empty .plate-blank {
  aspect-ratio: 16 / 9;
  max-height: 22rem;
  border: 1px solid var(--rule);
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(27, 24, 21, 0.06) 11px 12px),
    var(--paper-deep);
  display: grid;
  place-items: center;
}

/* Posters and covers are tall; don't let them take over the page. */
.plate.tall { max-width: 24rem; }
.subtitle { margin: -0.3rem 0 0.8rem; font: italic 400 1.15rem/1.35 var(--serif); }
.forthcoming { font-style: italic; color: var(--ink-soft); }

.entry-text p { margin: 0 0 1.1em; hyphens: auto; }
.logline { font: 400 1.4rem/1.35 var(--serif); }
.see { font-style: italic; }

.ref { line-height: 0; font-size: 0.85em; }
.ref a { color: var(--oxblood); text-decoration: none; padding: 0 0.12em; font-weight: 700; }

.particulars { margin: 1.6rem 0 2rem; border-top: 1px solid var(--ink); }
.particulars div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}
.particulars dt { font-style: italic; }
.particulars dd { margin: 0; }

.where { list-style: none; padding: 0; margin: 0 0 2.5rem; }
.where li { margin: 0 0 0.4rem; }
.where a::before { content: '→ '; color: var(--oxblood); }

.notes { border-top: 1px solid var(--ink); width: 9rem; padding-top: 0; margin-bottom: 1rem; }
.notes ol { list-style: none; padding: 0; margin: 0.8rem 0 0; width: min(var(--measure), 80vw); font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }
.notes li { margin: 0 0 0.6rem; padding-left: 1.1rem; text-indent: -1.1rem; }
.notes .mark { color: var(--oxblood); }
.notes .back { text-decoration: none; color: var(--ink-soft); }
.notes li:target { color: var(--ink); }

.turn {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}
.turn a { text-decoration: none; }
.turn a[rel='prev']::before { content: '← '; }
.turn a[rel='next']::after { content: ' →'; }

/* ---------- Plain pages ---------- */
.page { max-width: calc(var(--measure) + 2 * var(--gutter)); padding: 3rem var(--gutter) 4rem; margin-left: clamp(0rem, 12vw, 14rem); }
.page h1 { font: 400 clamp(2.4rem, 6vw, 3.8rem)/1 var(--display); margin: 0 0 1rem; }
.lede { font-size: 1.25rem; line-height: 1.4; margin: 0 0 1.6rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0 2rem; }
.ledger { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 0.92rem; }
.ledger th, .ledger td { text-align: left; padding: 0.55rem 0.8rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.ledger thead th { font-weight: 400; font-style: italic; border-bottom: 1px solid var(--ink); }
.ledger tbody th { font-weight: 400; }
.ledger .no { color: var(--oxblood); white-space: nowrap; }
.isbn { font-family: var(--mono); font-size: 0.85em; }

.files { list-style: none; padding: 0; border-top: 1px solid var(--ink); }
.files li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.kind { color: var(--ink-soft); }

/* ---------- Colophon ---------- */
.colophon {
  margin-top: 4rem;
  padding: 1.6rem var(--gutter) 2.4rem;
  border-top: 1px solid var(--ink);
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns: minmax(0, 30rem) 1fr;
  gap: 0.4rem 3rem;
}
.colophon p { margin: 0; }
.colophon .ack { grid-row: span 2; }

/* ---------- Narrow screens ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .titlepage { min-height: 86vh; }
  .index a { grid-template-columns: 4.6rem 1fr auto; row-gap: 0.25rem; }
  .index .leader { display: none; }
  .index .m { grid-column: 2; font-size: 0.9rem; }
  .index .s { grid-column: 3; grid-row: 2; }
  .index .t { grid-column: 2 / -1; }
  .particulars div { grid-template-columns: 7rem 1fr; }
  .page { margin-left: 0; }
  .plate.tall { max-width: 17rem; }
  .colophon { grid-template-columns: 1fr; }
  .colophon .ack { grid-row: auto; }
}

@media print {
  body::before, .field, .contents { display: none; }
}

/* On the home page the field sits behind everything; a soft paper halo keeps the words readable. */
.home main, .home .colophon { position: relative; z-index: 1; }
.home main, .home .colophon {
  text-shadow: 0 0 0.35em var(--paper), 0 0 0.12em var(--paper);
}
