/* Punc. Concept: a photocopied punk zine about books. Black ground, one hot
   pink, a warm chalk white for paper and tape; Anton poster type, Fraunces for
   reading and for the marks themselves. Tokens match joekarlsson.com. */

/* Anton and Fraunces (SIL Open Font License), self-hosted from Google Fonts'
   latin and latin-ext subsets, so the first paint doesn't wait on another
   site and visits don't ping Google. */
/* Anton, latin-ext */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/anton-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Anton, latin */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/anton-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Fraunces, latin-ext */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/fraunces-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Fraunces, latin */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/fraunces-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #000000;
  --paper: #ededed;
  --chalk: #ece6da;
  --pink: #ff4fd8;
  --muted: #a3a3a3;
  --surface-line: #3a3a3a;
  --poster: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --book: 'Fraunces', Georgia, serif;
  --gutter: clamp(16px, 4vw, 48px);
  /* Header, page and footer stay in a centered column this wide, so a big
     screen gets margins rather than lines that run from edge to edge. */
  --page-max: 1440px;
  --page-inset: max(var(--gutter), calc((100% - var(--page-max)) / 2));
  /* Spacing scale for layout: margins, padding and gaps between things.
     Small paddings inside stickers and labels stay in em. */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 2.5rem;
  --space-7: 3.5rem;
  --space-8: 5rem;
  --space-9: 6rem;
  /* Where every page's h1 starts below the header */
  --page-top: clamp(2rem, 6vw, 4rem);
  color-scheme: only dark;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--book);
  font-size: clamp(17px, 0.95rem + 0.4vw, 20px);
  line-height: 1.6;
  overflow-x: clip;
}

a {
  color: var(--pink);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--paper);
}

:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 3px;
}

::selection {
  background: var(--pink);
  color: var(--ink);
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 8px;
  background: var(--pink);
  color: var(--ink);
  padding: 4px 10px;
  z-index: 10;
}

main {
  padding: 0 var(--page-inset) 6rem;
}

/* header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-5);
  padding: 1.25rem var(--page-inset) 0;
}

.wordmark {
  font-family: var(--poster);
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1;
  text-transform: uppercase;
  color: var(--pink);
  text-decoration: none;
  transform: rotate(-2deg);
  display: inline-block;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem var(--space-4);
  font-family: var(--poster);
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  text-transform: uppercase;
}

.site-header nav a {
  color: var(--paper);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current='page'] {
  color: var(--pink);
  text-decoration: underline;
  text-decoration-thickness: 4px;
}

/* hero: a ransom note cut from magazines */

.hero {
  padding: var(--page-top) 0 clamp(2.5rem, 5vw, 3.5rem);
  max-width: 1200px;
}

.ransom {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.18em 0.22em;
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  line-height: 1;
  font-weight: 400;
}

.cut {
  display: inline-block;
  padding: 0.06em 0.16em 0.02em;
  font-family: var(--poster);
  text-transform: uppercase;
  transform: rotate(var(--r, -1deg));
}

.cut.serif {
  font-family: var(--book);
  font-weight: 700;
  text-transform: none;
  padding-bottom: 0.1em;
}

.cut:nth-child(3n) { --r: 2deg; }
.cut:nth-child(3n + 1) { --r: -2.5deg; }
.cut:nth-child(4n) { --r: 0.8deg; }

.cut-pink { background: var(--pink); color: var(--ink); }
.cut-chalk { background: var(--chalk); color: var(--ink); }
.cut-paper { background: var(--paper); color: var(--ink); }
.cut-ink { background: var(--ink); color: var(--paper); }

.ringed {
  position: relative;
}

.ring {
  position: absolute;
  left: -14%;
  top: -22%;
  width: 128%;
  height: 150%;
  overflow: visible;
  pointer-events: none;
}

.ring path {
  stroke: var(--pink);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: redraw 9s 0.6s cubic-bezier(0.45, 0.55, 0.3, 1) infinite;
}

@keyframes redraw {
  0% { stroke-dashoffset: 1; }
  35%, 85% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}

.lede {
  max-width: 32em;
  margin: var(--space-5) 0 0;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
}

