:root {
  /* dark page chrome */
  --bg: #000000;
  --bg-text: #ffffff;
  --bg-text-muted: #c2c2c2;
  --bg-text-soft: #8a8a8a;
  --bg-text-faint: #555555;
  --bg-border: #1f1f1f;
  --bg-border-strong: #3a3a3a;

  /* light surfaces (drawer, search, buttons) */
  --surface: #ffffff;
  --surface-alt: #f6f6f6;
  --surface-sunk: #ececec;
  --border: #e5e5e5;
  --border-strong: #c5c5c5;
  --text: #000000;
  --text-muted: #555555;
  --text-soft: #8a8a8a;
  --text-faint: #c5c5c5;

  --spine-radius: 2px;
  --pad-x: clamp(20px, 2.2vw, 36px);
  --max-w: 1640px;
}

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

html, body {
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--bg-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* lock scroll while sign-in overlay is up */
body:not(.is-authed) { overflow: hidden; }
body.is-resolving-auth .auth-overlay { animation: none; }

body { overflow-x: hidden; }

.header {
  padding: 36px var(--pad-x) 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  gap: 24px;
}

.header h1 {
  font-family: inherit;
  font-weight: 500;
  font-style: normal;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.02em;
}

.header .meta {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg-text-soft);
  justify-self: end;
}

.user-menu-wrap {
  position: relative;
  justify-self: end;
}

.user-menu-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--bg-border-strong);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 160ms ease;
}

.user-menu-button:hover { transform: translateY(-1px); }
.user-menu-button[aria-expanded="true"] { background: var(--bg-text); color: var(--bg); }

.user-avatar { line-height: 1; }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 56px -20px rgba(0, 0, 0, 0.5);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}

.user-menu[hidden] { display: none; }

.user-menu-email {
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-soft);
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  word-break: break-all;
}

.user-menu-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.user-menu-item:hover { background: var(--surface-alt); }

.nav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
}

.toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.search-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.search-button:hover {
  color: var(--text);
  background: var(--surface-sunk);
  border-color: var(--border-strong);
}

.toggle-option {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 180ms ease, color 180ms ease;
}

.toggle-icon { display: inline-block; opacity: 0.7; }
.toggle-option.is-active .toggle-icon { opacity: 1; }

.toggle-option.is-active {
  background: var(--text);
  color: var(--surface);
}

.toggle-option:hover:not(.is-active) {
  color: var(--text);
}

.view[hidden] { display: none; }

/* --- quotes intro --------------------------------------------------- */

.quotes {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 240px var(--pad-x) 96px;
  position: relative;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bg-text-soft);
  margin-bottom: 56px;
}

.hero-kicker .sep {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-border-strong);
}

.hero-kicker .loc {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.hero-kicker .loc.is-loading { opacity: 0.5; }

.hero-kicker .dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-text-muted);
  animation: heroPulse 2.4s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.quote {
  max-width: 900px;
  text-align: left;
}

.quote-text .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: wordIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes wordIn {
  to { opacity: 1; transform: none; }
}

.quote.is-fading .quote-text .w {
  animation: wordOut 320ms ease forwards;
}

@keyframes wordOut {
  to { opacity: 0; transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .quote-text .w { animation: none; opacity: 1; transform: none; }
  .hero-kicker .dot { animation: none; }
}

.quote-text {
  font-family: inherit;
  font-style: normal;
  font-weight: 400;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.3;
  letter-spacing: -0.018em;
  color: var(--bg-text);
}

.quote-attribution {
  margin-top: 22px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bg-text-soft);
  display: flex;
  align-items: center;
  gap: 14px;
}

.quote-attribution::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--bg-text-faint);
}

.quote-year { color: var(--bg-text-faint); }

