/*
 * L'habillage du gestionnaire.
 *
 * Rien de commun avec les trois sites : ceux-ci ont chacun leur charte, celui
 * -ci est un outil de travail. Ce qui compte ici, c'est qu'on lise sans
 * lunettes, qu'on distingue un brouillon d'une page en ligne, et que les
 * boutons dangereux ne ressemblent pas aux autres.
 *
 * Aucune police distante, aucun script tiers : le gestionnaire fonctionne
 * même si le collège coupe l'accès aux serveurs de Google.
 */

:root {
  --encre: #1c1e21;
  --encre-douce: #5b6169;
  --fond: #f4f5f7;
  --papier: #ffffff;
  --trait: #d7dbe0;
  --accent: #1d4e89;
  --accent-clair: #e8eef6;
  --danger: #a4241c;
  --succes: #1f6b3a;
  --attente: #8a6100;
  --teinte: var(--accent);
  --rayon: 6px;
}

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 0.4rem;
}
h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
}

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

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

.evitement {
  position: absolute;
  left: -9999px;
  background: var(--encre);
  color: #fff;
  padding: 0.7rem 1.2rem;
  z-index: 100;
}
.evitement:focus {
  left: 0;
}

/* --- Barre du haut --------------------------------------------------------- */

.barre {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--encre);
  color: #fff;
  padding: 0.6rem 1.25rem;
  flex-wrap: wrap;
}
.barre__marque {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  margin-right: auto;
}
.barre__qui {
  color: #c8ccd2;
  font-size: 0.9rem;
}
.barre .lien-bouton {
  color: #c8ccd2;
}

/* --- Cadre ----------------------------------------------------------------- */

/* Les deux colonnes s'étirent à la même hauteur : sans cela, le rail blanc du
   menu s'arrête au milieu d'une fiche longue, et la page a l'air coupée. */
.cadre {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: stretch;
}
@media (max-width: 800px) {
  .cadre {
    grid-template-columns: 1fr;
  }
}

/* L'écran de connexion n'a pas de menu : sans cette règle, la page entière
   viendrait se loger dans la colonne de 250 pixels qui lui était réservée. */
.principal:only-child {
  grid-column: 1 / -1;
  margin-inline: auto;
  width: 100%;
}