.section-title,
.page-title {
  font-family: var(--poster);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1;
  margin: 0 0 var(--space-4);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.page-title {
  font-size: clamp(3rem, 10vw, 7rem);
  margin: var(--page-top) 0 var(--space-5);
}

/* the shelf: gig posters taped to the wall. Each cover is a Gutenberg cover
   dithered to hot pink and black (site/src/dither.ts), with the book's own
   punctuation running across the top like the tour dates. */

.featured {
  margin-bottom: clamp(3.5rem, 8vw, 6rem);
}

.shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 3.5rem clamp(1.5rem, 3vw, 2.5rem);
}

.shelf-featured {
  /* Book-sized however wide the screen: the columns stop growing at 300px */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 300px));
}

.cover {
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease-out;
}

.cover[hidden] {
  display: none;
}

.cover:hover,
.cover:focus-within {
  transform: rotate(0deg) scale(1.02);
}

.cover a {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 2 / 3;
  padding: 1.4rem var(--space-3) var(--space-3);
  background: var(--pink);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}

/* Masking tape across the top edge */
.cover a::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: -4px;
  left: 30%;
  width: 40%;
  height: 26px;
  background: var(--chalk);
  transform: rotate(-3deg);
  clip-path: polygon(0 10%, 4% 0, 9% 12%, 14% 2%, 20% 10%, 100% 0, 97% 30%, 100% 55%, 96% 80%, 100% 100%, 0 92%, 3% 60%, 0 35%);
}

/* The cover image waits hidden until it has been dithered, then the canvas
   replaces it, scaled up with hard pixels. */
.poster img,
.poster-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster img {
  visibility: hidden;
}

.poster-art {
  image-rendering: pixelated;
}

.poster-marks {
  position: relative;
  z-index: 1;
  align-self: stretch;
  max-height: 1.35em;
  overflow: hidden;
  background: var(--ink);
  color: var(--pink);
  font-family: var(--book);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: 0.08em;
  padding: 0.1em 0.35em;
  word-break: break-all;
  transform: rotate(1deg);
}

.cover-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.cover-title {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--poster);
  font-size: 1.55rem;
  line-height: 1.05;
  text-transform: uppercase;
  padding: 0.2em 0.35em 0.15em;
  transform: rotate(-1.5deg);
}

.shelf-featured .cover-title {
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
}

.cover-author {
  font-family: var(--book);
  font-weight: 600;
  font-size: 1rem;
  background: var(--chalk);
  color: var(--ink);
  padding: 0 0.4em;
  transform: rotate(1deg);
}

.cover-meta {
  margin: var(--space-3) 0 0;
  font-family: var(--book);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.shelf-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-5);
  margin: 0 0 var(--space-6);
}

.shelf-controls[hidden] {
  display: none;
}

.shelf-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--poster);
  font-size: 1.1rem;
  text-transform: uppercase;
}

.shelf-controls input,
.shelf-controls select {
  min-width: 13rem;
  padding: 0.45rem var(--space-1);
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-bottom: 3px solid var(--pink);
  border-radius: 0;
  font-family: var(--book);
  font-size: 1.05rem;
}

.shelf-controls input::placeholder {
  color: var(--muted);
}

.shelf-count {
  margin: 0 0 var(--space-1);
  font-family: var(--book);
  font-size: 0.95rem;
  color: var(--muted);
}

/* Previous and Next at the ends, the page numbers filling the width between
   them in rows of equal length (shelf.ts sets --per-row). On a phone the
   numbers get the whole width and Previous and Next go underneath. */
.shelf-pages {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  margin-top: var(--space-7);
}

.shelf-pages[hidden] {
  display: none;
}

.shelf-page-numbers {
  display: grid;
  grid-template-columns: repeat(var(--per-row, 7), minmax(0, 1fr));
  gap: 4px;
}