/* --- book drawer (bottom sheet) ------------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 17, 8, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity 280ms ease;
  cursor: pointer;
}

.drawer-backdrop[hidden] { display: none; }
.drawer-backdrop.is-open { opacity: 1; }

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70vh;
  background: var(--surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -30px 60px -20px rgba(27, 17, 8, 0.16);
  z-index: 41;
  transform: translateY(100%);
  transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drawer[hidden] { display: none; }
.drawer.is-open { transform: translateY(0); }

.drawer-grip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-faint);
  z-index: 2;
}

.drawer-menu-wrap {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 3;
}

.drawer-menu-button {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: border-color 160ms ease, background 160ms ease;
}

.drawer-menu-button:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.drawer-menu-button[aria-expanded="true"] { border-color: var(--text); background: var(--surface-alt); }

.drawer-menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--text-muted);
}
.drawer-menu-button:hover span { background: var(--text); }

.drawer-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 56px -20px rgba(27, 17, 8, 0.22);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-menu[hidden] { display: none; }

.drawer-menu-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.drawer-menu-item:hover { background: var(--surface-alt); }

.drawer-menu-item.danger { color: #b3261e; }
.drawer-menu-item.danger:hover { background: #fbeeed; }
.drawer-menu-item.danger.is-confirming {
  background: #b3261e;
  color: #fff;
}

.drawer-inner {
  flex: 1;
  overflow-y: auto;
}

.drawer-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px var(--pad-x) 64px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 72px;
}

@media (max-width: 880px) {
  .drawer-grid { grid-template-columns: 1fr; gap: 36px; padding-top: 64px; }
}

/* --- drawer left column: just a really large cover ----------------- */

.drawer-identity {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.drawer-cover {
  height: calc(70vh - 120px);
  max-height: 640px;
  width: auto;
  aspect-ratio: var(--cover-aspect, 2 / 3);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 1px 2px rgba(27, 17, 8, 0.10),
    0 24px 48px -16px rgba(27, 17, 8, 0.28);
}

@media (max-width: 880px) {
  .drawer-cover {
    height: auto;
    width: 100%;
    max-width: 320px;
    aspect-ratio: var(--cover-aspect, 2 / 3);
  }
}

.drawer-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  font-family: inherit;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
}

.drawer-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease;
}

.drawer-cover.has-image img { opacity: 1; }

/* --- drawer right column (meta + actions + notes) ------------------ */

.drawer-detail {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-top: 8px;
}

.drawer-headline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.drawer-headline-title {
  font-size: clamp(30px, 2.4vw, 38px);
  font-weight: 500;
  letter-spacing: -0.024em;
  line-height: 1.1;
  color: var(--text);
}

.drawer-headline-author {
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.drawer-add-to-library {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--text);
  color: var(--surface);
  border: 0;
  border-radius: 999px;
  padding: 14px 26px 14px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  width: max-content;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 220ms ease;
}

.drawer-add-to-library:hover { transform: translateY(-2px); }

.drawer-add-to-library .plus {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer-add-to-library:hover .plus { transform: rotate(90deg); }

.drawer-already-added {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-size: 14px;
  width: max-content;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 44px;
}

.drawer-meta-item {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.drawer-meta-item strong {
  display: block;
  font-weight: 500;
  color: var(--text);
  font-size: 20px;
  letter-spacing: -0.02em;
  text-transform: none;
  margin-top: 8px;
  font-family: inherit;
}

.drawer-description {
  font-family: inherit;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-muted);
  max-height: 240px;
  overflow-y: auto;
  padding-right: 8px;
}

.drawer-description.is-empty {
  color: var(--text-soft);
  font-style: italic;
}

.drawer-section-label {
  font-family: inherit;
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 16px;
}

.drawer-retailers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.retailer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.retailer:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-sunk);
  transform: translateY(-2px);
}

.retailer-arrow { opacity: 0.4; }

/* --- labels (tags) -------------------------------------------------- */

.drawer-labels { display: flex; flex-direction: column; }

