/* BookTrendSpy v3 — "what the world is reading".
   Palette from cloth-bound hardcovers: navy cloth, verdigris for rising,
   bookbinder's red for falling, a little gilt for #1. Literata (the typeface
   made for Google Play Books) for reading, Archivo for interface and numbers. */

@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/literata-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/literata-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/literata-latin-400-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/assets/fonts/literata-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/assets/fonts/literata-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/archivo-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/archivo-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/assets/fonts/archivo-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/assets/fonts/archivo-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/assets/fonts/archivo-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C0; }

:root {
  --paper: #ffffff;
  --endpaper: #eef2f6;
  --ink: #1f2430;
  --ink-soft: #4d5567;
  --ink-faint: #737b8c;
  --rule: #d7dde6;
  --cloth: #1e3157;
  --cloth-soft: #dfe6f2;
  --up: #12735f;
  --down: #b0343a;
  --gilt: #9a6b00;
  --gilt-soft: #f6ecd2;
  --focus: #2f6fdf;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wrap: 1180px;
  --read: 42rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151b27; --endpaper: #1c2433; --ink: #e8ebf1; --ink-soft: #b5bccb; --ink-faint: #8d95a7;
    --rule: #2f394c; --cloth: #a9c1ef; --cloth-soft: #253353; --up: #4cc7a8; --down: #f08589;
    --gilt: #e2b74d; --gilt-soft: #3a3220; --focus: #8ab4ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  font-variant-numeric: lining-nums;
}
img { max-width: 100%; display: block; }
a { color: var(--cloth); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 760px) { .wrap { padding: 0 1.5rem; } }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.5rem; padding-top: .9rem; padding-bottom: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font: 600 1.3rem/1 var(--serif); letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; flex: none; }
.nav { display: flex; gap: 1.15rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; font-size: .95rem; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink-soft); text-decoration: none; white-space: nowrap; padding: .35rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--cloth); }
@media (max-width: 759px) { .nav { margin-left: 0; width: 100%; order: 3; } }

