/* Goûts — charte « crème & pastel » de la maison, resserrée façon Erewhon :
   beaucoup de blanc, filets fins, micro-labels en capitales espacées, une seule
   couleur d'accent à la fois. Les photos de produits portent toute la couleur. */

:root {
  --creme: #fbf3e2;
  --papier: #fffcf3;
  --tuile: #ffffff; /* fond des photos produit, toujours clair */
  --survol: #ffffff;
  --encre: #17150f;
  --doux: #6b6455;
  --filet: #e2d9c4;
  --olive: #a9b472;
  --rose: #f3b9d2;
  --jaune: #f2e27c;
  --bleu: #a9c6e8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --large: 1060px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --creme: #15130e;
    --papier: #211e17;
    --tuile: #efe9dc;
    --survol: #2a261d;
    --encre: #f7f1e2;
    --doux: #a79e8b;
    --filet: #322d23;
  }
}
:root[data-theme="sombre"] {
  --creme: #15130e;
  --papier: #211e17;
  --tuile: #efe9dc;
  --survol: #2a261d;
  --encre: #f7f1e2;
  --doux: #a79e8b;
  --filet: #322d23;
}

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

body {
  background: var(--creme);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* `padding-inline` et non `padding` : sinon cette règle écrase le padding-block
   de `main` (même spécificité de classe contre élément) et colle le contenu au header. */
.wrap { max-width: var(--large); margin: 0 auto; padding-inline: 32px; }

.label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--doux);
  font-weight: 500;
}

.titre {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1.14;
  letter-spacing: -0.02em;
}
.titre.moyen { font-size: 29px; }
.chapo { color: var(--doux); max-width: 56ch; margin-top: 12px; }
.entete { margin-bottom: 42px; }

/* ---------------------------------------------------------------- en-tête */

header {
  border-bottom: 1px solid var(--filet);
  position: sticky;
  top: 0;
  background: var(--creme);
  z-index: 20;
}
.bar { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 18px; }
.logo {
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.logo em { font-style: italic; }
.outils { display: flex; align-items: center; gap: 14px; }

.profils { display: flex; border: 1px solid var(--encre); border-radius: 100px; overflow: hidden; }
.profils button {
  background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em;
  padding: 7px 15px; color: var(--encre);
}
.profils button[aria-pressed="true"] { background: var(--encre); color: var(--creme); }

.theme {
  background: none; border: 1px solid var(--filet); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; color: var(--doux);
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.theme:hover { border-color: var(--encre); color: var(--encre); }

/* ---------------------------------------------------------------- boutons */

.bouton {
  background: var(--encre); color: var(--creme);
  border: none; border-radius: 100px; cursor: pointer;
  font-family: var(--sans); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 12px 26px;
  /* Plusieurs « boutons » sont en réalité des <a> : sans ça, ils sont soulignés. */
  text-decoration: none; display: inline-block; text-align: center;
}
.bouton:hover { opacity: 0.85; }
.bouton.fin {
  background: none; color: var(--doux); border: 1px solid var(--filet);
  letter-spacing: 0.12em; text-transform: none; font-size: 12px; padding: 9px 20px;
  text-decoration: none;
}
.bouton.fin:hover { border-color: var(--encre); color: var(--encre); opacity: 1; }
.bouton[disabled] { opacity: 0.4; cursor: default; }

.retour {
  display: inline-block; margin-bottom: 22px;
  font-size: 12px; color: var(--doux); text-decoration: none;
}
.retour:hover { color: var(--encre); }

/* ---------------------------------------------------------------- accueil */

/* Filets dessinés par les bordures des cellules, et non par un fond de conteneur
   avec `gap: 1px` : une rangée incomplète peindrait sinon tout l'espace vide. */
.grille {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  border-top: 1px solid var(--filet); border-left: 1px solid var(--filet);
}
.carte {
  background: var(--papier); padding: 26px 24px 22px;
  /* `border: 0` d'abord : la tuile « Nouvelle catégorie » est un <button>, dont la
     bordure par défaut du navigateur resterait visible en haut et à gauche. */
  border: 0;
  border-right: 1px solid var(--filet); border-bottom: 1px solid var(--filet);
  display: flex; flex-direction: column; gap: 14px; min-height: 208px;
  text-decoration: none; color: inherit; transition: background 0.15s;
  font: inherit; text-align: left;
}
.carte:hover { background: var(--survol); }
.carte h3 { font-family: var(--serif); font-size: 25px; font-weight: 400; letter-spacing: -0.01em; }
.carte .meta { margin-top: auto; display: flex; flex-direction: column; gap: 9px; }
.chiffres { display: flex; gap: 16px; font-size: 12px; color: var(--doux); flex-wrap: wrap; }
.chiffres b { color: var(--encre); font-weight: 600; }
.jauge { height: 2px; background: var(--filet); position: relative; }
.jauge i { position: absolute; inset: 0 auto 0 0; background: var(--olive); transition: width 0.4s; }
.jauge.faible i { background: var(--jaune); }
.etat { font-size: 11px; color: var(--doux); }

.carte.neuve {
  background: transparent; align-items: center; justify-content: center;
  color: var(--doux); gap: 8px; text-align: center; cursor: pointer;
}
.carte.neuve:hover { background: var(--papier); color: var(--encre); }
.plus { font-family: var(--serif); font-size: 30px; line-height: 1; }

/* ---------------------------------------------------------------- duel */

.duel-tete { text-align: center; margin-bottom: 36px; }
.ring { display: grid; grid-template-columns: 1fr 60px 1fr; align-items: stretch; max-width: 880px; margin: 0 auto; }
.choix {
  background: var(--papier); border: 1px solid var(--filet); cursor: pointer;
  padding: 26px 24px 24px; text-align: center; font: inherit; color: inherit;
  transition: border-color 0.15s, transform 0.15s;
  display: flex; flex-direction: column;
}
.choix:hover, .choix:focus-visible { border-color: var(--encre); transform: translateY(-3px); outline: none; }
.choix.gagne { border-color: var(--olive); box-shadow: inset 0 0 0 1px var(--olive); }
.choix.perd { opacity: 0.35; }
/* `overflow: hidden` n'est pas décoratif : les photos OFF ont des proportions
   quelconques, et une image très haute débordait de la carte jusque sur les boutons. */
.visuel {
  background: var(--tuile); border-radius: 3px; overflow: hidden;
  height: 210px; display: grid; place-items: center; padding: 14px; margin-bottom: 18px;
}
.visuel img,
.vign img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.marque { font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--doux); }
.nom { font-family: var(--serif); font-size: 20px; font-weight: 400; margin-top: 6px; line-height: 1.3; }
.vs { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--doux); display: grid; place-items: center; }
.secondaires { display: flex; justify-content: center; gap: 10px; margin-top: 30px; flex-wrap: wrap; }
.aide { text-align: center; margin-top: 24px; font-size: 12px; color: var(--doux); }
.raccourcis { margin-top: 6px; font-size: 11px; color: var(--doux); opacity: 0.75; }
kbd {
  font-family: var(--sans); font-size: 10px; border: 1px solid var(--filet);
  border-radius: 3px; padding: 1px 5px; color: var(--doux);
}

