/* =============================================================
   Help ISFSC — design system léger (Phase 1)
   Thème clair uniquement, mobile-first, contrastes AA.
   Aucune ressource externe : polices système, icônes en sprite SVG local.
   ============================================================= */

/* ---------- 1. Variables ---------- */
:root {
  /* Teinte institutionnelle : bleu pétrole */
  --accent:        #0f5c68;
  --accent-sombre: #0b4550;
  --accent-clair:  #e2eff1;

  /* Gris chauds */
  --encre:       #2d2a24;
  --encre-douce: #6a6459;
  --fond:        #faf9f6;
  --surface:     #ffffff;
  --bord:        #e6e2da;
  --bord-fort:   #cbc4b8;

  /* Statuts : fond clair + texte foncé (contraste AA sur le fond) */
  --statut-nouveau-fond:     #e4ecf8;
  --statut-nouveau-texte:    #1c4f8a;
  --statut-en-cours-fond:    #ddedf0;
  --statut-en-cours-texte:   #0b535e;
  --statut-en-attente-fond:  #fbeed3;
  --statut-en-attente-texte: #7a4d05;
  --statut-resolu-fond:      #e0f1e3;
  --statut-resolu-texte:     #1d6633;
  --statut-clos-fond:        #eceae5;
  --statut-clos-texte:       #57534a;

  --erreur:      #8c2f28;
  --erreur-fond: #faeceb;
  --erreur-bord: #e7c0bc;

  --rayon: 10px;
  --ombre: 0 1px 3px rgba(45, 42, 36, 0.07);
  --anneau: #2a8091;
}

/* ---------- 2. Reset minimal ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--encre);
  background: var(--fond);
}

h1, h2, h3, p, ul, ol, figure {
  margin: 0 0 0.75rem;
}

img, svg {
  max-width: 100%;
  vertical-align: middle;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* Focus visible net et homogène (navigation clavier) */
:focus-visible {
  outline: 3px solid var(--anneau);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 3. Typographie de base ---------- */
h1 {
  font-size: clamp(1.45rem, 3vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

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

/* ---------- 4. Gabarit ---------- */
.contenu {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin-inline: auto;
  padding: 1.5rem 1rem 3rem;
}

/* Lien d'évitement (premier élément focusable de chaque page) */
.evitement {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 600;
}

.evitement:focus {
  left: 0;
}

/* Le sprite SVG injecté ne doit jamais s'afficher lui-même */
.sprite-icones {
  display: none;
}

.icone {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

/* ---------- 5. Entête ---------- */
.entete {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--bord);
}

.entete__inner {
  max-width: 64rem;
  margin-inline: auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.entete__marque {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--encre);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.entete__logo {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.entete__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.entete__lien {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  color: var(--encre);
  text-decoration: none;
  font-weight: 500;
}

.entete__lien:hover {
  background: var(--fond);
  color: var(--encre);
}

.entete__lien[aria-current="page"] {
  background: var(--accent-clair);
  color: var(--accent-sombre);
  font-weight: 600;
}

.entete__compte {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.entete__nom {
  color: var(--encre-douce);
  font-size: 0.9rem;
}

@media (max-width: 28em) {
  .entete__nom {
    display: none;
  }
}

/* ---------- 6. Pied de page ---------- */
.pied {
  border-top: 1px solid var(--bord);
  background: var(--surface);
}

.pied__inner {
  max-width: 64rem;
  margin-inline: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  font-size: 0.875rem;
  color: var(--encre-douce);
}

.pied__inner--centre {
  justify-content: center;
  text-align: center;
}

.pied__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-inline-start: auto;
}

.pied__inner--centre .pied__nav {
  margin-inline-start: 0;
}

/* ---------- 7. Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn--primaire {
  background: var(--accent);
  color: #fff;
}

.btn--primaire:hover:not(:disabled) {
  background: var(--accent-sombre);
  color: #fff;
}

.btn--secondaire {
  background: var(--surface);
  border-color: var(--bord-fort);
  color: var(--encre);
}

.btn--secondaire:hover:not(:disabled) {
  background: var(--fond);
}

.btn--discret {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.25rem 0.5rem;
  min-height: 0;
}

.btn--compact {
  min-height: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.btn--large {
  width: 100%;
  padding: 0.8rem 1.25rem;
  font-size: 1.05rem;
}

/* ---------- 8. Cartes ---------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1.25rem;
}

.carte--tableau {
  padding: 0;
  overflow: hidden;
}

/* ---------- 9. Badges de statut ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.15em 0.65em;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
}

.badge::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.badge--nouveau {
  background: var(--statut-nouveau-fond);
  color: var(--statut-nouveau-texte);
}

.badge--en_cours {
  background: var(--statut-en-cours-fond);
  color: var(--statut-en-cours-texte);
}

.badge--en_attente {
  background: var(--statut-en-attente-fond);
  color: var(--statut-en-attente-texte);
}

.badge--resolu {
  background: var(--statut-resolu-fond);
  color: var(--statut-resolu-texte);
}

.badge--clos,
.badge--inconnu {
  background: var(--statut-clos-fond);
  color: var(--statut-clos-texte);
}

/* ---------- 10. Onglets ---------- */
.onglets {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--bord);
  margin: 1.25rem 0 1rem;
}

.onglet {
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  padding: 0.55rem 0.9rem;
  margin-bottom: -1px;
  color: var(--encre-douce);
  font-weight: 500;
  cursor: pointer;
}

.onglet:hover {
  color: var(--encre);
}

.onglet[aria-selected="true"] {
  color: var(--accent-sombre);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- 11. Tableau responsive ---------- */
.tableau-defilant {
  overflow-x: auto;
}

.tableau {
  width: 100%;
  border-collapse: collapse;
}

.tableau th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--encre-douce);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--bord);
}

.tableau td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--bord);
  vertical-align: top;
}

