/* =========================================================================
   CPPA — socle de conception
   Jetons, elements de base et composants partages par le site public et
   l'espace connecte.

   Charte reprise du site du Cycle Preparatoire Pere Aupiais : le bleu de
   sa navigation et de ses liens (#267AAA, #2374A3), le bleu de son logo
   (#0A4A9C), son bleu clair (#7FBCE0), son fond gris (#F0F0F0) et ses
   polices — titres en Oswald, texte en Source Sans, citations en serif
   italique. Les couleurs d'etat reprennent le drapeau du Benin qui figure
   sur son bandeau : vert, jaune, rouge. Le quadrillage rappelle le papier
   millimetre d'une prepa scientifique.
   ========================================================================= */

:root {
  /* Bleus de la charte */
  --logo:         #0A4A9C;   /* bleu du logo CPPA */
  --noir:         #0A0A0A;   /* tous les textes : noir franc, jamais de gris */
  --encre:        #0B2E5C;   /* bleu nuit : titres, barre laterale, pied de page */
  --encre-2:      #123F7A;
  --encre-doux:   #3D5375;
  --accent:       #267AAA;   /* navigation et boutons du site d'origine */
  --accent-fonce: #1D6690;
  --accent-pale:  #E3F0F8;
  --ciel:         #7FBCE0;   /* bleu clair de la charte */
  --ciel-pale:    #E8F3FA;

  /* Fonds */
  --papier:       #F5FAFD;   /* fond clair, teinte de bleu : pas de gris */
  --papier-2:     #E6F1F8;
  --surface:      #FFFFFF;
  --blanc:        #FFFFFF;

  /* Couleurs d'etat : le drapeau du Benin */
  --foret:        #00794A;
  --foret-pale:   #E0F2EA;
  --ocre:         #F2B705;
  --ocre-fonce:   #7A5A00;
  --ocre-pale:    #FFF6D6;
  --rouge:        #D0142C;
  --rouge-pale:   #FCE4E7;
  --drapeau: linear-gradient(90deg, #008751 0 40%, #FCD116 40% 70%, #E8112D 70%);

  /* Texte et filets */
  --texte:        #0A0A0A;
  --texte-doux:   #141414;
  --texte-faible: #1F1F1F;
  --bord:         #D2E3EF;
  --bord-fort:    #AFCBDF;

  /* Quadrillage */
  --ligne-fine:   rgba(38, 122, 170, .06);
  --ligne-forte:  rgba(38, 122, 170, .13);
  --marge:        rgba(38, 122, 170, .55);

  /* Typographie */
  --police:        'Source Sans 3', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --police-titre:  'Oswald', 'Arial Narrow', 'Segoe UI', sans-serif;
  --police-mono:   'Oswald', 'Arial Narrow', 'Segoe UI', sans-serif;   /* etiquettes, heures et chiffres */
  --police-main:   'Noto Serif', 'Droid Serif', Georgia, serif;         /* annotations et citations, en italique */

  /* Formes et profondeur */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-pleine: 999px;

  --ombre-xs: 0 1px 2px rgba(11, 46, 92, .06);
  --ombre-sm: 0 2px 10px rgba(11, 46, 92, .07);
  --ombre:    0 14px 34px rgba(11, 46, 92, .12);
  --ombre-lg: 0 28px 60px rgba(11, 46, 92, .20);

  --transition: .2s cubic-bezier(.4, 0, .2, 1);
  --largeur: 1200px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texte);
  background: var(--papier);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--accent); color: #fff; }

em, .italique { font-family: var(--police-main); font-style: italic; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.icone { width: 18px; height: 18px; flex: none; }

/* --- Typographie ------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--police-titre);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: .005em;
  color: var(--noir);
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 2.7vw, 2.05rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
/* Dans un titre, le mot mis en valeur passe en serif italique. */
h1 em, h2 em { font-family: var(--police-main); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--accent); }

.surtitre {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--police-mono); font-size: .74rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .16em; color: var(--accent);
}
.surtitre::before { content: ''; width: 22px; height: 1.5px; background: currentColor; }