#label-area {
  transition: opacity 160ms ease;
}
#label-area.is-morphing { opacity: 0; }

.label-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--text);
  color: var(--surface);
  border: 0;
  border-radius: 999px;
  padding: 9px 6px 9px 14px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.01em;
  cursor: default;
}

.label-chip .x {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 160ms ease;
}
.label-chip .x:hover { background: rgba(255, 255, 255, 0.3); }

/* the "+ No labels yet" empty button and the small + at end of chips */

.label-empty-btn,
.label-plus-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.label-empty-btn {
  gap: 10px;
  padding: 7px 16px 7px 7px;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.label-plus-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.label-empty-btn:hover,
.label-plus-btn:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--surface-alt);
}

.label-empty-btn .plus {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.label-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 12px;
}

.label-input-wrap input {
  flex: 1;
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 13px 84px 13px 20px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.01em;
  outline: 0;
  transition: border-color 180ms ease, background 180ms ease;
}

.label-input-wrap input:focus { border-color: var(--border-strong); background: var(--surface); }
.label-input-wrap input::placeholder { color: var(--text-soft); }

.label-input-wrap .inline-add {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--surface);
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 160ms ease;
}
.label-input-wrap .inline-add:hover { opacity: 0.85; }
.label-input-wrap .inline-add:disabled { opacity: 0.35; cursor: not-allowed; }

.label-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.label-suggestions .suggest {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.label-suggestions .suggest:hover { color: var(--text); border-color: var(--text); }

.drawer-notes {
  display: flex;
  flex-direction: column;
}

.drawer-notes textarea {
  width: 100%;
  min-height: 140px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  color: var(--text);
  font: inherit;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.55;
  resize: vertical;
  outline: 0;
  transition: border-color 180ms ease, background 180ms ease;
}

.drawer-notes textarea:focus { border-color: var(--border-strong); background: var(--surface); }
.drawer-notes textarea::placeholder { color: var(--text-soft); font-style: italic; }

.drawer-notes-status {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-top: 8px;
  height: 12px;
}

/* --- search overlay ------------------------------------------------- */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 2, 0.55);
  backdrop-filter: blur(28px) saturate(120%);
  -webkit-backdrop-filter: blur(28px) saturate(120%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 22vh 24px 80px;
  animation: searchIn 220ms ease both;
}

.search-overlay[hidden] { display: none; }

@keyframes searchIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-panel {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 20px 60px -24px rgba(0, 0, 0, 0.65);
  transition: background 180ms ease, border-color 180ms ease;
}

.search-bar:focus-within {
  background: rgba(28, 22, 16, 0.7);
  border-color: rgba(255, 255, 255, 0.22);
}

.search-bar-icon { color: rgba(255, 255, 255, 0.45); flex: 0 0 auto; }

.search-bar input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--bg-text);
  font-family: inherit;
  font-style: normal;
  font-weight: 500;
  font-size: clamp(20px, 1.8vw, 26px);
  letter-spacing: -0.02em;
}

.search-bar input::placeholder { color: rgba(255, 255, 255, 0.28); }

