:root {
  color-scheme: light dark;
  --accent: #FF385C;
  --bg: #FFFFFF;
  --surface: #F7F7F7;
  --border: #DDDDDD;
  --text: #222222;
  --muted: #717171;
  --star: #FF385C;
  --star-empty: #DDDDDD;
  --radius-card: 12px;
  --radius-control: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1E1E1E;
    --border: #333333;
    --text: #F2F2F2;
    --muted: #A0A0A0;
    --star-empty: #444444;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
}

.wordmark {
  color: var(--accent);
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-left)) 64px;
}

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

h1, h2, h3 { line-height: 1.2; margin: 0; }

/* Landing and empty states */

.landing h1 { font-size: clamp(28px, 6vw, 44px); max-width: 16ch; margin-top: 24px; }
.landing .lede { color: var(--muted); font-size: 18px; max-width: 48ch; }
.empty { text-align: center; padding-top: 72px; }
.empty h1 { font-size: 24px; margin-bottom: 8px; }

/* Profile header */

.profile {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 32px;
}

.avatar {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 600;
  color: var(--muted);
}

.profile h1 { font-size: clamp(24px, 5vw, 32px); }
.handle { color: var(--muted); margin: 2px 0 0; }
.bio { margin: 8px 0 0; white-space: pre-line; max-width: 60ch; }
.stats { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* Sections */

.section { margin-top: 40px; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 22px; }
.count { color: var(--muted); font-size: 15px; }

.shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 24px 16px;
}

@media (max-width: 480px) {
  .shelf { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 12px; }
}

.book { min-width: 0; }

.cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
}

.book-title {
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-meta { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.stars {
  position: relative;
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--star-empty);
  margin-top: 6px;
}

.stars::before { content: "★★★★★"; }

.stars-fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--star);
}

.stars-fill::before { content: "★★★★★"; }

.review {
  margin-top: 8px;
  font-size: 13px;
}

.review summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.review p { margin: 6px 0 0; white-space: pre-line; }

/* Collections */

.collection {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
}

.collection h3 { font-size: 18px; }
.collection .description { color: var(--muted); margin: 4px 0 12px; }

.collection .shelf { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 12px; }