@media (max-width: 899px) {
  .shelf-pages {
    grid-template-columns: 1fr 1fr;
  }

  .shelf-page-numbers {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

.shelf-page {
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.3em 0.6em 0.25em;
  background: none;
  color: var(--paper);
  border: 2px solid var(--pink);
  border-radius: 0;
  font-family: var(--poster);
  font-size: 1.15rem;
  text-transform: uppercase;
  cursor: pointer;
}

.shelf-page-numbers .shelf-page {
  padding-inline: 0.2em;
}

.shelf-page:hover:not(:disabled) {
  background: var(--chalk);
  border-color: var(--chalk);
  color: var(--ink);
}

.shelf-page[aria-current='page'] {
  background: var(--pink);
  color: var(--ink);
}

.shelf-page:disabled {
  border-color: var(--surface-line);
  color: var(--muted);
  cursor: default;
}

.shelf-page-gap {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.shelf-empty {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pink);
}

.share {
  max-width: 40em;
  margin: var(--space-8) 0 0;
  font-family: var(--book);
  font-size: 0.95rem;
  color: var(--muted);
}

.share a,
.link-button {
  color: var(--paper);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.share a:hover,
.link-button:hover {
  color: var(--pink);
}

/* reader */

.status {
  min-height: 1.6em;
  margin: var(--space-3) 0;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--pink);
}

.status:empty {
  margin: 0;
  min-height: 0;
}

.dropzone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 900px;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem);
  background: var(--pink);
  color: var(--ink);
  cursor: pointer;
  transform: rotate(-0.8deg);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone:focus-within {
  outline: 3px solid var(--paper);
  outline-offset: 6px;
}

.dropzone.dragging {
  background: var(--chalk);
  transform: rotate(0deg);
}

.dropzone-big {
  font-family: var(--poster);
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 1;
  text-transform: uppercase;
}

.dropzone-small {
  max-width: 30em;
  font-size: 1.1rem;
}

.hint {
  max-width: 34em;
  margin-top: var(--space-6);
}

/* Title, byline and stats on the left, the poster on the right. With no
   poster (an uploaded file) the right column collapses to nothing. */
.book-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  /* The empty last row takes up the poster's extra height, so the text on
     the left stays together instead of spreading out to match it. */
  grid-template-rows: auto auto auto auto 1fr;
  grid-template-areas:
    'title poster'
    'byline poster'
    'stats poster'
    'fp poster'
    '. poster';
  align-items: start;
  column-gap: clamp(1rem, 4vw, 3rem);
  padding-top: var(--page-top);
}

.book-poster {
  grid-area: poster;
  position: relative;
  width: clamp(110px, 26vw, 300px);
  aspect-ratio: 2 / 3;
  margin: 0;
  background: var(--pink);
  overflow: hidden;
  transform: rotate(2deg);
}

/* The poster links to the book on Project Gutenberg */
.book-poster {
  display: block;
  transition: transform 0.2s ease-out;
}

.book-poster:hover,
.book-poster:focus-visible {
  transform: rotate(0deg) scale(1.02);
}

.book-title {
  grid-area: title;
  margin: 0;
  max-width: 14ch;
  font-family: var(--poster);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.book-byline {
  grid-area: byline;
  justify-self: start;
  display: inline-block;
  margin: var(--space-3) 0 0;
  padding: 0 0.4em;
  background: var(--chalk);
  color: var(--ink);
  font-weight: 600;
  font-size: 1.25rem;
  transform: rotate(-1deg);
}

.stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 1.25rem clamp(2rem, 5vw, 4.5rem);
  margin: var(--space-6) 0 0;
}

/* Two by two once four don't fit, so no number sits alone on a row */
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, max-content));
    column-gap: clamp(2rem, 8vw, 5rem);
  }
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  font-family: var(--poster);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1;
  color: var(--pink);
}

.stats dd.serif-mark {
  font-family: var(--book);
  font-weight: 700;
}

.views {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  margin: var(--space-7) 0 var(--space-4);
}

.views button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--paper);
  font-family: var(--poster);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  text-transform: uppercase;
  cursor: pointer;
}

.views button:hover,
.views button[aria-pressed='true'] {
  color: var(--pink);
  text-decoration: underline;
  text-decoration-thickness: 5px;
  text-underline-offset: 0.12em;
}

.view-note {
  max-width: 34em;
  margin: 0 0 var(--space-5);
}

.spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1100px;
}

.page {
  position: relative;
  min-height: 34rem;
  padding: 2.5rem clamp(1.25rem, 3vw, 2.75rem) 3rem;
  background: var(--chalk);
  color: var(--ink);
}