.search-close {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.search-close:hover { color: var(--bg-text); border-color: rgba(255, 255, 255, 0.3); }

.search-status {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  min-height: 14px;
}

/* recent books (shown when input is empty) */
.search-recent {
  grid-column: 1 / -1;   /* span the full search-results grid row */
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

.search-recent-title {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.search-recent-covers {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 18px;
  justify-content: flex-start;
}

.search-recent-cover {
  flex: 0 0 auto;
  width: 130px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  color: inherit;
  font: inherit;
}

.search-recent-cover-img {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: 0 14px 36px -18px rgba(0, 0, 0, 0.6);
}

.search-recent-cover:hover .search-recent-cover-img {
  transform: translateY(-4px);
}

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

.search-recent-cover-img .no-image-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.search-recent-cover-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--bg-text);
  line-height: 1.3;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-recent-cover-author {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.search-recent-empty {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* no-results / add-manually empty state */

.search-no-results {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 4px 0;
}

.search-no-results-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: -0.005em;
  line-height: 1.5;
  max-width: 460px;
}

.search-no-results-text strong {
  font-weight: 500;
  color: var(--bg-text);
}

.search-no-results-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-text);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 11px 22px 11px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.search-no-results-cta:hover { transform: translateY(-1px); }

.search-no-results-cta .plus {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--bg-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-no-results-cta:hover .plus { transform: rotate(90deg); }

/* editable title/author in drawer (manual entry) */

.drawer-headline-input {
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-family: inherit;
  width: 100%;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 8px;
  transition: border-color 180ms ease;
}

.drawer-headline-input:focus { border-bottom-color: var(--text); }

.drawer-headline-input.title {
  font-size: clamp(30px, 2.4vw, 38px);
  font-weight: 500;
  letter-spacing: -0.024em;
  line-height: 1.1;
  color: var(--text);
}

.drawer-headline-input.author {
  margin-top: 14px;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.drawer-headline-input.year {
  margin-top: 14px;
  max-width: 140px;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--text-soft);
}

.drawer-headline-input::placeholder {
  color: var(--text-faint);
  font-style: italic;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 28px 20px;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font: inherit;
}

.result-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  transition: transform 220ms ease;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.6);
}

.result:hover .result-cover {
  transform: translateY(-4px);
}

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

.result-cover.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.result-cover.no-image span {
  font-family: inherit;
  font-weight: 500;
  font-size: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.result-cover .added-flag {
  position: absolute;
  inset: auto 8px 8px auto;
  background: var(--bg-text);
  color: var(--bg);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 200ms ease;
}

.result.is-added .added-flag { opacity: 1; }

.result-title {
  font-size: 13px;
  color: var(--bg-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.result-meta .dot { opacity: 0.4; }

/* --- spines view stack --------------------------------------------- */

.stack {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x) 160px;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
}

.spine {
  position: relative;
  height: var(--h, 140px);
  width: var(--w, 100%);
  border-radius: var(--spine-radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 32px 0 28px;
  cursor: pointer;
  margin-top: var(--overlap, -2px);
  transform: translateX(var(--ox, 0px)) rotate(var(--rot, 0deg));
  transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1), z-index 0s 320ms;
  will-change: transform;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.18),
    0 6px 14px -8px rgba(0, 0, 0, 0.55);
  z-index: 1;
  isolation: isolate;
}

/* AI artwork layer — sits above the solid book color, below text */
.spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--art-url, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 600ms ease;
  pointer-events: none;
  z-index: 0;
}
.spine.has-art::before { opacity: 1; }

/* book-colored vignette to keep title + mark readable */
.spine::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 600ms ease;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--book-bg, #000) 75%, transparent) 0%,
    transparent 30%,
    transparent 70%,
    color-mix(in srgb, var(--book-bg, #000) 75%, transparent) 100%
  );
}
.spine.has-art::after { opacity: 1; }

.spine .title-block { position: relative; z-index: 2; }
.spine .mark { position: relative; z-index: 2; }

.spine:hover {
  transform: translateX(calc(var(--ox, 0px) + 10px)) rotate(0deg);
  z-index: 5;
  transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1), z-index 0s;
}

.spine .title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.spine .title {
  font-size: clamp(16px, 1.25vw, 20px);
  font-weight: 400;
  letter-spacing: -0.005em;
}

.spine .author {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
}

.spine .mark {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  pointer-events: none;
}

/* --- mark styles ----------------------------------------------------- */