/* ---------- type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.012em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.85rem); }
h3 { font-size: 1.15rem; }
.lede { font: 400 1.12rem/1.6 var(--serif); color: var(--ink-soft); max-width: 46rem; margin: .8rem 0 0; }
.meta { color: var(--ink-faint); font-size: .875rem; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.crumbs { font-size: .85rem; color: var(--ink-faint); margin: 1.25rem 0 .75rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs span[aria-hidden] { margin: 0 .35rem; }

main { padding-bottom: 4rem; }
section { margin-top: 3rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.section-head p { margin: 0; color: var(--ink-faint); font-size: .9rem; }
.more { font-size: .92rem; font-weight: 500; }

/* ---------- book cover as an object */
.cover {
  position: relative; display: block; aspect-ratio: 2 / 3; width: 100%;
  background: var(--cloth-soft); border-radius: 2px 4px 4px 2px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(20, 30, 50, .14), 0 3px 8px rgba(20, 30, 50, .10);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { /* the spine: a soft fold near the left edge */
  content: ''; position: absolute; inset: 0 auto 0 0; width: 9%;
  background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.14) 45%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.cover.blank { display: grid; place-items: center; padding: 8%; color: var(--cloth); font: 600 .7rem/1.2 var(--serif); text-align: center; }
.cover.audio { aspect-ratio: 1 / 1; }

/* ---------- hero: the tile map of #1 books */
.hero { padding-top: 2.2rem; }
.hero h1 { max-width: 15ch; }
.hero .lede { margin-bottom: 1.6rem; }
.worldmap { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px 10px; grid-template-columns: repeat(13, minmax(0, 1fr)); }
.worldmap li { min-width: 0; }
.worldmap a { display: block; color: inherit; text-decoration: none; }
.worldmap .cc { display: block; margin-top: .35rem; font-size: .78rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worldmap .tt { display: block; font: 400 .74rem/1.25 var(--serif); color: var(--ink-faint); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.worldmap a:hover .cover { transform: translateY(-2px); box-shadow: 0 2px 2px rgba(20,30,50,.16), 0 8px 18px rgba(20,30,50,.16); }
.worldmap .cover { transition: transform .15s ease, box-shadow .15s ease; }
.worldmap .shared .cc::after { content: ' ●'; color: var(--gilt); font-size: .6rem; vertical-align: .15em; }
.map-key { margin-top: 1.1rem; font-size: .86rem; color: var(--ink-faint); }
.map-key b { color: var(--gilt); font-weight: 600; }
@media (max-width: 899px) {
  .worldmap { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .worldmap li { grid-column: auto !important; grid-row: auto !important; }
}
@media (prefers-reduced-motion: reduce) { .worldmap .cover { transition: none; } .worldmap a:hover .cover { transform: none; } }

/* ---------- lists of books */
.grid-2 { display: grid; gap: 2.5rem 3rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1.25fr 1fr; } .grid-2.even { grid-template-columns: 1fr 1fr; } }
.ranklist { list-style: none; margin: 0; padding: 0; }
.ranklist > li { display: grid; grid-template-columns: 2.4rem 44px minmax(0, 1fr) auto; gap: .2rem .85rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--rule); }
.ranklist > li:last-child { border-bottom: 1px solid var(--rule); }
.ranklist.no-rank > li { grid-template-columns: 44px minmax(0, 1fr) auto; }
.rank { font: 600 1.45rem/1 var(--serif); color: var(--ink); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.rank.first { color: var(--gilt); }
.bk { min-width: 0; }
.bk a.t { font: 600 1rem/1.3 var(--serif); color: var(--ink); text-decoration: none; display: block; overflow-wrap: anywhere; }
.bk a.t:hover { text-decoration: underline; }
.bk .a { font-size: .86rem; color: var(--ink-soft); }
.bk .a a { color: inherit; text-decoration: none; }
.bk .a a:hover { text-decoration: underline; }
.side { text-align: right; font-size: .85rem; color: var(--ink-faint); white-space: nowrap; }
.side strong { display: block; color: var(--ink); font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { width: 84px; height: 26px; display: block; margin-left: auto; }
.spark path.l { fill: none; stroke: var(--cloth); stroke-width: 1.6; }
.spark path.f { fill: var(--cloth-soft); }

.mv { font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv.up { color: var(--up); }
.mv.down { color: var(--down); }
.mv.same { color: var(--ink-faint); font-weight: 400; }
.mv.new { color: var(--gilt); }

/* shelf: a row of covers */
.shelf { list-style: none; margin: 0; padding: 0 0 .5rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, 128px); gap: 1rem; overflow-x: auto; scroll-snap-type: x proximity; }
.shelf li { scroll-snap-align: start; min-width: 0; }
.shelf a { color: inherit; text-decoration: none; }
.shelf .t { display: block; margin-top: .45rem; font: 600 .85rem/1.25 var(--serif); }
.shelf .a { display: block; font-size: .78rem; color: var(--ink-faint); }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
table.data th { font-weight: 600; color: var(--ink-soft); font-size: .82rem; border-bottom-color: var(--ink-faint); white-space: nowrap; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data th button { all: unset; cursor: pointer; }
table.data th button:focus-visible { outline: 3px solid var(--focus); }
table.data th[aria-sort] button::after { content: ' ↕'; color: var(--ink-faint); }
table.data th[aria-sort="descending"] button::after { content: ' ↓'; }
table.data th[aria-sort="ascending"] button::after { content: ' ↑'; }
.bar { display: inline-block; height: .55rem; background: var(--up); border-radius: 1px; vertical-align: middle; margin-right: .4rem; }

/* ---------- book page */
.book-head { display: grid; gap: 1.5rem; margin-top: .5rem; }
@media (min-width: 720px) { .book-head { grid-template-columns: 220px minmax(0, 1fr); gap: 2.5rem; align-items: start; } }
.book-head .cover { max-width: 220px; }
.book-head h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); overflow-wrap: anywhere; }
.byline { margin: .5rem 0 0; font: 400 1.15rem/1.4 var(--serif); }
.facts { margin: 1.25rem 0 0; font: 400 1.08rem/1.6 var(--serif); max-width: 40rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: .9rem 0 0; padding: 0; list-style: none; font-size: .82rem; }
.chips li { background: var(--endpaper); padding: .2rem .55rem; border-radius: 3px; color: var(--ink-soft); }
.buy { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .95rem; border-radius: 4px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font: 500 .92rem/1.2 var(--sans); text-decoration: none; }
.btn:hover { border-color: var(--cloth); }
.btn.primary { background: var(--cloth); border-color: var(--cloth); color: var(--paper); }
.disclosure { margin-top: .6rem; font-size: .78rem; color: var(--ink-faint); max-width: 40rem; }

.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; margin: 2rem 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.statline div { padding: .9rem 1rem .9rem 0; }
.statline dt { font-size: .82rem; color: var(--ink-faint); }
.statline dd { margin: .15rem 0 0; font: 600 1.5rem/1.1 var(--serif); font-variant-numeric: lining-nums; }
.statline dd small { font: 400 .8rem/1 var(--sans); color: var(--ink-faint); }

figure.chart { margin: 0; }
figure.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
figure.chart figcaption { font-size: .84rem; color: var(--ink-faint); margin-top: .5rem; }
.axis text { font: 400 11px var(--sans); fill: var(--ink-faint); }
.axis line, .grid line { stroke: var(--rule); stroke-width: 1; }
.series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series .area { stroke: none; opacity: .18; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; padding: 0; margin: .6rem 0 0; font-size: .84rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: .35rem; }

/* ---------- reading pages */
.prose { max-width: var(--read); font: 400 1.08rem/1.7 var(--serif); }
.prose h2 { margin: 2.4rem 0 .6rem; font-size: 1.55rem; }
.prose h3 { margin: 1.8rem 0 .4rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05rem; }
.prose li { margin: .3rem 0; }
.prose table { font: 400 .92rem/1.4 var(--sans); }
.prose .note { background: var(--endpaper); padding: .9rem 1.1rem; border-radius: 4px; font-size: 1rem; }
.prose blockquote { margin: 1.2rem 0; padding-left: 1rem; border-left: 3px solid var(--cloth); color: var(--ink-soft); }
.updated { font: 400 .9rem/1.4 var(--sans); color: var(--ink-faint); margin-top: .9rem; }

.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); list-style: none; padding: 0; margin: 0; }
.cards li { border-top: 2px solid var(--cloth); padding-top: .8rem; }
.cards a.t { font: 600 1.12rem/1.3 var(--serif); color: var(--ink); text-decoration: none; }
.cards a.t:hover { text-decoration: underline; }
.cards p { margin: .35rem 0 0; color: var(--ink-soft); font-size: .93rem; }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1.25rem 0 0; }
.tabs a { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-soft); text-decoration: none; font-size: .9rem; }
.tabs a[aria-current="page"] { background: var(--cloth); color: var(--paper); border-color: var(--cloth); }

