/* Feuille de style de Boky. Une seule, lisible de bout en bout : le cours
   porte sur le déploiement, pas sur le CSS. */

:root {
  --encre: #1d2430;
  --encre-pale: #5a6675;
  --fond: #f7f6f3;
  --carte: #ffffff;
  --trait: #e2dfd8;
  --accent: #7a3b1e;   /* terre de Madagascar */
  --libre: #1f6f44;
  --sorti: #9a3324;
}

* { box-sizing: border-box; }

/* L'attribut `hidden` doit l'emporter sur les `display` déclarés plus bas :
   sans cette règle, un `display: flex` rend visible un élément masqué. */
[hidden] { display: none !important; }

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

header {
  padding: 1.5rem 1rem 1rem;
  background: var(--carte);
  border-bottom: 1px solid var(--trait);
}

.marque {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.sous-titre {
  margin: 0.2rem 0 0.8rem;
  color: var(--encre-pale);
  font-size: 0.95rem;
}

nav a {
  margin-right: 1.2rem;
  color: var(--encre);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
nav a:hover { border-bottom-color: var(--accent); }

main {
  max-width: 54rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Recherche et pagination */

form#recherche { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

input, button {
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--trait);
  border-radius: 6px;
  background: var(--carte);
}
input { flex: 1; }

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button:disabled { background: var(--trait); border-color: var(--trait); color: var(--encre-pale); cursor: default; }

.compte { color: var(--encre-pale); font-size: 0.9rem; }

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.2rem;
  font-size: 0.9rem;
  color: var(--encre-pale);
}

/* La liste du catalogue */

ul.livres { list-style: none; margin: 0; padding: 0; }

ul.livres li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 8px;
}

ul.livres a { flex: 1; text-decoration: none; color: inherit; }
ul.livres a:hover .titre { color: var(--accent); }

.titre { display: block; font-weight: 600; }
.auteur { display: block; font-size: 0.88rem; color: var(--encre-pale); }

.rayon {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--encre-pale);
  white-space: nowrap;
}

.libre, .sorti {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.libre { color: var(--libre); }
.sorti { color: var(--sorti); }

/* La fiche d'un livre */

#fiche {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
}
#fiche h2 { margin: 0 0 0.2rem; }
#fiche .meta { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--encre-pale); }
#fiche .resume { white-space: pre-wrap; }

#emprunter { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
#emprunter label { font-size: 0.9rem; color: var(--encre-pale); }

/* Les emprunts */

table { width: 100%; border-collapse: collapse; background: var(--carte); }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--trait); font-size: 0.9rem; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--encre-pale); white-space: nowrap; }
/* Un numéro d'étudiant ou une date ne se coupe pas en deux. */
td:nth-child(1), td:nth-child(3), td:nth-child(4), td:nth-child(5) { white-space: nowrap; }
td a { color: inherit; }

.note { font-size: 0.85rem; color: var(--encre-pale); }

.erreur {
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: #fdecea;
  border: 1px solid #f3c2bd;
  color: var(--sorti);
}

footer {
  border-top: 1px solid var(--trait);
  padding: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--encre-pale);
}
footer a { color: var(--encre-pale); }

@media (max-width: 34rem) {
  ul.livres li { flex-wrap: wrap; }
  table { font-size: 0.82rem; }
}