.page-right {
  background: var(--paper);
}

.page pre {
  margin: 0;
  font-family: var(--book);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.folio {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--book);
  font-size: 0.85rem;
}

.pager {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 1100px;
  margin-top: var(--space-4);
}

.pager input {
  flex: 1;
  accent-color: var(--pink);
}

.button {
  background: var(--pink);
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 0.35em 0.8em 0.3em;
  font-family: var(--poster);
  font-size: 1.25rem;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover {
  background: var(--chalk);
}

.art {
  display: block;
  width: 100%;
  max-width: 1100px;
  height: auto;
  margin-bottom: var(--space-4);
}

/* Score and spiral run edge to edge, out through the page gutter */
.bleed {
  width: calc(100% + 2 * var(--gutter));
  max-width: none;
  margin-inline: calc(-1 * var(--gutter));
}

.explorer {
  position: relative;
}

/* As tall as the screen allows on a computer; square on a phone, so there's
   page left above and below to scroll by. */
.explorer-canvas {
  width: 100%;
  max-width: none;
  height: min(100vw, calc(100svh - 2rem));
  margin: 0;
  cursor: grab;
  touch-action: none;
}

.explorer-canvas:active {
  cursor: grabbing;
}

.explorer-readout {
  position: absolute;
  left: var(--gutter);
  bottom: 0.5rem;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--book);
  font-size: 0.9rem;
  padding: 0 0.35rem;
}

.explorer-readout:empty {
  display: none;
}

.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.explorer-controls .button[aria-label] {
  min-width: 2.6rem;
  font-size: 1.6rem;
  line-height: 1;
}

/* Punctuation fingerprint: ten fixed slots, the same order and scale for
   every book, a bar for each mark's share (site/src/patterns.ts). */
.fingerprint {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
  margin: var(--space-2) 0 0;
  font-family: var(--book);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  --fp-height: 30px;
}

.fp-slot {
  display: grid;
  grid-template-rows: var(--fp-height) auto;
  justify-items: stretch;
  row-gap: 3px;
}

.fp-bar {
  align-self: end;
  background: var(--pink);
  border-radius: 2px 2px 0 0;
}

.fp-mark {
  text-align: center;
  color: var(--paper);
}

.book-fingerprint {
  grid-area: fp;
  max-width: 34rem;
  margin-top: var(--space-4);
}

.fp-caption {
  margin: var(--space-1) 0 0;
  font-family: var(--book);
  font-size: 0.85rem;
  color: var(--muted);
}

.fingerprint-large {
  font-size: 1.4rem;
  gap: 6px;
  --fp-height: 72px;
}

.view-heading {
  margin: 0 0 var(--space-2);
  font-family: var(--poster);
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  text-transform: uppercase;
}

.view-heading + .view-note {
  margin-bottom: var(--space-4);
}

#through-book {
  margin-bottom: var(--space-7);
}

.through-book {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 900px;
  display: grid;
  gap: var(--space-3);
}

.through-book li {
  display: grid;
  grid-template-columns: 3.5rem 11rem minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: end;
}

.tb-mark {
  font-family: var(--book);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  text-align: center;
  color: var(--pink);
}

.tb-name {
  font-family: var(--book);
  font-size: 0.95rem;
  line-height: 1.35;
}

.tb-peak {
  color: var(--muted);
}

.tb-bars {
  display: block;
  width: 100%;
  height: 40px;
  fill: var(--paper);
}

.tb-bars rect:hover {
  fill: var(--pink);
}

/* The axis sits in the bars' column: the first two columns of a row are the
   mark (3.5rem) and its name (11rem), each followed by a 1rem gap. */
.tb-axis {
  max-width: 900px;
  margin-top: 0.4rem;
  padding-left: calc(3.5rem + 11rem + 2rem);
  font-family: var(--book);
  font-size: 0.85rem;
  color: var(--muted);
}

.tb-ticks {
  position: relative;
  display: block;
  height: 1.9rem;
  border-top: 2px solid var(--muted);
}

.tb-tick {
  position: absolute;
  top: 0;
  padding-top: 0.45rem;
  transform: translateX(-50%);
  white-space: nowrap;
}