.chapeau { font-family: var(--police-main); font-style: italic; font-size: 1.1rem; line-height: 1.75; color: var(--texte); }
.doux    { color: var(--texte-doux); }
.faible  { color: var(--texte-faible); }
.petit   { font-size: .82rem; }
.minus   { font-size: .72rem; }
.gras    { font-weight: 600; }
.centre  { text-align: center; }
.mono    { font-family: var(--police-mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.manuscrit { font-family: var(--police-main); font-style: italic; font-weight: 400; color: var(--accent); line-height: 1.35; }
.tronque { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre-ligne { white-space: pre-line; }

/* --- Grille ------------------------------------------------------------ */

.contenu { width: 100%; max-width: var(--largeur); margin-inline: auto; padding-inline: 24px; }
.contenu-etroit { max-width: 760px; }
.contenu-moyen  { max-width: 960px; }

.grille { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.rangee { display: flex; align-items: center; gap: 12px; }
.rangee-haut { align-items: flex-start; }
.rangee-entre { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rangee-souple { flex-wrap: wrap; }
.pile { display: flex; flex-direction: column; gap: 16px; }
.pile-serree { display: flex; flex-direction: column; gap: 6px; }
.pousse { margin-left: auto; }
.min0 { min-width: 0; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .g2, .g3, .g4, .g-auto { grid-template-columns: minmax(0, 1fr); }
  .contenu { padding-inline: 18px; }
}

/* --- Boutons ----------------------------------------------------------- */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm); border: 1.5px solid transparent;
  font-weight: 600; font-size: .9rem; line-height: 1.2; white-space: nowrap;
  cursor: pointer; transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}
.bouton:active { transform: translateY(1px); }
.bouton[disabled] { opacity: .5; cursor: not-allowed; }

.bouton-primaire { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px rgba(38, 122, 170, .22); }
.bouton-primaire:hover { background: var(--accent-fonce); }
.bouton-encre { background: var(--encre); color: #fff; }
.bouton-encre:hover { background: var(--encre-2); }
.bouton-contour { background: transparent; border-color: var(--bord-fort); color: var(--noir); }
.bouton-contour:hover { border-color: var(--encre); background: var(--surface); }
.bouton-fantome { background: transparent; color: var(--texte-doux); padding-inline: 10px; }
.bouton-fantome:hover { color: var(--noir); background: var(--papier-2); }
.bouton-danger { background: transparent; border-color: #E2B4B0; color: var(--rouge); }
.bouton-danger:hover { background: var(--rouge-pale); }
.bouton-clair { background: #fff; color: var(--noir); }
.bouton-clair:hover { background: var(--papier); }

.bouton-petit { padding: 7px 12px; font-size: .8rem; }
.bouton-large { padding: 14px 24px; font-size: 1rem; }
.bouton-bloc { width: 100%; }

.lien { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: rgba(38, 122, 170, .35); transition: text-decoration-color var(--transition); }
.lien:hover { text-decoration-color: currentColor; }

.lien-fleche { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--accent); }
.lien-fleche .icone { width: 16px; height: 16px; transition: transform var(--transition); }
.lien-fleche:hover .icone { transform: translateX(3px); }

/* --- Cartes ------------------------------------------------------------ */

.carte {
  background: var(--surface); border: 1px solid var(--bord);
  border-radius: var(--r); box-shadow: var(--ombre-xs);
}
.carte-entete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--bord);
}
.carte-entete h2, .carte-entete h3 { font-size: 1.02rem; }
.carte-corps { padding: 20px; }
.carte-pied { padding: 14px 20px; border-top: 1px solid var(--bord); }
.carte-serree .carte-corps { padding: 0; }

/* --- Pastilles --------------------------------------------------------- */

.pastille {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pleine);
  font-size: .72rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--papier-2); color: var(--texte-doux);
}
.pastille::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pastille.sans-point::before { display: none; }
.ton-neutre    { background: var(--papier-2); color: var(--texte-doux); }
.ton-direct    { background: var(--accent-pale); color: var(--accent-fonce); }
.ton-succes    { background: var(--foret-pale); color: var(--foret); }
.ton-attention { background: var(--ocre-pale); color: var(--ocre-fonce); }
.ton-alerte    { background: var(--rouge-pale); color: var(--rouge); }
.ton-info      { background: var(--ciel-pale); color: var(--ciel); }
.ton-direct.pulse::before { animation: pulsation 1.6s ease-in-out infinite; }

@keyframes pulsation { 50% { opacity: .25; transform: scale(.7); } }

.point-matiere { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--couleur, var(--encre-doux)); }

/* --- Formulaires ------------------------------------------------------- */