/* ---------------------------------------------------------------- classement */

.liste { border-top: 1px solid var(--filet); }
.ligne {
  display: grid; grid-template-columns: 56px 92px 1fr auto; gap: 22px; align-items: center;
  padding: 18px 4px; border-bottom: 1px solid var(--filet);
}
.rang { font-family: var(--serif); font-size: 32px; text-align: center; line-height: 1; }
.ligne:nth-child(n + 4) .rang { color: var(--doux); font-size: 26px; }
.vign { background: var(--tuile); border-radius: 3px; overflow: hidden; height: 84px; display: grid; place-items: center; padding: 7px; }
.infos .nom { font-size: 17px; margin-top: 2px; }
.note { font-size: 13px; color: var(--doux); margin-top: 5px; font-style: italic; }
.ou { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--doux); margin-top: 7px; }
.ou::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--bleu); flex: none; }
.score { text-align: right; font-family: var(--serif); font-size: 17px; color: var(--doux); }
.score span {
  display: block; font-family: var(--sans); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase; margin-top: 2px;
}
.encart {
  margin-top: 26px; padding: 16px 20px; border: 1px solid var(--filet);
  font-size: 13px; color: var(--doux); background: var(--papier);
}
.encart b { color: var(--encre); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.puce {
  border: 1px solid var(--filet); border-radius: 100px; padding: 5px 12px;
  font-size: 12px; color: var(--doux); background: var(--creme); cursor: pointer;
}
.puce:hover { border-color: var(--encre); color: var(--encre); }

/* ---------------------------------------------------------------- comparaison */

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--filet); border: 1px solid var(--filet); }
.colonne { background: var(--papier); padding: 22px 20px; }
.colonne ol { list-style: none; margin-top: 14px; }
.colonne li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--filet); font-size: 14px; }
.colonne li:last-child { border-bottom: none; }
.colonne li i { font-family: var(--serif); font-style: normal; color: var(--doux); width: 16px; flex: none; }

.bloc { margin-top: 44px; }
.bloc h3 { font-family: var(--serif); font-size: 22px; font-weight: 400; margin-bottom: 4px; }
.bloc p.chapo { margin-bottom: 18px; font-size: 14px; }
.paires { border-top: 1px solid var(--filet); }
.paire {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 18px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--filet);
}
.paire .vign { height: 58px; }
.rangs { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--doux); white-space: nowrap; }
.pastille {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 100px; font-family: var(--serif); font-size: 13px; color: var(--encre);
}
.pastille.un { background: var(--rose); }
.pastille.deux { background: var(--bleu); }
.pastille.absente { background: var(--filet); color: var(--doux); }

