:root {
  /* Role tokens */
  --surface: #ffffff;
  --surface-sunken: rgba(0, 0, 0, .04);
  --text-primary: #1d1f20;
  --text-secondary: #6b7072;   /* 5.0:1 on white */
  --accent: #4f6f77;           /* 5.4:1 on white; hover, focus and selection */
  --border: rgba(0, 0, 0, .1);
  --hero: #2b3133;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --press: 160ms;

  --width: 880px;
  --gutter: 24px;
  --safe-l: max(var(--gutter), env(safe-area-inset-left));
  --safe-r: max(var(--gutter), env(safe-area-inset-right));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: light;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--surface);
  color: var(--text-primary);
  font: 300 18px/1.65 var(--sans);
  font-optical-sizing: auto;
}

::selection { background: var(--accent); color: #fff; }

h1, h2, h3, .statement__lead, .row__title { text-wrap: balance; }
p, .row__excerpt { text-wrap: pretty; }

.row__meta, .row__date, .footer__copy { font-variant-numeric: tabular-nums; }

a {
  color: inherit;
  touch-action: manipulation;
}

.footer a {
  text-decoration: underline 1px;
  text-underline-offset: 5px;
}

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

/* Hero */

.hero {
  position: relative;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  color: #fff;
  background: var(--hero);
}

/* The portrait is upright, so wide screens crop to head and shoulders */
.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 8%;
}

/* Scrims so the name and nav stay readable over any photo */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 22%),
    linear-gradient(to top, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0) 50%);
}

/* Burger: three bars that fold into an X. It stays in the corner as the page scrolls. */

.burger {
  position: fixed;
  z-index: 5;
  top: max(16px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform var(--press) var(--ease-out),
    color 200ms var(--ease-out),
    background-color 200ms var(--ease-out),
    box-shadow 200ms var(--ease-out);
  animation: fade 600ms var(--ease-out) both 200ms;
}

/* Past the photo it turns dark, on a small white tile so text scrolling under it never clashes */
[data-past-hero] .burger[aria-controls="menu"] {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, .94);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.burger:active { transform: scale(.94); }

.burger span,
.burger span::before,
.burger span::after {
  display: block;
  width: 30px;
  height: 3px;
  background: currentColor;
}

.burger span { position: relative; }

.burger span::before,
.burger span::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 300ms var(--ease-out);
}

.burger span::before { transform: translateY(-10px); }
.burger span::after { transform: translateY(10px); }

/* Menu: a white panel wiped in from the right edge, like the reference site */

.menu {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text-primary);
  clip-path: inset(0 0 0 100%);
  visibility: hidden;
  transition:
    clip-path 280ms var(--ease-out),
    visibility 0s linear 280ms;
}

[data-menu-open] { overflow: hidden; }

[data-menu-open] .menu {
  clip-path: inset(0);
  visibility: visible;
  transition:
    clip-path 400ms var(--ease-drawer),
    visibility 0s;
}

/* The close button starts as a burger and folds into an X as the panel arrives */
.burger--close {
  color: var(--text-primary);
  animation: none;
}

.burger--close span { transition: background-color 0s linear 150ms; }

[data-menu-open] .burger--close span { background-color: transparent; transition-delay: 0s; }
[data-menu-open] .burger--close span::before { transform: rotate(45deg); transition-delay: 120ms; }
[data-menu-open] .burger--close span::after { transform: rotate(-45deg); transition-delay: 120ms; }

.menu__list {
  list-style: none;
  text-align: center;
}

.menu__list a {
  display: inline-block;
  padding: 8px 16px;
  font: 400 clamp(40px, 6vw, 56px)/1.15 var(--serif);
  text-decoration: none;
  touch-action: manipulation;
  opacity: 0;
  transform: translateY(16px);
  filter: blur(4px);
  transition:
    opacity 150ms var(--ease-out),
    transform 150ms var(--ease-out),
    filter 150ms var(--ease-out);
}

/* Links rise in one after another, 40ms apart; on close they leave together, faster */
/* The section you're in is underlined */
.menu__list a[aria-current] {
  text-decoration: underline 1px;
  text-underline-offset: 10px;
}

[data-menu-open] .menu__list a {
  opacity: 1;
  transform: none;
  filter: none;
  transition-duration: 500ms;
  transition-delay: calc(120ms + var(--i) * 40ms);
}