.tableau tbody tr:last-child td {
  border-bottom: 0;
}

.tableau tbody tr:hover {
  background: var(--fond);
}

.tableau__numero {
  font-variant-numeric: tabular-nums;
  color: var(--encre-douce);
  white-space: nowrap;
}

.tableau__activite {
  color: var(--encre-douce);
  white-space: nowrap;
  font-size: 0.9rem;
}

/* En mobile : les lignes deviennent des cartes empilées */
@media (max-width: 40em) {
  .tableau thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .tableau,
  .tableau tbody,
  .tableau tr,
  .tableau td {
    display: block;
  }

  .tableau tr {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--bord);
  }

  .tableau tbody tr:last-child {
    border-bottom: 0;
  }

  .tableau td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    border: 0;
    padding: 0.25rem 0;
  }

  .tableau td::before {
    content: attr(data-libelle);
    flex: none;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--encre-douce);
  }

  .tableau td.tableau__demande {
    display: block;
  }

  .tableau td.tableau__demande::before {
    display: block;
    margin-bottom: 0.15rem;
  }
}

/* ---------- 12. Formulaires ---------- */
.champ {
  margin-bottom: 1.1rem;
}

.champ > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--bord-fort);
  border-radius: 8px;
  background: var(--surface);
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
}

.champ-aide {
  font-size: 0.85rem;
  color: var(--encre-douce);
  margin-top: 0.3rem;
}

.champ-erreur {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--erreur);
  margin-top: 0.3rem;
}

/* ---------- 13. Stepper (Reçue → En cours → Résolue → Clôturée) ---------- */
.stepper {
  display: flex;
  list-style: none;
  margin: 1.25rem 0;
  padding: 0;
}

.stepper__etape {
  flex: 1 1 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--encre-douce);
}

/* Trait de liaison : du centre de l'étape précédente au centre de celle-ci */
.stepper__etape::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--bord-fort);
}

.stepper__etape:first-child::before {
  display: none;
}

.stepper__etape.est-faite::before,
.stepper__etape.est-active::before {
  background: var(--accent);
}

.stepper__puce {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bord-fort);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: #fff;
}

.stepper__puce .icone {
  width: 16px;
  height: 16px;
}

.stepper__etape.est-faite .stepper__puce {
  background: var(--accent);
  border-color: var(--accent);
}

.stepper__etape.est-active .stepper__puce {
  border-color: var(--accent);
}

.stepper__etape.est-active .stepper__puce::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

/* Étape à la fois faite et active (demande clôturée) : la coche suffit */
.stepper__etape.est-faite .stepper__puce::after {
  content: none;
}

.stepper__etape.est-active {
  color: var(--encre);
  font-weight: 600;
}

/* Variante « en attente de votre réponse » : l'étape active passe en ambre */
.stepper__etape.est-attente .stepper__puce {
  border-color: var(--statut-en-attente-texte);
  background: var(--statut-en-attente-fond);
}

.stepper__etape.est-attente .stepper__puce::after {
  background: var(--statut-en-attente-texte);
}

.stepper__etape.est-attente {
  color: var(--statut-en-attente-texte);
}

/* ---------- 14. Alertes et états vides ---------- */
.alerte {
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  text-align: left;
}

.alerte--erreur {
  background: var(--erreur-fond);
  border: 1px solid var(--erreur-bord);
  color: var(--erreur);
}

.alerte--info {
  background: var(--accent-clair);
  border: 1px solid #bcd8dd;
  color: var(--accent-sombre);
}

.etat-vide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--encre-douce);
}

.etat-vide .icone {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--bord-fort);
}

.etat-vide strong {
  font-size: 1.1rem;
  color: var(--encre);
}

.etat-vide .btn {
  margin-top: 0.75rem;
}

/* ---------- 15. Barre de titre ---------- */
.barre-titre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.barre-titre h1 {
  margin: 0;
}

/* ---------- 16. Page de connexion ---------- */
.connexion {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.connexion__carte {
  width: 100%;
  max-width: 26rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 2.25rem 1.5rem;
  text-align: center;
}

.connexion__logo {
  width: 56px;
  height: 56px;
  color: var(--accent);
}

.connexion__carte h1 {
  margin: 0;
}

.connexion__accroche {
  margin: 0;
  font-size: 1.05rem;
  color: var(--encre-douce);
}

.connexion__carte .alerte {
  width: 100%;
}

/* ---------- 17. Prose (pages de contenu, ex. confidentialité) ---------- */
.prose h1 {
  margin-bottom: 0.75rem;
}

.prose h2 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.prose p,
.prose li {
  max-width: 68ch;
}

.prose ul {
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.a-valider {
  background: var(--statut-en-attente-fond);
  color: var(--statut-en-attente-texte);
  border-radius: 4px;
  padding: 0 0.3em;
  font-size: 0.85em;
  font-weight: 600;
}

/* ---------- 18. Utilitaires ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.texte-doux {
  color: var(--encre-douce);
}

.texte-petit {
  font-size: 0.875rem;
}

.u-centre {
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