/* ---------------------------------------------------------------- références */

.recherche { display: flex; border: 1px solid var(--encre); max-width: 520px; }
.recherche input {
  flex: 1; border: none; background: var(--papier); padding: 13px 16px;
  font-family: var(--sans); font-size: 14px; color: var(--encre); outline: none;
}
.recherche button {
  background: var(--encre); color: var(--creme); border: none; cursor: pointer;
  font-family: var(--sans); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.2em; padding: 0 22px;
}
.resultats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  border-top: 1px solid var(--filet); border-left: 1px solid var(--filet); margin-top: 22px;
}
.res {
  background: var(--papier); padding: 16px 14px; text-align: center; cursor: pointer; position: relative;
  border: 0;
  border-right: 1px solid var(--filet); border-bottom: 1px solid var(--filet);
  font: inherit; color: inherit;
}
.res .visuel { height: 110px; margin-bottom: 12px; }
.res .nom { font-size: 13px; }
.coche {
  position: absolute; top: 10px; right: 10px; width: 19px; height: 19px;
  border: 1px solid var(--filet); border-radius: 50%; background: var(--papier);
}
.res[aria-pressed="true"] .coche { background: var(--olive); border-color: var(--olive); }
.res[aria-pressed="true"] .coche::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 9px;
  border: solid var(--papier); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.barre-action {
  position: sticky; bottom: 0; background: var(--creme); border-top: 1px solid var(--filet);
  padding: 14px 0; margin-top: 26px; display: flex; justify-content: space-between;
  align-items: center; gap: 14px; flex-wrap: wrap;
}
/* `display: flex` ci-dessus l'emporterait sur le `display: none` du navigateur. */
.barre-action[hidden] { display: none; }
.deux-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 50px; align-items: start; }
.panneau { border: 1px solid var(--filet); background: var(--papier); padding: 22px; }
.panneau + .panneau { margin-top: 18px; }
.panneau h4 { font-family: var(--serif); font-size: 19px; font-weight: 400; margin-bottom: 5px; }
.panneau p { font-size: 13px; color: var(--doux); margin-bottom: 16px; }
.champ {
  width: 100%; border: 1px solid var(--filet); background: var(--creme);
  padding: 11px 13px; font-family: var(--sans); font-size: 14px; color: var(--encre);
  margin-bottom: 10px; outline: none;
}
.champ:focus { border-color: var(--encre); }
textarea.champ { resize: vertical; min-height: 62px; }

.inventaire { border-top: 1px solid var(--filet); margin-top: 12px; }
.item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--filet);
}
.item .vign { height: 50px; }
.item .nom { font-size: 15px; }
.item .actions { display: flex; gap: 6px; }
.mini {
  background: none; border: 1px solid var(--filet); border-radius: 100px;
  font-size: 11px; color: var(--doux); padding: 5px 11px; cursor: pointer; font-family: var(--sans);
}
.mini:hover { border-color: var(--encre); color: var(--encre); }
.mini.danger:hover { border-color: #b4553f; color: #b4553f; }
.editeur { padding: 4px 4px 18px; border-bottom: 1px solid var(--filet); background: var(--papier); }
.editeur .champ { background: var(--creme); }

/* ---------------------------------------------------------------- divers */

.vide { padding: 60px 0; text-align: center; color: var(--doux); }
.vide .titre { margin-bottom: 10px; }
.charge { padding: 70px 0; text-align: center; color: var(--doux); font-size: 13px; }
.erreur {
  border: 1px solid #b4553f; color: #b4553f; background: var(--papier);
  padding: 12px 16px; font-size: 13px; margin-bottom: 20px;
}
.pied {
  border-top: 1px solid var(--filet); margin-top: 70px; padding: 22px 0 40px;
  font-size: 11px; color: var(--doux);
}
.pied a { color: var(--doux); }

main { padding-block: 64px 0; }

@media (max-width: 860px) {
  .deux-col { grid-template-columns: 1fr; gap: 34px; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .bar { height: 58px; gap: 10px; }
  .logo { font-size: 20px; }
  .titre { font-size: 27px; }
  .titre.moyen { font-size: 23px; }
  main { padding-block: 40px 0; }
  .ring { grid-template-columns: 1fr; gap: 12px; }
  .vs { padding: 2px 0; }
  .visuel { height: 168px; }
  .duo { grid-template-columns: 1fr; }
  .ligne { grid-template-columns: 40px 62px 1fr; gap: 12px; }
  .score { grid-column: 2 / 4; text-align: left; display: flex; gap: 6px; align-items: baseline; }
  .score span { margin-top: 0; }
  .secondaires { gap: 8px; }
  .bouton.fin { padding: 8px 14px; font-size: 11px; }
  .item { grid-template-columns: 46px 1fr; }
  .item .actions { grid-column: 1 / 3; }
}