.menu__list a:active { color: var(--accent); }

.hero__name {
  position: absolute;
  z-index: 1;
  left: max(48px, env(safe-area-inset-left));
  bottom: 64px;
  font: 400 clamp(56px, 9vw, 112px)/.95 var(--serif);
  letter-spacing: -.01em;
  animation: rise 900ms var(--ease-out) both 100ms;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
}

@keyframes fade {
  from { opacity: 0; }
}

/* Sections */

.section {
  max-width: var(--width);
  margin: 0 auto;
  padding: 96px var(--safe-r) 0 var(--safe-l);
}

.section__title {
  font: 500 15px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 32px;
}

/* About */

/* About fills the same column as the sections below it */

.statement p + p { margin-top: 16px; }

.statement__lead {
  font: 400 26px/1.45 var(--serif);
  margin-bottom: 24px;
}

/* Signature: written out left to right, the first time it scrolls into view */
.statement .signature {
  width: fit-content;
  margin-top: 40px;
  padding-right: 16px;
  font: 400 64px/1.2 "Mrs Saint Delafield", cursive;
  white-space: nowrap;
}

/* A mask with a soft leading edge slides across, like ink following the pen */
.signature.is-waiting,
.signature.is-signed {
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 250% 100%;
  mask-size: 250% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
}

.signature.is-signed { animation: sign 1900ms cubic-bezier(.45, .05, .4, 1) forwards; }

@keyframes sign {
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

.section__intro {
  max-width: 640px;
  margin: -16px 0 32px;
  color: var(--text-secondary);
}

/* The Path So Far: a timeline of chapters that open in place, after the reference site */

:root { interpolate-size: allow-keywords; }

.path__title { margin-top: 96px; }

.path { border-top: 1px solid var(--border); }

.path details { border-bottom: 1px solid var(--border); }

.path summary {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 24px;
  gap: 24px;
  align-items: baseline;
  padding: 24px 0;
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.path summary::-webkit-details-marker { display: none; }

.path__year {
  font: 400 15px/1.4 var(--sans);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.path__label { font: 400 22px/1.35 var(--serif); }

/* A plus that turns into a cross when the chapter is open */
.path summary::after {
  content: "";
  justify-self: end;
  width: 12px;
  height: 12px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
  transition: transform 200ms var(--ease-out);
}

.path details[open] summary::after { transform: rotate(45deg); }

/* Height opens smoothly where the browser supports it; elsewhere it opens at once */
.path details::details-content {
  block-size: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    block-size 300ms var(--ease-out),
    opacity 200ms var(--ease-out),
    content-visibility 300ms allow-discrete;
}

.path details[open]::details-content { block-size: auto; opacity: 1; }

.path__body {
  max-width: 640px;
  margin-left: 184px;
  padding-bottom: 32px;
}

.path__body p + p,
.path__body ul { margin-top: 16px; }

.path__body ul { padding-left: 20px; }

.path__body li + li { margin-top: 8px; }

.path__body a,
.statement a {
  text-decoration: underline 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--border);
}

/* Press + Diary rows */

/* "See All": the rest of a long list opens in place */
.more {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding: 12px 20px;
  border: 1px solid var(--text-primary);
  border-radius: 2px;
  background: none;
  color: var(--text-primary);
  font: 500 15px/1.2 var(--sans);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--press) var(--ease-out);
}

.more::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}

.more[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(-135deg); }

.more:active { transform: scale(.98); }


.list { list-style: none; border-top: 1px solid var(--border); }

.row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: baseline;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.row__meta,
.row__date { font-size: 15px; color: var(--text-secondary); }

.row__title {
  font: 400 22px/1.35 var(--serif);
  overflow-wrap: anywhere;
}

.row__excerpt {
  display: block;
  margin-top: 4px;
  font: 300 16px/1.5 var(--sans);
  color: var(--text-secondary);
}

a.row:active .row__title { color: var(--accent); }

/* Books: "the stacks". Each book is a 3D box standing spine-out on the shelf.
   The chosen book slides forward and turns to show its front cover; the one it
   replaces turns back. Its catalogue card shows below. */

