:root {
  --red: #c8102e;
  --ink: #2b2b2b;
  --muted: #6f7275;
  --line: #dcdfe2;
  --bg: #e9ebed;
  --card: #ffffff;
  --field: #f3f4f5;
  --wood-1: #d6a56b;
  --wood-2: #b98247;
  --wood-3: #8e5d2c;
  --radius: 12px;
  --book-w: 138px;
  --book-h: 194px;
  --gap: 64px;
  font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 20% 0%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(900px 600px at 90% 40%, rgba(255,255,255,.5), transparent 60%),
    linear-gradient(135deg, #eceef0, #e2e5e8);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  background: rgba(233,235,237,.86);
  backdrop-filter: blur(10px);
}
.logo {
  flex: none; width: 68px; height: 68px;
  display: flex; align-items: center; justify-content: center; white-space: nowrap;
  background: #f7f5f3; border-radius: 3px;
  font-size: 12px; letter-spacing: .08em; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.logo b, .fc-brand b { color: var(--red); font-weight: 400; }
.search {
  flex: 1; display: flex; align-items: center;
  height: 44px; padding: 0 8px 0 14px;
  background: rgba(0,0,0,.035); border-radius: 22px;
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: #8a8d90; }
.icon-btn {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border: 0; background: none; border-radius: 50%;
  color: #333;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- Filtres ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 18px 16px 0; }
.chip {
  border: 1px solid var(--line); background: rgba(255,255,255,.7);
  padding: 7px 16px; border-radius: 999px; font-size: 14px; color: #444;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Étagères ---------- */
.library { max-width: 1960px; margin: 0 auto; padding: 40px 16px 80px; }
.shelf { position: relative; margin-bottom: 96px; }
.shelf-books {
  display: flex; justify-content: center; align-items: flex-end;
  gap: var(--gap); padding: 0 24px; min-height: var(--book-h);
}
.plank {
  position: relative; height: 12px; margin-top: 0;
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 55%, var(--wood-3) 100%);
  border-radius: 2px;
  box-shadow: 0 10px 14px -6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.35);
}
.plank::before, .plank::after {
  content: ""; position: absolute; top: -34px; width: 2px; height: 46px;
  background: linear-gradient(#9aa0a4, #6d7276); transform: skewX(-18deg);
}
.plank::before { left: 16px; }
.plank::after { right: 16px; transform: skewX(18deg); }

.book {
  position: relative; flex: none;
  width: var(--book-w); height: var(--book-h);
  padding: 0; border: 0; background: var(--card);
  box-shadow: 0 1px 1px rgba(0,0,0,.08), 4px 0 10px -4px rgba(0,0,0,.25);
  overflow: hidden; text-align: center;
  transition: transform .25s ease, box-shadow .25s ease;
  transform-origin: bottom center;
}
.book:hover, .book:focus-visible {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: 0 16px 24px -10px rgba(0,0,0,.35);
  outline: none;
}
.book img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book .label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 6px 5px;
  background: rgba(240,240,240,.92);
  font-size: 13.5px; line-height: 1.35; color: #333;
  text-transform: none;
}
.book .badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--red); color: #fff; padding: 2px 6px; border-radius: 3px;
}
.fallback-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding: 22px 10px 48px; gap: 12px; background: #fff;
}
.fc-brand { font-size: 11px; letter-spacing: .14em; }
.fc-title { flex: 1; display: grid; place-items: center; font-size: 16px; line-height: 1.25; font-weight: 500; }
.fc-cat { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 80px 16px; font-size: 17px; }

/* ---------- Fiche document ---------- */
dialog {
  border: 0; padding: 0; border-radius: var(--radius);
  width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 30px 80px rgba(0,0,0,.3); color: var(--ink);
}
dialog::backdrop { background: rgba(25,25,25,.55); backdrop-filter: blur(3px); }
.sheet { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 28px; position: relative; }
.sheet-cover { position: relative; width: 220px; height: 310px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.2); overflow: hidden; }
.sheet-cover img { width: 100%; height: 100%; object-fit: cover; }
.sheet h2 { margin: 4px 0 6px; font-size: 26px; font-weight: 500; line-height: 1.2; }
.sheet .cat { color: var(--red); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.sheet .desc { color: #4a4d50; line-height: 1.6; white-space: pre-line; }
.sheet .meta { color: var(--muted); font-size: 14px; margin: 10px 0 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: 15px;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.accent { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.close-x { position: absolute; top: 10px; right: 10px; }
.progress { height: 4px; border-radius: 2px; background: #eee; overflow: hidden; margin-top: 14px; display: none; }
.progress.on { display: block; }
.progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #222; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sites des marques ---------- */
.hidden { display: none !important; }
.brands { max-width: 1320px; margin: -24px auto 0; padding: 0 16px 72px; }
.brands h2 { text-align: center; font-weight: 400; font-size: 24px; letter-spacing: .04em; margin: 0 0 28px; }
.brands h2::after { content: ""; display: block; width: 40px; height: 2px; background: var(--red); margin: 12px auto 0; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 300px)); justify-content: center; gap: 22px; }
.brand-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px -14px rgba(0,0,0,.3);
  transition: transform .25s ease, box-shadow .25s ease;
}
.brand-card:hover, .brand-card:focus-visible { transform: translateY(-4px); box-shadow: 0 18px 36px -16px rgba(0,0,0,.35); outline: none; }
.brand-img { position: relative; aspect-ratio: 16 / 10; background: #e4e6e8; overflow: hidden; }
.brand-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.brand-card:hover .brand-img img { transform: scale(1.04); }
.brand-img .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; letter-spacing: .12em; color: #888; }
.brand-body { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.brand-body div { flex: 1; min-width: 0; }
.brand-body h3 { margin: 0; font-size: 17px; font-weight: 500; }
.brand-body p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.brand-body .go { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #f1f2f3; transition: background .2s, color .2s; }
.brand-body .go svg { width: 16px; height: 16px; }
.brand-card:hover .go { background: var(--red); color: #fff; }

footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 32px; }

@media (max-width: 640px) {
  :root { --book-w: 104px; --book-h: 146px; --gap: 22px; }
  .logo { width: 52px; height: 52px; font-size: 10px; }
  .library { padding-top: 28px; }
  .shelf { margin-bottom: 64px; }
  .shelf-books { padding: 0 8px; }
  .book .label { font-size: 11px; padding: 4px 4px 3px; }
  .sheet { grid-template-columns: 1fr; padding: 22px 16px; gap: 18px; }
  .sheet-cover { width: 150px; height: 212px; margin: 0 auto; }
  .sheet h2 { font-size: 22px; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .brands { margin-top: -8px; }
  .brand-grid { grid-template-columns: 1fr; gap: 16px; }
}