.mark.condensed {
  font-family: "Bebas Neue", "Oswald", Impact, sans-serif;
  font-size: var(--mark-size, 110px);
  line-height: 0.85;
  letter-spacing: 0.02em;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.mark.condensed .secondary {
  font-size: calc(var(--mark-size, 110px) * 0.12);
  letter-spacing: 0.22em;
  opacity: 0.85;
}

.mark.serif-italic {
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: calc(var(--mark-size, 110px) * 1.05);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.mark.wordmark {
  font-family: "Fraunces", "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: calc(var(--mark-size, 110px) * 1.0);
  line-height: 0.9;
  letter-spacing: -0.025em;
}

.mark.monogram {
  font-family: "DM Serif Display", "Playfair Display", Georgia, serif;
  font-weight: 400;
  font-size: calc(var(--mark-size, 110px) * 1.1);
  line-height: 0.85;
}

.mark.stacked {
  font-family: "Archivo Black", "Helvetica Neue", Arial, sans-serif;
  font-size: calc(var(--mark-size, 110px) * 0.32);
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.mark.glyph {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: calc(var(--mark-size, 110px) * 1.0);
  line-height: 1;
}

.mark.circular {
  width: var(--mark-circle, 110px);
  height: var(--mark-circle, 110px);
  position: relative;
}
.mark.circular svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: spin 18s linear infinite;
}
.mark.circular text {
  font-family: "Archivo Black", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  fill: currentColor;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .mark.circular svg { animation: none; }
  .spine { transition: none; }
}

.sentinel { height: 1px; }

/* --- filter bar (above the books) ---------------------------------- */

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px var(--pad-x);
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 40px;
}

@media (max-width: 880px) {
  .filter-bar { flex-direction: column; align-items: stretch; gap: 14px; }
}

.filter-search {
  flex: 0 0 460px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0a0a0a;
  border: 1px solid var(--bg-border);
  border-radius: 999px;
  padding: 14px 22px;
  color: var(--bg-text-soft);
  transition: border-color 180ms ease, background 180ms ease;
}

.filter-search:focus-within {
  border-color: var(--bg-border-strong);
  background: #111111;
  color: var(--bg-text);
}

@media (max-width: 880px) { .filter-search { flex-basis: auto; width: 100%; } }

.filter-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--bg-text);
  font: inherit;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.filter-search input::placeholder { color: var(--bg-text-faint); }

.filter-clear {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-border);
  color: var(--bg-text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, color 160ms ease;
}
.filter-clear:hover { background: var(--bg-border-strong); color: var(--bg-text); }

.filter-tags {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tags::-webkit-scrollbar { display: none; }

.filter-pill {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--bg-border-strong);
  color: var(--bg-text-muted);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.filter-pill:hover { color: var(--bg-text); border-color: var(--bg-text-soft); }

.filter-pill.is-active {
  background: var(--bg-text);
  color: var(--bg);
  border-color: var(--bg-text);
}

.filter-pill .count {
  margin-left: 6px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.filter-empty {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px var(--pad-x);
  text-align: center;
  color: var(--bg-text-soft);
  font-size: 15px;
  letter-spacing: -0.005em;
}

/* --- "Add a book" CTA in the filter bar ---------------------------- */

.add-book-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-text);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 11px 22px 11px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), background 220ms ease;
  white-space: nowrap;
}

.add-book-cta:hover { transform: translateY(-1px); }
.add-book-cta:active { transform: translateY(0); }

.add-book-cta .plus {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--bg-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.add-book-cta:hover .plus { transform: rotate(90deg); }

/* floating add-a-book button (mobile only) */
.add-book-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 35;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--bg-text);
  color: var(--bg);
  border: 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 18px 36px -10px rgba(0, 0, 0, 0.6),
    0 4px 12px -4px rgba(0, 0, 0, 0.35);
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.add-book-fab:hover { transform: translateY(-2px); }
.add-book-fab:active { transform: translateY(0) scale(0.96); }

/* --- grid view (front covers, natural aspect ratios) --------------- */

.view-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x) 120px;
}

.rail {
  columns: 4 240px;
  column-gap: 12px;
}

