/* Couleurs et polices de la maquette, communes à l'élève et au professeur */

/* Polices hébergées sur le site (licence OFL, voir assets/polices/) */
@font-face {
  font-family: "Source Serif 4";
  src: url("../polices/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../polices/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../polices/source-sans-3-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../polices/source-sans-3-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --bleu: #1d4b94;
  --bleu-fonce: #0f2b5b;
  --bouton: #1d4b94;
  --entete: #1d4b94;
  --bleu-clair: #e3eaf6;
  --fond: #eef2f8;
  --surface: #ffffff;
  --bordure: #c9d4e6;
  --texte: #16213a;
  --texte-2: #4b5672;
  --vert: #1b6e3c;
  --vert-fond: #dcf1e3;
  --rouge: #a8261d;
  --rouge-fond: #fbe4e1;
  --orange: #8a4200;
  --orange-fond: #fde3c8;
  --gris-fond: #e5e9f0;
  --ombre: 0 1px 2px rgba(15, 43, 91, .06);
  --rayon: 14px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bleu: #7ea6e8;
    --bleu-fonce: #0b1a36;
    --bouton: #2f5fae;
    --entete: #13254a;
    --bleu-clair: #1d2c4a;
    --fond: #0f1626;
    --surface: #18223a;
    --bordure: #2c3a5a;
    --texte: #e7ecf6;
    --texte-2: #a8b3cc;
    --vert: #7fd3a0;
    --vert-fond: #173a28;
    --rouge: #f2a39b;
    --rouge-fond: #4a1f1c;
    --orange: #f5c08a;
    --orange-fond: #4a2f12;
    --gris-fond: #26324d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bleu: #7ea6e8;
  --bleu-fonce: #0b1a36;
  --bouton: #2f5fae;
  --entete: #13254a;
  --bleu-clair: #1d2c4a;
  --fond: #0f1626;
  --surface: #18223a;
  --bordure: #2c3a5a;
  --texte: #e7ecf6;
  --texte-2: #a8b3cc;
  --vert: #7fd3a0;
  --vert-fond: #173a28;
  --rouge: #f2a39b;
  --rouge-fond: #4a1f1c;
  --orange: #f5c08a;
  --orange-fond: #4a2f12;
  --gris-fond: #26324d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75em; }
a { color: var(--bleu); }
[hidden] { display: none !important; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 16px;
  box-shadow: var(--ombre);
}
.surtitre {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bleu);
  margin: 0 0 6px;
}
.discret { color: var(--texte-2); font-size: .92rem; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--bouton);
  background: var(--bouton);
  color: #fff;
  font: 700 1rem var(--sans);
  cursor: pointer;
  text-decoration: none;
}
.btn-contour { background: transparent; color: var(--bleu); border-color: var(--bleu); }
.btn-large { width: 100%; }
.btn-petit { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--bleu);
  outline-offset: 2px;
}

/* Formulaires */
.carte > form:not(:last-child) { margin-bottom: 16px; }
.champ { display: block; margin-bottom: 14px; }
.champ > span { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--bordure);
  border-radius: 10px;
  background: var(--surface);
  color: var(--texte);
  font: 1rem var(--sans);
}
textarea { min-height: 140px; resize: vertical; }

.message {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: .95rem;
}
.message-erreur { background: var(--rouge-fond); color: var(--rouge); }
.message-ok { background: var(--vert-fond); color: var(--vert); }
.message-info { background: var(--bleu-clair); color: var(--texte); }

/* Pastilles de statut */
.pastille {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--gris-fond);
  color: var(--texte-2);
  white-space: nowrap;
}
.pastille-vert { background: var(--vert-fond); color: var(--vert); }
.pastille-orange { background: var(--orange-fond); color: var(--orange); }
.pastille-bleu { background: var(--bleu-clair); color: var(--bleu); }

/* Photo de profil, illustration ou initiales */
.avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bleu-clair);
  color: var(--bleu);
  display: inline-grid;
  place-items: center;
  font: 700 1.4rem var(--serif);
  flex: none;
  object-fit: cover;
}
.avatar-petit { width: 48px; height: 48px; font-size: 1rem; }
.avatar-grand { width: 160px; height: 160px; font-size: 3rem; }

.fichier-cache { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Texte enrichi des fiches de cours */
.texte-riche > * { margin: 0 0 .75em; }
.texte-riche > :last-child { margin-bottom: 0; }
.texte-riche h4 { font: 700 1.05rem var(--serif); color: var(--bleu); }
.texte-riche blockquote {
  margin-left: 0; padding: 8px 14px; border-left: 4px solid var(--bleu);
  background: var(--bleu-clair); border-radius: 0 10px 10px 0; font-family: var(--serif); font-style: italic;
}
.texte-riche ul, .texte-riche ol { padding-left: 22px; }
.figure-cours { margin: 0 0 .75em; }
.figure-cours img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.figure-cours figcaption { font-size: .85rem; color: var(--texte-2); margin-top: 4px; }

/* Texte annoté (correction du professeur) */
.texte-annote {
  white-space: pre-wrap; line-height: 1.9;
  background: var(--fond); border-radius: 10px; padding: 12px 14px; margin: 10px 0;
}
mark.annotation {
  background: var(--orange-fond); color: inherit;
  border-bottom: 2px solid var(--orange); border-radius: 3px; padding: 1px 0; cursor: help;
}
mark.annotation::after {
  content: attr(data-n);
  font: 700 .7rem var(--sans); color: var(--orange);
  vertical-align: super; margin-left: 2px;
}
.liste-annotations { margin: 0; padding-left: 22px; }
.liste-annotations li + li { margin-top: 6px; }
.liste-annotations q { font-style: italic; }

.signature {
  text-align: center;
  font-size: .8rem;
  color: var(--texte-2);
  margin: 24px 0 8px;
}

.chargement { padding: 40px 16px; text-align: center; color: var(--texte-2); }
.texte-riche .tableau-conteneur { overflow-x: auto; max-width: 100%; }
.texte-riche table { border-collapse: collapse; width: 100%; }
.texte-riche th, .texte-riche td { border: 1px solid var(--bordure); padding: 8px; text-align: left; }
.conversation { display: grid; gap: 12px; }
.conversation > button { justify-self: start; }
.conversation input[type=file] { max-width: 100%; }
.historique-conversation { max-height: 46vh; overflow-y: auto; }
.message-conversation { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--bordure); border-radius: 10px; overflow-wrap: anywhere; }
.message-conversation-moi { background: var(--bleu-clair); }
.message-conversation p { white-space: pre-wrap; margin: 5px 0; }
.liste-conversations { list-style: none; }
.liste-conversations li { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--bordure); }