.tb-tick::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 0.35rem;
  background: var(--muted);
}

.tb-tick:first-child {
  transform: none;
}

.tb-tick:first-child::before {
  left: 0;
}

.tb-tick:last-child {
  transform: translateX(-100%);
}

.tb-tick:last-child::before {
  left: auto;
  right: 0;
}

.tb-axis-label {
  display: block;
  text-align: center;
  color: var(--paper);
}

/* The shelf map */
.map-page .lede {
  margin-bottom: var(--space-5);
}

.shelf-map {
  position: relative;
  max-width: 1100px;
  margin: 0;
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.map-grid {
  stroke: var(--surface-line);
  stroke-width: 1;
}

.map-tick,
.map-axis,
.map-label {
  font-family: var(--book);
  fill: var(--muted);
}

.map-tick {
  font-size: 18px;
}

.map-axis {
  font-size: 20px;
  fill: var(--paper);
}

.map-label {
  font-size: 19px;
  fill: var(--paper);
  /* A black outline keeps labels readable where they cross other dots */
  paint-order: stroke;
  stroke: var(--ink);
  stroke-width: 6px;
  stroke-linejoin: round;
  pointer-events: none;
}

.map-hit {
  fill: transparent;
}

.map-dot {
  fill: var(--pink);
  stroke: var(--ink);
  stroke-width: 2;
}

.shelf-map a:hover .map-dot,
.shelf-map a:focus-visible .map-dot {
  fill: var(--chalk);
}

.shelf-map a:focus-visible {
  outline: none;
}

.map-here-dot {
  fill: var(--chalk);
  stroke: var(--pink);
  stroke-width: 5;
}

.map-here:focus-visible {
  outline: none;
}

.map-here:focus-visible .map-here-dot {
  stroke: var(--paper);
}

.map-label-here {
  font-family: var(--poster);
  font-size: 26px;
  text-transform: uppercase;
  fill: var(--chalk);
}

.map-scroll-hint {
  display: none;
  margin: 0 0 var(--space-3);
  font-family: var(--book);
  font-size: 0.95rem;
  color: var(--muted);
}

.shelf-map-book {
  margin-bottom: var(--space-7);
}

.map-tip {
  position: absolute;
  z-index: 3;
  max-width: 18rem;
  margin: 0;
  padding: 0.35rem var(--space-1);
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--book);
  font-size: 0.9rem;
  line-height: 1.35;
  pointer-events: none;
}

.map-table {
  max-width: 900px;
  margin-top: var(--space-6);
  font-family: var(--book);
}

.map-table summary {
  cursor: pointer;
  font-family: var(--poster);
  font-size: 1.3rem;
  text-transform: uppercase;
}

.map-table table {
  width: 100%;
  margin-top: var(--space-3);
  border-collapse: collapse;
  font-size: 0.95rem;
}

.map-table th,
.map-table td {
  padding: 0.35rem var(--space-2) 0.35rem 0;
  text-align: left;
  font-weight: 400;
}

.map-table thead th {
  color: var(--muted);
}

.map-table td {
  font-variant-numeric: tabular-nums;
}

.counts {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 900px;
  display: grid;
  gap: var(--space-1);
}

.counts li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--space-3);
  align-items: center;
}

.count-mark {
  grid-row: span 2;
  font-family: var(--book);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  text-align: center;
  color: var(--pink);
}

.count-name {
  font-family: var(--book);
  font-size: 0.95rem;
}

.count-bar {
  height: 12px;
  background: var(--paper);
}

.another {
  margin-top: var(--space-7);
}

/* about */

.about {
  max-width: 34em;
}

.about section {
  margin-bottom: var(--space-7);
}

.about p {
  margin: 0 0 var(--space-3);
}

code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.9em;
  background: var(--chalk);
  color: var(--ink);
  padding: 0.05em 0.3em;
}

/* footer */

.site-footer {
  background: var(--pink);
  color: var(--ink);
  padding: 3rem var(--page-inset) 2.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem var(--space-6);
  font-family: var(--poster);
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
  text-decoration-thickness: 5px;
}

.site-footer p {
  margin: var(--space-5) 0 0;
  font-weight: 600;
}