@media (max-width: 900px) {
  .rail { columns: 3 200px; }
}
@media (max-width: 600px) {
  .rail { columns: 2 160px; }
}

.cover {
  break-inside: avoid;
  width: 100%;
  aspect-ratio: var(--cover-aspect, 2 / 3);
  margin-bottom: 12px;
  isolation: isolate;
  border-radius: 8px;
  padding: 28px 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 18px 36px -16px rgba(27, 17, 8, 0.22);
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.cover:hover { transform: translateY(-10px); }

.cover .cover-top {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.7;
}

.cover .cover-title {
  align-self: center;
  font-family: inherit;
  font-weight: 500;
  font-size: clamp(20px, 1.7vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.022em;
}

.cover .cover-author {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* tiny mark in the corner echoes the spine's mark */
.cover .cover-mark {
  position: absolute;
  right: 20px;
  top: 22px;
  font-size: 14px;
  letter-spacing: 0.18em;
  opacity: 0.6;
}

.cover .cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease;
  z-index: 1;
}

.cover.has-image .cover-image { opacity: 1; }
.cover.has-image .cover-top,
.cover.has-image .cover-mark,
.cover.has-image .cover-title,
.cover.has-image .cover-author {
  opacity: 0;
  transition: opacity 200ms ease;
}

/* =====================================================================
   Sign-in overlay
   ===================================================================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.auth-overlay[hidden] { display: none; }

.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-brand {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--bg-text);
}

.auth-tagline {
  font-size: 14px;
  color: var(--bg-text-soft);
  letter-spacing: -0.005em;
  margin-top: -10px;
  line-height: 1.4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bg-text-soft);
}

.auth-field input {
  background: #0a0a0a;
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: 13px 16px;
  color: var(--bg-text);
  font: inherit;
  font-size: 15px;
  letter-spacing: -0.005em;
  outline: 0;
  transition: border-color 180ms ease, background 180ms ease;
  width: 100%;
  box-sizing: border-box;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input { padding-right: 46px; }

.auth-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--bg-text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms ease, background 160ms ease;
}

.auth-eye-btn:hover {
  color: var(--bg-text);
  background: rgba(255, 255, 255, 0.04);
}

.auth-eye-btn .eye-closed { display: none; }
.auth-eye-btn[aria-pressed="true"] .eye-open { display: none; }
.auth-eye-btn[aria-pressed="true"] .eye-closed { display: block; }

.auth-field input:focus {
  border-color: var(--bg-border-strong);
  background: #111111;
}

.auth-error {
  font-size: 13px;
  color: #f97066;
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.auth-error-action {
  background: transparent;
  border: 0;
  color: var(--bg-text);
  padding: 0;
  font: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--bg-text-faint);
  margin-left: 4px;
  transition: text-decoration-color 160ms ease;
}
.auth-error-action:hover { text-decoration-color: var(--bg-text); }

.auth-submit {
  background: var(--bg-text);
  color: var(--bg);
  border: 0;
  border-radius: 10px;
  padding: 14px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: opacity 180ms ease, transform 180ms ease;
  margin-top: 4px;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); }
.auth-submit:disabled { opacity: 0.6; cursor: wait; }

.auth-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--bg-text-soft);
}

.auth-toggle-btn {
  background: transparent;
  border: 0;
  color: var(--bg-text);
  padding: 0;
  font: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--bg-text-faint);
  transition: text-decoration-color 160ms ease;
}
.auth-toggle-btn:hover { text-decoration-color: var(--bg-text); }

/* =====================================================================
   Mobile pass — tablet (<= 720px) and phone (<= 480px) overrides
   ===================================================================== */

@media (max-width: 720px) {
  :root { --pad-x: 14px; }

  /* header */
  .header {
    padding: 22px var(--pad-x) 14px;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }
  .header h1 { font-size: 20px; }
  .nav-center { justify-self: center; }
  .user-menu-button { width: 32px; height: 32px; }
  .toggle { padding: 3px; }
  .toggle-option { padding: 8px 14px; font-size: 13px; gap: 6px; }

  /* hero / quote */
  .quotes {
    padding: 110px var(--pad-x) 56px;
  }
  .hero-kicker {
    margin-bottom: 32px;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 10px;
    letter-spacing: 0.22em;
  }
  .hero-kicker .sep { display: none; }
  .quote-text {
    font-size: clamp(22px, 5.6vw, 28px);
    line-height: 1.28;
  }
  .quote-attribution {
    margin-top: 16px;
    font-size: 10px;
    gap: 10px;
  }
  .quote-attribution::before { width: 18px; }

  /* filter bar — stack vertically */
  .filter-bar {
    padding: 14px var(--pad-x);
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 24px;
  }
  .filter-search {
    flex-basis: auto;
    width: 100%;
    padding: 12px 18px;
  }
  .filter-search input { font-size: 15px; }
  .filter-tags { gap: 6px; padding-bottom: 4px; }
  .filter-pill { padding: 7px 14px; font-size: 12px; }
  /* hide the inline "Add a book" pill on mobile — replaced by the FAB */
  .add-book-cta { display: none; }
  .add-book-fab { display: inline-flex; }

  /* spines — much thinner so the full shelf fits on a phone */
  .stack { padding: 0 var(--pad-x) 64px; gap: 1px; }
  .spine {
    padding: 0 12px 0 10px;
    height: calc(var(--h, 140px) * 0.4);
    max-height: 78px;
    min-height: 36px;
    /* flatten the rotation/offset so books don't bleed off the viewport */
    --ox: 0px;
    --rot: 0deg;
    --overlap: -1px;
  }
  .spine:hover { transform: translateX(0); }
  .spine .title {
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: -0.005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .spine .author {
    font-size: 9px;
    letter-spacing: 0.10em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .spine .title-block { min-width: 0; gap: 3px; max-width: 100%; overflow: hidden; }

  /* mark sizes scale with the book's actual thickness (--h) — thinner book
     means a smaller mark, so the spine always reads as balanced */
  .mark.condensed    { font-size: clamp(11px, calc(var(--h, 100px) * 0.18), 24px); letter-spacing: 0.02em; }
  .mark.serif-italic { font-size: clamp(12px, calc(var(--h, 100px) * 0.22), 28px); }
  .mark.wordmark     { font-size: clamp(11px, calc(var(--h, 100px) * 0.20), 26px); }
  .mark.monogram     { font-size: clamp(14px, calc(var(--h, 100px) * 0.26), 32px); }
  .mark.stacked      { font-size: clamp(6px,  calc(var(--h, 100px) * 0.07),  9px); gap: 1px; }
  .mark.glyph        { font-size: clamp(12px, calc(var(--h, 100px) * 0.20), 26px); }
  .mark.condensed .secondary { font-size: clamp(5px, calc(var(--h, 100px) * 0.06), 8px); }
  .mark.circular     { width: clamp(20px, calc(var(--h, 100px) * 0.28), 36px); height: clamp(20px, calc(var(--h, 100px) * 0.28), 36px); }
  .mark.circular text { font-size: 11px; letter-spacing: 0.08em; }
  /* mark column can't take more than 40% of the spine, no matter how long the text */
  .spine { grid-template-columns: minmax(0, 1fr) minmax(0, 40%); column-gap: 8px; }
  .spine .mark { padding-left: 4px; overflow: hidden; }

  /* drawer */
  .drawer { height: 86vh; }
  .drawer-grid {
    padding: 52px var(--pad-x) 36px;
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .drawer-identity { align-items: center; }
  .drawer-cover {
    height: auto;
    width: 100%;
    max-width: 220px;
    aspect-ratio: var(--cover-aspect, 2 / 3);
  }
  .drawer-detail { gap: 26px; padding-top: 0; }
  .drawer-headline-title { font-size: 26px; letter-spacing: -0.02em; }
  .drawer-headline-author { font-size: 12px; }
  .drawer-meta { gap: 16px 28px; }
  .drawer-meta-item { font-size: 11px; }
  .drawer-meta-item strong { font-size: 16px; }
  .drawer-description { font-size: 15px; line-height: 1.55; max-height: 200px; }
  .drawer-section-label { font-size: 11px; margin-bottom: 12px; }
  .drawer-retailers { gap: 6px; }
  .retailer { padding: 10px 16px; font-size: 13px; }
  .drawer-add-to-library { font-size: 14px; padding: 12px 22px 12px 14px; }
  .drawer-notes textarea { font-size: 16px; min-height: 100px; }
  .label-add input,
  .label-input-wrap input { font-size: 14px; }
  .drawer-menu-wrap { top: 16px; right: 16px; }

  /* search overlay */
  .search-overlay { padding: 12vh 16px 48px; }
  .search-panel { max-width: 100%; gap: 22px; }
  .search-bar { padding: 14px 18px; gap: 12px; }
  .search-bar input { font-size: 18px; }
  .search-status { font-size: 10px; }
  .search-recent-title { font-size: 10px; }
  .search-recent-cover { width: calc((100% - 24px) / 3); }
  .search-recent-cover-title { font-size: 11px; }
  .search-recent-cover-author { font-size: 9px; }
  .search-results {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px 12px;
  }
  .result-title { font-size: 12px; }
  .result-meta { font-size: 9px; }
  .search-no-results-text { font-size: 13px; }
}

@media (max-width: 480px) {
  /* phones — even tighter */
  :root { --pad-x: 12px; }
  .quotes { padding: 80px var(--pad-x) 36px; }
  .quote-text { font-size: 20px; line-height: 1.28; }
  .header { padding: 16px var(--pad-x) 10px; }
  .header h1 { font-size: 18px; }
  .toggle-option { padding: 6px 11px; font-size: 11px; gap: 5px; }
  .drawer-grid { padding: 44px var(--pad-x) 28px; gap: 24px; }
  .drawer-cover { max-width: 180px; }
  .drawer-headline-title { font-size: 22px; }
  .drawer-meta { gap: 14px 22px; }
  .search-recent-cover { width: calc((100% - 16px) / 2); }

  /* spines — even thinner on phones */
  .spine {
    height: calc(var(--h, 140px) * 0.34);
    max-height: 64px;
    min-height: 32px;
    padding: 0 10px 0 8px;
  }
  .spine .title { font-size: 11px; line-height: 1.18; }
  .spine .author {
    font-size: 8px;
    letter-spacing: 0.10em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .spine .title-block { gap: 2px; }
  /* phones — same proportional model, dialed even tighter */
  .mark.condensed    { font-size: clamp(9px,  calc(var(--h, 100px) * 0.14), 18px); }
  .mark.serif-italic { font-size: clamp(10px, calc(var(--h, 100px) * 0.17), 22px); }
  .mark.wordmark     { font-size: clamp(10px, calc(var(--h, 100px) * 0.15), 20px); }
  .mark.monogram     { font-size: clamp(12px, calc(var(--h, 100px) * 0.20), 24px); }
  .mark.stacked      { font-size: clamp(5px,  calc(var(--h, 100px) * 0.05),  7px); }
  .mark.glyph        { font-size: clamp(10px, calc(var(--h, 100px) * 0.15), 20px); }
  .mark.condensed .secondary { font-size: clamp(4px, calc(var(--h, 100px) * 0.05), 6px); }
  .mark.circular     { width: clamp(18px, calc(var(--h, 100px) * 0.22), 30px); height: clamp(18px, calc(var(--h, 100px) * 0.22), 30px); }
  .mark.circular text { font-size: 10px; }
}
