/* margin's three themes, from the token table in MARGIN-PLAN.md ("Web UI"): Light, Sepia
   (Kanagawa Lotus) and Dark (Kanagawa Wave). theme.js sets `data-theme` on <html>. Every text
   pairing here is at least 4.5:1; check any new one before adding it. */

/* Bundled fonts (SIL Open Font License; see fonts/LICENSE-*.txt): Literata, a variable font
   with weight and optical-size axes, and IBM Plex Sans 400/500/600. Latin and Latin Extended
   only; other scripts fall back to system fonts. */

@font-face {
  font-family: Literata;
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/literata-latin-opsz-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: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/literata-latin-opsz-italic.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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-500-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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-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: "IBM Plex Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-italic.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: 200 900;
  font-display: swap;
  src: url("fonts/literata-latin-ext-opsz-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: Literata;
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/literata-latin-ext-opsz-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-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+0304, U+0308, U+0329, 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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-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+0304, U+0308, U+0329, 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: "IBM Plex Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f5;
  --chrome: #ffffff;
  --surface: #ffffff;
  --raised: #ffffff;
  --hover: #ededea;
  --border: #e3e3df;
  --border-control: #d3d3ce;
  --text: #17191c;
  --heading: #17191c;
  --text-2: #575b62;
  --accent: #2b44c2;
  --link: #2b44c2;
  --on-accent: #ffffff;
  --selected-bg: #e8ecfb;
  --selected-border: #b9c3f0;
  --selected-text: #1c2e8c;
  --label: #575b62;
  --progress: #2b44c2;
  --track: #e3e3df;
  --error-bg: #fcedec;
  --error-border: #ebb7b2;
  --error-text: #7a1d14;
  --paper: #fdfcfa;
  --ink: #1b1c1e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.12);
  --scrim: rgb(23 25 28 / 0.28);
}

:root[data-theme="sepia"] {
  color-scheme: light;
  --bg: #f2ecbc;
  --chrome: #e7dba0;
  --surface: #f7f3d3;
  --raised: #e5ddb0;
  --hover: #e5ddb0;
  --border: #d5cea3;
  --border-control: #a09cac;
  --text: #545464;
  --heading: #43436c;
  --text-2: #5f5c50;
  --accent: #4d699b;
  --link: #4d699b;
  --on-accent: #f2ecbc;
  --selected-bg: #c9cbd1;
  --selected-border: #a09cac;
  --selected-text: #43436c;
  --label: #624c83;
  --progress: #cc6d00;
  --track: #e5ddb0;
  --error-bg: #f4dcd3;
  --error-border: #d9a594;
  --error-text: #a02f3f;
  --paper: #f2ecbc;
  --ink: #545464;
  --shadow: 0 1px 2px rgb(84 84 100 / 0.2);
  --scrim: rgb(84 84 100 / 0.3);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1f28;
  --chrome: #16161d;
  --surface: #2a2a37;
  --raised: #363646;
  --hover: #2a2a37;
  --border: #363646;
  --border-control: #54546d;
  --text: #dcd7ba;
  --heading: #dcd7ba;
  --text-2: #a09f93;
  --accent: #7e9cd8;
  --link: #7fb4ca;
  --on-accent: #16161d;
  --selected-bg: #223249;
  --selected-border: #2d4f67;
  --selected-text: #a3d4d5;
  --label: #e6c384;
  --progress: #ff9e3b;
  --track: #363646;
  --error-bg: #43242b;
  --error-border: #6b3440;
  --error-text: #ff5d62;
  --paper: #1f1f28;
  --ink: #dcd7ba;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.5);
  --scrim: rgb(0 0 0 / 0.45);
}

:root {
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Literata, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--link);
}

h1,
h2,
h3 {
  color: var(--heading);
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.125rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted,
.status {
  color: var(--text-2);
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}

/* Buttons */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--border-control);
  border-radius: 6px;
  background: var(--raised);
  color: var(--text);
  font: 500 0.875rem var(--sans);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.btn:hover {
  border-color: var(--text-2);
}

.btn.primary,
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.btn.sm {
  min-height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  text-decoration: underline;
}

.icon-button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.625rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
}

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

.icon-button svg,
.btn svg {
  flex: none;
}

/* Segmented controls: theme, layout */

.seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  overflow: hidden;
  background: var(--raised);
}

.seg button {
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: 400;
}

.seg button + button {
  border-left: 1px solid var(--border-control);
}

.seg button[aria-pressed="true"],
.seg button[aria-checked="true"] {
  background: var(--selected-bg);
  color: var(--selected-text);
  font-weight: 500;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-control);
  border-radius: 1rem;
  background: var(--raised);
  color: var(--text);
  font-size: 0.8125rem;
  text-decoration: none;
}

.chip:hover {
  border-color: var(--text-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Header */

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  min-width: 0;
  color: var(--heading);
  text-decoration: none;
}

.brand b {
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--text-2);
}

.search {
  position: relative;
  flex: 1 1 20rem;
  max-width: 35rem;
}

.search svg {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  color: var(--text-2);
  pointer-events: none;
}

.search input,
.field input,
.field select {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: 0.875rem var(--sans);
}

.search input {
  padding-left: 2.25rem;
}

.search input::placeholder {
  color: var(--text-2);
}

.session {
  position: relative;
  margin-left: auto;
}

.session summary {
  list-style: none;
}

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

.avatar {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--selected-bg);
  color: var(--selected-text);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 3;
  width: min(20rem, calc(100vw - 2rem));
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
}

.menu form {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.menu .signed-in {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-2);
}

.theme-picker {
  display: grid;
  gap: 0.5rem;
}