.site-footer :focus-visible {
  outline-color: var(--ink);
}

/* small screens and reduced motion */

@media (max-width: 720px) {
  .spread {
    grid-template-columns: 1fr;
  }

  .page-right {
    display: none;
  }

  .page {
    min-height: 28rem;
  }

  /* Phones: no room beside the title, so the poster goes full width and the
     title and byline are pasted onto its bottom edge, like the shelf covers.
     The poster spans rows 1-3; row 1 is open art, rows 2-3 hold the labels. */
  .book-head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      'title'
      'byline'
      'stats'
      'fp';
  }

  .book-head:has(.book-poster) {
    grid-template-rows: minmax(14rem, 52vw) auto auto auto auto;
    grid-template-areas: none;
  }

  .book-head:has(.book-poster) .book-poster {
    grid-area: 1 / 1 / 4 / 2;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    transform: rotate(-1deg);
  }

  .book-head:has(.book-poster) .book-title {
    grid-area: 2 / 1 / 3 / 2;
    z-index: 1;
    justify-self: start;
    margin: 0 var(--space-2);
    padding: 0.08em 0.25em 0;
    background: var(--ink);
    transform: rotate(-1.5deg);
  }

  .book-head:has(.book-poster) .book-byline {
    grid-area: 3 / 1 / 4 / 2;
    z-index: 1;
    margin: var(--space-1) var(--space-2) var(--space-3);
  }

  .book-head:has(.book-poster) .stats {
    grid-area: 4 / 1 / 5 / 2;
  }

  .book-head:has(.book-poster) .book-fingerprint {
    grid-area: 5 / 1 / 6 / 2;
  }

  .book-title {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-3);
  }

  /* Keep the map's labels readable: it scrolls sideways in its own frame */
  .shelf-map {
    overflow-x: auto;
  }

  .map-svg {
    min-width: 640px;
  }

  .map-scroll-hint {
    display: block;
  }

  .through-book li {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    row-gap: 0.3rem;
  }

  .tb-bars {
    grid-column: 1 / -1;
  }

  .tb-axis {
    padding-left: 0;
  }

  .fingerprint-large {
    font-size: 1.15rem;
    --fp-height: 56px;
  }

  .shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6) var(--space-3);
  }

  .cover a {
    padding: var(--space-3) var(--space-1) var(--space-1);
  }

  .poster-marks {
    font-size: 0.85rem;
  }

  .cover-title,
  .shelf-featured .cover-title {
    font-size: 1.05rem;
  }

  .cover-author {
    font-size: 0.8rem;
  }

  .cover-meta {
    font-size: 0.75rem;
  }

  .shelf-controls input,
  .shelf-controls select {
    min-width: 0;
    width: 100%;
  }

  .shelf-controls label {
    flex: 1 1 100%;
  }

  .site-header nav a {
    display: inline-block;
    padding: 0.2rem 0;
  }

  /* Thumb-sized share links */
  .share {
    line-height: 1.4;
  }

  .share a,
  .link-button {
    display: inline-block;
    padding: var(--space-2) 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ring path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .cover {
    transition: none;
  }
}

/* The numbers page (site/src/numbers.ts draws the charts) */
.numbers-contents {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-5) 0 0;
  font-family: var(--poster);
  font-size: 1.15rem;
  text-transform: uppercase;
}

.numbers-section {
  margin-top: var(--space-8);
  scroll-margin-top: var(--space-4);
}

.numbers-section .view-heading {
  margin-top: var(--space-6);
}

.numbers-note {
  max-width: 40em;
  margin: 0 0 var(--space-4);
}

.numbers-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin: 0 0 var(--space-3);
}

.chart-key {
  margin: 0 0 var(--space-4);
  font-size: 0.95rem;
  color: var(--muted);
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: var(--space-6) var(--space-5);
}

.chart {
  position: relative;
  margin: 0;
}

.chart figcaption {
  margin: 0 0 var(--space-2);
  font-size: 0.95rem;
}