.book[data-cloth="oxblood"] { --cloth: #5a2324; }
.book[data-cloth="bottle"]  { --cloth: #263b32; }
.book[data-cloth="navy"]    { --cloth: #22304a; }
.book[data-cloth="umber"]   { --cloth: #6b4a2f; }
.book[data-cloth="slate"]   { --cloth: #3f5a61; }
.book[data-cloth="ink"]     { --cloth: #1d1f20; }
.book[data-cloth="oat"]     { --cloth: #d9ceb6; --gilt: #6b4a2f; }
.book[data-cloth="chalk"]   { --cloth: #f1eee7; --gilt: #c8102e; }

/* Every row is the same height, so a shelf line sits under each row if the books wrap */
.shelf {
  --row: 296px;
  --scale: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 3px;
  padding: 0 4px;
  perspective: 1400px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(var(--row) - 2px),
    var(--text-primary) calc(var(--row) - 2px) var(--row)
  );
}

/* The slot on the shelf. It widens to the cover's width as the book turns. */
.book {
  --gilt: #c9a865;
  --bh: calc(var(--h) * var(--scale));     /* height */
  --cw: calc(var(--bh) * var(--ratio));    /* cover width, front to back on the shelf */
  --turn: 750ms cubic-bezier(.77, 0, .175, 1);
  position: relative;
  flex: none;
  width: var(--w);
  height: var(--bh);
  margin: calc(var(--row) - var(--bh) - 2px) 0 2px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: width var(--turn);
}

.book[aria-selected="true"] { width: var(--cw); z-index: 1; }

.book__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--turn);
}

/* Out of the shelf, toward the reader, then a quarter turn to the cover */
.book[aria-selected="true"] .book__body {
  transform: translateY(-14px) translateZ(calc(var(--cw) / 2 - var(--w) / 2 + 24px)) rotateY(-90deg);
}

.book__spine,
.book__cover {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.book__spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--w);
  margin-left: calc(var(--w) / -2);
  padding: 26px 0 30px;
  border-radius: 2px 2px 0 0;
  /* Light on the left, shade on the right: the curve of a rounded spine */
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 35%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, .22)),
    var(--cloth);
  color: var(--gilt);
  transform: translateZ(calc(var(--cw) / 2));
}

/* The front cover is the book's right-hand side while it stands on the shelf */
.book__cover {
  display: grid;
  place-items: center;
  width: var(--cw);
  margin-left: calc(var(--cw) / -2);
  overflow: hidden;
  border-radius: 0 2px 2px 0;
  background: var(--cloth);
  color: var(--gilt);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2));
}

.book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A shadow along the hinge, where the cover meets the spine */
.book__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0) 7%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

/* A typeset cover for books without a cover image, inside a gilt frame */
.book__cover:not(:has(img))::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--gilt);
  opacity: .7;
}

.book__cover-title {
  padding: 16px;
  font: 500 20px/1.15 var(--serif);
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
}

/* Gilt bands near the head and the foot */
.book__spine::before,
.book__spine::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 5px;
  border-block: 1px solid var(--gilt);
  opacity: .8;
}

.book__spine::before { top: 12px; }
.book__spine::after { bottom: 14px; }

.spine__year {
  font: 400 10px/1 var(--sans);
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: calc(var(--w) - 8px);
  overflow: hidden;
}

.spine__title {
  flex: 1;
  min-height: 0;
  margin: 12px 0;
  overflow: hidden;
  writing-mode: vertical-rl;
  font: 500 15px/1.1 var(--serif);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
}

.spine__author {
  font: 500 10px/1 var(--sans);
  letter-spacing: .12em;
}

.book[aria-selected="false"]:active .book__body { transform: translateY(-6px) scale(.98); }

/* Catalogue card: cream stock, a red rule under the heading line, faint blue rules,
   a punched hole at the foot. Lines are 28px apart and the text sits on them. */

.cards { margin-top: 48px; }

.stacks:not(.is-ready) .card + .card { margin-top: 32px; }

.card {
  --line: 28px;
  --ink: #2a2622;
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-content: start;
  max-width: 600px;
  min-height: 340px;
  padding: 24px 32px 64px 24px;
  background:
    linear-gradient(rgba(186, 64, 58, .55), rgba(186, 64, 58, .55)) 0 63px / 100% 1px no-repeat,
    repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), rgba(74, 112, 160, .16) calc(var(--line) - 1px) var(--line)) 0 64px / 100% calc(100% - 64px) no-repeat,
    #fbf8f0;
  color: var(--ink);
  font: 400 15px/var(--line) "Courier Prime", "Courier New", monospace;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .06),
    0 1px 2px rgba(0, 0, 0, .06),
    0 6px 16px rgba(0, 0, 0, .06),
    0 18px 40px rgba(0, 0, 0, .05);
}

