@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Baskerville:wght@400;700&display=swap");
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --border: #e6e0d6;
  --accent: #b5452b;
  --accent-text: #ffffff;
  --accent-soft: #f6e4dd;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 14px rgba(0, 0, 0, .05);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161a;
    --surface: #221f25;
    --text: #ece8e1;
    --muted: #a29c93;
    --border: #36323a;
    --accent: #e0775c;
    --accent-text: #17161a;
    --accent-soft: #3a2621;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- En-tête ---------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  padding-top: 12px; padding-bottom: 12px;
  flex-wrap: wrap;
}
.logo { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.logo span span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.search { display: flex; flex: 1; min-width: 260px; }
.search select, .search input, .search button,
.inline-search input, .inline-search button {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 9px 12px;
}
.search select { border-radius: 8px 0 0 8px; border-right: none; }
.search input { flex: 1; min-width: 0; }
.search button, .inline-search button {
  background: var(--accent); color: var(--accent-text);
  border-color: var(--accent); border-radius: 0 8px 8px 0;
  cursor: pointer; font-weight: 600;
}

.main-nav { display: flex; align-items: center; gap: 16px; font-weight: 600; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 1.2rem; padding: 4px; }

@media (max-width: 640px) {
  .header-inner { gap: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .main-nav { margin-left: auto; }
  .search select { max-width: 80px; }
  .search button { padding: 9px; }
}

/* ---------- Sections ---------- */

main { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }

.hero {
  text-align: center;
  padding: 32px 0 16px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 8px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }

section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { margin: 0 0 12px; font-size: 1.3rem; }
.page-title { margin: 0 0 4px; font-size: 1.7rem; }

/* ---------- Genres ---------- */

.genre-group h2 { font-size: 1.15rem; margin: 28px 0 0; }

.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.genre-card {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-weight: 600;
  transition: transform .15s, border-color .15s;
}
.genre-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.genre-icon { font-size: 1.5rem; }

/* ---------- Auteurs ---------- */

.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.author-chip {
  display: flex; flex-direction: column;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.author-chip:hover { text-decoration: none; border-color: var(--accent); }
.author-chip small { color: var(--muted); }

.inline-search { display: flex; max-width: 560px; margin: 16px 0; }
.inline-search input { flex: 1; min-width: 0; border-radius: 8px 0 0 8px; }

.tag-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tag {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.tag.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- Livres ---------- */

.book-grid, .shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  margin-top: 16px;
}
.shelf {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: 160px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.shelf > * { scroll-snap-align: start; }
.shelf > .loading, .shelf > p { grid-column: 1 / -1; }

@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

.book-card { display: flex; flex-direction: column; min-width: 0; }
.book-open {
  background: none; border: none; padding: 0; text-align: left; cursor: pointer;
}
.cover {
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.book-open:hover .cover img { transform: scale(1.04); }
/* Couverture dessinée quand aucune image n'est disponible */
.cover-gen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 12px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .18) 0 6px, transparent 6px),
    linear-gradient(160deg, hsl(var(--hue) 45% 38%), hsl(calc(var(--hue) + 40) 50% 24%));
  color: #fdf8f0;
  overflow: hidden;
}
.cover-gen-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem; font-weight: 700; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.cover-gen-author {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-title {
  font-size: .95rem; margin: 8px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-authors { margin: 0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.book-meta { margin: 0 0 8px; font-size: .8rem; color: var(--muted); }

.buy-btn {
  margin-top: auto;
  display: block; text-align: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  font-size: .82rem; font-weight: 600;
}
.buy-btn:hover { text-decoration: none; filter: brightness(1.08); }
.buy-btn.big { display: inline-block; padding: 11px 20px; font-size: 1rem; margin: 16px 0 6px; }

.results-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.sort select { margin-left: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }

.more-wrap { text-align: center; margin-top: 28px; }
.more-btn {
  padding: 10px 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600;
}
.more-btn:hover { background: var(--accent-soft); }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 0; justify-content: center; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--accent); text-align: center; padding: 16px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* ---------- Modales ---------- */

.dialog {
  border: none; border-radius: 16px; padding: 28px;
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialog.small { width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dialog h2 { margin-top: 0; }
.dialog-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-weight: 600; }
.field select { padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); font-weight: 400; }

.detail { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.detail-cover { align-self: start; }
.detail-body h2 { margin: 0 0 4px; padding-right: 24px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0; font-size: .9rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cats span { background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.desc { max-height: 220px; overflow-y: auto; white-space: pre-line; font-size: .95rem; margin-top: 12px; }
.store-list { display: flex; flex-wrap: wrap; gap: 8px; }
.store-list a {
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: .88rem;
}
.store-list a:hover { border-color: var(--accent); text-decoration: none; }

@media (max-width: 640px) {
  .dialog { padding: 20px; }
  .detail { grid-template-columns: 1fr; gap: 16px; }
  .detail-cover { width: 150px; margin: 0 auto; }
}

/* ---------- Pied de page ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  padding: 20px 0;
}

/* ---------- Avis des lecteurs ---------- */

.reviews { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.reviews h3 { margin: 0 0 10px; }
.reviews-summary { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.reviews-summary strong { font-size: 1.3rem; }

.stars { color: #e3a008; letter-spacing: 2px; white-space: nowrap; }
.stars-off { color: var(--border); }

.review-form {
  margin: 16px 0; padding: 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 560px;
}
.review-form .field { margin: 10px 0; }
.review-form input:not([type=radio]), .review-form textarea {
  font-weight: 400; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  resize: vertical; width: 100%;
}
.review-form .buy-btn { display: inline-block; border: none; cursor: pointer; padding: 9px 18px; font-size: .9rem; }
.review-form .buy-btn:disabled { opacity: .6; cursor: wait; }
.review-form .form-error { text-align: left; padding: 0; margin: 4px 0 10px; }

/* Étoiles cliquables : les boutons radio sont dans l'ordre 5 → 1 et affichés de droite à gauche,
   ce qui permet de colorer l'étoile survolée et toutes celles qui la précèdent. */
.star-input {
  border: none; padding: 0; margin: 0;
  display: inline-flex; flex-direction: row-reverse; justify-content: flex-end;
}
.star-label { font-weight: 600; margin: 0 0 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 2rem; line-height: 1; color: var(--border); cursor: pointer; padding: 0 2px; transition: color .1s; }
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: #e3a008; }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

.review-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 14px; }
.review-list li { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.review-list li:last-child { border-bottom: none; }
.review-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.review-list p { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Comptes ---------- */

.login-btn {
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.login-btn:hover { background: var(--accent-soft); }
.account-chip { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.account-chip:hover { text-decoration: none; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-size: .8rem; font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
  .account-name { display: none; }
  .main-nav { gap: 12px; }
}

.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn.danger { color: #c0392b; }
.link-btn:disabled { opacity: .6; cursor: default; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.badge.ok { background: rgba(39, 174, 96, .15); color: #219150; }

#auth-content h2 { margin-bottom: 4px; }
#auth-content .field input, .account-card .field input {
  font-weight: 400; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
#auth-content .field small { font-weight: 400; }
.buy-btn.wide { width: 100%; border: none; cursor: pointer; padding: 11px; font-size: .95rem; }
.buy-btn:disabled { opacity: .6; cursor: wait; }
button.buy-btn { border: none; cursor: pointer; }
.auth-forgot { text-align: right; margin: -6px 0 10px; font-size: .85rem; }
.auth-switch { text-align: center; margin: 16px 0 0; font-size: .9rem; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 16px 0; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface);
}
.google-btn:hover { border-color: var(--accent); }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.error.form-error, .form-msg.error, .security-msg.error { text-align: left; padding: 0; }
.success { color: #219150; }

.review-login {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 16px 0; padding: 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.review-login p { flex-basis: 100%; margin: 0; }
.review-login .buy-btn { padding: 8px 16px; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.account-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-top: 20px; min-width: 0;
}
.account-grid .account-card { margin-top: 0; }
.account-card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.account-card hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.field-static { margin: 10px 0 14px; overflow-wrap: anywhere; }
.account-empty { max-width: 520px; margin: 40px auto; text-align: center; }
.account-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Classement ---------- */

.ranking { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.rank-row {
  display: grid; grid-template-columns: 48px 64px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.rank-num { font-size: 1.6rem; font-weight: 800; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-row.podium .rank-num { color: var(--accent); font-size: 2rem; }
.rank-cover { width: 64px; border-radius: 6px; }
.rank-cover .cover-gen { padding: 6px; }
.rank-cover .cover-gen-title { font-size: .55rem; -webkit-line-clamp: 4; }
.rank-cover .cover-gen-author { font-size: .45rem; }
.rank-info { min-width: 0; }
.rank-open {
  background: none; border: none; padding: 0; text-align: left; cursor: pointer;
  font-weight: 700; font-size: 1.02rem; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rank-open:hover { color: var(--accent); text-decoration: none; }
.rank-score { margin: 4px 0 0; display: flex; align-items: baseline; gap: 6px; }
.rank-count { text-align: right; color: var(--muted); white-space: nowrap; }
.rank-count strong { display: block; font-size: 1.4rem; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .rank-row { grid-template-columns: 32px 48px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .rank-cover { width: 48px; }
  .rank-count { grid-column: 3; text-align: left; }
  .rank-count strong { display: inline; font-size: 1rem; }
}

/* ---------- Nouveautés ---------- */

.book-card { position: relative; }
.new-badge {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  background: var(--accent); color: var(--accent-text);
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
a.tag { color: var(--text); }
a.tag:hover { text-decoration: none; border-color: var(--accent); }
a.tag.active { color: var(--accent-text); }

.main-nav { flex-wrap: wrap; row-gap: 6px; }
@media (max-width: 640px) {
  .main-nav {
    order: 2; flex-basis: 100%; margin-left: 0;
    flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  #account-area { margin-left: auto; }
}
a.book-open { display: block; color: var(--text); }
a.book-open:hover { text-decoration: none; }
/* La recherche garde une largeur confortable ; le menu passe à la ligne si besoin. */
.search { flex: 1 1 380px; }
.main-nav { margin-left: auto; }
@media (min-width: 641px) { .search { min-width: 440px; } }
@media (max-width: 640px) { .search { flex: 1 1 100%; min-width: 0; } }
.genre-card { min-width: 0; }
.genre-card span:last-child { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }

/* ---------- Lecteurs ---------- */

.readers-title { font-size: 1.1rem; margin: 24px 0 12px; }
.reader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.reader-card {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
}
.reader-card:hover { text-decoration: none; border-color: var(--accent); }
.reader-text { display: flex; flex-direction: column; min-width: 0; }
.reader-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.large { width: 88px; height: 88px; font-size: 2rem; }
a.reviewer { font-weight: 700; color: var(--text); }
a.reviewer:hover { color: var(--accent); }

.profile-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px;
  padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.profile-id .page-title { overflow-wrap: anywhere; }
.profile-id p { margin: 4px 0; }
.profile-stats { display: flex; gap: 24px; margin: 0; }
.profile-stats div { text-align: center; }
.profile-stats dt { font-size: .8rem; color: var(--muted); }
.profile-stats dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .profile-head { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 14px; }
  .avatar.large { width: 64px; height: 64px; font-size: 1.5rem; }
  .profile-stats { grid-column: 1 / -1; justify-content: space-around; }
}

.rating-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-width: 480px; }
.rating-bars li { display: grid; grid-template-columns: 40px 1fr 32px; align-items: center; gap: 10px; font-size: .9rem; }
.bar-label { color: #e3a008; font-weight: 700; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #e3a008; border-radius: 999px; }
.bar-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.review-edit { margin: 4px 0 0; }
.edit-actions { display: flex; align-items: center; gap: 16px; }

/* ---------- Recherche : autocomplétion, filtres, chargement ---------- */

.ac-wrap { position: relative; }
.search.ac-wrap { position: relative; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.ac-list li {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--accent-soft); }
.ac-type { grid-row: span 2; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.ac-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  margin: 14px 0 4px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filters[hidden] { display: none; }
.filters-title { font-weight: 700; align-self: center; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); min-width: 0; }
.filters select { max-width: 220px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
@media (max-width: 640px) { .filters label { flex: 1 1 140px; } .filters select { max-width: none; width: 100%; } }

.no-results { text-align: left; max-width: 560px; margin: 24px auto; }
.no-results .tips { color: var(--muted); padding-left: 20px; }

.skeleton-card { display: flex; flex-direction: column; gap: 8px; }
.sk-cover, .sk-line { background: var(--border); border-radius: 8px; animation: sk-pulse 1.2s ease-in-out infinite; }
.sk-cover { aspect-ratio: 2 / 3; }
.sk-line { height: 12px; }
.sk-line.short { width: 60%; }
@keyframes sk-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .sk-cover, .sk-line { animation: none; } }

/* ---------- Bibliothèque personnelle ---------- */

.lib-controls { margin: 12px 0; display: grid; gap: 10px; }
.lib-status { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: .88rem;
}
.lib-btn:hover { border-color: var(--accent); }
.lib-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.lib-btn.fav.on { background: #c0392b; border-color: #c0392b; color: #fff; }
.lib-lists summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
.lib-lists-body { display: grid; gap: 6px; padding: 8px 0 0 4px; }
.lib-list-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.lib-new-list { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-new-list input { flex: 1 1 180px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.lib-new-list .more-btn { padding: 6px 14px; }

.lib-badges { position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 4px; pointer-events: none; }
.lib-badge {
  font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(20, 20, 20, .78); color: #fff; letter-spacing: .02em;
}
.lib-badge.s-read { background: #1e8449; }
.lib-badge.s-reading { background: #2471a3; }
.lib-badge.fav { background: #c0392b; }

.lib-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.lib-stats > div { flex: 1 1 120px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.lib-stats dt { font-size: .8rem; color: var(--muted); }
.lib-stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tag .count { font-size: .75rem; opacity: .75; margin-left: 2px; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 0; }
.list-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.list-card .book-grid { margin-top: 12px; }
.rename-form { display: inline-flex; gap: 8px; }
.rename-form input { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.public-lists { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ---------- Modération, avatars ---------- */

.link-btn.subtle { color: var(--muted); font-weight: 500; }
.report-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 8px; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; }
.report-form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.report-form select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.mod-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.mod-row { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.mod-row:last-child { border-bottom: none; }
.mod-comment { white-space: pre-line; overflow-wrap: anywhere; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.mod-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.avatar.emoji { background: var(--accent-soft); font-size: 1.1rem; }
.avatar.emoji.large { font-size: 2.6rem; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.avatar-choice {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg);
  font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; overflow: hidden; padding: 0; color: var(--text); font-weight: 700;
}
.avatar-choice img { width: 100%; height: 100%; object-fit: cover; }
.avatar-choice[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
code { font-size: .8rem; overflow-wrap: anywhere; }

/* ---------- En-tête (v2.0) : recherche, actions, menu défilant ---------- */

.hdr {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "logo search actions" "nav nav nav";
  align-items: center; gap: 10px 18px; padding-block: 10px;
}
.hdr .logo { grid-area: logo; display: flex; align-items: center; gap: 8px; }
.hdr .logo img { display: block; }
.hdr .search { grid-area: search; min-width: 0; order: 0; }
.hdr .header-actions { grid-area: actions; display: flex; align-items: center; gap: 10px; }
.hdr .main-nav {
  grid-area: nav; order: 0; margin: 0; display: flex; flex-wrap: nowrap; gap: 20px;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: .95rem; padding-bottom: 2px;
}
.hdr .main-nav::-webkit-scrollbar { display: none; }
.hdr .main-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
@media (min-width: 641px) { .hdr .search { min-width: 0; } }
@media (max-width: 640px) {
  .hdr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "logo . actions" "search search search" "nav nav nav"; }
  .hdr .main-nav { gap: 16px; }
}

/* ---------- Accessibilité ---------- */

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- À propos ---------- */

.about { max-width: 760px; }
.about h2 { margin-top: 28px; font-size: 1.2rem; }
.about p, .about li { line-height: 1.65; }
.about table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.about th, .about td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.about .table-wrap { overflow-x: auto; }

.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 6px; }
.detail-actions .buy-btn.big { margin: 0; }
.detail-actions .more-btn { padding: 10px 18px; }

/* ---------- Social ---------- */

.follow-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.follow-box .buy-btn, .follow-box .more-btn { padding: 6px 16px; font-size: .9rem; margin: 0; }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .7rem; font-weight: 800;
}
.nav-badge[hidden] { display: none; }
.feed { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.feed-item { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.feed-item.new { border-color: var(--accent); }
.feed-item p { margin: 6px 0 0; overflow-wrap: anywhere; white-space: pre-line; }


/* ========================================================================
 * Refonte visuelle — Biblio FR / direction "librairie chaleureuse"
 * ======================================================================== */
:root {
  --bg: #f7f0e6;
  --surface: #fffaf2;
  --surface-2: #f1e7d8;
  --text: #28231e;
  --muted: #776e64;
  --border: #dfd2c0;
  --accent: #b5482d;
  --accent-text: #fffaf4;
  --accent-soft: #f2ded4;
  --sage: #62735a;
  --ink: #27221e;
  --cream: #fbf4e9;
  --shadow: 0 10px 28px rgba(74, 52, 33, .08), 0 2px 8px rgba(74, 52, 33, .06);
  --radius: 16px;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513; --surface: #211e1a; --surface-2: #2a241e; --text: #f3eadf; --muted: #b6aa9b;
    --border: #3d352c; --accent: #d16a4a; --accent-text: #211611; --accent-soft: #3a2923;
    --sage: #8ea282; --ink: #f3eadf; --cream: #2a241e;
  }
}
:root[data-theme="light"] { color-scheme: light; --bg:#f7f0e6; --surface:#fffaf2; --surface-2:#f1e7d8; --text:#28231e; --muted:#776e64; --border:#dfd2c0; --accent:#b5482d; --accent-text:#fffaf4; --accent-soft:#f2ded4; --sage:#62735a; --ink:#27221e; --cream:#fbf4e9; }
:root[data-theme="dark"] { color-scheme: dark; --bg:#171513; --surface:#211e1a; --surface-2:#2a241e; --text:#f3eadf; --muted:#b6aa9b; --border:#3d352c; --accent:#d16a4a; --accent-text:#211611; --accent-soft:#3a2923; --sage:#8ea282; --ink:#f3eadf; --cream:#2a241e; }

body { font-family: "DM Sans", system-ui, sans-serif; background: var(--bg); color: var(--text); }
h1,h2,h3,.logo { font-family: "Libre Baskerville", Georgia, "Times New Roman", serif; }
.wrap { max-width: 1440px; padding-inline: 40px; }

.site-header { background: rgba(255,250,242,.94); border-bottom: 1px solid rgba(125,94,62,.16); backdrop-filter: blur(12px); }
@media (prefers-color-scheme: dark) { .site-header { background: rgba(33,30,26,.94); } }
:root[data-theme="light"] .site-header { background: rgba(255,250,242,.94); }
:root[data-theme="dark"] .site-header { background: rgba(33,30,26,.94); }
.hdr { max-width: 1440px; grid-template-columns: 250px minmax(360px, 1fr) auto; grid-template-areas: "logo search actions" "nav nav nav"; gap: 8px 24px; padding-block: 12px 8px; }
.hdr .logo { font-size: 1.52rem; letter-spacing: -.035em; font-weight: 700; }
.hdr .logo img { width: 48px; height: 48px; }
.hdr .logo span span { color: var(--accent); }
.hdr .search { height: 42px; max-width: 820px; margin-inline: auto; width: 100%; border: 1px solid #d8cbbb; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.55); box-shadow: 0 1px 2px rgba(55,40,25,.04); }
.hdr .search select, .hdr .search input, .hdr .search button { border: 0; background: transparent; height: 100%; }
.hdr .search select { padding-left: 16px; color: var(--text); }
.hdr .search input { padding-inline: 14px; }
.hdr .search button { width: 52px; padding: 0; font-size: 0; color: var(--text); position: relative; }
.hdr .search button::before { content: "⌕"; font-size: 1.55rem; line-height: 1; }
.hdr .header-actions { gap: 4px; }
.hdr .icon-btn { width: 38px; height: 38px; border-radius: 50%; color: var(--text); background: transparent; font-size: 1.25rem; }
.hdr .icon-btn:hover { background: var(--surface-2); }
.hdr .main-nav { justify-content: center; gap: 28px; padding: 4px 0 6px; font-size: .91rem; font-weight: 600; }
.hdr .main-nav a { color: var(--text); position: relative; }
.hdr .main-nav a::before { margin-right: 7px; opacity: .9; }
.hdr .main-nav a[href="#/genres"]::before { content:"◒"; color:var(--sage); }
.hdr .main-nav a[href="#/auteurs"]::before { content:"♙"; }
.hdr .main-nav a[href="#/classement"]::before { content:"♜"; }
.hdr .main-nav a[href="#/nouveautes"]::before { content:"☆"; color:var(--sage); }
.hdr .main-nav a[href="#/incontournables"]::before { content:"★"; color:var(--sage); }
.hdr .main-nav a[href="#/lecteurs"]::before { content:"♧"; }
.hdr .main-nav a[href="#/bibliotheque"]::before { content:"▤"; }
.hdr .main-nav a:hover { text-decoration: none; color: var(--accent); }

main { max-width: 1440px; padding-top: 0; padding-bottom: 64px; }

/* Accueil façon belle librairie */
.home-hero { min-height: 340px; margin-inline: -40px; display: grid; grid-template-columns: 42% 58%; overflow: hidden; background: #ead8bf; }
.home-hero-copy { padding: 52px 40px 48px max(40px, calc((100vw - 1360px)/2)); display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--sage); font-size: .74rem; font-weight: 700; letter-spacing: .12em; }
.home-hero h1 { font-size: clamp(2.6rem, 4vw, 4.25rem); line-height: 1.08; margin: 0; letter-spacing: -.055em; color: #2d2924; }
.home-hero h1 span { color: var(--accent); }
.hero-lead { max-width: 560px; margin: 18px 0 0; font-size: 1.05rem; line-height: 1.58; color: #423a32; }
.hero-actions { display:flex; gap: 14px; flex-wrap:wrap; margin-top: 24px; }
.hero-cta { display:inline-flex; align-items:center; gap:9px; border-radius:999px; padding: 12px 20px; font-weight:700; transition:transform .18s, box-shadow .18s; }
.hero-cta:hover { text-decoration:none; transform:translateY(-1px); }
.hero-cta.primary { background:var(--accent); color:#fff; box-shadow: 0 7px 16px rgba(181,72,45,.2); }
.hero-cta.secondary { background:rgba(255,250,242,.7); color:var(--accent); border:1px solid rgba(181,72,45,.16); }
.home-hero-art { min-height:340px; position:relative; overflow:hidden; }
.home-hero-art > img { width:100%; height:100%; object-fit:cover; display:block; }
.hero-quote { position:absolute; right: 7%; top: 31%; width: 250px; text-align:center; color:#493b2e; font-family:"Libre Baskerville", Georgia, serif; font-style:italic; font-size:1.02rem; line-height:1.7; }
.hero-quote::after { content:"⌁"; display:block; font-size:2rem; margin-top:4px; }

.home-categories { margin-top: 16px; }
.home-section-head { align-items:flex-end; margin-bottom: 16px; }
.home-section-head > div:first-child { display:flex; align-items:flex-start; gap:12px; }
.home-section-head h2 { margin:0; font-size:1.65rem; letter-spacing:-.025em; }
.home-section-head p { margin:4px 0 0; color:var(--muted); }
.home-section-head > a { color:var(--accent); font-size:.92rem; white-space:nowrap; }
.section-kicker { color:var(--sage); font-size:.7rem; letter-spacing:.12em; font-weight:800; padding-top:5px; }
.home-category-grid { display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:14px; }
.home-category { position:relative; height:145px; overflow:hidden; border-radius:14px; color:#231f1b; box-shadow: 0 2px 8px rgba(55,40,25,.06); }
.home-category:hover { text-decoration:none; transform:translateY(-2px); box-shadow:0 12px 24px rgba(55,40,25,.11); }
.home-category img { width:100%; height:100%; object-fit:cover; display:block; transition:transform .35s ease; }
.home-category:hover img { transform:scale(1.035); }
.home-category-shade { position:absolute; inset:0; background:linear-gradient(90deg, rgba(255,248,235,.95) 0%, rgba(255,248,235,.75) 42%, rgba(255,248,235,.04) 100%); }
.home-category-copy { position:absolute; inset:0; padding:20px 14px 13px; display:flex; flex-direction:column; align-items:flex-start; }
.home-category-copy strong { font-family:"Libre Baskerville", Georgia, serif; font-size:1rem; line-height:1.2; max-width:72%; }
.home-category-copy small { margin-top:7px; font-size:.76rem; line-height:1.35; max-width:70%; color:#51483e; }
.home-category-copy em { margin-top:auto; font-style:normal; font-size:.7rem; color:#51483e; }
.home-category-copy b { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:50%; background:#fff9f0; margin-left:4px; font-size:.9rem; }

.home-shelf-section { margin-top: 30px; }
.section-mark { display:grid; place-items:center; width:31px; height:31px; border-radius:50%; font-size:1.15rem; }
.section-mark.leaf { color:var(--sage); background:#e0e7d9; }
.section-mark.star { color:#c46a16; background:#f5ddbb; }
.home-shelf { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(132px, 160px); grid-template-columns:none; gap:28px; overflow-x:auto; padding:2px 2px 14px; scrollbar-width:thin; }
.home-shelf .book-card { min-width:0; }
.home-shelf .cover { border-radius:4px; box-shadow:0 5px 14px rgba(50,35,24,.14); }
.home-shelf .book-title { font-family:"Libre Baskerville", Georgia, serif; font-size:.82rem; text-align:center; margin-top:9px; }
.home-shelf .book-authors { font-size:.76rem; color:var(--muted); text-align:center; }
.home-shelf .book-meta, .home-shelf .buy-btn { display:none; }
.home-shelf .new-badge { left:50%; transform:translateX(-50%); top:auto; bottom:47px; font-size:.64rem; padding:3px 9px; background:var(--accent); }
.home-shelf .lib-badges { top:auto; bottom:48px; right:3px; }

.book-card { transition:transform .18s ease; }
.book-card:hover { transform:translateY(-2px); }
.cover { border-radius:6px; box-shadow:0 7px 18px rgba(55,40,25,.10); }
.book-title { font-family:"Libre Baskerville", Georgia, serif; }
.buy-btn { border-radius:999px; }

@media (max-width: 1120px) {
  .home-category-grid { grid-template-columns:repeat(3, minmax(0,1fr)); }
  .home-category { height:150px; }
  .hdr { grid-template-columns:220px minmax(260px,1fr) auto; }
  .hdr .main-nav { gap:18px; }
}
@media (max-width: 760px) {
  .wrap { padding-inline:18px; }
  .hdr { grid-template-columns:1fr auto; grid-template-areas:"logo actions" "search search" "nav nav"; gap:8px 12px; }
  .hdr .search { max-width:none; }
  .hdr .main-nav { justify-content:flex-start; gap:16px; }
  .home-hero { margin-inline:-18px; grid-template-columns:1fr; }
  .home-hero-copy { padding:38px 24px 30px; }
  .home-hero h1 { font-size:2.5rem; }
  .home-hero-art { min-height:245px; }
  .hero-quote { top:18%; right:5%; width:190px; font-size:.84rem; }
  .home-category-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 480px) {
  .home-category-grid { grid-template-columns:1fr; }
  .home-category { height:138px; }
  .home-section-head { align-items:flex-start; flex-direction:column; }
  .home-section-head > a { margin-left:43px; }
  .home-shelf { grid-auto-columns:125px; gap:18px; }
  .hero-actions { flex-direction:column; align-items:stretch; }
  .hero-cta { justify-content:center; }
}


/* ---------- Finitions visuelles v5 : précision, douceur et responsive ---------- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.hdr .logo { min-width: 0; }
.hdr .logo span { white-space: nowrap; }
.hdr .search { box-shadow: 0 2px 10px rgba(70, 48, 30, .05); }
.hdr .search:focus-within { border-color: rgba(181,72,45,.42); box-shadow: 0 0 0 4px rgba(181,72,45,.08); }
.hdr .search input::placeholder { color: #8b8177; opacity: 1; }
.hdr .main-nav a { transition: color .16s ease, transform .16s ease; }
.hdr .main-nav a:hover { transform: translateY(-1px); }
.hdr .main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: -7px; height: 2px;
  border-radius: 99px; background: var(--accent);
}

.home-hero { border-radius: 0 0 18px 18px; box-shadow: 0 12px 30px rgba(74,52,33,.07); }
.home-hero-copy { min-width: 0; }
.home-hero h1 { max-width: 680px; }
.home-hero h1 span { display: inline-block; }
.hero-cta { box-shadow: none; }
.hero-cta.secondary:hover { background: #fffaf2; box-shadow: 0 5px 14px rgba(74,52,33,.08); }
.home-hero-art::after {
  content: ""; position: absolute; inset: auto 0 0; height: 32px;
  background: linear-gradient(to top, rgba(93,65,40,.08), transparent); pointer-events: none;
}

.home-categories { padding-top: 2px; }
.home-category { transition: transform .2s ease, box-shadow .2s ease; }
.home-category:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.home-category-shade { background: linear-gradient(90deg, rgba(255,248,235,.97) 0%, rgba(255,248,235,.79) 39%, rgba(255,248,235,.10) 100%); }
.home-category-copy { padding: 18px 15px 12px; }
.home-category-copy strong { font-size: 1.02rem; }
.home-category-copy small { max-width: 68%; }
.home-category-copy em { display: flex; align-items: center; gap: 4px; }
.home-category-copy b { transition: transform .18s ease; }
.home-category:hover .home-category-copy b { transform: translateX(2px); }

.home-shelf-section { position: relative; }
.home-shelf-section::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125,94,62,.18) 12%, rgba(125,94,62,.18) 88%, transparent);
  pointer-events: none;
}
.home-shelf { scrollbar-color: rgba(119,110,100,.45) transparent; }
.home-shelf::-webkit-scrollbar { height: 6px; }
.home-shelf::-webkit-scrollbar-track { background: transparent; }
.home-shelf::-webkit-scrollbar-thumb { background: rgba(119,110,100,.35); border-radius: 99px; }
.home-shelf .book-card { padding-bottom: 2px; }
.home-shelf .book-card:hover .cover { box-shadow: 0 10px 22px rgba(55,40,25,.17); }

/* Pages internes : conserver la même sensation éditoriale que l'accueil. */
.page-title { font-family: "Libre Baskerville", Georgia, serif; letter-spacing: -.025em; }
.genre-group h2 { font-family: "Libre Baskerville", Georgia, serif; }
.genre-card, .author-chip, .account-card, .feed-item, .filters, .profile-head, .lib-stats > div {
  box-shadow: 0 3px 12px rgba(74,52,33,.045);
}
.genre-card:hover, .author-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(74,52,33,.08); }

.dialog { border: 1px solid rgba(125,94,62,.18); }
.dialog h2, .detail-body h2 { font-family: "Libre Baskerville", Georgia, serif; }

.site-footer { margin-top: 20px; background: #f1e7d8; border-top-color: rgba(125,94,62,.14); }
.site-footer p { max-width: 900px; }

@media (max-width: 1120px) {
  .wrap { padding-inline: 28px; }
  .home-hero { margin-inline: -28px; }
  .home-hero-copy { padding-left: 40px; }
  .home-category-grid { gap: 12px; }
}

@media (max-width: 760px) {
  .wrap { padding-inline: 18px; }
  .site-header { position: sticky; }
  .hdr { padding-block: 9px 7px; }
  .hdr .logo img { width: 44px; height: 44px; }
  .hdr .logo { font-size: 1.28rem; }
  .hdr .main-nav { padding: 3px 2px 5px; }
  .hdr .main-nav a[aria-current="page"]::after { bottom: -5px; }
  .home-hero { margin-inline: -18px; border-radius: 0 0 16px 16px; }
  .home-hero-copy { padding: 34px 24px 28px; }
  .home-hero h1 { font-size: clamp(2.35rem, 11vw, 3.2rem); }
  .hero-lead { font-size: .98rem; }
  .home-hero-art { min-height: 235px; }
  .home-categories { margin-top: 22px; }
}

@media (max-width: 480px) {
  .hdr .header-actions { gap: 0; }
  .hdr .icon-btn { width: 34px; height: 34px; }
  .hdr .search { height: 40px; }
  .hdr .search select { max-width: 70px; padding-left: 10px; }
  .hdr .search input { font-size: .9rem; }
  .hdr .search button { width: 44px; }
  .home-hero-copy { padding-inline: 20px; }
  .eyebrow { font-size: .66rem; }
  .hero-quote { display: none; }
  .home-hero-art { min-height: 205px; }
  .home-category-grid { gap: 10px; }
  .home-category { height: 132px; }
  .home-category-copy { padding: 17px 13px 11px; }
  .home-category-copy small { font-size: .73rem; }
  .home-section-head h2 { font-size: 1.4rem; }
  .home-shelf { grid-auto-columns: 122px; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ========================================================================
 * Finition finale — reproduction fidèle de la maquette de référence
 * ======================================================================== */
:root {
  --bg: #faf4ea;
  --surface: #fffdf8;
  --surface-2: #f4eadc;
  --text: #26231f;
  --muted: #7c746c;
  --border: #e4d8c8;
  --accent: #b94b2d;
  --accent-text: #fffaf4;
  --accent-soft: #f2ddd3;
  --sage: #55715a;
  --ink: #26231f;
  --cream: #fff8ee;
  --shadow: 0 8px 24px rgba(73, 52, 33, .07), 0 2px 6px rgba(73, 52, 33, .04);
  --radius: 14px;
}

body { background: var(--bg); color: var(--text); }

/* La maquette utilise un cadre très large, avec environ 55 px de marge sur
   le contenu et un en-tête légèrement plus resserré. */
main.wrap { max-width: 1536px; padding-inline: 55px; }
.site-footer .wrap { max-width: 1536px; padding-inline: 55px; }
.hdr { max-width: 1536px; padding-inline: 40px; padding-top: 10px; padding-bottom: 7px; }

.hdr .logo { gap: 10px; align-items: center; }
.hdr .logo img { width: 48px; height: 48px; flex: none; }
.hdr .logo-text { display: flex; flex-direction: column; line-height: 1; }
.hdr .logo-text strong { font-family: "Libre Baskerville", Georgia, serif; font-size: 1.5rem; font-weight: 700; letter-spacing: -.045em; }
.hdr .logo-text small { margin-top: 5px; font-family: "DM Sans", system-ui, sans-serif; font-size: .72rem; font-weight: 500; color: #625b54; letter-spacing: .01em; }

.hdr .search { height: 38px; max-width: 800px; border-color: #ddd2c3; background: rgba(255,255,255,.62); box-shadow: 0 1px 3px rgba(73,52,33,.04); }
.hdr .search select { width: 74px; padding-left: 15px; font-size: .82rem; }
.hdr .search input { font-size: .82rem; }
.hdr .search button { width: 48px; }
.hdr .search button::before { content: "⌕"; font-size: 1.42rem; }
.hdr .header-actions { gap: 2px; }
.hdr .icon-btn { width: 34px; height: 34px; font-size: 1.05rem; }
.hdr .main-nav { gap: 26px; padding-top: 4px; padding-bottom: 6px; font-size: .82rem; font-weight: 600; }
.hdr .main-nav a::before { margin-right: 6px; font-size: .95rem; }

/* Hero : même hauteur, proportions et hiérarchie que la maquette. */
.home-hero {
  width: calc(100% + 110px);
  margin-left: -55px;
  margin-right: -55px;
  min-height: 305px;
  grid-template-columns: 50% 50%;
  background: #ead9c2;
  border-radius: 0;
  box-shadow: none;
}
.home-hero-copy { padding: 30px 52px 30px 85px; justify-content: center; }
.home-hero h1 { font-size: clamp(3rem, 3.55vw, 3.55rem); line-height: 1.04; letter-spacing: -.055em; max-width: 650px; }
.home-hero h1::after { content: ""; display: block; width: 42px; height: 2px; margin-top: 8px; background: var(--accent); }
.home-hero h1 span { color: var(--accent); }
.eyebrow { display: none; }
.hero-lead { max-width: 540px; margin-top: 12px; font-size: .98rem; line-height: 1.45; color: #403a34; }
.hero-actions { gap: 14px; margin-top: 17px; }
.hero-cta { min-height: 41px; padding: 10px 22px; font-size: .86rem; }
.hero-cta.primary { background: var(--accent); box-shadow: 0 6px 15px rgba(185,75,45,.18); }
.hero-cta.secondary { background: rgba(255,250,242,.78); border: 1px solid rgba(185,75,45,.12); }
.home-hero-art { min-height: 305px; }
.hero-quote { right: 8%; top: 33%; width: 250px; font-size: .93rem; line-height: 1.65; }

/* Les six cartes sont immédiatement sous le hero, sans titre intermédiaire. */
.home-categories { margin-top: 14px; }
.home-category-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.home-category { height: 146px; border-radius: 13px; box-shadow: 0 2px 8px rgba(55,40,25,.05); }
.home-category-shade { background: linear-gradient(90deg, rgba(255,248,235,.95) 0%, rgba(255,248,235,.73) 42%, rgba(255,248,235,.08) 100%); }
.home-category-copy { padding: 17px 17px 12px; }
.home-category-copy strong { font-size: 1rem; }
.home-category-copy small { margin-top: 7px; max-width: 70%; font-size: .73rem; }
.home-category-copy em { font-size: .69rem; }
.home-category-copy b { width: 20px; height: 20px; background: #fffdf7; }

/* Rayons : les titres commencent plus près des cartes de catégories. */
.home-shelf-section { margin-top: 26px; }
.home-section-head { margin-bottom: 14px; }
.home-section-head > div:first-child { gap: 12px; }
.section-mark { width: 30px; height: 30px; font-size: 1.05rem; }
.section-mark.leaf { background: transparent; font-size: 1.5rem; }
.section-mark.leaf::first-letter { color: var(--sage); }
.section-mark.star { background: transparent; color: #e17b16; font-size: 1.6rem; }
.home-section-head h2 { font-size: 1.48rem; }
.home-section-head p { font-size: .82rem; margin-top: 2px; }
.home-section-head > a { font-size: .78rem; }
.home-shelf { grid-auto-columns: 116px; gap: 59px; padding: 2px 28px 8px; overflow-x: hidden; }
.home-shelf .cover { border-radius: 3px; box-shadow: 0 5px 13px rgba(50,35,24,.13); }
.home-shelf .book-title { font-size: .73rem; line-height: 1.35; margin-top: 7px; }
.home-shelf .book-authors { font-size: .69rem; line-height: 1.35; }
.home-shelf .new-badge { bottom: 42px; font-size: .58rem; padding: 3px 8px; }

/* Les contrôles de défilement natifs ne doivent pas concurrencer les livres. */
.home-shelf-section::after { display: none; }

@media (max-width: 1200px) {
  main.wrap { padding-inline: 32px; }
  .home-hero { width: calc(100% + 64px); margin-left: -32px; margin-right: -32px; }
  .home-hero-copy { padding-left: 52px; }
  .home-category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-shelf { gap: 34px; overflow-x: auto; }
}

@media (max-width: 760px) {
  main.wrap { padding-inline: 18px; }
  .hdr { padding-inline: 18px; }
  .home-hero { width: calc(100% + 36px); margin-left: -18px; margin-right: -18px; grid-template-columns: 1fr; }
  .home-hero-copy { padding: 34px 24px 26px; }
  .home-hero h1 { font-size: clamp(2.45rem, 10vw, 3.1rem); }
  .home-hero-art { min-height: 235px; }
  .home-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-shelf { gap: 22px; grid-auto-columns: 122px; padding-inline: 2px; }
}

@media (max-width: 480px) {
  .hdr .logo-text strong { font-size: 1.25rem; }
  .hdr .logo-text small { font-size: .62rem; }
  .hdr .logo img { width: 42px; height: 42px; }
  .home-category-grid { grid-template-columns: 1fr; }
  .home-category { height: 132px; }
  .home-shelf { gap: 18px; }
}

/* Hero image de la maquette : le texte de citation est intégré à l'illustration. */
.home-hero-art > img {
  object-fit: cover;
  object-position: center center;
}

/* ========================================================================
 * Finitions v9 — détails d'interface, icônes, fiches, formulaires et thème sombre
 * ======================================================================== */

/* Navigation : icônes SVG cohérentes avec la maquette, sans dépendance externe. */
.hdr .main-nav a { display:inline-flex; align-items:center; gap:7px; text-decoration:none; }
.hdr .main-nav a::before { content:none !important; }
.nav-icon { display:inline-grid; place-items:center; width:18px; height:18px; color:var(--sage); flex:none; }
.nav-icon img { width:18px; height:18px; display:block; }
.hdr .main-nav a:hover .nav-icon { color:var(--accent); }
.hdr .main-nav a[aria-current="page"] .nav-icon { color:var(--accent); }

/* Marque : légèrement plus dessinée et plus proche d'une vraie identité éditoriale. */
.hdr .logo { transition:opacity .18s ease, transform .18s ease; }
.hdr .logo:hover { opacity:.92; transform:translateY(-1px); }
.hdr .logo img { filter: drop-shadow(0 2px 2px rgba(73,52,33,.08)); }
.hdr .logo-text strong { color:var(--text); }
.hdr .logo-text strong span { color:var(--accent); }

/* Contrôles : états hover/focus plus doux et homogènes. */
button, input, select, textarea { accent-color:var(--accent); }
button:not(:disabled), a, select { -webkit-tap-highlight-color:transparent; }
.hdr .icon-btn { transition:background .18s ease, color .18s ease, transform .18s ease; }
.hdr .icon-btn:hover { color:var(--accent); transform:translateY(-1px); }
.hdr .icon-btn:active { transform:translateY(0); }
.search input:focus, .search select:focus, .inline-search input:focus, .sort select:focus,
.field input:focus, .field select:focus, .review-form textarea:focus, .review-form input:focus,
.lib-new-list input:focus, .rename-form input:focus, .report-form select:focus { outline:none; border-color:rgba(185,75,45,.55); box-shadow:0 0 0 3px rgba(185,75,45,.10); }
.more-btn, .lib-btn, .login-btn, .google-btn, .store-list a { transition:background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.more-btn:hover, .lib-btn:hover, .login-btn:hover, .google-btn:hover, .store-list a:hover { transform:translateY(-1px); }
.buy-btn { transition:transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.buy-btn:hover { transform:translateY(-1px); box-shadow:0 7px 16px rgba(185,75,45,.16); }

/* Fiche livre : plus éditoriale, sans modifier son contenu fonctionnel. */
.dialog { padding:32px; border-radius:20px; }
.dialog-close { width:36px; height:36px; display:grid; place-items:center; border-radius:50%; transition:background .18s ease, color .18s ease; }
.dialog-close:hover { background:var(--surface-2); color:var(--accent); }
.detail { grid-template-columns:minmax(180px,230px) minmax(0,1fr); gap:34px; }
.detail-cover .cover { border-radius:8px; box-shadow:0 14px 32px rgba(55,40,25,.16); }
.detail-body h2 { font-size:clamp(1.45rem,2.2vw,2rem); line-height:1.2; }
.detail-body > .book-authors { font-size:.96rem; }
.detail-body > .book-authors a { color:var(--muted); }
.detail-body > .book-authors a:hover { color:var(--accent); }
.meta { padding:12px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.desc { max-height:260px; padding-right:8px; color:color-mix(in srgb, var(--text) 88%, var(--muted)); line-height:1.65; }
.cats span { transition:background .18s ease, color .18s ease; }
.cats span:hover { background:var(--accent); color:var(--accent-text); }
.store-list a { background:var(--surface); }

/* Formulaires et cartes : langage plus doux, sans perdre la lisibilité. */
.field input, .field textarea, .field select, .account-card .field input, #auth-content .field input,
.review-form input:not([type=radio]), .review-form textarea { border-radius:10px; }
.review-form, .review-login { box-shadow:0 4px 16px rgba(74,52,33,.045); }
.review-form { border-color:rgba(125,94,62,.16); }
.account-card { box-shadow:0 5px 18px rgba(74,52,33,.05); }

/* Rayons : conserver les boutons de défilement natifs du composant, mais rendre le mouvement plus lisible. */
.home-shelf { scroll-behavior:smooth; }
.home-shelf .book-card { transition:transform .2s ease; }
.home-shelf .book-card:hover { transform:translateY(-3px); }
.home-shelf .book-title { color:var(--text); }

/* Focus clavier plus fin sur les éléments décoratifs. */
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }

/* Mode sombre : les éléments introduits pour la maquette restent lisibles. */
:root[data-theme="dark"] body { background:var(--bg); }
:root[data-theme="dark"] .hdr .logo-text small { color:var(--muted); }
:root[data-theme="dark"] .hdr .search { background:rgba(42,36,30,.82); border-color:var(--border); }
:root[data-theme="dark"] .home-hero { background:#2a241e; }
:root[data-theme="dark"] .home-hero h1 { color:var(--text); }
:root[data-theme="dark"] .hero-lead { color:#d2c7bb; }
:root[data-theme="dark"] .hero-cta.secondary { background:rgba(42,36,30,.88); color:var(--accent); border-color:rgba(208,106,74,.28); }
:root[data-theme="dark"] .home-category-shade { background:linear-gradient(90deg, rgba(34,30,25,.94) 0%, rgba(34,30,25,.72) 43%, rgba(34,30,25,.12) 100%); }
:root[data-theme="dark"] .home-category { color:var(--text); }
:root[data-theme="dark"] .home-category-copy small,
:root[data-theme="dark"] .home-category-copy em { color:#d0c4b6; }
:root[data-theme="dark"] .home-category-copy b { background:#f0e6d8; color:#33271e; }
:root[data-theme="dark"] .site-footer { background:#211e1a; border-top-color:var(--border); }
:root[data-theme="dark"] .dialog { box-shadow:0 24px 70px rgba(0,0,0,.55); }

@media (max-width:760px) {
  .detail { grid-template-columns:130px minmax(0,1fr); gap:20px; align-items:start; }
  .detail-cover { width:auto; margin:0; }
  .detail-body h2 { font-size:1.35rem; }
}
@media (max-width:560px) {
  .detail { grid-template-columns:1fr; }
  .detail-cover { width:150px; margin:0 auto; }
  .dialog { padding:24px 20px; border-radius:18px; }
}

.home-hero-art .hero-quote { display:none; }

/* ---------- Corrections après vérification visuelle (v12) ---------- */

/* Badge « Nouveau » des étagères de l'accueil : sur la couverture, sans masquer le titre. */
.home-shelf .new-badge { top: 8px; bottom: auto; left: 8px; transform: none; }

/* Sélecteur « Tout / Titre / Auteur / ISBN » lisible sur mobile. */
.hdr .search select { min-width: 68px; }

/* Cartes d'univers : voile renforcé sous le texte (les illustrations contiennent des lettrages). */
.home-category-shade { background: linear-gradient(90deg, rgba(255,248,235,.97) 0%, rgba(255,248,235,.90) 55%, rgba(255,248,235,.15) 100%); }
:root[data-theme="dark"] .home-category-shade { background: linear-gradient(90deg, rgba(34,30,25,.96) 0%, rgba(34,30,25,.88) 55%, rgba(34,30,25,.18) 100%); }
/* Couverture dessinée : le titre commence sous le badge « Nouveau ». */
.book-card .new-badge ~ .book-open .cover-gen-title { margin-top: 22px; }
/* « Tout » entièrement visible dans la barre de recherche. */
.hdr form.search select { min-width: 74px; flex: none; width: auto; }
.home-category-shade { background: linear-gradient(90deg, rgba(255,248,235,.98) 0%, rgba(255,248,235,.95) 55%, rgba(255,248,235,.2) 100%); }
:root[data-theme="dark"] .home-category-shade { background: linear-gradient(90deg, rgba(34,30,25,.98) 0%, rgba(34,30,25,.94) 55%, rgba(34,30,25,.22) 100%); }
