/*
 * Canal public d'Érudit — feuille autonome, mobile d'abord.
 *
 * Écrite pour un téléphone d'entrée de gamme sur un réseau lent : aucune
 * police téléchargée, aucune image décorative, aucune animation coûteuse.
 * La couleur de l'organisation arrive par /marque.css, qui redéfinit
 * --accent, --accent-lien et --on-accent (voir erudit/marque.py).
 */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-400.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-700.woff2") format("woff2");
}
/* Titres : Source Serif 4 (Adobe, OFL) — voir erudit.css, décision du 14/11. */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/source-serif-4-subhead-600.woff2") format("woff2");
}

/* Identité « Indigo et cachet » : docs/12_IDENTITE.md. */
:root {
  --encre: #0f1640;
  --encre-douce: #4b5168;
  --papier: #f2f3f7;
  --carte: #ffffff;
  --trait: #e3e5ee;
  --nuit: #0f1640;
  --accent: #2e40ac;
  --accent-lien: #2e40ac;
  --on-accent: #ffffff;
  --cachet: #8a5e00;
  --motif: url("../img/motif-clair.svg");
  --alerte: #8a5a00;
  --alerte-fond: #fdf3e0;
  --ok: #2f6b4f;
  --ok-fond: #e8f3ec;
  --erreur: #a23b2e;
  --erreur-fond: #fbebe8;
  --rayon: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --encre: #e8eaf5;
    --encre-douce: #a3a9c4;
    --papier: #16171c;
    --carte: #202128;
    --trait: #30323b;
    --nuit: #111216;
    --accent: #8d9bf2;
    --accent-lien: #aeb8ff;
    --on-accent: #16171c;
    --cachet: #e0a526;
    --motif: url("../img/motif-sombre.svg");
    --alerte: #e3b765;
    --alerte-fond: #2b2210;
    --ok: #7fd6a4;
    --ok-fond: #16281f;
    --erreur: #f0a197;
    --erreur-fond: #2e1714;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--papier) var(--motif) repeat;
  background-size: 280px;
  color: var(--encre);
  font: 17px/1.55 "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-lien); }

.invisible {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------- mise en page */
.page {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  max-width: 760px; margin: 0 auto;
  padding: 0 16px env(safe-area-inset-bottom);
}

.entete {
  display: flex; align-items: center; gap: 12px;
  margin: 0 -16px; padding: 16px 16px;
  background: var(--nuit); color: #f2f3f7;
}
.entete .sous-titre { color: #c9cee6; }
.entete h1 { font-size: 1.2rem; margin: 0; line-height: 1.25; }
h1, h2, .pastille {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 600; letter-spacing: .005em;
}
.sous-titre { margin: 0; color: var(--encre-douce); font-size: .875rem; }
.logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.pastille {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--accent); color: var(--on-accent);
  font-size: 1.3rem;
}

.fil { flex: 1; padding: 16px 0; }

.accueil {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 14px 16px;
}
.accueil p { margin: 0; }

/* ----------------------------------------------------------------- bulles */
.message { margin: 14px 0; }
.message.usager { display: flex; justify-content: flex-end; }
.message.usager .bulle {
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--rayon) var(--rayon) 4px var(--rayon);
  max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bulle { padding: 10px 14px; }
.message.assistant .bulle {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon) var(--rayon) var(--rayon) 4px;
  overflow-wrap: anywhere;
}
.bulle p { margin: .4em 0; }
.bulle p:first-child { margin-top: 0; }
.bulle p:last-child { margin-bottom: 0; }
.bulle ul, .bulle ol { padding-left: 1.3em; margin: .4em 0; }
.bulle table { border-collapse: collapse; display: block; overflow-x: auto; }
.bulle th, .bulle td { border: 1px solid var(--trait); padding: 4px 8px; }
.bulle pre { overflow-x: auto; }
.bulle hr { border: 0; border-top: 1px solid var(--trait); }

/* Le cachet : seul élément audacieux de l'identité (docs/12_IDENTITE.md). */
.verifie {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--trait);
  color: var(--cachet); font-weight: 700; font-size: .9rem;
}
.verifie .cachet { flex: none; }

/* Pas de source : une orientation, cadrée en indigo, pas une erreur. */
.message.orientation .bulle { border: 2px solid var(--accent); }
.sans-cachet { color: var(--encre-douce); font-size: .8125rem; }

.sources { margin-top: 8px; font-size: .875rem; }
.sources summary { cursor: pointer; color: var(--encre-douce); }
.sources ol { margin: 6px 0 0; padding-left: 1.3em; }
.sources li { margin: 4px 0; }
.sources .extrait {
  display: block; color: var(--encre-douce); font-size: .8125rem;
  border-left: 3px solid var(--trait); padding-left: 8px; margin-top: 2px;
}
.perime { color: var(--alerte); font-weight: 600; }

.erreur {
  background: var(--erreur-fond); color: var(--erreur);
  border-radius: var(--rayon); padding: 10px 14px;
}

/* ------------------------------------------------------------ état / saisie */
.etat {
  margin: 0 0 8px; color: var(--encre-douce); font-size: .875rem;
}
.etat::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  margin-right: 8px; border-radius: 50%; background: var(--accent);
  vertical-align: middle; animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .etat::before { animation: none; } }