.card[hidden] { display: none; }

.card:not([hidden]) { animation: card-in 320ms var(--ease-out); }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(2px); }
}

.card:focus { outline: none; }

/* The punched hole for the catalogue drawer rod */
.card::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
}

.card > * { grid-column: 2; }

/* Each part of the call number sits on its own ruled line */
.card__call {
  grid-column: 1;
  grid-row: 1 / span 6;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-weight: 700;
}

.card__author { margin-bottom: 12px; }

.card__title {
  font: inherit;
  font-weight: 700;
  text-wrap: pretty;
}

.card__imprint { font-variant-numeric: tabular-nums; }

.card__note { margin-top: var(--line); }

/* Read and Download keep clear space between them, side by side or stacked */
.card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  margin-top: var(--line);
}

.card__borrow {
  display: inline-block;
  font-weight: 700;
  text-decoration: underline 1px;
  text-underline-offset: 4px;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--press) var(--ease-out);
}

.card__borrow:active { transform: scale(.98); }

.card__size { margin-left: 16px; color: #6b6259; font-variant-numeric: tabular-nums; }

/* Read sits before Download as the main action */
.card__read {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font: 700 15px/var(--line) "Courier Prime", "Courier New", monospace;
  line-height: 18px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--press) var(--ease-out);
}

.card__read:active { transform: scale(.98); }

.card__read-page { font-weight: 400; font-variant-numeric: tabular-nums; }
.card__read-page:empty { display: none; }

/* Reader: a full-screen dialog that turns pages like a book */

[data-reading] { overflow: hidden; }

.reader {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #ecebe7;
  color: var(--text-primary);
  overscroll-behavior: contain;
}

.reader[open] {
  display: flex;
  flex-direction: column;
  animation: reader-in 300ms var(--ease-out);
}

.reader.is-closing { animation: reader-out 180ms var(--ease-out) forwards; }

.reader::backdrop { background: transparent; }

@keyframes reader-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes reader-out {
  to { opacity: 0; }
}

.reader__progress {
  height: 2px;
  background: rgba(0, 0, 0, .06);
}

.reader__progress span {
  display: block;
  height: 100%;
  background: var(--text-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
}

.reader__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 16px;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.reader__title {
  overflow: hidden;
  font: 400 20px/1.2 var(--serif);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader__count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.reader__page {
  width: 4ch;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  text-align: right;
}

.reader__page:focus { outline: none; border-bottom-color: var(--accent); }

.reader__close.burger {
  position: static;
  color: var(--text-primary);
}

.reader__close span { background-color: transparent; }
.reader__close span::before { transform: rotate(45deg); }
.reader__close span::after { transform: rotate(-45deg); }

/* The stage holds one view: a single page, or two pages meeting at the spine */
.reader__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  outline: none;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

.reader__spread {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.reader__sheet {
  position: relative;
  flex: none;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 2px 6px rgba(0, 0, 0, .06), 0 12px 32px rgba(0, 0, 0, .06);
}

.reader__sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* The fold: a soft shadow on each side of the spine */
.reader__sheet--left::after,
.reader__sheet--right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6%;
  pointer-events: none;
}

.reader__sheet--left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .09), rgba(0, 0, 0, 0)); }
.reader__sheet--right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .09), rgba(0, 0, 0, 0)); }

/* Quiet arrows at the edges, for mouse users; touch screens tap or swipe instead */
.reader__turn {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 48px;
  height: 96px;
  margin-top: -48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  opacity: .35;
  cursor: pointer;
}

.reader__turn--prev { left: max(8px, env(safe-area-inset-left)); }
.reader__turn--next { right: max(8px, env(safe-area-inset-right)); }

.reader__turn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
}

.reader__turn--prev::before { transform: translate(-30%, -50%) rotate(-45deg); }
.reader__turn--next::before { transform: translate(-70%, -50%) rotate(135deg); }

.reader__turn:disabled { opacity: 0; pointer-events: none; }

@media (hover: none), (pointer: coarse) {
  .reader__turn { display: none; }
}

.reader__error {
  max-width: 480px;
  margin: 64px auto;
  text-align: center;
}

