/*
 * Identité visuelle : la copie double d'examen français.
 * Papier ivoire, réglure Seyès bleu pâle, filet de marge rouge, encre violette
 * pour les actions — les couleurs viennent de l'objet même que ce moteur sert.
 *
 * Licence MIT. Polices : Spectral et IBM Plex (SIL Open Font License).
 */

:root {
  --papier: #fcfbf7;
  --papier-creux: #f4f2ec;
  --encre: #17202e;
  --encre-pale: #5f6875;
  --seyes: #cadcea;
  --marge: #cf4559;
  --violet: #4a3f8f;
  --surlignage: #f6e6a8;

  --interligne: 2.25rem;
  --rayon: 3px;
  --transition: 140ms ease;

  --police-sujet: "Spectral", Georgia, "Times New Roman", serif;
  --police-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-chiffres: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #12161f;
    --papier-creux: #1a2029;
    --encre: #e8e6e0;
    --encre-pale: #99a1ad;
    --seyes: #26333f;
    --marge: #e05c6f;
    --violet: #a99bf0;
    --surlignage: #4a4114;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--police-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

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

.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--papier);
  border-bottom: 1px solid var(--seyes);
}

.entete__contenu {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.4rem 1.25rem 0.9rem;
}

.surtitre {
  margin: 0 0 0.6rem;
  font-family: var(--police-chiffres);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--encre-pale);
}

/* La ligne d'écriture : un simple filet, épaissi quand le champ a le focus. */
.ligne-saisie {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  border-bottom: 2px solid var(--seyes);
  transition: border-color var(--transition);
}

.ligne-saisie:focus-within {
  border-bottom-color: var(--violet);
}

.ligne-saisie__champ {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0 0.55rem;
  border: 0;
  background: transparent;
  color: var(--encre);
  font-family: var(--police-sujet);
  font-size: clamp(1.25rem, 4vw, 1.9rem);
  font-weight: 300;
}

.ligne-saisie__champ::placeholder {
  color: var(--encre-pale);
  opacity: 0.55;
  font-style: italic;
}

.ligne-saisie__champ:focus { outline: none; }
.ligne-saisie__champ::-webkit-search-cancel-button { display: none; }

.ligne-saisie__effacer {
  flex: none;
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: var(--encre-pale);
  font-family: var(--police-ui);
  font-size: 0.8rem;
  cursor: pointer;
}

.ligne-saisie__effacer:hover { color: var(--marge); }

.barre-etat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.55rem;
}

.compteur {
  margin: 0;
  font-family: var(--police-chiffres);
  font-size: 0.78rem;
  color: var(--encre-pale);
}

.compteur strong {
  color: var(--encre);
  font-weight: 500;
}

.tri {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--encre-pale);
}

.tri select {
  border: 0;
  border-bottom: 1px dotted var(--encre-pale);
  background: transparent;
  color: var(--encre);
  font-family: var(--police-ui);
  font-size: 0.78rem;
  padding: 0.1rem 0.1rem 0.15rem;
}

.suggestion {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--encre-pale);
}

.suggestion button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--violet);
  font: inherit;
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ Page */

.page {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 2.5rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
  align-items: start;
}

/* --------------------------------------------------------------- Filtres */

.filtres {
  position: sticky;
  top: 9.5rem;
}

.filtres__titre {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--police-chiffres);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--encre-pale);
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
}

.filtres__titre::-webkit-details-marker { display: none; }

.filtres__compteur {
  display: inline-block;
  min-width: 1.35em;
  padding: 0.05em 0.35em;
  border-radius: 999px;
  background: var(--violet);
  color: var(--papier);
  text-align: center;
  letter-spacing: 0;
}

.filtres__corps {
  padding-top: 0.5rem;
}

.bouton-lien {
  margin-bottom: 1.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--marge);
  font-family: var(--police-ui);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.facette {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

.facette legend {
  padding: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.facette--defilante .facette__options {
  max-height: 11rem;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.option {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.16rem 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.option input {
  accent-color: var(--violet);
  margin: 0;
  flex: none;
}

.option__nombre {
  margin-left: auto;
  font-family: var(--police-chiffres);
  font-size: 0.72rem;
  color: var(--encre-pale);
}

.option--vide {
  opacity: 0.4;
}

/* -------------------------------------------------------------- Résultats */

/*
 * Signature de la page : les sujets sont posés sur une réglure Seyès, avec le
 * filet de marge rouge à gauche, comme sur une copie.
 */
.liste {
  margin: 0;
  padding: 0 0 0 1.5rem;
  list-style: none;
  border-left: 1px solid var(--marge);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--interligne) - 1px),
    var(--seyes) calc(var(--interligne) - 1px),
    var(--seyes) var(--interligne)
  );
  background-position: 0 0.2rem;
}

.sujet {
  padding: 0.75rem 0 1rem;
}

.sujet__texte {
  margin: 0;
  font-family: var(--police-sujet);
  font-size: 1.18rem;
  font-weight: 300;
  line-height: var(--interligne);
  text-wrap: pretty;
}

.sujet__texte mark {
  background: var(--surlignage);
  color: inherit;
  border-radius: var(--rayon);
  padding: 0 0.12em;
}

.sujet__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: var(--encre-pale);
}

.etiquette {
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--seyes);
  border-radius: var(--rayon);
  background: var(--papier-creux);
  white-space: nowrap;
}

.etiquette--forme {
  border-style: dashed;
  font-style: italic;
}

.annees {
  font-family: var(--police-chiffres);
  font-size: 0.74rem;
  color: var(--marge);
  letter-spacing: 0.02em;
}

.message {
  margin: 2rem 0;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  color: var(--encre-pale);
  max-width: 34rem;
}

.message strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--encre);
  font-weight: 600;
}

.bouton-suite {
  display: block;
  margin: 1.75rem 0 0 1.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--violet);
  border-radius: var(--rayon);
  background: transparent;
  color: var(--violet);
  font-family: var(--police-ui);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.bouton-suite:hover {
  background: var(--violet);
  color: var(--papier);
}

/* ------------------------------------------------------------------ Pied */

.pied {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--seyes);
  font-size: 0.78rem;
  color: var(--encre-pale);
}

.pied code {
  font-family: var(--police-chiffres);
  font-size: 0.9em;
  background: var(--papier-creux);
  padding: 0.05em 0.3em;
  border-radius: var(--rayon);
}

/* --------------------------------------------------------------- Mobile */

@media (max-width: 47rem) {
  .page {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .filtres {
    position: static;
    border: 1px solid var(--seyes);
    border-radius: var(--rayon);
    padding: 0 0.9rem 0.2rem;
  }

  .filtres__corps {
    padding-bottom: 0.75rem;
  }

  .liste {
    padding-left: 1rem;
  }

  .message,
  .bouton-suite {
    margin-left: 1rem;
    padding-left: 0;
  }
}

/* Apparition discrète des résultats, désactivée si l'utilisateur préfère
   limiter les animations. */
@media (prefers-reduced-motion: no-preference) {
  .sujet {
    animation: apparition 220ms ease both;
  }

  @keyframes apparition {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
  }
}