.notice { background: var(--gilt-soft); border-radius: 4px; padding: .8rem 1rem; font-size: .92rem; margin-top: 1.5rem; max-width: 46rem; }
.empty { color: var(--ink-faint); font-style: italic; font-family: var(--serif); }

/* ---------- tools */
.tool { display: grid; gap: 2rem; margin-top: 1.5rem; }
@media (min-width: 900px) { .tool { grid-template-columns: 320px minmax(0, 1fr); } }
.tool form { display: grid; gap: 1rem; align-content: start; background: var(--endpaper); padding: 1.25rem; border-radius: 6px; }
.tool label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 500; }
.tool label small { font-weight: 400; color: var(--ink-faint); }
.tool input, .tool select { font: 400 1rem/1.3 var(--sans); padding: .55rem .6rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); width: 100%; }
.tool fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .4rem; }
.tool legend { font-size: .9rem; font-weight: 500; margin-bottom: .2rem; }
.tool .radio { display: flex; gap: .45rem; align-items: center; font-weight: 400; }
.tool .radio input { width: auto; }
.result-big { font: 600 2.2rem/1.1 var(--serif); }

.search-box { display: flex; gap: .5rem; max-width: 34rem; margin-top: 1.25rem; }
.search-box input { flex: 1; font: 400 1.05rem var(--sans); padding: .65rem .8rem; border: 1px solid var(--ink-faint); border-radius: 4px; background: var(--paper); color: var(--ink); }

/* ---------- footer */
.footer { border-top: 1px solid var(--rule); background: var(--endpaper); padding: 2.5rem 0 3rem; font-size: .88rem; color: var(--ink-soft); }
.footer .cols { display: grid; gap: 1.5rem 2rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.footer h2 { font: 600 .95rem/1.3 var(--sans); margin-bottom: .5rem; color: var(--ink); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: .3rem 0; }
.footer a { color: var(--ink-soft); }
.footer .fine { margin-top: 2rem; font-size: .8rem; color: var(--ink-faint); max-width: 60rem; }

/* ---------- embed widget */
body.embed { background: var(--paper); }
.embed-box { padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: 6px; max-width: 420px; }
.embed-box h1 { font-size: 1.05rem; margin-bottom: .5rem; }
.embed-box .ranklist > li { padding: .4rem 0; grid-template-columns: 1.6rem 32px minmax(0, 1fr); }
.embed-box .rank { font-size: 1.05rem; }
.embed-box .bk a.t { font-size: .88rem; }
.embed-box .from { margin-top: .6rem; font-size: .78rem; }

@media print { .masthead .nav, .footer, .buy { display: none; } }
.book-head h2.q { font-size: 1rem; font-weight: 600; margin: 1.3rem 0 0; color: var(--ink-soft); font-family: var(--sans); letter-spacing: 0; }
.book-head h2.q + .facts { margin-top: .35rem; }
.tool { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .tool { grid-template-columns: 320px minmax(0, 1fr); } }
.tool > *, .tool form > * { min-width: 0; }
.tool select { max-width: 100%; }
table.data tbody th { font-weight: 500; color: var(--ink); font-size: .92rem; border-bottom-color: var(--rule); white-space: normal; }
.side > span, .side > .mv { display: block; }
.side .spark + span { margin-top: .1rem; }
@media (max-width: 599px) {
  .worldmap { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 12px 8px; }
  .worldmap .tt { -webkit-line-clamp: 1; }
  .book-head .cover { max-width: 150px; }
}