.chart figcaption strong {
  font-family: var(--poster);
  font-weight: 400;
  font-size: 1.3rem;
  text-transform: uppercase;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid {
  stroke: var(--surface-line);
  stroke-width: 1;
}

.chart-tick,
.chart-axis {
  font-family: var(--book);
  font-size: 15px;
  fill: var(--muted);
}

.chart-axis {
  font-size: 18px;
  fill: var(--paper);
}

.chart-dot {
  fill: var(--pink);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.chart-dot:hover {
  fill: var(--chalk);
}

.chart-dot-out {
  fill: var(--surface-line);
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.chart-line-all,
.chart-line-genre {
  stroke: var(--paper);
}

.chart-line-genre {
  display: none;
}

.chart-line-genre.on {
  display: inline;
}

.genre-picked .chart-line-all {
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.chart-line-author {
  stroke: var(--pink);
}

.chart-line-shelf {
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.genre-prints,
.twin-list,
.cluster-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.genre-prints {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--space-5);
}

.genre-name,
.record-name,
.compare-name {
  margin: 0;
  font-family: var(--poster);
  font-weight: 400;
  font-size: 1.3rem;
  text-transform: uppercase;
}

.genre-count,
.compare-detail,
.twin-detail {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.numbers-table-wrap {
  overflow-x: auto;
}

/* Two notes side by side when there's room for both */
.numbers-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26em), 1fr));
  column-gap: var(--space-7);
}

/* Two parts of a section side by side when there's room for both */
.numbers-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: var(--space-6) var(--space-7);
  align-items: start;
}

.numbers-split > div > .view-heading:first-child {
  margin-top: 0;
}

/* A chart with its notes in a narrower column beside it */
@media (min-width: 900px) {
  .numbers-split-wide {
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  }

  /* The map's notes come first to read, but sit to its right */
  .map-split .map-notes {
    grid-column: 2;
    grid-row: 1;
  }
}

.map-split .shelf-map {
  max-width: none;
}

/* Authors: a list to pick from on the left, the picked author on the right */
.author-explorer {
  display: grid;
  grid-template-columns: minmax(17rem, 1fr) minmax(0, 2.2fr);
  gap: var(--space-6) var(--space-7);
  align-items: start;
  margin-top: var(--space-5);
}

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

.author-browse .shelf-controls {
  margin-bottom: var(--space-3);
}

.author-browse .shelf-controls label,
.author-browse .shelf-controls input {
  width: 100%;
}

/* The list scrolls in place, so sixty-odd authors don't push the page down */
.author-list {
  max-height: 38rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--pink) var(--ink);
}

@media (max-width: 900px) {
  .author-list {
    max-height: 20rem;
  }
}

.author-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'name count'
    'squares squares';
  gap: 0.3rem var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  background: none;
  color: var(--paper);
  border: 0;
  border-radius: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.author-pick:hover .author-pick-name {
  color: var(--pink);
}

.author-pick[aria-pressed='true'] {
  background: var(--pink);
  color: var(--ink);
}

.author-pick[aria-pressed='true'] .author-pick-name,
.author-pick[aria-pressed='true'] .author-pick-count {
  color: var(--ink);
}

.author-pick-name {
  grid-area: name;
  font-weight: 700;
}

.author-pick-count {
  grid-area: count;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.author-pick[aria-pressed='true'] .named {
  border-color: var(--ink);
}

.author-pick[aria-pressed='true'] .named-right {
  background: var(--ink);
}

.author-detail-name {
  margin: 0;
  font-family: var(--poster);
  font-weight: 400;
  font-size: clamp(2rem, 1.4rem + 2vw, 3.2rem);
  line-height: 1;
  text-transform: uppercase;
}

.author-summary {
  max-width: 40em;
  margin: var(--space-2) 0 var(--space-5);
}

.author-detail-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--space-5) var(--space-6);
  align-items: start;
}

.author-detail-label {
  margin: 0 0 var(--space-1);
  font-size: 0.9rem;
  color: var(--muted);
}

.author-detail-books {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.author-detail-books li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-1);
  padding: 0.2rem 0;
}

.author-detail-books .named {
  width: 12px;
  height: 12px;
  align-self: center;
}

#author-career {
  margin-top: var(--space-5);
}

#author-career .numbers-controls {
  margin-top: var(--space-2);
}

