/*
 * Near Fine
 *
 * Plain CSS served by Propshaft. No build step. Colors are OKLCH tokens with a dark
 * variant under prefers-color-scheme; components only reference the semantic tokens.
 * The palette is paper and ink with one accent, cinnabar: the red that printers used
 * for rubrics and title pages, here kept for the few marks that matter.
 * Type is Source Serif 4 for reading, with Departure Mono, a pixel monospace, for
 * labels, controls and code (both SIL Open Font License, self-hosted as Latin
 * subsets).
 */

/* Fonts
   ========================================================================== */

@font-face {
  font-family: "Source Serif";
  src: url("/assets/source-serif-1a2ec00b.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Departure Mono";
  src: url("/assets/departure-mono-7d5f0643.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Tokens
   ========================================================================== */

:root {
  color-scheme: light dark;

  --font-serif: "Source Serif", Georgia, "Times New Roman", serif;
  --font-mono: "Departure Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Running text grows from 19px on phones to 23px on wide screens, and leads
     stay a step above it */
  --text-body: clamp(1.1875rem, 1.05rem + 0.45vw, 1.4375rem);
  --text-lead: clamp(1.375rem, 1.1rem + 0.9vw, 1.875rem);

  --color-bg: oklch(0.982 0.004 85);
  --color-surface: oklch(0.997 0.002 85);
  --color-subtle: oklch(0.958 0.005 85);
  --color-border: oklch(0.895 0.006 80);
  --color-border-strong: oklch(0.6 0.009 75);
  --color-rule: oklch(0.8 0.008 78);
  --color-text: oklch(0.2 0.008 70);
  --color-text-secondary: oklch(0.47 0.01 70);

  /* Cinnabar: a fill for marks, and a deeper shade for text and links */
  --color-accent: oklch(0.58 0.17 30);
  --color-accent-text: oklch(0.52 0.17 29);
  --color-accent-subtle: oklch(0.58 0.17 30 / 0.16);
  /* A reader's highlighter, swiped behind what a card confirms the shopper asked for */
  --color-highlight: color-mix(in oklch, var(--color-accent) 22%, transparent);

  --color-primary: oklch(0.2 0.008 70);
  --color-primary-hover: oklch(0.34 0.009 70);
  --color-on-primary: oklch(0.982 0.004 85);
  --color-focus: oklch(0.2 0.008 70);
  --color-positive: oklch(0.47 0.09 160);
  --color-cover: oklch(0.27 0.008 70);
  --color-on-cover: oklch(0.93 0.005 85);
  --color-image-outline: oklch(0 0 0 / 0.08);
  --color-backdrop: oklch(0.2 0.01 70 / 0.35);

  --shadow-md: 0 1px 2px oklch(0.2 0.01 70 / 0.06), 0 12px 28px -12px oklch(0.2 0.01 70 / 0.2);
  --shadow-cover: 0 1px 2px oklch(0.2 0.01 70 / 0.16), 0 6px 12px oklch(0.2 0.01 70 / 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --gutter: clamp(1rem, 4vw, 3rem);
  /* The header's height, where the phone menu starts: the wordmark's line and
     the padding */
  --site-header-height: 4.6125rem;
  --page: 76rem;
  --measure: min(100% - 2 * var(--gutter), var(--page));
  --section: clamp(4rem, 3rem + 5vw, 8rem);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: oklch(0.17 0.005 70);
    --color-surface: oklch(0.205 0.006 70);
    --color-subtle: oklch(0.24 0.007 70);
    --color-border: oklch(0.305 0.008 70);
    --color-border-strong: oklch(0.56 0.01 70);
    --color-rule: oklch(0.305 0.008 70);
    --color-text: oklch(0.95 0.005 85);
    --color-text-secondary: oklch(0.75 0.01 80);

    --color-accent: oklch(0.68 0.15 33);
    --color-accent-text: oklch(0.74 0.13 35);
    --color-accent-subtle: oklch(0.68 0.15 33 / 0.22);
    --color-highlight: color-mix(in oklch, var(--color-accent) 34%, transparent);

    --color-primary: oklch(0.95 0.005 85);
    --color-primary-hover: oklch(0.86 0.006 85);
    --color-on-primary: oklch(0.17 0.005 70);
    --color-focus: oklch(0.95 0.005 85);
    --color-positive: oklch(0.77 0.1 160);
    --color-cover: oklch(0.34 0.008 70);
    --color-image-outline: oklch(1 0 0 / 0.08);
    --color-backdrop: oklch(0 0 0 / 0.6);

    --shadow-md: 0 0 0 1px oklch(1 0 0 / 0.06), 0 16px 32px -12px oklch(0 0 0 / 0.6);
    --shadow-cover: 0 2px 10px oklch(0 0 0 / 0.5);
  }
}

/* Base
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  @view-transition {
    navigation: auto;
  }
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-underline-offset: 0.22em;
  text-decoration-thickness: from-font;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--color-subtle);
}

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

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

[hidden] {
  display: none !important;
}

.nowrap {
  white-space: nowrap;
}

/* A shop's own name in another script stays whole, since Chinese and
   Japanese would otherwise break between any two characters */
bdi[lang] {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
  color: var(--color-on-primary);
  background: var(--color-primary);
  translate: 0 -100%;
}

.skip-link:focus {
  translate: 0 0;
}

/* A quiet label above a page title */
.eyebrow {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-accent-text);
}

/* Wordmark
   ========================================================================== */

.wordmark {
  display: inline-block;
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  view-transition-name: wordmark;

  /* The box includes the underline below the letters, so centred in the
     header the letters look high beside the nav. Nudge them level. */
  translate: 0 2px;
}

/* On phones the search page's "N." sits centred on its form, so the home
   page's N goes to the same spot and stays put between the two */
@media (max-width: 40rem) {
  .wordmark {
    translate: 0 4px;
  }
}

/* Each snapshot keeps its own size, so between the full wordmark and the
   search page's "N." on phones the rest fades out rather than stretching */
::view-transition-old(wordmark),
::view-transition-new(wordmark) {
  width: auto;
}

.wordmark-dot {
  color: var(--color-accent);
}

/* A hand-drawn underline, as on lineofflig.ht: a filled shape that swells and
   tapers like ink from a pen, stretched to the width of the word */
.scribble {
  position: relative;
  display: inline-block;
  padding-bottom: 0.3em;
}

.scribble svg {
  position: absolute;
  left: -3%;
  bottom: 0;
  width: 106%;
  height: 0.38em;
  overflow: visible;
  fill: var(--color-accent);
}

/* Header and footer
   ========================================================================== */

.site-header {
  position: relative;
  z-index: 10;
  background: var(--color-bg);
}

.site-header-inner {
  display: flex;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  width: var(--measure);
  margin-inline: auto;
  padding-block: 1.25rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem clamp(1rem, 5vw - 0.25rem, 1.75rem);
  font-size: 1rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--color-text-secondary);
  white-space: nowrap;
  text-decoration: none;
  transition: color 150ms var(--ease);
}

.site-nav a[aria-current="page"] {
  color: var(--color-text);
}

.site-nav form {
  display: contents;
}

.site-nav-sign-out {
  padding: 0;
  font: inherit;
  color: var(--color-text-secondary);
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 150ms var(--ease);
}

/* On phones Alerts and Sign out sit together at the foot of the menu */
.site-menu .site-menu-alerts {
  display: none;
}

@media (max-width: 61.99rem) {
  .site-nav-alerts,
  .site-nav-sign-out {
    display: none;
  }
}

@media (hover: hover) {
  .site-nav a:hover,
  .site-nav-sign-out:hover {
    color: var(--color-text);
  }
}

/* The full nav needs about 61rem signed in and 54rem signed out. Below 62rem
   the account link stays in the header and the other links fold into a
   full-screen popover behind the burger. The popover starts under the header,
   which pins itself to the top while the menu is open, so the burger stays in
   reach to close it */
.site-menu-button,
.site-menu .site-menu-cta {
  display: none;
}

.site-menu form {
  display: contents;
}

@media (min-width: 62rem) {
  .site-menu {
    display: contents;
  }
}

@media (max-width: 61.99rem) {
  :root:has(.site-menu:popover-open) {
    overflow: hidden;
  }

  .site-header:has(.site-menu:popover-open) {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
  }

  .site-nav {
    align-items: center;
  }

  .site-nav > a {
    padding: 0.625rem 0.375rem;
    margin: -0.625rem -0.375rem;
  }

  .site-menu-button {
    display: block;
    padding: 0.875rem 0.6875rem;
    margin: -0.875rem -0.6875rem;
    color: var(--color-text);
    background: none;
    border: 0;
    cursor: pointer;
  }

  .site-menu-button svg {
    display: block;
  }

  .site-menu-button path {
    transform-box: fill-box;
    transform-origin: center;
  }

  .site-nav:has(.site-menu:popover-open) .site-menu-button path:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-nav:has(.site-menu:popover-open) .site-menu-button path:nth-child(2) {
    opacity: 0;
  }

  .site-nav:has(.site-menu:popover-open) .site-menu-button path:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .site-menu {
    position: fixed;
    inset: calc(env(safe-area-inset-top, 0px) + var(--site-header-height)) 0 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.5rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom, 0px));
    color: inherit;
    background: var(--color-bg);
    border: 0;
    overscroll-behavior: contain;
  }

  .site-menu:popover-open {
    display: flex;
    flex-direction: column;
  }

  .site-menu a {
    padding-block: 1.125rem;
    font-family: var(--font-serif);
    font-size: 1.625rem;
    font-weight: 400;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
  }

  .site-menu a[aria-current="page"] {
    color: var(--color-accent-text);
  }

  .site-menu a:focus-visible {
    outline-offset: -2px;
  }

  .site-menu .site-menu-alerts {
    display: block;
    margin-top: auto;
  }

  .site-menu .site-menu-alerts ~ form .site-menu-cta {
    margin-top: 1rem;
  }

  .site-menu .site-menu-cta {
    display: flex;
    margin-top: auto;
    padding-block: 0.875rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
  }

  .site-menu a.site-menu-cta {
    color: var(--color-on-primary);
    border: 0;
  }
}