.menu {
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--trait);
  min-height: calc(100vh - 64px);
  background: var(--papier);
}
.menu__site {
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--teinte);
  padding-left: 0.75rem;
}
.menu__titre {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu li a {
  display: block;
  padding: 0.3rem 0.5rem;
  color: var(--encre);
  text-decoration: none;
  border-radius: var(--rayon);
  font-size: 0.95rem;
}
.menu li a:hover {
  background: var(--fond);
}
.menu li a[aria-current='page'] {
  background: var(--accent-clair);
  color: var(--accent);
  font-weight: 600;
}

.principal {
  padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 4rem;
  max-width: 900px;
}

.fil {
  font-size: 0.9rem;
  color: var(--encre-douce);
  margin: 0 0 0.75rem;
}
.chapo {
  color: var(--encre-douce);
  margin: 0 0 1.5rem;
  max-width: 62ch;
}
.note {
  color: var(--encre-douce);
  font-size: 0.92rem;
  border-top: 1px solid var(--trait);
  padding-top: 1rem;
  margin-top: 2rem;
}
.vide {
  color: var(--encre-douce);
  font-style: italic;
  background: var(--papier);
  border: 1px dashed var(--trait);
  border-radius: var(--rayon);
  padding: 1.5rem;
  text-align: center;
}

/* --- Messages -------------------------------------------------------------- */

.message {
  border-radius: var(--rayon);
  padding: 0.8rem 1rem;
  margin: 0 0 1.25rem;
  border-left: 5px solid;
}
.message--erreur {
  background: #fdeceb;
  border-color: var(--danger);
  color: #6d1712;
}
.message--succes {
  background: #e9f5ed;
  border-color: var(--succes);
  color: #144927;
}
.message--attente {
  background: #fdf4e0;
  border-color: var(--attente);
  color: #5c4100;
}

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

.bouton {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--rayon);
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.bouton:hover {
  filter: brightness(1.12);
}
.bouton--discret {
  background: var(--papier);
  color: var(--accent);
}
.bouton--publier {
  background: var(--succes);
  border-color: var(--succes);
}

.lien-bouton {
  background: none;
  border: 0;
  padding: 0.55rem 0.4rem;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.lien-bouton--danger {
  color: var(--danger);
  margin-left: auto;
}

/* --- Connexion ------------------------------------------------------------- */

.connexion {
  max-width: 25rem;
  margin: 10vh auto;
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 2.25rem 2.25rem 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.connexion h1 {
  font-size: 1.55rem;
  margin-bottom: 0.3rem;
}
.connexion__sous {
  color: var(--encre-douce);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1.75rem;
  /* Sans cela, la ligne casse entre « Sainte » et « Clotilde ». */
  text-wrap: balance;
}
/* Le formulaire de connexion n'utilise pas `.champ__libelle` : son libellé est
   un simple `span` dans le `label`, pour que cliquer le texte donne le focus au
   champ. Il faut donc le remettre en forme ici. */
.connexion .champ {
  margin-bottom: 1.15rem;
}
.connexion .champ span {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
}
.connexion .champ input {
  max-width: none;
  padding: 0.6rem 0.7rem;
}
/* Le bouton respire, et occupe toute la largeur : c'est la seule action de la
   page, elle n'a pas à se chercher. */
.connexion .bouton {
  width: 100%;
  margin-top: 1.6rem;
  padding: 0.65rem 1.1rem;
}

/* --- Accueil --------------------------------------------------------------- */

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.carte {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-top: 5px solid var(--teinte);
  border-radius: var(--rayon);
  padding: 1.1rem 1.25rem 1.35rem;
}
.carte h2 {
  margin: 0 0 0.15rem;
  font-size: 1.1rem;
}
/* L'adresse publique, en toutes lettres. C'est le seul endroit de l'outil où
   l'on voit sous quel domaine les sites sortent réellement. */
.carte__adresse {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--encre-douce);
  text-decoration: none;
  border-bottom: 1px dotted var(--trait);
  margin-bottom: 0.9rem;
  overflow-wrap: anywhere;
}
.carte__adresse:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Visible des seuls lecteurs d'écran : « ouvre dans un nouvel onglet » n'a pas
   à encombrer la page, mais doit être annoncé. */
.invisible {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.carte__sections {
  list-style: none;
  margin: 0;
  padding: 0;
}
.carte__sections li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--fond);
}
.carte__nombre {
  color: var(--encre-douce);
  font-size: 0.85rem;
  margin-left: auto;
}
.pastille {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

/* --- Listes ---------------------------------------------------------------- */

.entete-liste {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.entete-liste > div {
  flex: 1 1 20rem;
}

.filtre {
  margin: 0 0 1rem;
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.6rem 0.9rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
}
.table th,
.table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--trait);
  vertical-align: middle;
}
.table th {
  background: var(--fond);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--encre-douce);
}
.table tr:last-child td {
  border-bottom: 0;
}
/* Un brouillon ne doit pas se confondre avec une page en ligne. */
.brouillon td {
  background: #fbfbf4;
}
.brouillon td:first-child a::after {
  content: ' · brouillon';
  color: var(--attente);
  font-size: 0.8rem;
  font-weight: 600;
}
.brouillon-marque {
  color: var(--attente);
  font-size: 0.8rem;
  font-weight: 600;
}
.oui {
  color: var(--succes);
  font-weight: 600;
}
.non {
  color: var(--encre-douce);
}
.mini {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

/* --- Galeries -------------------------------------------------------------- */

.galerie {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.vignette {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
}
.vignette a {
  color: inherit;
  text-decoration: none;
  display: block;
}
.vignette img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--fond);
}
.vignette__absente {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  color: var(--encre-douce);
  font-size: 0.85rem;
  background: var(--fond);
}
.vignette__legende {
  display: block;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* --- Formulaire ------------------------------------------------------------ */

.formulaire {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1.5rem;
}
.separateur {
  border-top: 1px solid var(--trait);
  padding-top: 1.25rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--encre-douce);
}
.champ {
  margin-bottom: 1.35rem;
}
.champ__libelle {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.obligatoire {
  color: var(--danger);
}
.aide {
  display: block;
  color: var(--encre-douce);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  max-width: 62ch;
}
.champ input[type='text'],
.champ input[type='email'],
.champ input[type='password'],
.champ input[type='number'],
.champ input[type='date'],
.champ textarea,
.champ select {
  width: 100%;
  max-width: 44rem;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: #fff;
}
.champ textarea {
  resize: vertical;
}
.champ--erreur input,
.champ--erreur textarea,
.champ--erreur select {
  border-color: var(--danger);
}
.champ__erreur {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0.3rem 0 0;
}
.lecture {
  margin: 0;
  padding: 0.5rem 0.65rem;
  background: var(--fond);
  border-radius: var(--rayon);
  white-space: pre-wrap;
  max-width: 44rem;
}
.bascule {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.bascule input {
  width: 1.2rem;
  height: 1.2rem;
}
.couleur {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}
.couleur input[type='text'] {
  width: 9rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--trait);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}

/* --- Éditeur de texte ------------------------------------------------------ */

.riche__outils {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border: 1px solid var(--trait);
  border-bottom: 0;
  border-radius: var(--rayon) var(--rayon) 0 0;
  padding: 0.35rem;
  background: var(--fond);
  max-width: 44rem;
}
.riche__outils button {
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
  font: inherit;
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: 4px;
  cursor: pointer;
}
.riche__outils button:hover {
  background: var(--accent-clair);
}
.riche__surface {
  border: 1px solid var(--trait);
  border-radius: 0 0 var(--rayon) var(--rayon);
  background: #fff;
  padding: 0.75rem 0.9rem;
  min-height: 12rem;
  max-width: 44rem;
  overflow-wrap: break-word;
}
.riche__surface h2 {
  margin: 1rem 0 0.4rem;
  font-size: 1.15rem;
}
.riche__surface p {
  margin: 0 0 0.8rem;
}

/* --- Médias ---------------------------------------------------------------- */

.media {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.75rem;
  max-width: 44rem;
}
.media__apercu img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.media__vide,
.media__nom {
  display: grid;
  place-items: center;
  width: 120px;
  height: 90px;
  background: var(--fond);
  color: var(--encre-douce);
  font-size: 0.85rem;
  border-radius: 4px;
  text-align: center;
  padding: 0.25rem;
}
.media__etat {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.88rem;
  color: var(--encre-douce);
}

/* --- Tableaux de lignes et étiquettes -------------------------------------- */

.paires table {
  border-collapse: collapse;
  margin-bottom: 0.5rem;
}
.paires td {
  padding: 0.15rem 0.3rem 0.15rem 0;
}
.paires input {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--trait);
  border-radius: 4px;
}

.etiquettes ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
}
.etiquettes li {
  background: var(--accent-clair);
  border-radius: 999px;
  padding: 0.15rem 0.35rem 0.15rem 0.75rem;
  font-size: 0.9rem;
}
.etiquettes li button {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  color: var(--encre-douce);
}

/* --- Sections rattachées --------------------------------------------------- */

.liees {
  margin-top: 2.5rem;
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1.25rem 1.5rem 1.5rem;
}
.liees h2 {
  margin-top: 0;
}
.compte {
  background: var(--fond);
  color: var(--encre-douce);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  font-size: 0.85rem;
}
.ancres {
  padding-left: 1.2rem;
  margin: 0 0 1rem;
}
.ancres li {
  padding: 0.2rem 0;
}
.depot {
  margin-bottom: 1rem;
}
.depot__etat {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--encre-douce);
}

.journal {
  background: var(--encre);
  color: #e6e8ea;
  padding: 1rem 1.25rem;
  border-radius: var(--rayon);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
