:root {
  color-scheme: dark;
  --fond: #0b0b0d;
  --surface: #131316;
  --surface-2: #1b1b20;
  --surface-3: #25252b;
  --texte: #f3f3f5;
  --texte-2: #9b9ba6;
  --bord: #26262c;
  --bord-fort: #3a3a42;
  --principal: #f3f3f5;
  --principal-texte: #0b0b0d;
  --danger: #f0897c;
  --rayon: 14px;
  --rayon-petit: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button { transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s; }

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

.invisible {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.entete {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--bord);
  background: rgb(11 11 13 / 0.8);
  backdrop-filter: blur(14px);
}

.marque {
  color: var(--texte);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.marque span { color: var(--texte-2); font-weight: 450; }

.stats { margin: 0 0 0 auto; color: var(--texte-2); font-size: 13px; text-align: right; }

.connexion {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--bord-fort);
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.connexion:hover { background: var(--surface-2); }

.page {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  max-width: 1560px;
  margin: 0 auto;
}

.categories {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 28px 12px 28px 28px;
}

.categories h2 {
  margin: 0 0 10px;
  padding: 0 12px;
  color: var(--texte-2);
  font-size: 12px;
  font-weight: 500;
}

.categories ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }

.categories button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--rayon-petit);
  background: none;
  color: var(--texte-2);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.categories button:hover { background: var(--surface); color: var(--texte); }

.categories button[aria-current="true"] { background: var(--surface-2); color: var(--texte); }

.categories .compte { color: var(--texte-2); font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 400; }

main { min-width: 0; padding: 28px; }

.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.barre h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.recherche { flex: 0 1 320px; }

input[type="search"], input[type="text"], input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon-petit);
  background: var(--surface);
  transition: border-color 0.15s;
}

input[type="search"]:hover, input[type="text"]:hover, input[type="password"]:hover { border-color: var(--bord-fort); }

input::placeholder { color: var(--texte-2); }

.message { color: var(--texte-2); }

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.carte {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.carte:hover { border-color: var(--bord-fort); transform: translateY(-2px); }

.vignette {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: var(--surface-2);
}

/* Hors du flux : une image haute ne peut plus agrandir sa case. */
.vignette img {
  position: absolute;
  inset: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
  object-fit: contain;
}

.carte-nom {
  display: block;
  padding: 10px 12px 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carte-taille {
  display: block;
  padding: 0 12px 10px;
  color: var(--texte-2);
  font-size: 12px;
}

.apercu {
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bord-fort);
  border-radius: 18px;
  background: var(--surface);
  color: var(--texte);
}

.apercu::backdrop { background: rgb(0 0 0 / 0.65); backdrop-filter: blur(6px); }

.apercu-image {
  position: relative;
  height: min(44vh, 380px);
  background: var(--surface-2);
}

.apercu-image img {
  position: absolute;
  inset: 24px;
  width: calc(100% - 48px);
  height: calc(100% - 48px);
  object-fit: contain;
}

.apercu-infos { padding: 20px 22px 22px; }

.apercu-infos h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }

.apercu-infos p { margin: 2px 0 16px; color: var(--texte-2); font-size: 13px; }

.apercu-infos label span {
  display: block;
  margin-bottom: 6px;
  color: var(--texte-2);
  font-size: 13px;
}

.dialogue-court { width: min(420px, calc(100vw - 32px)); }

.dialogue-court h2 { margin-bottom: 16px; }

.dialogue-court label { display: block; margin-bottom: 14px; }

.apercu-infos .erreur-formulaire { margin: 8px 0 0; color: var(--danger); }

.erreur-formulaire:empty { display: none; }

.apercu-actions { display: flex; gap: 8px; margin-top: 16px; }

.apercu-actions button {
  padding: 9px 16px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--rayon-petit);
  background: none;
  font-weight: 500;
  cursor: pointer;
}

.apercu-actions button:hover { background: var(--surface-2); }

.apercu-actions .principal {
  border-color: var(--principal);
  background: var(--principal);
  color: var(--principal-texte);
  font-weight: 600;
}

.apercu-actions .principal:hover { background: var(--principal); opacity: 0.85; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--bord-fort);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--texte);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}

.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.erreur {
  display: grid;
  place-content: center;
  min-height: 100vh;
  padding: 16px;
  text-align: center;
}

.erreur h1 { margin: 0 0 4px; font-size: 26px; font-weight: 650; letter-spacing: -0.025em; }

.erreur p { margin: 0 0 14px; color: var(--texte-2); }

.erreur a { color: var(--texte); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }

  .carte:hover { transform: none; }
}

@media (max-width: 760px) {
  .entete { min-height: 56px; padding: 8px 16px; }

  .stats { font-size: 12px; }

  .page { grid-template-columns: minmax(0, 1fr); }

  .categories {
    position: static;
    max-height: none;
    padding: 12px 16px 0;
    overflow-x: auto;
  }

  .categories h2 { display: none; }

  .categories ul { display: flex; gap: 6px; }

  .categories button { white-space: nowrap; }

  main { padding: 16px; }

  .barre { align-items: stretch; flex-direction: column; gap: 10px; }

  .barre h1 { font-size: 22px; }

  .recherche { flex: none; }

  .grille { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}