@media (max-width: 61.99rem) and (prefers-reduced-motion: no-preference) {
  .site-menu-button path {
    transition: transform 200ms var(--ease), opacity 150ms var(--ease);
  }

  .site-menu {
    opacity: 0;
    transition: opacity 150ms var(--ease), display 150ms allow-discrete, overlay 150ms allow-discrete;
  }

  .site-menu:popover-open {
    opacity: 1;
  }

  @starting-style {
    .site-menu:popover-open {
      opacity: 0;
    }
  }
}

.site-footer {
  border-top: 1px solid var(--color-border);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  justify-content: space-between;
  width: var(--measure);
  margin-inline: auto;
  padding-block: 1.75rem 2.25rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* A line of its own across the footer, with the links under it */
.footer-disclosure {
  flex-basis: 100%;
  text-wrap: pretty;
}

/* Four columns across, two by two on phones */
.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  flex-basis: 100%;
  gap: 1.5rem 2rem;
  margin-top: 0.5rem;
}

@media (min-width: 48rem) {
  .footer-nav {
    grid-template-columns: repeat(4, 1fr);
  }
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.footer-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--color-accent-text);
  text-transform: uppercase;
}

.footer-nav a {
  text-decoration: none;
  transition: color 150ms var(--ease);
}

@media (hover: hover) {
  .footer-nav a:hover {
    color: var(--color-text);
  }
}

/* Buttons
   ========================================================================== */

.button {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  justify-content: center;
  padding: 0.4375rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), scale 150ms ease-out;
}

.button svg {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
}

@media (prefers-reduced-motion: no-preference) {
  .button:not(:disabled):active {
    scale: 0.97;
  }
}

.button--primary {
  color: var(--color-on-primary);
  background: var(--color-primary);
}

.button--secondary {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.button--secondary svg {
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .button--primary:hover {
    background: var(--color-primary-hover);
  }

  .button--secondary:hover {
    border-color: var(--color-border-strong);
  }
}

/* Search form
   ========================================================================== */

/* The field and its button share one frame, which shows focus for the input inside it */
.search-form {
  position: relative;
  display: flex;
  gap: 0.375rem;
  align-items: center;
  width: 100%;
  padding: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.search-form:has(.search-input:focus-visible) {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-border);
}

.combobox {
  flex: 1;
  min-width: 0;
}

.search-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.5rem 0 0.875rem;
  font-size: 1.0625rem;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  appearance: none;
}

.search-input::placeholder {
  color: var(--color-text-secondary);
  opacity: 1;
}

.search-input::-webkit-search-decoration {
  appearance: none;
}

/* Chrome draws the clear button in blue */
.search-input::-webkit-search-cancel-button {
  filter: grayscale(1);
}

/* The frame around it shows focus instead */
.search-input:focus-visible {
  outline: 2px solid transparent;
}

.search-button {
  display: inline-flex;
  flex: none;
  gap: 0.5rem;
  align-items: center;
  height: 2.5rem;
  padding: 0 1.125rem 0 1rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms var(--ease), scale 150ms ease-out;
}

.search-button svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
}

@media (prefers-reduced-motion: no-preference) {
  .search-button:not(:disabled):active {
    scale: 0.97;
  }
}

@media (hover: hover) {
  .search-button:hover {
    background: var(--color-primary-hover);
  }
}

@media (max-width: 30rem) {
  .search-button {
    justify-content: center;
    width: 2.5rem;
    padding: 0;
  }

  .search-button span {
    display: none;
  }
}

/* Suggestions (typeahead listbox), under the whole frame */