.reader__error a { text-decoration: underline 1px; text-underline-offset: 4px; }

/* Date-due stamp, inked when the PDF is downloaded */
.card__stamp {
  position: absolute;
  right: 28px;
  bottom: 40px;
  padding: 4px 10px;
  border: 3px double #a8322c;
  color: #a8322c;
  font: 700 13px/1.35 "Courier Prime", "Courier New", monospace;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
  mix-blend-mode: multiply;
  opacity: 0;
  transform: rotate(-8deg);
  pointer-events: none;
}

.card.is-stamped .card__stamp { animation: stamp 260ms var(--ease-out) forwards; }

@keyframes stamp {
  from { opacity: 0; transform: rotate(-8deg) scale(1.4); }
  to { opacity: .88; transform: rotate(-8deg) scale(1); }
}

/* Footer */

.footer {
  margin-top: 128px;
  padding: 48px var(--safe-r) max(48px, env(safe-area-inset-bottom)) var(--safe-l);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 15px;
}

.footer a {
  display: inline-block;
  min-width: 24px;
  padding: 8px 4px;
  text-decoration-color: var(--border);
}

.footer__copy { margin-top: 8px; color: var(--text-secondary); }

/* Hover only where a pointer can hover, so taps don't leave sticky states.
   Colour changes are instant; only the press scale is timed. */

@media (hover: hover) and (pointer: fine) {
  .footer a:hover { text-decoration-color: currentColor; }
  .menu__list a:hover { color: var(--accent); }
  a.row:hover .row__title,
  .path summary:hover .path__label { color: var(--accent); }
  .path__body a:hover { text-decoration-color: currentColor; }
  .book[aria-selected="false"]:hover .book__body { transform: translateY(-6px); }
  .card__borrow:hover { color: #a8322c; }
  .card__read:hover { background: var(--ink); color: #fbf8f0; }
  .reader__turn:hover { opacity: 1; }
  .more:hover { background: var(--text-primary); color: var(--surface); }
}

/* Mobile */

@media (max-width: 640px) {
  .burger { right: max(12px, env(safe-area-inset-right)); }
  .hero__name { left: var(--safe-l); bottom: 48px; }

  .section { padding-top: 64px; }

  .statement__lead { font-size: 22px; }
  .statement .signature { font-size: 52px; }

  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 16px 0; }

  .path__title { margin-top: 64px; }
  .path summary { grid-template-columns: minmax(0, 1fr) 24px; gap: 4px 16px; padding: 16px 0; }
  .path__year { grid-column: 1; }
  .path__label { grid-column: 1; font-size: 20px; }
  .path summary::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .path__body { margin-left: 0; padding-bottom: 24px; }
  .row__title { font-size: 20px; }

  .shelf { --row: 256px; --scale: .86; }
  .card { grid-template-columns: 64px minmax(0, 1fr); padding: 24px 20px 64px 16px; font-size: 14px; }

  .footer { margin-top: 96px; }
}

/* Reduced motion keeps the fades and drops the movement */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__name { animation-name: fade; }
  .menu,
  [data-menu-open] .menu { clip-path: none; opacity: 0; transition: opacity 200ms var(--ease-out), visibility 0s linear 200ms; }
  [data-menu-open] .menu { opacity: 1; transition: opacity 200ms var(--ease-out), visibility 0s; }
  .menu__list a { transform: none; filter: none; }
  .card__borrow:active { transform: none; }
  /* Books swap spine for cover with a fade instead of turning */
  .book { transition: none; }
  .book__body,
  .book[aria-selected] .book__body { transform: none; transition: none; }
  .book__spine,
  .book__cover { transform: none; transition: opacity 200ms var(--ease-out); }
  .book__cover { opacity: 0; }
  .book[aria-selected="true"] .book__cover { opacity: 1; }
  .book[aria-selected="true"] .book__spine { opacity: 0; }
  .card:not([hidden]) { animation-name: fade; }
  .path details::details-content { transition: opacity 200ms var(--ease-out), content-visibility 200ms allow-discrete; block-size: auto; }
  .card.is-stamped .card__stamp { animation: none; opacity: .88; }
  .reader[open] { animation-name: fade; }
  .signature.is-waiting, .signature.is-signed { -webkit-mask-image: none; mask-image: none; animation: none; }
  .more:active { transform: none; }
  .card__read:active { transform: none; }
}