.formulaire {
  position: sticky; bottom: 0;
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 0; background: var(--papier);
}
.formulaire textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 160px;
  padding: 12px; font: inherit; color: inherit;
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon);
}
.formulaire textarea:focus, .bouton:focus-visible {
  outline: 2px solid var(--accent-lien); outline-offset: 2px;
}

.bouton {
  min-height: 48px; padding: 0 18px; border: 0; border-radius: var(--rayon);
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 600; cursor: pointer;
}
.bouton.secondaire {
  background: transparent; color: var(--encre); border: 1px solid var(--trait);
}
.bouton[disabled] { opacity: .6; cursor: wait; }

/* ------------------------------------------------------------------ pied */
.pied {
  border-top: 1px solid var(--trait); padding: 12px 0 16px;
  color: var(--encre-douce); font-size: .8125rem;
}
.pied p { margin: 4px 0; }
.contacts span { display: block; }
.marque-erudit { opacity: .8; }

/* Sélecteur de langue (erudit/langues.py), dans l'en-tête. */
.entete-nom { flex: 1 1 13rem; min-width: min(13rem, 70%); }
/* Six langues ne tiennent pas à côté du nom sur un téléphone : elles passent
   sous lui plutôt que de l'écraser en colonne. */
.langues { display: flex; gap: 6px; font-size: .8125rem; font-weight: 700; }
.langues a, .langues span {
  min-width: 36px; min-height: 36px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 8px; color: #c9cee6; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .25);
}
.langues span[aria-current] { background: #f2f3f7; color: var(--nuit); border-color: transparent; }
.langues a:hover { color: #ffffff; border-color: rgba(255, 255, 255, .6); }
.bientot { margin-top: 8px !important; color: var(--encre-douce); font-size: .875rem; }
.experimental {
  margin-top: 10px !important; padding: 8px 12px; border-radius: 10px;
  background: var(--alerte-fond); color: var(--alerte); font-size: .875rem;
}
/* Six langues : le sélecteur passe sous le nom sur un téléphone. */
.entete { flex-wrap: wrap; }
.langues { flex-wrap: wrap; }
.langues a, .langues span { padding: 0 8px; }


/* Un lien habillé en bouton (page « pas de connexion »). */
a.bouton { display: inline-flex; align-items: center; text-decoration: none; }

/* Mouvement (14/11/2026) : un message qui arrive glisse à sa place, et le
   cachet se pose comme un tampon. Coupé si l'usager demande moins
   d'animations. */
@keyframes apparition {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.message { animation: apparition 240ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes tampon {
  0%   { opacity: 0; transform: scale(1.9) rotate(-14deg); }
  60%  { opacity: 1; transform: scale(.92) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.verifie .cachet { animation: tampon 520ms cubic-bezier(.2, .9, .3, 1.3) both; }
.bouton { transition: transform 120ms ease, background .15s; }
.bouton:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) {
  .message, .verifie .cachet, .etat::before { animation: none; }
  .bouton { transition: none; }
}

/* ---------------------------------------------------------------- lot F */
.icone { width: 1.05em; height: 1.05em; vertical-align: -0.15em; }
.avis {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--trait);
  color: var(--encre-douce); font-size: .875rem;
}
.avis-bouton {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--trait);
  background: transparent; color: var(--encre); font: inherit; cursor: pointer;
  transition: transform 120ms ease, border-color .15s, color .15s;
}
.avis-bouton:hover { border-color: var(--accent); color: var(--accent-lien); }
.avis-bouton:active { transform: scale(.95); }
.avis-merci { color: var(--ok); }

.transmettre {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--papier); display: flex; flex-direction: column; gap: 8px;
}
.transmettre-titre { margin: 0 !important; font-weight: 700; }
.transmettre-libelle { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; }
.transmettre input[type="text"] {
  font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--trait); background: var(--carte); color: var(--encre);
}
.transmettre-accord { display: flex; gap: 8px; align-items: flex-start; font-size: .8125rem; }
.transmettre-accord input { margin-top: 3px; }
.transmettre .bouton { align-self: flex-start; }
.transmettre-retour { margin: 0 !important; color: var(--erreur); font-size: .8125rem; }
.transmettre-merci { margin: 0 !important; color: var(--ok); font-weight: 700; }

/* Page de confidentialité. */
.legal section {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 14px 18px; margin-bottom: 12px;
}
.legal h2 { font-size: 1.05rem; margin: 0 0 6px; }
.legal ul { padding-left: 1.2em; margin: 6px 0; }
.pied a { color: var(--accent-lien); }

/* Citation phrase par phrase (H.4) : renvoi vers la n-ième source de la liste. */
sup.renvoi { font-size: .72em; font-weight: 700; color: var(--accent-lien); line-height: 0; }

/* Questions fréquentes validées (erudit/faq.py) : lues sans attendre le modèle. */
.faq { margin: 14px 0 0; padding: 14px 16px; border-radius: var(--rayon);
       background: var(--carte); border: 1px solid var(--trait); }
.faq h2 { font-size: 1.05rem; margin: 0 0 8px; }
.faq details { border-top: 1px solid var(--trait); padding: 8px 0; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--accent-lien); }
.faq-reponse { white-space: pre-line; margin: 8px 0 4px; }
.faq-sources { margin: 4px 0 0; padding-left: 20px; font-size: .85rem; color: var(--encre-douce); }
.faq-note { margin: 8px 0 0 !important; font-size: .8rem; color: var(--encre-douce); }