.suggestions {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 60dvh;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  text-align: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.suggestion {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.suggestion[aria-selected="true"] {
  background: var(--color-subtle);
}

@media (hover: hover) {
  .suggestion:hover {
    background: var(--color-subtle);
  }
}

.suggestion-title {
  font-weight: 500;
}

.suggestion-author {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* Home: hero
   ========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  width: var(--measure);
  margin-inline: auto;
  padding-block: clamp(2rem, 6vw, 5.5rem) clamp(2.5rem, 5vw, 4.5rem);
}

@media (min-width: 62rem) {
  .hero {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-areas:
      "title title"
      "copy sketch";
    column-gap: clamp(3rem, 6vw, 6rem);
    row-gap: clamp(2rem, 3.5vw, 3rem);
  }

  .hero-title {
    grid-area: title;
  }

  .hero-copy {
    grid-area: copy;
  }

  .sketch {
    grid-area: sketch;
  }
}

/* Two lines, broken after the comma. Narrow enough that "from any bookseller" can't join the
   first line, and on phones small enough that it still fits on the second. */
.hero-title {
  max-width: 8.4em;
  font-size: clamp(2rem, min(1.25rem + 6.2vw, 11.6vw - 0.25rem), 6.75rem);
  font-weight: 560;
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-wrap: wrap;
}

/* The full stop echoes the wordmark's */
.hero-stop {
  color: var(--color-accent);
}

.hero-copy {
  display: grid;
  gap: 1.5rem;
  align-content: start;
  justify-items: start;
}

/* Wide enough for two lines on tablets and in the desktop grid from about 1240px. In em so the
   cap scales with the fluid lead size. */
.hero-lead {
  max-width: 23em;
  font-size: var(--text-lead);
  line-height: 1.45;
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

.hero .search-form {
  max-width: 36rem;
  padding: 0.3125rem;
}

.hero .search-input,
.hero .search-button {
  height: 3rem;
}

.hero .search-input {
  padding-inline: 1rem 0.5rem;
  font-size: 1.125rem;
}

@media (max-width: 30rem) {
  .hero .search-button {
    width: 3rem;
  }
}

.hero-examples {
  margin-top: -0.375rem;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.hero-examples a {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  text-decoration-color: var(--color-border-strong);
  transition: text-decoration-color 150ms var(--ease);
}

@media (hover: hover) {
  .hero-examples a:hover {
    text-decoration-color: var(--color-accent);
  }
}

.hero-assistants {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  text-wrap: pretty;
}

/* The arrow stays with the last word when the line wraps */
.hero-assistants svg {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  vertical-align: -0.1875rem;
  color: var(--color-accent-text);
  transition: translate 200ms var(--ease);
}

@media (hover: hover) {
  .hero-assistants:hover svg {
    translate: 3px 0;
  }
}

/* A book in charcoal pencil (see application/_sketch.html.erb), ink on the paper in either
   theme, with the cinnabar of the full stop in the ribbon */
.sketch {
  display: block;
  align-self: end;
  width: 100%;
  max-width: 30rem;
  height: auto;
  color: var(--color-text);
}

.sketch-ribbon {
  fill: var(--color-accent);
}

/* Rufus Margin, the Ledger's friend, at /margin
   ========================================================================== */

.margin-figure {
  width: min(15rem, 100%);
  margin: 0.5rem 0 1.5rem;
}

.margin-portrait {
  display: block;
  width: 100%;
  height: auto;
  color: var(--color-text);
}

.margin-figure figcaption {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--color-text-secondary);
}

.margin-quotes blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  font-style: italic;
  border-left: 2px solid var(--color-accent);
}

/* The small print at the foot of his page: he's invented */
.prose .margin-fineprint {
  margin: 3rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

/* A post's byline: Rufus, linked to his page */
.prose .ledger-byline {
  margin: -0.5rem 0 1.5rem;
  font-size: 1rem;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Rufus Margin signs off each Ledger post */
.prose .ledger-signoff {
  margin: 2rem 0 0;
  font-style: italic;
}

/* Home: booksellers
   ========================================================================== */

.sellers {
  display: grid;
  gap: 0.75rem 3rem;
  width: var(--measure);
  margin-inline: auto;
  padding-block: 1.5rem 1.625rem;
  border-block: 1px solid var(--color-border);
}

@media (min-width: 48rem) {
  .sellers {
    grid-template-columns: 9rem minmax(0, 1fr);
    align-items: baseline;
  }
}

.sellers-title {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.sellers-list {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  font-size: clamp(0.9375rem, 0.875rem + 0.3vw, 1.125rem);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.01em;
  list-style: none;
}

.sellers-list li {
  white-space: nowrap;
}

.sellers-list li:not(:last-child)::after {
  content: "/" / "";
  margin-inline: 0.45em;
  font-weight: 300;
  color: var(--color-border-strong);
}

/* Home: how it works
   ========================================================================== */

.section {
  padding-block: var(--section);
}

.section-inner {
  width: var(--measure);
  margin-inline: auto;
}

.section-title {
  max-width: 15ch;
  font-size: clamp(2rem, 1.2rem + 3vw, 3.75rem);
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
}

.section-header {
  display: grid;
  gap: 1rem 4rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

@media (min-width: 62rem) {
  .section-header {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
  }
}

.section-lead {
  max-width: 30rem;
  font-size: var(--text-lead);
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

/* Two ways in: the site and an assistant, each with a small example */
.ways {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem) clamp(1rem, 2.5vw, 1.5rem);
}

@media (min-width: 52rem) {
  .ways {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.way {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1.25rem;
  margin: 0;
}

.way figcaption {
  display: grid;
  gap: 0.375rem;
}

.way h3 {
  font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.875rem);
  letter-spacing: -0.02em;
}

.way p {
  max-width: 34rem;
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

.demo {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-height: 17rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.demo-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.demo-link:hover {
  border-color: var(--color-border-strong);
}

.demo-link:focus-visible {
  outline-offset: 3px;
}

.demo-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.25rem 0.25rem 0.875rem;
  font-size: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}

.demo-search-button {
  width: 2.25rem;
  height: 1.875rem;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
}

.demo-status {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.demo-offers {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-offer {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.125rem 0.875rem;
  align-items: center;
  padding-block: 0.75rem;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--color-border);
}

.demo-cover {
  display: grid;
  grid-row: span 2;
  place-items: center;
  aspect-ratio: 2 / 3;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-on-cover);
  background: var(--color-cover);
  border-radius: 2px 3px 3px 2px;
}

.demo-price {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.625rem;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.demo-offer--best .demo-amount {
  color: var(--color-accent-text);
}

.demo-meta {
  overflow: hidden;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-free {
  font-weight: 600;
  color: var(--color-positive);
}

.demo--chat {
  gap: 1rem;
  font-size: 1rem;
}

.chat-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 0.75rem 1rem;
  background: var(--color-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  text-wrap: pretty;
}

.chat-tool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.chat-tool svg {
  width: 1rem;
  height: 1rem;
  padding: 0.1875rem;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-radius: 50%;
}

.chat-tool code {
  font-size: 0.8125rem;
}

.chat-reply {
  max-width: 92%;
  text-wrap: pretty;
}

.chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-links span {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.chat-links span::after {
  content: "↗" / "";
  color: var(--color-text-secondary);
}

/* The examples play in order once they scroll into view (see reveal_controller.js) */
.is-pending [style*="--i"] {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .is-revealed [style*="--i"] {
    animation: rise 600ms var(--ease-out) calc(var(--i) * 450ms) both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      translate: 0 0.5rem;
    }
  }
}

.features {
  display: grid;
  gap: 2rem clamp(1.5rem, 4vw, 3rem);
  margin: clamp(3.5rem, 7vw, 6rem) 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* With alerts there are four, two to a row */
  .features:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-text);
}

.feature h3 {
  font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.875rem);
  letter-spacing: -0.015em;
}

.feature p {
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

/* Home: AI assistants
   ========================================================================== */

.assistants {
  padding-block: var(--section);
  background: var(--color-subtle);
}

/* minmax(0, …) keeps long code from widening the columns past the page */
.assistants-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(3rem, 6vw, 5rem);
  width: var(--measure);
  margin-inline: auto;
}

.assistants-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem 4rem;
  align-items: end;
}

@media (min-width: 62rem) {
  .assistants-intro {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}

.assistants-heading {
  display: grid;
  gap: 1.25rem;
}

.assistants-lead {
  max-width: 36rem;
  font-size: var(--text-lead);
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

.assistants-connect {
  display: grid;
  gap: 1rem;
}

.assistants-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 500;
  list-style: none;
}

.assistants-links a {
  text-decoration-color: var(--color-border-strong);
  transition: text-decoration-color 150ms var(--ease);
}

@media (hover: hover) {
  .assistants-links a:hover {
    text-decoration-color: var(--color-accent);
  }
}

/* A value to copy: the server URL */
.copyable-label {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.copyable {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3125rem 0.3125rem 0.3125rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}

/* Long values wrap rather than scroll, so they can be read in full */
.copyable code {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0;
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.1875rem);
  overflow-wrap: anywhere;
  background: none;
}

.copy-button {
  flex: none;
  min-width: 4.75rem;
  padding: 0.5rem 1rem;
}

.steps {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

/* Step numbers hang in their own column */
.steps li {
  position: relative;
  padding-left: 1.75rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.tools {
  display: grid;
  gap: 0.5rem;
}

.tools dd + dt {
  margin-top: 0.5rem;
}

.tools dt code {
  font-size: 1rem;
}

/* Results
   ========================================================================== */

.search-page {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* Its height, where the phone menu starts: the search form (3rem and its 2px
   border), the padding and the 1px rule below */
.site-header--search {
  --site-header-height: calc(4.5rem + 3px);
  position: sticky;
  top: 0;
  background: color-mix(in oklab, var(--color-bg) 85%, transparent);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(16px) saturate(1.4);
  will-change: transform;
}

.site-header--search .site-header-inner {
  justify-content: flex-start;
  width: auto;
  margin-inline: var(--gutter);
  padding-block: 0.75rem;
}

/* The footer lines up with the results, which run gutter to gutter */
.search-page ~ .site-footer .site-footer-inner {
  width: auto;
  margin-inline: var(--gutter);
}

.site-header--search .search-form {
  flex: 1;
  min-width: 0;
  max-width: 48rem;
}

.progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--color-accent);
  transition: width 300ms var(--ease), opacity 300ms var(--ease);
}

.progress.is-done .progress-bar {
  opacity: 0;
}

.results-page {
  width: 100%;
  padding: 0 var(--gutter) 4rem;
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 0;
}

/* Under the toolbar, on Best deal: "Your booksellers rank as if 5% cheaper" */
.results-note {
  margin: -0.5rem 0 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.results-note[hidden] {
  display: none;
}

/* "70 results from 30 booksellers · Delivering to the Netherlands" on one line where both
   fit. Where they don't, the country starts a line of its own: its dot sits in the gap
   before it, so at the start of a line it falls left of the box and the clip hides it. */
.results-summary {
  --dot: 2.5ch;
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--dot);
  align-items: baseline;
  /* Room for the picker's focus ring at the end of a line */
  padding-inline-end: 4px;
  overflow-x: clip;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}

/* The country reads as part of the sentence, with a caret to say it changes. The select
   lies unseen over it, so a click anywhere on it opens the list. */
.results-country {
  position: relative;
  margin-left: calc(-1 * var(--dot));
  padding-left: var(--dot);
}

.results-country[hidden] {
  display: none;
}

.results-country::before {
  position: absolute;
  left: 0;
  width: var(--dot);
  text-align: center;
  content: "·";
}

.results-country-name {
  color: var(--color-text);
  text-decoration: underline 1px var(--color-border-strong);
  text-underline-offset: 0.25em;
}

.results-country-name::after {
  display: inline-block;
  width: 8px;
  height: 4px;
  margin-left: 0.5ch;
  vertical-align: middle;
  content: "";
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.results-country select {
  position: absolute;
  inset: 0;
  width: 100%;
  /* At 16px, iOS doesn't zoom in when it opens */
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  appearance: none;
}

.results-country:has(select:focus-visible) .results-country-name {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Segmented control: radios inside styled labels */

.segmented {
  display: inline-flex;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--color-border);
  background: var(--color-subtle);
  border-radius: var(--radius-sm);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 0.3125rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--color-text-secondary);
  border-radius: 4px;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}

.segmented input:checked + span {
  color: var(--color-on-primary);
  background: var(--color-primary);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.segmented[hidden],
.segmented label[hidden] {
  display: none;
}

/* Icons in place of words, a line of text tall */
.segmented--icons > label > span {
  padding-inline: 0.5rem;
}

.segmented--icons svg {
  display: block;
  width: 1.25em;
  height: 1.25em;
}

/* Booksellers: a button that opens the list of those in view, which once some are picked names
   them, inked like a chosen segment, with a second half that clears them */

.seller-filter {
  display: inline-flex;
  min-width: 0;
}

.seller-filter[hidden],
.seller-filter-clear[hidden] {
  display: none;
}

.seller-filter-toggle {
  min-width: 0;
}

.seller-filter-toggle svg {
  width: 1rem;
  height: 1rem;
}

.seller-filter-label {
  min-width: 0;
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seller-filter.is-on .button {
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.seller-filter.is-on .button svg {
  color: currentColor;
}

.seller-filter.is-on .seller-filter-toggle {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.seller-filter-clear {
  padding-inline: 0.5rem;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  box-shadow: inset 1px 0 color-mix(in oklch, var(--color-on-primary) 30%, transparent);
}

@media (hover: hover) {
  .seller-filter.is-on .button:hover {
    background: var(--color-primary-hover);
  }
}

.seller-filter .button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* The list opens under the toolbar, the whole width, and scrolls within itself on phones */
.seller-panel {
  display: grid;
  flex-basis: 100%;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.seller-panel[hidden],
.seller-panel-clear[hidden],
.seller-none[hidden],
.seller-choices li[hidden] {
  display: none;
}

.seller-panel-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.seller-find {
  flex: 1;
  min-width: 0;
  max-width: 24rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  /* At 16px, iOS doesn't zoom in on it */
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  appearance: none;
}

.seller-find::placeholder {
  color: var(--color-text-secondary);
  opacity: 1;
}

.seller-find::-webkit-search-decoration {
  appearance: none;
}

.seller-find::-webkit-search-cancel-button {
  filter: grayscale(1);
}

.seller-find:focus-visible {
  border-color: var(--color-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--color-border);
}

.seller-panel-clear {
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.seller-panel-clear:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .seller-panel-clear:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: from-font;
  }
}

.seller-choices {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A plain scrolling list on phones; columns once two 15rem tracks fit */
.seller-choices ul {
  display: block;
  max-height: min(24rem, 45svh);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  contain: content;
  list-style: none;
}

@media (min-width: 36rem) {
  .seller-choices ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    column-gap: 1.5rem;
  }
}

/* A row is the choice and, with accounts on, a star that favours the bookseller */
.seller-choices li {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.seller-choice {
  display: flex;
  flex: 1;
  gap: 0.625rem;
  align-items: center;
  min-width: 0;
  padding: 0.4375rem 0.25rem;
  font-size: 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}

.seller-choice input {
  flex: none;
  width: 1.0625rem;
  height: 1.0625rem;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.seller-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seller-count {
  margin-left: auto;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .seller-choice:hover {
    background: var(--color-subtle);
  }
}

.seller-none {
  padding: 0.4375rem 0.25rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* Ebooks and audiobooks wait above the print copies: a row per format, naming each
   seller once at its cheapest */

.also {
  display: grid;
  margin: 0 0 1rem;
  padding: 0.25rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.also[hidden],
.also-format[hidden],
.also-all[hidden] {
  display: none;
}

.also-format {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  align-items: center;
  padding: 0.625rem 0;
}

.also-format:not([hidden]) ~ .also-format:not([hidden]) {
  border-top: 1px solid var(--color-border);
}

.also-title {
  margin-right: 0.5rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.also-offers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  padding: 0;
  list-style: none;
}

.also-offer {
  display: inline-flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.25rem 0.625rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

.also-seller {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.also-price {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.also-all {
  padding: 0.25rem 0.5rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.also-offer:focus-visible,
.also-all:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .also-offer:hover {
    background: var(--color-subtle);
    border-color: var(--color-border-strong);
  }

  .also-all:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: from-font;
  }
}

/* On an ISBN search, which book this is, and its other editions */

/* The other editions take the header's whole width on a phone, and line up under the title
   on wider screens */
.edition {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1rem;
  align-items: start;
  margin: 1.125rem 0 0;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.edition[hidden],
.edition-cover[hidden],
.edition-others[hidden] {
  display: none;
}

.edition-cover {
  flex: none;
  width: 4rem;
  margin: 0;
}

.edition-cover img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: var(--shadow-cover);
}

.edition-body {
  display: grid;
  grid-column: 2;
  gap: 0.25rem;
  min-width: 0;
}

.edition:has(.edition-cover[hidden]) {
  grid-template-columns: 1fr;
}

.edition:has(.edition-cover[hidden]) .edition-body {
  grid-column: 1;
}

.edition-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.edition-author:empty,
.edition-details:empty {
  display: none;
}

.edition-details,
.edition-meta {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.edition-others {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 0.375rem 0.5rem;
  align-items: center;
  min-width: 0;
}

.edition-others-title {
  margin-right: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.edition-others ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  padding: 0;
  list-style: none;
}

.edition-other {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  align-items: baseline;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

.edition-other-isbn {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}

.edition-other:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .edition-other:hover {
    background: var(--color-subtle);
    border-color: var(--color-border-strong);
  }
}

/* On a phone the other editions keep to one line that scrolls sideways, so the first results
   show without scrolling the page. It stays inside the header's padding and fades at the
   right to say there's more; the padding there lets the last edition scroll clear of the
   fade, and the rest leaves room for the focus ring. */
@media (max-width: 47.99rem) {
  .edition-others {
    flex-wrap: nowrap;
  }

  .edition-others-title {
    flex: none;
  }

  .edition-others ul {
    flex-wrap: nowrap;
    min-width: 0;
    margin: -4px;
    padding: 4px 1.5rem 4px 4px;
    overflow-x: auto;
    mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
    overscroll-behavior-x: contain;
    scroll-padding-left: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .edition-others li {
    scroll-snap-align: start;
  }

  .edition-other {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

@media (min-width: 48rem) {
  .edition {
    column-gap: 1.25rem;
  }

  .edition-others {
    grid-column: -2;
  }

  .edition-cover {
    width: 5rem;
  }

  .edition-title {
    font-size: 1.5rem;
  }
}

/* Only the chosen format's cards show in the results */
.results[data-format="print"] > .product:not([data-format="print"]),
.results[data-format="ebook"] > .product:not([data-format="ebook"]),
.results[data-format="audiobook"] > .product:not([data-format="audiobook"]) {
  display: none;
}

.results,
.skeleton {
  --results-gap: 0.75rem;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--results-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .results,
  .skeleton {
    --results-gap: 1rem;

    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  }
}

/* The masonry controller spans each card over as many of these short rows as it needs */
.results.is-masonry {
  grid-auto-rows: 4px;
  row-gap: 0;
}

.product {
  position: relative;
  display: flex;
  content-visibility: auto;
  contain-intrinsic-size: auto 22rem;
}

.is-masonry > .product {
  align-self: start;
  padding-bottom: var(--results-gap);
}

@media (prefers-reduced-motion: no-preference) {
  .product {
    animation: enter-card 350ms var(--ease-out) both;
  }

  @keyframes enter-card {
    from {
      opacity: 0;
      translate: 0 0.5rem;
    }
  }
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 150ms var(--ease), box-shadow 200ms var(--ease);
}

.product-body .product-link {
  text-decoration: none;
}

/* Stretches the title's link across the card, while the bookseller star sits above it */
.product-body .product-link[href]::after {
  content: "";
  position: absolute;
  inset: 0;
}

.product-card:has(.product-link:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.product-body .product-link:focus-visible {
  outline: none;
}

@media (hover: hover) {
  .product-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
  }

  .product-card:hover:not(:has(.favourite-toggle:hover)) .product-name {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

.product-cover {
  display: grid;
  place-items: center;
  margin: 0.3125rem 0.3125rem 0;
  padding: 1rem 1rem 0.875rem;
  background: var(--color-subtle);
  border-radius: calc(var(--radius-md) - 0.3125rem);
}

/* Covers keep their own shape, which is what gives the grid its varied heights; until a
   lazy cover arrives, 2:3 holds its place so scrolling doesn't jump as covers decode */
.product-cover img {
  width: 100%;
  height: auto;
  max-height: 22rem;
  object-fit: contain;
  box-shadow: var(--shadow-cover);
}

.product--loading-cover .product-cover img {
  aspect-ratio: 2 / 3;
  box-shadow: none;
}

/* Without a cover, a plain binding with the title's initial */
.product-initial {
  display: none;
  place-items: center;
  width: 72%;
  aspect-ratio: 2 / 3;
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--color-on-cover);
  background: var(--color-cover);
  border-radius: 2px 4px 4px 2px;
  box-shadow: var(--shadow-cover);
}

.product--no-cover img {
  display: none;
}

.product[hidden] {
  display: none;
}

/* Amazon has no price to show, so its card stands apart and points out of the site */
.product--amazon .product-card {
  border: 1px dashed var(--color-border-strong);
}

.product--no-cover .product-initial {
  display: grid;
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.875rem 0.875rem;
}

/* Offers come after the title in the markup, so screen readers name the book first, but lead visually */
.product-offers {
  display: grid;
  order: -1;
  gap: 0.5rem;
  margin: 0 0 0.375rem;
  padding: 0;
  font-variant-numeric: tabular-nums;
  list-style: none;
}

/* The chip sits beside the price, or under it where the grade won’t fit */
.offer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 0.5rem;
  align-items: baseline;
}

/* A converted price, "≈ €4.87", leads, with the seller's own after it, or under it on a narrow card */
.offer-price {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.375rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.offer-amount {
  white-space: nowrap;
}

.offer-approx {
  font-weight: 400;
  color: var(--color-text-secondary);
}

.offer-listed {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

/* A long grade, as "Near Fine in a Very Good dust jacket", is cut short, and in full in the chip's title */
.offer-type {
  display: inline-block;
  box-sizing: content-box;
  max-width: 12ch;
  padding: 0.0625rem 0.375rem;
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

/* Booksellers send conditions in lower case */
.offer-type::first-letter {
  text-transform: uppercase;
}

.offer-meta {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  gap: 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.offer-shipping--free {
  font-weight: 600;
  color: var(--color-positive);
}

.product-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
  text-decoration-thickness: from-font;
  text-wrap: pretty;
}

.product-creator,
.product-meta,
.product-seller,
.product-origin {
  overflow: hidden;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-origin {
  white-space: normal;
  text-wrap: pretty;
}

.product-shop {
  display: flex;
  gap: 0.1875rem;
  align-items: center;
  min-width: 0;
  margin-top: 0.25rem;
}

.product-shop .favourite-toggle {
  translate: 0 -0.0625rem;
}

.product-seller {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Favourite booksellers: a small star right after the bookseller's name on a card and in a
   list row (outside the stretched link since a button can't sit inside one), and beside each
   shop in the Booksellers list; outline by default, filled in the accent on one of yours, with
   their cards and rows washed in the accent */
.favourite-toggle {
  position: relative;
  z-index: 1;
  display: inline-grid;
  flex: none;
  place-items: center;
  padding: 0.0625rem;
  color: var(--color-border-strong);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms var(--ease);
}

/* A comfortable tap target without stretching the seller line's height */
.favourite-toggle::before {
  content: "";
  position: absolute;
  inset: -0.4375rem;
}

.favourite-toggle svg {
  width: 0.875rem;
  height: 0.875rem;
}

.product-row .favourite-toggle svg {
  width: 0.9375rem;
  height: 0.9375rem;
}

.favourite-toggle--list {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--color-text-secondary);
  border-radius: 50%;
}

.favourite-toggle--list::before {
  content: none;
}

.favourite-toggle--list svg {
  width: 1.125rem;
  height: 1.125rem;
}

.favourite-toggle.is-on {
  color: var(--color-accent);
}

.favourite-toggle.is-on svg {
  fill: var(--color-accent);
}

.favourite-toggle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.favourite-toggle--list:focus-visible {
  outline-offset: -4px;
}

@media (hover: hover) {
  .favourite-toggle:hover {
    color: var(--color-accent);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .favourite-toggle:active {
    scale: 0.96;
    transition: color 150ms var(--ease), scale 150ms ease-out;
  }
}

.product--favourite .product-card {
  background: var(--color-accent-subtle);
  border-color: color-mix(in oklch, var(--color-accent) 30%, var(--color-border));
}

.product-creator:empty,
.product-origin:empty {
  display: none;
}

/* A line under the author, as "1st ed. · Signed · Paperback · 2009 · German": what the shopper asked
   for that the bookseller or Jev confirms, in the text's colour, then what the listing says of
   its edition. A span each, so more can join, with a dot between those showing. The language
   hides while it's the results' own, and the line goes when nothing on it shows. It wraps
   after a dot rather than inside a part or cutting one short. */
.product-meta {
  white-space: normal;
  text-wrap: pretty;
}

.product-meta > * {
  white-space: nowrap;
}

.product-meta > :not([hidden]) ~ :not([hidden])::before {
  content: "\00a0· ";
  color: var(--color-text-secondary);
  white-space: normal;
}

/* Marked like a reader's highlighter: a swipe behind the lower part of the words, carried
   onto each line when one wraps. No underline, which would read as a link. */
.product-meta-claim mark {
  padding: 0 0.125em;
  color: var(--color-text);
  background: linear-gradient(transparent 55%, var(--color-highlight) 55%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.product-meta:not(:has(> :not([hidden]))) {
  display: none;
}

/* In a list view's row, what the shopper asked for that the bookseller or Jev confirms,
   such as "1st ed." */
.product-claims {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.product-claims:empty {
  display: none;
}

.product-claim {
  padding: 0.0625rem 0.375rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--color-accent-text);
  border: 1px solid var(--color-accent-subtle);
  border-radius: 4px;
}

/* Listings Jev doubts wait behind a quiet control under the results */
.results:not(.is-showing-all) > .product--doubtful {
  display: none;
}

/* Results from booksellers other than those picked */
.results > .product--unpicked {
  display: none;
}

.results-more {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.results-more:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .results-more:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: from-font;
  }
}

/* The list view: a row per offer, ruled like a ledger, for scanning prices when the covers are
   all the same. Each result holds its card and its rows, and the page shows one or the other.
   On phones a row is the shop and its total, then the condition, country, price and shipping,
   then the book; on wide screens, one line of columns. */

.product-rows {
  display: none;
}

.is-list .results {
  display: block;
}

.is-list .results > .product {
  padding-bottom: 0;
  contain-intrinsic-size: auto 4.5rem;
}

.is-list .product-card {
  display: none;
}

.is-list .product-rows {
  display: block;
  flex: 1;
  min-width: 0;
}

.product-row {
  position: relative;
  display: grid;
  grid-template-areas:
    "seller seller total total"
    "type country price shipping"
    "book book book book";
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
  margin-top: -1px;
  padding: 0.75rem 0;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  border-block: 1px solid var(--color-border);
  transition: background-color 150ms var(--ease);
}

.product-row:focus-visible,
.product-row:has(.row-link:focus-visible) {
  position: relative;
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.row-link:focus-visible {
  outline: none;
}

.row-shop {
  display: contents;
}

.row-seller,
.row-country,
.row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-seller-line {
  display: flex;
  grid-area: seller;
  gap: 0.25rem;
  align-items: center;
  min-width: 0;
}

.row-link {
  display: flex;
  min-width: 0;
  text-decoration: none;
}

.row-link[href]::after {
  content: "";
  position: absolute;
  inset: 0;
}

.row-seller {
  grid-area: seller;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  text-decoration-thickness: from-font;
}

.product--favourite .product-row {
  background: var(--color-accent-subtle);
}

.row-country {
  grid-area: country;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.row-book {
  display: flex;
  grid-area: book;
  gap: 0.375rem;
  align-items: baseline;
  min-width: 0;
}

.row-book .product-claims {
  flex: none;
  margin: 0;
}

.row-name {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

/* The publisher and year, as "Penguin Classics, 2003", after the title, which is cut short first */
.row-edition {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-edition::before {
  content: "· ";
}

.row-edition[hidden] {
  display: none;
}

/* Jev's match, which the page ranks and folds by */
.row-match {
  flex: none;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

.row-match[hidden] {
  display: none;
}

.product-row .offer-type {
  grid-area: type;
  justify-self: start;
}

.product-row .offer-price {
  grid-area: price;
  justify-self: end;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
}

/* The seller's own currency stays on the cards */
.product-row .offer-listed {
  display: none;
}

.product-row .offer-meta {
  grid-area: shipping;
}

.row-total {
  grid-area: total;
  justify-self: end;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

/* Without the shipping there's no total, so the price stands in, unbolded */
.row-total[aria-hidden] {
  font-weight: 400;
}

/* On phones the total says the price already where shipping adds nothing to it, or nothing
   known, so the line under it gives only the shipping */
.product-row:is([data-shipping="free"], [data-shipping="unknown"]) .offer-price {
  display: none;
}

@media (hover: hover) {
  .product-row:hover {
    background: var(--color-subtle);
  }

  .product-row:hover:not(:has(.favourite-toggle:hover)) .row-seller {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

@media (min-width: 64rem) {
  /* The rows' padding hangs into the gutter, so their text lines up with the toolbar */
  .is-list .results {
    margin-inline: -0.75rem;
  }

  .product-row {
    grid-template-areas: "shop book type price shipping total";
    grid-template-columns: 13rem minmax(0, 1fr) 7rem 6.5rem 9rem 6rem;
    column-gap: 1rem;
    padding: 0.625rem 0.75rem;
  }

  .row-shop {
    display: flex;
    flex-direction: column;
    grid-area: shop;
    min-width: 0;
  }

  .row-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.875rem;
    white-space: normal;
  }

  .row-edition {
    font-size: 0.875rem;
  }

  .product-row .offer-price,
  .product-row:is([data-shipping="free"], [data-shipping="unknown"]) .offer-price {
    display: flex;
    font-size: 1rem;
  }

  /* Amazon's note takes the condition, price and shipping's room */
  .product--amazon .offer-meta {
    grid-column: type-start / shipping-end;
    justify-self: end;
  }
}

/* Placeholders while the first booksellers answer */

.skeleton-card {
  overflow: hidden;
  padding: 0.3125rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.skeleton-cover,
.skeleton-line {
  background: var(--color-subtle);
}

.skeleton-cover {
  aspect-ratio: 3 / 4;
  border-radius: calc(var(--radius-md) - 0.3125rem);
}

.skeleton-line {
  height: 0.625rem;
  margin: 0.75rem 0.5rem 0;
  border-radius: 3px;
}

.skeleton-line:nth-child(2) {
  width: 40%;
  height: 1rem;
}

.skeleton-line:last-child {
  width: 60%;
  margin-bottom: 0.625rem;
}

/* In the list, rows: the shop and the book on the left, the total on the right */
.is-list .skeleton {
  display: block;
}

.is-list .skeleton-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4rem;
  gap: 0.625rem 1rem;
  padding: 0.875rem 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
}

.is-list .skeleton-cover {
  display: none;
}

.is-list .skeleton-line,
.is-list .skeleton-line:last-child {
  margin: 0;
}

.is-list .skeleton-line:nth-child(2) {
  grid-area: 1 / 2;
  width: auto;
}

.is-list .skeleton-line:nth-child(3) {
  grid-area: 1 / 1;
  width: 35%;
}

.is-list .skeleton-line:last-child {
  grid-area: 2 / 1;
}

/* A sheen sweeps across while the booksellers answer */
@media (prefers-reduced-motion: no-preference) {
  .skeleton-cover,
  .skeleton-line {
    background:
      linear-gradient(100deg, transparent 30%, color-mix(in oklab, var(--color-surface) 70%, transparent) 50%, transparent 70%)
      var(--color-subtle);
    background-size: 250% 100%;
    background-attachment: fixed;
    animation: sheen 1.6s linear infinite;
  }

  @keyframes sheen {
    from {
      background-position: 125% 0;
    }

    to {
      background-position: -125% 0;
    }
  }
}

/* Empty and error states */

.notice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  max-width: 32rem;
  margin-inline: auto;
  padding: 4rem 1rem;
  text-align: center;
}

.notice > svg {
  box-sizing: content-box;
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.5rem;
  padding: 0.875rem;
  color: var(--color-text-secondary);
  background: var(--color-subtle);
  border-radius: 50%;
}

.notice h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 560;
  letter-spacing: -0.015em;
}

.notice p {
  color: var(--color-text-secondary);
  text-wrap: pretty;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Prose pages (about, cookies)
   ========================================================================== */

/* Text pages sit on the same grid as the header and footer, starting at the
   wordmark, with the text in a column narrow enough to read. Headlines may
   run wider. */
.prose {
  --prose-column: 44rem;
  width: var(--measure);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 7vw, 5.5rem) 5rem;
}

.prose > * {
  max-width: var(--prose-column);
}

.prose > h1 {
  max-width: 60rem;
}

.prose h1 {
  margin: 0.75rem 0 1.5rem;
  font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  font-weight: 560;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.prose h2 {
  margin: 3rem 0 0.75rem;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.prose p,
.prose ul {
  max-width: 65ch;
  margin-bottom: 1rem;
  text-wrap: pretty;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose li::marker {
  color: var(--color-accent);
}

.prose .lead {
  margin-bottom: 2rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.5;
  color: var(--color-text-secondary);
}

/* The about page's bookshop: a pencil sketch on white, multiplied so the paper takes the
   page's colour. In dark mode it's inverted, the hue turned back so the book stays red,
   and screened, so the pencil reads light on the dark paper, as the home page's sketch does. */
.prose-art {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  .prose-art {
    filter: invert(1) hue-rotate(180deg);
    mix-blend-mode: screen;
  }
}

/* A Ledger post opens with its sketch, the lead under it */
.prose .prose-art + .lead {
  margin-top: 1.5rem;
}

.prose a {
  overflow-wrap: anywhere;
  text-decoration-color: var(--color-accent);
  transition: text-decoration-thickness 150ms var(--ease);
}

.prose code {
  white-space: nowrap;
}

/* On phones, code wraps at its spaces, or a long one, like a number line in a
   table or a sample query in a sentence, widens the page past the screen */
@media (max-width: 40rem) {
  .prose code {
    white-space: normal;
  }
}

.prose table {
  width: 100%;
  max-width: var(--prose-column);
  margin: 1.5rem 0 2rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.4;
  border-top: 1px solid var(--color-text);
}

.prose th,
.prose td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.prose th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.prose td:last-child,
.prose th:last-child {
  padding-right: 0;
}

.prose td:first-child,
.prose th:first-child {
  padding-left: 0;
}

.prose pre,
.prose-mono-box {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
}

.postal-slip {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
}

.postal-slip-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed var(--color-border-strong);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.postal-slip-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  border: 1px solid currentColor;
  color: var(--color-accent);
}

.postal-slip-badge--ok {
  color: var(--color-positive);
}

.postal-slip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem 1.5rem;
}

.postal-field-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
}

.postal-field-value {
  font-size: 0.9375rem;
  color: var(--color-text);
}

.customs-routes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 2rem 0;
}

@media (min-width: 40rem) {
  .customs-routes {
    grid-template-columns: 1fr 1fr;
  }
}

.customs-route {
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.customs-route--warn {
  border-left: 3px solid var(--color-accent);
}

.customs-route--good {
  border-left: 3px solid var(--color-positive);
}

.customs-route-title {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.customs-route--good .customs-route-title {
  color: var(--color-positive);
}

.customs-route--warn .customs-route-title {
  color: var(--color-accent);
}

.customs-route-step {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.guides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2.5rem 0 3.5rem;
}

@media (min-width: 44rem) {
  .guides-grid {
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  }
}

.guide-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 150ms var(--ease);
}

.guide-card:hover {
  border-color: var(--color-border-strong);
  text-decoration: none;
}

.guide-card-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.guide-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.guide-card-desc {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
}

.guide-card-cta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.prose .guide-cta {
  max-width: var(--prose-column);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .prose a:hover {
    text-decoration-thickness: 2px;
  }
}

/* A post's books side by side, six in a row, three on phones. The covers share one shape,
   trimming a sliver off the slimmer ones, so the row lines up. */
.prose .ledger-covers {
  display: grid;
  grid-template-columns: repeat(var(--covers, 6), minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.prose .ledger-covers li + li {
  margin-top: 0;
}

.ledger-covers a {
  display: block;
  border-radius: 2px 4px 4px 2px;
}

.ledger-covers img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 13 / 20;
  object-fit: cover;
  border-radius: 2px 4px 4px 2px;
  box-shadow: var(--shadow-cover);
}

@media (max-width: 35.99rem) {
  .prose .ledger-covers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* A book's market in a post, ruled like a page of a ledger. Self-contained, so it can
   later be served on its own. Covers above link to it, so it stops short of the top. */
/* A Bookplate in a post, the embed any site can paste in: the book card's spacing, set from the page's side as any
   host would, and the scroll margin the glance's links need */
.prose near-fine-bookplate {
  display: block;
  margin: 1.5rem 0 2.5rem;
  scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 1.5rem);
}

.book-card {
  margin: 1.5rem 0 2.5rem;
  padding: 1.25rem 1.5rem 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 1.5rem);
}

.prose .book-card p,
.prose .book-card ul {
  max-width: none;
  margin: 0;
}

.book-card-book {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.book-card-cover {
  flex: none;
  width: 3.5rem;
  height: auto;
  aspect-ratio: 13 / 20;
  object-fit: cover;
  border-radius: 1px 3px 3px 1px;
  box-shadow: var(--shadow-cover);
}

.prose .book-card-title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.2;
  text-wrap: balance;
}

.book-card-author {
  color: var(--color-text-secondary);
}

/* Three markets side by side, down to a phone */
.book-card-markets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
  padding-top: 0.875rem;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--color-text);
}

.book-card-markets dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

/* Europe's note shows on hover */
.book-card-markets [title] dt {
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  cursor: help;
}

.book-card-markets dd {
  margin: 0;
  line-height: 1.25;
}

.book-card-from {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.book-card-amount {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.prose .book-card .book-card-more {
  margin-top: 1rem;
  padding: 0;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
  list-style: none;
}

.prose .book-card-more li + li {
  margin-top: 0.125rem;
}

.book-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--color-border-strong);
}

.prose .book-card .book-card-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

@media (max-width: 30rem) {
  .book-card {
    padding: 1rem 1rem 1.125rem;
  }

  .book-card-cover {
    width: 3rem;
  }

  .book-card-markets {
    column-gap: 0.75rem;
  }

  .book-card-from {
    font-size: 0.8125rem;
  }

  .book-card-amount {
    font-size: 1.125rem;
  }

  /* So the four other markets take two lines, and signed copies and first editions one */
  .prose .book-card .book-card-more {
    font-size: 0.8125rem;
  }
}

/* A post's books at a glance, each with its cheapest copy in the UK, linking down to its
   card. Narrower screens take it after the lead, its covers in place of the strip above;
   wide ones keep it in the side column, in view, the text where it was. Its rule tops its
   head, which moves with the part of the column that stays in view. */
.prose .ledger-glance {
  margin: 0 0 2.5rem;
  font-size: 0.9375rem;
  line-height: 1.25;
}

.prose .ledger-glance-head {
  margin: 0;
  padding-block: 0.625rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.prose .ledger-glance-books {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .ledger-glance-books li {
  margin: 0;
  border-bottom: 1px solid var(--color-border);
}

.prose .ledger-glance-books a {
  display: grid;
  grid-template-columns: 1.625rem minmax(0, 1fr) auto;
  gap: 0 0.75rem;
  align-items: center;
  min-height: 2.875rem;
  padding-block: 0.1875rem;
  color: inherit;
  text-decoration: none;
}

.ledger-glance-cover {
  display: block;
  width: 1.625rem;
  height: auto;
  aspect-ratio: 13 / 20;
  object-fit: cover;
  border-radius: 1px 2px 2px 1px;
  background: var(--color-subtle);
  /* Inside the cover, where the side column's scroll box can't clip it */
  outline: 1px solid var(--color-image-outline);
  outline-offset: -1px;
}

.ledger-glance-book {
  display: grid;
  min-width: 0;
}

.ledger-glance-title {
  font-weight: 500;
  text-wrap: balance;
}

.ledger-glance-mark {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent-text);
}

.ledger-glance-price {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  color: var(--color-text);
}

/* Before the first snapshot, the day prices begin, quietly */
.ledger-glance-price:not(:has(.book-card-from)) {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .prose .ledger-glance-books a:hover .ledger-glance-title {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

/* A post's sections in the glance's place, ruled as its books are, with one search of our own under them */
.prose .ledger-contents-sections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .ledger-contents-sections li {
  margin: 0;
  border-bottom: 1px solid var(--color-border);
}

/* Each section's starting date in a narrow column before it, so the list reads as a timeline */
.prose .ledger-contents-sections a {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  gap: 0 0.5rem;
  align-items: baseline;
  padding-block: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.ledger-contents-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}

.ledger-contents-heading {
  font-weight: 500;
  text-wrap: balance;
}

@media (hover: hover) {
  .prose .ledger-contents-sections a:hover .ledger-contents-heading {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

/* The post's further reading, under its contents, as a glance of its own */
.prose .ledger-contents .ledger-glance {
  margin: 1.5rem 0 0;
}

/* The covers above give way to the glance's on narrower screens */
@media (max-width: 63.99rem) {
  .prose:has(> .ledger-glance) > .ledger-covers {
    display: none;
  }
}

@media (min-width: 64rem) {
  /* The price goes under the title in the narrow column */
  .prose .ledger-glance-books a {
    grid-template-columns: 1.625rem minmax(0, 1fr);
    padding-block: 0.375rem;
  }

  .ledger-glance-cover {
    grid-row: span 2;
  }

  .ledger-glance-price {
    text-align: left;
  }
}

/* A side column on wide screens: a rail on the right from the top of the text, level with
   the eyebrow, where the browser can't start it under the title (after the contents, below),
   to its foot. The headline stops 2rem short of it, wrapping if it's long. Where to follow
   us on an index, a post's books or contents, and Rufus's facts sit in a column inside it
   that stays in view (prose-rail-column, below). Only a child of the
   text is a rail, so the further reading inside a post's contents stays plain.
   Narrower screens take a post's and Rufus's in the flow, and leave out where to follow
   us, which the footer has */
.prose > .follow-rail {
  display: none;
}

@media (min-width: 64rem) {
  .prose:has(> .prose-rail) {
    position: relative;
  }

  .prose:has(> .prose-rail) > h1 {
    max-width: min(60rem, 100% - 19rem);
  }

  .prose > .prose-rail {
    position: absolute;
    top: clamp(2.5rem, 7vw, 5.5rem);
    right: 0;
    bottom: 5rem;
    display: block;
    width: min(17rem, 100% - var(--prose-column) - 2rem);
    max-width: none;
    margin: 0;
  }

  /* The Ledger's line under its posts leaves following to the rail */
  .prose:has(> .follow-rail) .follow-inline {
    display: none;
  }
}

/* Where to follow us, each place with its glyph and handle, unruled. Its rule tops its
   head, which moves with the column that stays in view */
.prose .follow-rail {
  font-size: 0.9375rem;
  line-height: 1.25;
}

.prose .follow-rail-head {
  margin: 0;
  padding-block: 0.625rem 0.25rem;
  border-top: 1px solid var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.prose .follow-rail-links {
  max-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .follow-rail-links li {
  margin: 0;
}

.prose .follow-rail-links a {
  display: flex;
  gap: 0.625rem;
  align-items: baseline;
  padding-block: 0.5rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

/* The platform's glyph, the size of the text and centred on it */
.follow-rail-icon {
  flex: none;
  align-self: center;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.prose .follow-rail-handle {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .prose .follow-rail-links a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

/* Side columns stay in view as the text scrolls on wide screens: where to follow us, a
   post's glance or contents, and Rufus's facts, each held in its rail until the foot of the
   text. One taller
   than the screen, as on a small laptop, scrolls within itself so its foot is in reach, and
   its links' focus rings sit inside, where its edges can't clip them. Its overflow would also
   clip a quote mark Safari hangs outside the edge (hanging-punctuation on html), so nothing
   hangs here */
@media (min-width: 64rem) {
  .prose > .prose-rail > .prose-rail-column {
    --side-top: calc(env(safe-area-inset-top, 0px) + 1.5rem);

    position: sticky;
    top: var(--side-top);
    max-height: calc(100dvh - 2 * var(--side-top));
    overflow-y: auto;
    scrollbar-width: thin;
    hanging-punctuation: none;
  }

  .prose > .prose-rail > .prose-rail-column a:focus-visible {
    outline-offset: -2px;
  }
}

/* Rufus's facts sit in the flow; wide screens move them into the side column */
@media (min-width: 64rem) {
  .prose .margin-rail {
    font-size: 0.9375rem;
    line-height: 1.25;
  }

  /* Headed as a glance is, each fact under its label */
  .prose .margin-rail h2 {
    margin: 0;
    padding-block: 0.625rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-text);
  }

  .prose .margin-rail .facts {
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    font-size: inherit;
    border-top-color: var(--color-border);
  }

  /* A label in the contents' date type, with its fact tight beneath */
  .prose .margin-rail .facts dt {
    padding-block: 0.625rem 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    border-bottom: 0;
  }

  .prose .margin-rail .facts dd {
    padding-block: 0.125rem 0.5rem;
  }
}

/* Key facts, such as the cookie's name and lifetime */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  margin: 0 0 2rem;
  font-size: 1rem;
  border-top: 1px solid var(--color-text);
}

.facts dt,
.facts dd {
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.facts dt {
  padding-right: 2rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

@media (max-width: 30rem) {
  .facts {
    grid-template-columns: 1fr;
  }

  .facts dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .facts dd {
    padding-top: 0.125rem;
  }
}

/* Press kit
   ========================================================================== */

/* A description to copy runs to several lines, which wrap round its button
   and take the box's full width below it */
.copyable--text {
  display: flow-root;
}

.copyable--text .copy-button {
  float: right;
  margin: 0 0 0.25rem 0.75rem;
}

.prose .copyable--text p {
  max-width: none;
  margin: 0;
  padding-block: 0.4375rem;
  font-size: 1rem;
  line-height: 1.55;
}

/* The logo on the grounds it's made for, in either theme */
.press-marks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem 1rem;
  margin-bottom: 1.5rem;
}

.press-mark {
  margin: 0;
}

.press-mark img {
  display: block;
  width: 100%;
  height: auto;
  padding: 2.5rem 2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.press-mark--light img {
  background: oklch(0.982 0.004 85);
}

.press-mark--dark img {
  background: oklch(0.17 0.005 70);
}

/* The square icon, one card a wordmark card wide at most */
.press-marks--icon {
  grid-template-columns: minmax(0, 16rem);
}

.press-mark--icon img {
  width: 100%;
  max-width: 16rem;
  padding: 2rem;
}

.press-mark figcaption,
.press-shots p {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.prose .press-shots {
  max-width: var(--prose-column);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem 1rem;
  padding: 0;
  list-style: none;
}

.prose .press-shots li {
  margin: 0;
}

.press-shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.press-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

/* One click selects the whole address */
.press-contact span {
  user-select: all;
}

/* Assistants and docs pages
   ========================================================================== */

.prose h3 {
  margin: 2rem 0 0.75rem;
  font-size: var(--text-body);
  font-weight: 600;
}

.prose h2 + h3 {
  margin-top: 1.25rem;
}

.prose h3 code {
  font-size: 0.9375em;
}

.prose .steps {
  margin-bottom: 1rem;
}

.prose .steps li + li {
  margin-top: 0;
}

.prose .steps b {
  font-weight: 600;
  white-space: nowrap;
}

.prose-note {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.prose-copyable {
  margin-bottom: 1.5rem;
}

/* A command wraps rather than runs off a phone screen */
.prose .copyable code {
  white-space: normal;
}

/* A block of code to copy, such as a Bookplate's: its label and Copy button above it */
.copyable-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.prose .copyable-head .copyable-label {
  margin: 0;
}

.prose .prose-copyable pre {
  margin: 0;
}

/* Bookplates page
   ========================================================================== */

/* The sample cards side by side, stacked on phones */
.bookplate-samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem 1.5rem;
  margin: 2rem 0;
}

.bookplate-samples figure {
  margin: 0;
}

/* A panel painted with our palette, to preview the card on a light or a dark page; the card
   takes its text colour and background from whatever it sits on */
.bookplate-page {
  padding: 1.5rem;
}

.bookplate-page--light {
  color: oklch(0.2 0.008 70);
  background: oklch(0.982 0.004 85);
}

.bookplate-page--dark {
  color: oklch(0.95 0.005 85);
  background: oklch(0.17 0.005 70);
}

.prose .bookplate-page near-fine-bookplate {
  margin: 0;
}

.bookplate-samples figcaption {
  margin-top: 0.5rem;
}

.bookplate-samples figcaption {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.bookplate-samples figcaption code {
  padding: 0;
  font-size: inherit;
  background: none;
}

/* Try it: the ISBN and its button, with the preview switch beside them where there's room */
.bookplate-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  margin: 1rem 0 0.75rem;
}

.bookplate-field {
  display: grid;
  flex: 1 1 18rem;
  gap: 0.375rem;
  max-width: 26rem;
}

.bookplate-field label {
  font-size: 1rem;
  font-weight: 500;
}

.bookplate-isbn {
  display: flex;
  gap: 0.5rem;
}

.bookplate-isbn .input {
  flex: 1;
  min-width: 0;
}

.bookplate-isbn .button,
.bookplate-form .segmented {
  height: 2.75rem;
}

.bookplate-form .segmented span {
  display: flex;
  align-items: center;
  height: 100%;
}

.prose .bookplate-form + .form-error {
  margin-bottom: 0.5rem;
}

/* So does a long path */
.prose code.path {
  white-space: normal;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  background: var(--color-subtle);
  border-radius: var(--radius-md);
}

.prose pre code {
  padding: 0;
  font-size: inherit;
  white-space: inherit;
  background: none;
}

.toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.25rem;
  max-width: none;
  margin-bottom: 1rem;
  padding: 0;
  font-size: 1rem;
  list-style: none;
}

.toc li + li {
  margin-top: 0;
}

/* On wide screens the contents move to a rail on the right and stay in view.
   Pages whose contents only make sense as a rail hide them on smaller screens. */
@media (min-width: 72rem) {
  .prose:has(> .toc) {
    position: relative;
  }

  /* The headline stops short of it, wrapping if it's long. From the top of the text where
     the browser can't start it under the title (below) */
  .prose:has(> .toc) > h1 {
    max-width: min(60rem, 100% - 17rem);
  }

  .prose > .toc {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 13rem;
    max-width: none;
    padding-top: clamp(2.5rem, 7vw, 5.5rem);
  }

  .prose > .toc ul {
    position: sticky;
    top: 2rem;
    flex-direction: column;
    gap: 1.25rem;
    padding-left: 1.25rem;
    font-size: 1.25rem;
    line-height: 1.3;
    border-left: 1px solid var(--color-rule);
  }

  .prose > .toc a {
    position: relative;
    display: block;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 150ms var(--ease);
  }

  @media (hover: hover) {
    .prose > .toc a:hover {
      color: var(--color-text);
    }
  }

  /* The section being read, marked on the rule */
  .prose > .toc a[aria-current] {
    color: var(--color-text);
  }

  .prose > .toc a[aria-current]::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1.25rem - 1px);
    width: 2px;
    content: "";
    background: var(--color-accent);
  }
}

@media (max-width: 71.99rem) {
  .toc--aside {
    display: none;
  }
}

/* Every side column, rail or contents, starts under the title where the browser can anchor
   it: level with the first block after the headline, a post's byline and any draft notice.
   That's the lead, or a Ledger post's covers or sketch: an illustrated post opens with its
   pencil sketch (.prose-art) right after the byline, before the lead, and only a post whose
   subject is those priced books, as the Booker posts' is, has the covers, never one with
   further reading. Where the title wraps decides where that is, so the column is anchored to
   that block. The headline still stops short of the column, as above, so a long one wraps
   rather than run up to it. Browsers without anchor positioning keep the column level with
   the eyebrow */
@supports (top: anchor(--a top)) {
  .prose > h1 ~ :not(.ledger-byline, .warning):not(h1 ~ :not(.ledger-byline, .warning) ~ *) {
    anchor-name: --prose-start;
  }

  @media (min-width: 64rem) {
    .prose > .prose-rail {
      top: anchor(--prose-start top);
    }
  }

  @media (min-width: 72rem) {
    .prose > .toc {
      top: anchor(--prose-start top);
      padding-top: 0;
    }
  }
}

/* Long field names wrap in their own column rather than squeeze the text */
.prose--docs .facts {
  grid-template-columns: fit-content(12rem) minmax(0, 1fr);
}

/* Tables and code run as wide as the headline, clear of the rail */
.prose--docs > :is(.facts, pre) {
  max-width: none;
}

@media (min-width: 72rem) {
  .prose--docs > :is(.facts, pre) {
    max-width: min(60rem, 100% - 17rem);
  }
}

@media (max-width: 30rem) {
  .prose--docs .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Accounts and alerts
   ========================================================================== */

/* Forms stay a short, centred column */
.prose--narrow {
  width: min(100% - 2 * var(--gutter), 36rem);
}

.form {
  display: grid;
  gap: 0.5rem;
  max-width: 26rem;
  margin-block: 0.5rem 2rem;
}

.form label {
  font-size: 1rem;
  font-weight: 500;
}

.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  font-size: 1.0625rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.input:focus-visible {
  border-color: var(--color-focus);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px var(--color-border);
}

.input[aria-invalid="true"] {
  border-color: var(--color-accent-text);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* A button_to form beside a link button would sit a pixel off its baseline */
.form-actions .button_to {
  display: contents;
}

.form-error {
  font-size: 1rem;
  color: var(--color-accent-text);
}

.prose .form-note {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.input--area {
  height: auto;
  min-height: 7rem;
  padding-block: 0.625rem;
  line-height: 1.45;
  resize: vertical;
}

/* Feedback: a dialog on every page, and /feedback without JavaScript
   ========================================================================== */

/* "Something off with these results?" under them, and "Couldn't find it?"
   under none */
.results-feedback {
  margin-top: 2.5rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.notice .notice-feedback {
  margin-top: 1rem;
  font-size: 0.9375rem;
}

.results-feedback a,
.notice-feedback a {
  color: var(--color-text);
  text-decoration-color: var(--color-accent);
}

:root:has(.feedback-dialog[open]) {
  overflow: hidden;
}

/* Centred, which the reset's margin: 0 undoes */
.feedback-dialog {
  width: min(100% - 2rem, 34rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 1.5rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overscroll-behavior: contain;
}

.feedback-dialog::backdrop {
  background: var(--color-backdrop);
}

.feedback-dialog .form {
  max-width: none;
  margin: 0;
}

.feedback-title {
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
}

.feedback-thanks {
  display: grid;
  gap: 0.75rem;
}

.feedback-thanks p {
  color: var(--color-text-secondary);
}

/* People never see the field that catches bots */
.feedback-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* What the form sends, folded under the buttons: a quiet row until opened */
.feedback-sends {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.feedback-sends summary {
  width: fit-content;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--color-accent-text);
  text-transform: uppercase;
}

.feedback-sends[open] {
  padding: 0.875rem 1rem;
  background: var(--color-subtle);
  border-radius: var(--radius-sm);
}

.feedback-sends[open] > :not(summary) {
  margin: 0.5rem 0 0;
}

.feedback-sends dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1rem;
}

.feedback-sends dl > div {
  display: contents;
}

.feedback-sends dt {
  color: var(--color-text);
}

.feedback-sends dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Phones pin the dialog to the top and stack each thing sent under its name */
@media (max-width: 40rem) {
  .feedback-dialog {
    width: calc(100% - 1.5rem);
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px));
    margin: calc(0.75rem + env(safe-area-inset-top, 0px)) auto auto;
    padding: 1rem;
  }

  .feedback-dialog .feedback-title {
    font-size: 1.25rem;
  }

  .feedback-sends dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .feedback-sends dd {
    margin-bottom: 0.375rem;
  }
}

/* "Alert me", beside the status line; the sort and format controls stay right */
.alert-me {
  display: flex;
  margin-right: auto;
}

.alert-me .button {
  white-space: normal;
  text-align: left;
}

.alert-me .button svg {
  width: 1rem;
  height: 1rem;
  color: var(--color-accent-text);
}

.alert-me-what {
  color: var(--color-text-secondary);
}

.alert-me-what:not(:empty)::before {
  content: " · ";
}

.site-header--search .site-nav {
  flex: none;
  margin-left: auto;
}

/* Wide screens show only the account link beside the search; the site links
   stay in the burger's menu */
@media (min-width: 62rem) {
  .site-header--search .site-menu {
    display: none;
  }
}

/* Phones keep the width for the search: Sign in waits in the menu, and the
   wordmark shortens to the icon's "N.", without the underline (drop the svg
   line below to keep it). Its tap target is a pseudo-element, so the link
   keeps the letters' size for the view transition. The row tightens to 12px
   after the mark and 16px before the menu button. */
@media (max-width: 40rem) {
  .site-header--search .site-header-inner {
    column-gap: 1rem;
  }

  .site-header--search .site-nav > a {
    display: none;
  }

  .site-header--search .wordmark-rest,
  .site-header--search .scribble svg {
    display: none;
  }

  .site-header--search .wordmark {
    position: relative;
    margin-right: -0.25rem;
    translate: none;
  }

  /* The padding was room for the underline; without it the letter sits in
     the middle of the link's box, level with the search form */
  .site-header--search .scribble {
    padding-bottom: 0;
  }

  .site-header--search .wordmark::after {
    position: absolute;
    inset: -0.625rem -0.75rem;
    content: "";
  }
}

.button--danger {
  color: var(--color-on-primary);
  background: var(--color-accent-text);
}

@media (hover: hover) {
  .button--danger:hover {
    background: var(--color-accent);
  }
}

.checkbox {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  font-size: 1rem;
  cursor: pointer;
}

.checkbox input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--color-accent-text);
}

/* The code from a sign-in email */
.input--code {
  max-width: 11rem;
  font-family: var(--font-mono);
  font-size: 1.375rem;
  letter-spacing: 0.2em;
}

/* Connecting an assistant: what to check before allowing it; also a Ledger post's dated update */
.prose .warning,
.prose .ledger-update {
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: var(--color-subtle);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
}

/* An update spans the column, as the lead under it does, in the text's own size */
.prose .ledger-update {
  max-width: var(--prose-column);
  font-size: inherit;
}

/* Connected assistants, on the account page */
.prose .connections {
  display: grid;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.prose .connections li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding-block: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}

.prose .connections p {
  margin: 0;
}

.connection-name {
  font-weight: 500;
}

.connection-host {
  font-weight: 400;
  color: var(--color-text-secondary);
}

.prose .connection-meta {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.prose--alerts {
  --prose-column: 48rem;
}

.alerts {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

/* The grid spaces the cards, not the prose list's margin */
.prose .alerts > li + li,
.prose .plans > li + li {
  margin-top: 0;
}

.alert-card {
  padding: 1.25rem 1.5rem 1.375rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  scroll-margin-top: 2rem;
  transition: border-color 300ms var(--ease), box-shadow 300ms var(--ease);
}

/* The alert just set or changed */
.alert-card:target {
  border-color: var(--color-border-strong);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.prose .alert-card p {
  max-width: none;
  margin: 0;
}

.alert-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1rem;
  align-items: baseline;
  justify-content: space-between;
}

.prose .alert-title {
  margin: 0;
  font-size: 1.375rem;
  overflow-wrap: anywhere;
}

.prose .alert-title a {
  text-decoration: none;
}

@media (hover: hover) {
  .prose .alert-title a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
  }
}

.alert-status {
  flex: none;
  padding: 0.125rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  background: var(--color-subtle);
  border-radius: 999px;
}

.alert-card--found .alert-status {
  color: var(--color-accent-text);
  background: var(--color-accent-subtle);
}

.alert-card--live .alert-status {
  color: var(--color-positive);
}

.prose .alert-watching {
  margin-top: 0.25rem;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.prose .alert-meta {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.found {
  display: grid;
  gap: 0.125rem;
  margin-top: 1rem;
  padding-top: 1rem;
  font-size: 1rem;
  border-top: 1px solid var(--color-border);
}

.prose .found-when {
  margin-bottom: 0.25rem;
  font-size: 0.8125rem;
  color: var(--color-accent-text);
}

.prose .found-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.found-author {
  font-weight: 400;
  color: var(--color-text-secondary);
}

.found-seller {
  color: var(--color-text-secondary);
}

.found-words {
  margin: 0.625rem 0 0;
  padding-left: 1rem;
  font-style: italic;
  color: var(--color-text-secondary);
  border-left: 3px solid var(--color-border);
}

.alert-lower {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.875rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.money-input {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  color: var(--color-text);
}

.money-input .input {
  width: 6.5rem;
  height: 2.375rem;
}

.prose .alerts-plan {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.alerts-empty {
  display: grid;
  gap: 1.25rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--color-subtle);
  border-radius: var(--radius-lg);
}

.prose .alerts-empty p {
  margin: 0;
}

/* Pro's want list, folded away above the alerts */
.want-list {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  background: var(--color-subtle);
  border-radius: var(--radius-lg);
}

.want-list summary {
  font-weight: 500;
  cursor: pointer;
}

.want-list .form {
  max-width: 36rem;
  margin-block: 1.25rem 0.5rem;
}

.prose .want-list .form-note {
  margin: 0 0 0.75rem;
}

.want-list textarea.input {
  height: auto;
  padding-block: 0.625rem;
  line-height: 1.5;
  resize: vertical;
}

.want-list input[type="file"] {
  font-size: 1rem;
}

/* As a secondary button */
.want-list input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.4375rem 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* What a want list set, skipped and had no room for */
.prose .want-list-result {
  max-width: var(--prose-column);
  margin: 1.5rem 0;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: var(--color-subtle);
  border-left: 3px solid var(--color-positive);
  border-radius: var(--radius-sm);
}

/* Plans */

.prose--plans {
  --prose-column: none;
}

/* Searching, free for everyone, in a band above the alert plans */
.plans-search {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding: 1.25rem clamp(1.25rem, 3vw, 1.5rem);
  background: var(--color-subtle);
  border-radius: var(--radius-lg);
}

.plans-search > div {
  flex: 1 1 26rem;
}

.prose .plans-search-title {
  margin: 0 0 0.375rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.prose .plans-search p {
  max-width: none;
  margin: 0;
  font-size: 1.0625rem;
}

.plans-search strong {
  font-weight: 600;
}

.prose .plans-search-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.25rem;
  padding: 0;
  list-style: none;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.5rem 1.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.plan--current {
  border-color: var(--color-border-strong);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.prose .plan-name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  font-size: 1.5rem;
}

.plan-badge {
  padding: 0.125rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--color-accent-text);
  background: var(--color-accent-subtle);
  border-radius: 999px;
}

/* The amount large, "a month" and the year's price beside and under it */
.prose .plan-price {
  display: grid;
  gap: 0.125rem;
  margin: 0;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.plan-price strong {
  margin-right: 0.125rem;
  font-size: clamp(2.25rem, 1.9rem + 1vw, 2.75rem);
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.prose .plan-features {
  margin: 0;
  padding: 1rem 0 0;
  font-size: 1rem;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.prose .plan-features li + li {
  margin-top: 0.25rem;
}

.prose .plan-features .plan-alerts {
  margin-bottom: 0.5rem;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* As wide as the cards */
.prose .plans-note {
  max-width: var(--prose-column);
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.prose .plans-soon {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--color-subtle);
  border-radius: var(--radius-md);
}

.prose .plans-action {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.plans-form {
  max-width: 38rem;
  margin-top: 2rem;
}

/* Sized like the home page's sections and features */
.prose .plans-questions {
  margin-top: clamp(3.5rem, 7vw, 6rem);
  font-size: clamp(2rem, 1.2rem + 3vw, 3.75rem);
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
}

.questions {
  display: grid;
  gap: 2rem clamp(1.5rem, 4vw, 3rem);
  margin-top: 1.5rem;
}

@media (min-width: 48rem) {
  .questions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.question {
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-text);
}

.prose .question h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.875rem);
  letter-spacing: -0.015em;
}

.prose .question p {
  margin: 0;
  color: var(--color-text-secondary);
}

.prose .plans-more {
  margin-top: 2.5rem;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.plan-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

.plan-choices legend {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.plan-choice {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.plan-choice:has(input:checked) {
  border-color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-text);
}

.plan-choice input {
  margin: 0;
  accent-color: var(--color-accent-text);
}

.checkbox--top {
  align-items: flex-start;
}

.checkbox--top input {
  margin-top: 0.25rem;
}

/* Labels, navigation and small controls take the pixel mono
   ========================================================================== */
.eyebrow,
.site-nav,
.button,
.alert-status,
.found-when,
.plan-badge,
.plans-search-title,
.sellers-title,
.results-summary,
.results-more,
.also-title,
.also-all,
.offer-type,
.product-claim,
.edition-others-title,
.edition-other-isbn,
.copyable-label,
.demo-status,
.hero-examples,
.hero-assistants,
.segmented span,
.seller-panel-clear,
.seller-count,
.site-footer-inner {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
}

.eyebrow,
.plans-search-title,
.sellers-title,
.copyable-label {
  text-transform: uppercase;
}