.author-name {
  margin: 0;
  font-family: var(--poster);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.05;
  text-transform: uppercase;
}

/* A book each: pink where the marks named its author */
.named-squares {
  grid-area: squares;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.named {
  display: block;
  flex: none;
  width: 10px;
  height: 10px;
  border: 2px solid var(--pink);
}

.named-right {
  background: var(--pink);
}

/* Compare: the two fingerprints stacked, the numbers beside them */
.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5) var(--space-7);
  align-items: start;
}

.compare .compare-table {
  margin-top: 0;
}

.compare-table th[scope='row'] {
  white-space: nowrap;
}

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

.compare-pair {
  display: grid;
  gap: var(--space-5);
}

.compare-table {
  margin-top: var(--space-4);
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.compare-table th,
.compare-table td {
  padding: 0.3rem var(--space-4) 0.3rem 0;
  text-align: left;
  font-weight: 400;
}

.compare-table thead th {
  color: var(--muted);
}

/* Pairs sit further apart than the two books in a pair */
.twin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr));
  gap: var(--space-7) var(--space-9);
}

.twin {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

/* A book page's author on the shelf (bookAuthorHTML in site/src/numbers.ts) */
.book-author {
  margin: var(--space-7) 0;
}

.book-author-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--space-5) var(--space-7);
  align-items: start;
}

.book-author .compare-table {
  margin-top: 0;
}

.book-author .author-name {
  margin-top: var(--space-5);
}

.author-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-5) var(--space-4);
  margin: var(--space-6) 0 0;
  padding: 0;
  list-style: none;
}

/* Titles run to different lengths; the fingerprints line up at the bottom */
.author-books li {
  display: flex;
  flex-direction: column;
}

.author-books .fingerprint {
  margin-top: auto;
  padding-top: var(--space-2);
}

.author-book-this {
  font-weight: 700;
  color: var(--pink);
}

.author-book-year {
  font-size: 0.85rem;
  color: var(--muted);
}

.twin-title {
  font-size: 1.1rem;
}

.next-grid {
  border-collapse: separate;
  border-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.next-grid caption {
  caption-side: bottom;
  padding-top: var(--space-2);
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
}

.next-grid th,
.next-grid td {
  width: 2.6rem;
  height: 2.2rem;
  text-align: center;
  font-weight: 400;
}

.next-grid th {
  font-weight: 700;
  font-size: 1.2rem;
}

.next-grid abbr {
  text-decoration: none;
}

/* One pink, darker for rarer: the share of the row */
.next-0 { background: var(--ink); color: var(--paper); }
.next-1 { background: #3d1335; color: var(--paper); }
.next-2 { background: #6e2160; color: var(--paper); }
.next-3 { background: #a2308d; color: var(--paper); }
.next-4 { background: #d23fb5; color: var(--ink); }
.next-5 { background: var(--pink); color: var(--ink); }

.cluster-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: var(--space-4);
}

.cluster-list li {
  display: flex;
  flex-direction: column;
}

.cluster-marks {
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1.1;
  color: var(--pink);
}

.cluster-count {
  font-size: 0.9rem;
  color: var(--muted);
}

.rank-links {
  margin: var(--space-4) 0 0;
  padding-left: 1.2em;
}

.records {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-5);
}

.records ol {
  margin: var(--space-1) 0 0;
  padding-left: 1.2em;
}

@media (max-width: 720px) {
  .compare-pair,
  .twin {
    gap: var(--space-3);
  }

  .compare-pair .fingerprint-large,
  .twin .fingerprint {
    font-size: 0.9rem;
    --fp-height: 40px;
  }
}

.numbers-controls select {
  width: 22rem;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 720px) {
  /* The charts shrink to the screen; their labels shouldn't shrink as far */
  .chart-tick {
    font-size: 21px;
  }
}

.compare-table caption {
  caption-side: bottom;
  padding-top: var(--space-2);
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Holds the map's space until the browser draws it */
.map-holder:empty {
  aspect-ratio: 1000 / 640;
}

.career-chart:empty {
  aspect-ratio: 320 / 190;
}

/* A long page: skip layout and paint for sections off screen. auto keeps
   each section's real height once it has been drawn. */
.numbers-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 1400px;
}