/* Library layout: sidebar + content */

.shell {
  display: flex;
  min-height: calc(100dvh - 4.1rem);
}

.sidebar {
  flex: none;
  width: 16rem;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--chrome);
  border-right: 1px solid var(--border);
}

.sidebar[hidden] {
  display: none;
}

.sidebar section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar .eyebrow {
  margin: 0 0 0.375rem 0.625rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0 0.625rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--hover);
}

.sidebar a[aria-current="page"] {
  background: var(--selected-bg);
  color: var(--selected-text);
  font-weight: 500;
}

.sidebar .count {
  color: var(--text-2);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.sidebar a[aria-current="page"] .count {
  color: var(--selected-text);
}

main {
  flex: 1;
  min-width: 0;
  max-width: 72rem;
  padding: 1.75rem 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

main > .status {
  margin: 0;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-head p {
  margin: 0;
  max-width: 40rem;
  color: var(--text-2);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-head a,
.section-head span {
  font-size: 0.875rem;
}

.section-head span {
  color: var(--text-2);
}

/* Navigation lists (authors, subjects, ...) */

.nav {
  list-style: none;
  margin: 0;
  padding: 0.25rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.nav li + li {
  border-top: 1px solid var(--border);
}

.nav a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  color: var(--text);
  text-decoration: none;
}

.nav a:hover .label {
  color: var(--link);
  text-decoration: underline;
}

.nav .count {
  color: var(--text-2);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* Collection cards on the home page */

.collections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr));
  gap: 1rem;
}

.collections a {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.collections a:hover {
  border-color: var(--border-control);
}

.collections b {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--heading);
}

.collections span {
  font-size: 0.8125rem;
  color: var(--text-2);
}

/* Book grid */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));
  gap: 1.75rem 1.375rem;
}

.card a {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
}

.card .meta {
  display: flex;
  flex-direction: column;
}

.card .title {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
}

.card a:hover .title {
  color: var(--link);
  text-decoration: underline;
}

.card .authors {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.format {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.cover {
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: var(--raised);
  box-shadow: var(--shadow), inset 0 0 0 1px rgb(0 0 0 / 0.06);
}

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

/* A cover drawn from the title when the book has none. */
.placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem;
  border: 1px dashed var(--border-control);
  border-radius: 4px;
  color: var(--heading);
}

.placeholder b {
  font-family: var(--serif);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.placeholder i {
  font-size: 0.6875rem;
  font-style: normal;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

.cover.large .placeholder {
  padding: 1.75rem;
}

.cover.large .placeholder b {
  font-size: 1.875rem;
}

.cover.large .placeholder i {
  font-size: 0.8125rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.pager div {
  display: flex;
  gap: 0.375rem;
}

.pager .btn[aria-disabled="true"] {
  color: var(--text-2);
  pointer-events: none;
  opacity: 0.7;
}

/* Continue reading */

.continue {
  display: flex;
  gap: 1.25rem;
  max-width: 44rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.continue .cover {
  flex: none;
  width: 6.5rem;
}

.continue .body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.continue p {
  margin: 0;
}

.continue h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
}

.continue .actions {
  margin-top: auto;
}

.progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.progress .track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}

.progress .fill {
  height: 100%;
  border-radius: 3px;
  background: var(--progress);
}

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

/* Book page */

.book {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  align-items: flex-start;
}

.book > .cover {
  flex: 0 1 16rem;
}

.book .info {
  flex: 999 1 20rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.book .titles {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.book h1 {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.15;
}

.book .series {
  font-size: 0.875rem;
  text-decoration: none;
}

.book .subtitle,
.book .byline {
  margin: 0;
  font-size: 1.0625rem;
}

.book .subtitle {
  color: var(--text-2);
}

.formats {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.formats .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
}

.formats .row + .row {
  border-top: 1px solid var(--border);
}

.formats .kind {
  width: 3.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.formats .about {
  flex: 1 1 6rem;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--text-2);
}

.description {
  max-width: 40rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.description p,
.description ul,
.description ol,
.description blockquote {
  margin: 0 0 0.75rem;
}

.details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.details dt {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.details dd {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
}

/* Sign in */

.login-page {
  min-height: calc(100dvh - 4.1rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.login {
  width: 100%;
  max-width: 25rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.login header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  text-align: center;
}

.login header b {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--heading);
}

.login h1 {
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-2);
}

.login form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field .label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

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

.field input {
  height: 2.75rem;
  font-size: 0.9375rem;
  background: var(--surface);
}

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

.login button[type="submit"] {
  min-height: 2.875rem;
  font-size: 0.9375rem;
}

.login .note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-2);
}

.login > .note {
  text-align: center;
}

code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--hover);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.error {
  display: flex;
  gap: 0.625rem;
  margin: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--error-border);
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.875rem;
  line-height: 1.45;
}

.error svg {
  flex: none;
  margin-top: 1px;
}

/* Phones and narrow windows: the sidebar becomes a scrolling strip under the header. */
@media (max-width: 48rem) {
  .bar {
    padding: 0.625rem 1rem;
    gap: 0.625rem 1rem;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .shell {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    flex-direction: row;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar section {
    flex-direction: row;
  }

  .sidebar .eyebrow {
    display: none;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .sidebar .count {
    display: none;
  }

  main {
    padding: 1.25rem 1rem 2.5rem;
    gap: 1.5rem;
  }

  .continue .cover {
    width: 4.5rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    gap: 1.25rem 1rem;
  }

  .book > .cover {
    flex-basis: 12rem;
  }
}

/* Without the sidebar (signing in), centre the page. */
.sidebar[hidden] + main {
  margin: 0 auto;
}