.formulaire-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.formulaire-grille .plein { grid-column: 1 / -1; }
@media (max-width: 680px) { .formulaire-grille { grid-template-columns: minmax(0, 1fr); } }

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > label, .champ > .libelle { font-size: .82rem; font-weight: 600; color: var(--noir); }
.champ .requis { color: var(--accent); }

.saisie {
  width: 100%; padding: 10px 12px; background: var(--blanc);
  border: 1.5px solid var(--bord-fort); border-radius: var(--r-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.saisie::placeholder { color: var(--texte-faible); }
.saisie:hover { border-color: var(--encre-doux); }
.saisie:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(38, 122, 170, .14); }
textarea.saisie { min-height: 104px; resize: vertical; line-height: 1.55; }
select.saisie { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355607A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
select.saisie[multiple] { background-image: none; padding: 6px; }
select.saisie[multiple] option { padding: 6px 8px; border-radius: 4px; }
input[type='color'].saisie { padding: 4px; height: 42px; }
.champ.en-erreur .saisie { border-color: var(--rouge); }

.champ-aide { font-size: .78rem; color: var(--texte-faible); }
.champ-erreur { font-size: .78rem; font-weight: 600; color: var(--rouge); }

.case { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; cursor: pointer; }
.case input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* Champ piege anti-robots : hors ecran, jamais vu d'un visiteur. */
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Alertes ----------------------------------------------------------- */

.alerte {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: .88rem; margin-bottom: 18px;
}
.alerte .icone { margin-top: 2px; }
.alerte ul { list-style: disc; padding-left: 18px; }
.alerte-fermer { margin-left: auto; background: none; border: none; opacity: .55; padding: 2px; }
.alerte-fermer:hover { opacity: 1; }
.alerte-succes        { background: var(--foret-pale); border-color: #BFDCCB; color: #1F4D38; }
.alerte-avertissement { background: var(--ocre-pale); border-color: #EBD29A; color: #6B4808; }
.alerte-erreur        { background: var(--rouge-pale); border-color: #EDBDB9; color: #7F1A14; }
.alerte-info          { background: var(--ciel-pale); border-color: #C3D4EE; color: #1C427A; }

/* --- Tableaux ---------------------------------------------------------- */

.tableau-enveloppe { overflow-x: auto; }
.tableau th {
  padding: 11px 16px; text-align: left; white-space: nowrap;
  font-family: var(--police-mono); font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--texte-faible);
  border-bottom: 1px solid var(--bord); background: var(--papier);
}
.tableau td { padding: 13px 16px; border-bottom: 1px solid var(--bord); vertical-align: middle; font-size: .9rem; }
.tableau tr:last-child td { border-bottom: none; }
.tableau tbody tr { transition: background var(--transition); }
.tableau tbody tr:hover { background: rgba(240, 240, 240, .6); }
.tableau .droite { text-align: right; }
.tableau .actions { display: flex; justify-content: flex-end; gap: 6px; }

/* --- Avatars ----------------------------------------------------------- */

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--encre); color: #fff;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.avatar-petit { width: 30px; height: 30px; font-size: .68rem; }
.avatar-grand { width: 64px; height: 64px; font-size: 1.2rem; font-family: var(--police-titre); }

/* --- Logo -------------------------------------------------------------- */

.logo { display: inline-flex; align-items: center; gap: 12px; }
.logo-texte { display: flex; flex-direction: column; line-height: 1.15; }
.logo img { height: var(--hauteur-logo, 44px); width: auto; flex: none; }
.logo-sigle { font-family: var(--police-titre); font-size: 1.12rem; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--logo); }
.logo-nom { font-family: var(--police-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--texte-faible); }
.logo.clair .logo-sigle { color: #fff; }
.logo.clair .logo-nom { color: rgba(201, 209, 224, .7); }
.logo img { transition: transform .4s cubic-bezier(.3, 1.4, .5, 1); }
.logo:hover img { transform: scale(1.06) rotate(-3deg); }

/* --- Jauge ------------------------------------------------------------- */

.jauge { display: block; height: 7px; border-radius: var(--r-pleine); background: var(--papier-2); overflow: hidden; }
.jauge > span { display: block; height: 100%; border-radius: inherit; background: var(--couleur, var(--accent)); width: var(--valeur, 0%); }

/* --- Vignette de fichier : une feuille au coin corne ------------------- */

.vignette-fichier {
  width: 40px; height: 46px; flex: none; display: grid; place-items: end center; padding-bottom: 6px;
  border-radius: 6px; border: 1px solid var(--bord-fort); background-color: var(--blanc);
  background-image: linear-gradient(225deg, var(--papier-2) 9px, transparent 9px);
  font-family: var(--police-mono); font-size: .56rem; font-weight: 500; letter-spacing: .04em; color: var(--accent-fonce);
}

/* --- Etat vide --------------------------------------------------------- */

.vide { padding: 40px 24px; text-align: center; color: var(--texte-doux); }
.vide .vide-icone {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px;
  display: grid; place-items: center; background: var(--papier-2); color: var(--noir);
}
.vide .vide-icone .icone { width: 22px; height: 22px; }
.vide h3 { font-size: 1.02rem; margin-bottom: 4px; }
.vide p { font-size: .88rem; max-width: 420px; margin-inline: auto; }
.vide .bouton { margin-top: 16px; }

/* --- Onglets ----------------------------------------------------------- */

.onglets { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--bord); margin-bottom: 20px; }
.onglet {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: .9rem; font-weight: 600; color: var(--texte-doux);
  transition: color var(--transition), border-color var(--transition);
}
.onglet:hover { color: var(--noir); }
.onglet.actif { color: var(--noir); border-bottom-color: var(--accent); }
.onglet .compteur {
  font-family: var(--police-mono); font-size: .7rem; font-weight: 500;
  padding: 1px 7px; border-radius: var(--r-pleine); background: var(--papier-2); color: var(--texte-doux);
}
.onglet.actif .compteur { background: var(--accent-pale); color: var(--accent-fonce); }

/* --- Pagination -------------------------------------------------------- */

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.pagination-pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.page {
  min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--bord); background: var(--surface);
  font-family: var(--police-mono); font-size: .8rem; color: var(--texte-doux);
}
.pagination a:hover { border-color: var(--encre); color: var(--noir); }
.pagination span.page.actif { background: var(--encre); border-color: var(--encre); color: #fff; }
.pagination span.page.inactif { opacity: .45; }

/* --- Reglure Seyes ----------------------------------------------------- */

.seyes {
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--ligne-forte) 1px, transparent 1px),
    linear-gradient(90deg, var(--ligne-forte) 1px, transparent 1px),
    linear-gradient(var(--ligne-fine) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 32px 8px;
}

/* --- Divers ------------------------------------------------------------ */

.separateur { border: none; border-top: 1px solid var(--bord); margin: 20px 0; }
.masque { display: none !important; }
.lecteur-ecran { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }



/* --- Animations communes -------------------------------------------------
   Sobres et utiles : elles accompagnent l'arrivee d'un contenu ou repondent
   a un geste. Tout est coupe pour qui a demande moins de mouvement. */

/* Fondu entre deux pages, dans les navigateurs qui le permettent. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fondu-sortie .2s ease both; }
::view-transition-new(root) { animation: fondu-entree .34s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fondu-sortie { to { opacity: 0; } }
@keyframes fondu-entree { from { opacity: 0; transform: translateY(10px); } }

@keyframes entree { from { opacity: 0; transform: translateY(14px); } }
@keyframes remplissage { from { transform: scaleX(0); } }
@keyframes reflet { to { transform: translateX(130%) skewX(-18deg); } }

/* Boutons : leger soulevement, reflet qui traverse le bouton principal, fleche qui avance. */
.bouton { position: relative; overflow: hidden; }
.bouton:hover { transform: translateY(-2px); }
.bouton .icone { transition: transform var(--transition); }
.bouton:hover .icone:last-child { transform: translateX(3px); }
.bouton-primaire::after, .bouton-encre::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent);
  transform: translateX(-130%) skewX(-18deg); pointer-events: none;
}
.bouton-primaire:hover::after, .bouton-encre:hover::after { animation: reflet .75s ease; }

/* Jauges : la barre se remplit a l'affichage. */
.jauge > span { transform-origin: left; animation: remplissage 1.1s cubic-bezier(.2, .7, .2, 1) .15s both; }

/* Cartes et vignettes. */
.carte { transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition); }
.vignette-fichier { transition: transform var(--transition); }
.ligne-simple:hover .vignette-fichier, .document-ligne:hover .vignette-fichier { transform: translateY(-2px) rotate(-3deg); }
.avatar { transition: transform var(--transition); }
a:hover > .avatar { transform: scale(1.06); }
.alerte { animation: entree .4s cubic-bezier(.2, .7, .2, 1) both; }
.pastille { transition: background var(--transition), color var(--transition); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
