/* =====================================================================
   LIRISCOM — Pages de fiches CEE (chantier 6)
   fiche.php (/fiche/CODE) et apercu-fiches-cee.php SEULEMENT.
   Namespace .fc  ·  aucune dépendance Bootstrap / jQuery ; mêmes couleurs
   que navbar.css et footer.css ; polices de repli système si Manrope manque.
   ===================================================================== */

.fc-page {
  margin: 0;
  background: #f5f8f6;
  color: #07261d;
}

.fc, .fc * { box-sizing: border-box; }

.fc {
  --fc-green: #0A7F5D;
  --fc-green-700: #0e6e52;
  --fc-mint: #6FEDA8;
  --fc-mint-bg: #e4faee;
  --fc-ink: #07261d;
  --fc-ink-soft: #45594f;
  --fc-line: rgba(7, 38, 29, .12);

  display: block;
  font-family: "Manrope", "Manrope repli Arial", "Manrope repli Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.fc a { color: var(--fc-green-700); }
.fc a:hover { color: var(--fc-green); }
.fc a:focus-visible { outline: 2px solid var(--fc-green-700); outline-offset: 2px; border-radius: 4px; }

.fc-wrap {
  width: min(1100px, 94vw);
  margin-inline: auto;
  padding: 20px 0 0;
}

/* ---- Fil d'Ariane ---- */
.fc-ariane ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--fc-ink-soft);
}
.fc-ariane li + li::before { content: "›"; margin-right: 8px; opacity: .6; }
.fc-ariane [aria-current] { font-weight: 700; color: var(--fc-ink); }

/* ---- Bandeau d'aperçu ---- */
.fc-apercu {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px dashed var(--fc-green);
  border-radius: 10px;
  background: var(--fc-mint-bg);
  font-size: 14.5px;
}

/* ---- En-tête de fiche ---- */
.fc-tete {
  padding: clamp(18px, 3vw, 30px);
  background: #fff;
  border: 1px solid var(--fc-line);
  border-radius: 16px;
}
.fc-tete__haut { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.fc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--fc-ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.fc-tete__secteur { font-weight: 600; color: var(--fc-ink-soft); }

/* Titre long (BAT-TH-116 : ~150 caractères) : il revient à la ligne au lieu
   de déborder, et sa taille baisse avec la largeur. */
.fc-titre {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.fc-source { margin: 0 0 6px; color: var(--fc-ink-soft); }
.fc-note { margin: 0 0 6px; font-size: 14.5px; color: var(--fc-ink-soft); font-style: italic; }

.fc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--fc-line);
}
.fc-meta dt { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--fc-ink-soft); }
.fc-meta dd { margin: 0; font-weight: 700; }

.fc-h2 { margin: 0 0 12px; font-size: 1.2rem; line-height: 1.3; }

/* ---- Documents / liste d'aperçu ---- */
.fc-pieces__liste, .fc-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fc-piece {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--fc-line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease;
}
.fc a.fc-piece { color: var(--fc-ink); }
.fc a.fc-piece:hover { border-color: var(--fc-green); background: var(--fc-mint-bg); color: var(--fc-ink); }
.fc-piece__nom { font-weight: 700; overflow-wrap: anywhere; }
.fc-piece__detail { font-size: 14px; color: var(--fc-ink-soft); }

.fc-absent {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-left: 4px solid #c98a00;
  background: #fff8e6;
  border-radius: 0 10px 10px 0;
}

/* ---- Recherche (liste d'aperçu) ---- */
.fc-recherche { margin: 24px 0 14px; }
.fc-recherche label { display: block; font-weight: 700; margin-bottom: 6px; }
.fc-recherche input {
  width: 100%;
  max-width: 520px;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
  background: #fff;
}
.fc-recherche input:focus { outline: 2px solid var(--fc-green); outline-offset: 1px; }
.fc-recherche__statut { min-height: 1.6em; margin: 6px 0 0; font-size: 14px; color: var(--fc-ink-soft); }
.fc-liste__item[hidden] { display: none; }

/* ---- Bouton PDF ---- */
.fc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}
/* Fond uni et non le dégradé de la charte : le blanc sur sa teinte la plus
   claire (#6FEDA8) n'atteint pas 4,5:1. Blanc sur #0e6e52 ≈ 6,2:1 ; au
   survol, #0a5640 est plus foncé, donc plus contrasté encore. */
.fc a.fc-btn--plein { color: #fff; background: #0e6e52; }
.fc a.fc-btn--plein:hover,
.fc a.fc-btn--plein:focus-visible { color: #fff; background: #0a5640; }

/* =====================================================================
   PAGE DE FICHE (fiche.php) — tout est limité à .fc-fiche, la liste
   d'aperçu n'en reçoit rien.

   Ordre du HTML : .fc-aside (informations, documents, contacts) PUIS
   .fc-lecteur. Seule la grille place le lecteur à gauche ; rien n'est
   dupliqué selon la taille d'écran.

   EMPILÉ par défaut (téléphone, tablette, fenêtre basse, zoom fort) :
   informations, bouton PDF, contacts, documents ; cadre PDF masqué, sans
   place réservée — sur téléphone il reste souvent vide (Android) ou
   n'affiche que la première page (iPhone). Le bouton le remplace.

   DEUX COLONNES seulement si la fenêtre est assez large ET assez haute
   (1025 × 640 px au moins) : PDF à gauche (60 %), dès le bas du menu et
   jusqu'au bas de l'écran ; informations à droite (40 %), qui défilent
   dans leur zone, contacts fixés au bas de la colonne. Le pied de page
   reste dans le flux, sous la grille.
   ===================================================================== */
.fc-fiche {
  /* Hauteur de la barre de navigation de navbar.css : 74 px + filet de
     1 px. Elle est la même menu ouvert ou replié (burger). */
  --fc-nav-h: 75px;
}

.fc-fiche .fc-split {
  width: min(760px, 94vw);
  margin-inline: auto;
  padding: 12px 0 24px;
}
.fc-fiche .fc-aside { display: flex; flex-direction: column; gap: 16px; }
/* Le conteneur défilant s'efface : ses enfants deviennent des éléments de
   .fc-aside, que l'ordre visuel range autour des contacts. Ses attributs
   (région, tabindex) restent dans le HTML. */
.fc-fiche .fc-scroll { display: contents; }
.fc-fiche .fc-info { order: 1; }
.fc-fiche .fc-actions { order: 2; }
.fc-fiche .fc-pieces { order: 3; }
.fc-fiche .fc-lecteur { display: none; }

/* ---- Informations, compactes ---- */
.fc-fiche .fc-ariane ol { margin: 0 0 6px; font-size: 13px; }
.fc-fiche .fc-apercu { margin: 0 0 10px; padding: 4px 10px; font-size: 13px; line-height: 1.45; }
.fc-fiche .fc-tete__haut { margin: 0 0 6px; }
.fc-fiche .fc-badge { padding: 2px 9px; font-size: 13px; }
.fc-fiche .fc-tete__secteur { font-size: 14px; }
/* Jamais tronqué (titre BAT-TH-116 d'environ 150 caractères) : il revient
   à la ligne, seule sa taille baisse. */
.fc-fiche .fc-titre { margin: 0 0 8px; font-size: clamp(1.2rem, 1rem + .9vw, 1.6rem); }
.fc-fiche .fc-meta {
  flex-direction: column;
  gap: 1px;
  margin: 0 0 8px;
  padding-top: 8px;
  font-size: 14px;
  line-height: 1.45;
}
.fc-fiche .fc-meta div { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.fc-fiche .fc-meta dt { font-size: 11.5px; }
.fc-fiche .fc-meta dt::after { content: " :"; }
.fc-fiche .fc-source { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.fc-fiche .fc-note { margin: 0 0 4px; font-size: 13.5px; line-height: 1.45; }
.fc-fiche .fc-open { min-height: 44px; margin-top: 8px; }

.fc-fiche .fc-h2 { margin: 0 0 8px; font-size: 1rem; }

/* ---- Documents ---- */
.fc-fiche .fc-pieces__liste { gap: 6px; }
.fc-fiche .fc-piece { padding: 8px 12px; border-radius: 10px; }
.fc-fiche .fc-piece__detail { font-size: 13px; }
/* Document affiché dans le lecteur (fiche-cee.js, deux colonnes seulement) :
   fond et barre intérieure. box-shadow inset et couleur de bordure ne changent
   ni la taille ni la place du lien. */
.fc-fiche .fc-piece[aria-current="true"] {
  background: var(--fc-mint-bg);
  border-color: var(--fc-green);
  box-shadow: inset 4px 0 0 var(--fc-green-700);
}
.fc-fiche .fc-absent { margin: 8px 0 0; padding: 8px 12px; font-size: 14px; line-height: 1.45; }

/* ---- Contacts : quatre boutons compacts, 44 px au moins ---- */
.fc-fiche .fc-actions__grille {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fc-fiche a.fc-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  height: 100%;
  padding: 8px 10px;
  border: 2px solid var(--fc-green);
  border-radius: 12px;
  background: #fff;
  color: var(--fc-green-700);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.fc-fiche a.fc-action:hover,
.fc-fiche a.fc-action:focus-visible { background: var(--fc-mint-bg); color: var(--fc-green-700); }
.fc-fiche .fc-liens { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 8px 0 0; font-size: 13.5px; font-weight: 600; }

/* ---- Deux colonnes ---- */
@media (min-width: 1025px) and (min-height: 640px) {
  .fc-fiche .fc-split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    width: 100%;
    margin: 0;
    padding: 0;
    height: calc(100vh - var(--fc-nav-h));
    height: calc(100dvh - var(--fc-nav-h));
  }

  /* Lecteur : à gauche, sans marge, sans titre ni bouton au-dessus. */
  .fc-fiche .fc-lecteur {
    display: block;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    margin: 0;
    background: #fff;
    border-right: 1px solid var(--fc-line);
  }
  .fc-fiche .fc-lecteur iframe { display: block; width: 100%; height: 100%; border: 0; }

  .fc-fiche .fc-aside { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; gap: 0; }
  .fc-fiche .fc-scroll {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 20px 16px;
  }
  /* Contour net et intérieur : la zone est au bord de la fenêtre. */
  .fc-fiche .fc-scroll:focus-visible { outline: 3px solid var(--fc-green-700); outline-offset: -3px; }
  .fc-fiche .fc-pieces { margin-top: 16px; }
  .fc-fiche .fc-actions {
    flex: 0 0 auto;
    padding: 10px 20px 12px;
    background: #fff;
    border-top: 1px solid var(--fc-line);
  }
}

/* =====================================================================
   HISTORIQUE (chantier 9) — fiche.php seulement. Tout est limité à
   .fc-fiche--historique (historique affiché) ou .fc-fiche--ancienne :
   une fiche en vigueur sans historique garde exactement la présentation
   du chantier 6.
   ===================================================================== */
.fc-etiquette {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid #8a5a00;
  border-radius: 999px;
  background: #fff8e6;
  color: #6b4500;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.fc-fiche .fc-note--ancienne { font-style: normal; color: var(--fc-ink); }

/* Empilé : l'historique vient après les documents de la fiche. */
.fc-fiche .fc-histoire { order: 4; }
.fc-fiche .fc-histoire__bandeau {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 4px solid var(--fc-green-700);
  background: #fff;
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
  line-height: 1.45;
}
.fc-fiche .fc-version {
  margin: 0 0 8px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
}
.fc-fiche .fc-version[open] { padding-bottom: 10px; }
.fc-fiche .fc-version--courante { border-color: var(--fc-green); }
.fc-fiche .fc-version > summary {
  padding: 10px 0;
  cursor: pointer;
  min-height: 44px;
}
.fc-fiche .fc-version > summary:focus-visible { outline: 2px solid var(--fc-green-700); outline-offset: 2px; border-radius: 6px; }
.fc-fiche .fc-version__titre { display: inline; margin: 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.fc-fiche .fc-version > ul { margin-top: 4px; }
.fc-fiche .fc-version__statut {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--fc-mint-bg);
  color: var(--fc-green-700);
  font-size: 12.5px;
  font-weight: 700;
}
.fc-fiche .fc-histoire__doc { display: grid; gap: 4px; }
.fc-fiche .fc-histoire__partage { margin: 0; padding: 0 12px; }
.fc-fiche .fc-piece--absente { margin: 0; border-style: dashed; background: transparent; }
.fc-fiche .fc-avert { padding: 0 12px; font-size: 13px; line-height: 1.45; }
.fc-fiche .fc-avert > summary { cursor: pointer; font-weight: 700; color: #6b4500; }
.fc-fiche .fc-avert > summary:focus-visible { outline: 2px solid var(--fc-green-700); outline-offset: 2px; border-radius: 4px; }
.fc-fiche .fc-avert p { margin: 4px 0 0; }

/* Une seule action (ancienne fiche) : toute la largeur. */
.fc-fiche .fc-actions__grille li:only-child { grid-column: 1 / -1; }

/* Ancienne fiche sans PDF à afficher : le message reste visible empilé. */
.fc-fiche .fc-lecteur--vide { display: block; padding: 12px 0 0; }

/* Bandeau du lecteur : au-dessus du cadre, qu'il ne recouvre jamais. */
.fc-fiche .fc-lecteur__bandeau {
  margin: 0;
  padding: 8px 14px;
  background: #fff8e6;
  border-bottom: 1px solid #c98a00;
  color: var(--fc-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.fc-fiche .fc-lecteur__bandeau[hidden] { display: none; }

/* ---- Historique, prototype v1 (décisions d'Ilan du 15/10/2026) ----
   Un seul bloc replié « Historique des versions (N) » ; dedans, la phrase de
   principe, « En savoir plus » (bandeau et notes uniques), puis les versions.
   Une ligne par pièce : le document principal, puis « Autres exemplaires ». */
.fc-fiche .fc-histoire__global > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
}
.fc-fiche .fc-histoire__global > summary .fc-h2 { display: inline; margin: 0; }
.fc-fiche .fc-histoire__global > summary:focus-visible,
.fc-fiche .fc-savoir > summary:focus-visible,
.fc-fiche .fc-exemplaires > summary:focus-visible { outline: 2px solid var(--fc-green-700); outline-offset: 2px; border-radius: 6px; }
.fc-fiche .fc-histoire__resume { margin: 0 0 6px; font-size: 14px; line-height: 1.45; font-weight: 600; }
.fc-fiche .fc-savoir { margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; }
.fc-fiche .fc-savoir > summary { cursor: pointer; font-weight: 700; color: var(--fc-green-700); min-height: 32px; }
.fc-fiche .fc-savoir .fc-histoire__bandeau { margin: 6px 0 8px; }
.fc-fiche .fc-note-unique { margin: 0 0 8px; padding: 8px 12px; background: #fff8e6; border-radius: 10px; }
.fc-fiche .fc-note-unique:focus { outline: 2px solid var(--fc-green-700); outline-offset: 2px; }
.fc-fiche .fc-note-unique__titre { margin: 0 0 4px; font-size: 13.5px; }
.fc-fiche .fc-note-unique p { margin: 0 0 4px; }
.fc-fiche .fc-note__raisons { margin: 4px 0 0; padding-left: 18px; }
.fc-fiche .fc-note__raisons li:target,
.fc-fiche .fc-note-unique:target { background: var(--fc-mint-bg); }
.fc-fiche .fc-version__dates { display: block; font-size: 13px; color: var(--fc-ink-soft); }
/* Prototype v2 : « Remplacée par … », sous l'en-tête de la version. */
.fc-fiche .fc-version__remplacee { margin: 0 0 8px; font-size: 13.5px; }
.fc-fiche .fc-renvoi { margin: 0 0 8px; font-size: 13.5px; }
/* C1 (ECH-20261015-161012) : sous le renvoi, liste compacte des documents
   renvoyés qui portent une marque (badge, lien Légifrance) : type puis
   mêmes marques que les exemplaires, sans lien vers le fichier. */
.fc-fiche .fc-renvoi__liste { list-style: none; margin: -4px 0 8px; padding: 0; display: grid; gap: 4px; }
.fc-fiche .fc-renvoi__liste li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.fc-fiche .fc-renvoi__type { font-size: 12.5px; font-weight: 700; color: var(--fc-ink-soft); }
.fc-fiche .fc-renvoi__liste .fc-marques { padding: 0; }
.fc-fiche .fc-types { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fc-fiche .fc-type__nom { margin: 0 0 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--fc-ink-soft); }
.fc-fiche .fc-exemplaires__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fc-fiche .fc-exemplaire { display: grid; gap: 2px; }
.fc-fiche .fc-exemplaires { margin: 4px 0 0; }
.fc-fiche .fc-exemplaires > summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--fc-green-700); min-height: 32px; }
.fc-fiche .fc-exemplaires[open] > summary { margin-bottom: 6px; }
.fc-fiche .fc-marques { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0 12px; font-size: 12.5px; }
.fc-fiche .fc-marque {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff8e6;
  color: #6b4500;
  font-weight: 700;
}
.fc-fiche a.fc-marque { color: #6b4500; text-decoration: underline; }
.fc-fiche .fc-marque--identique { background: var(--fc-mint-bg); color: var(--fc-green-700); }

@media (min-width: 1025px) and (min-height: 640px) {
  .fc-fiche--historique .fc-lecteur { display: flex; flex-direction: column; }
  .fc-fiche--historique .fc-lecteur iframe { flex: 1 1 auto; min-height: 0; height: auto; }
  .fc-fiche .fc-lecteur--vide { padding: 24px; }
  .fc-fiche .fc-histoire { margin-top: 16px; }
  /* Prototype v1 : deux colonnes seulement. Le PDF prend tout l'espace
     disponible ; la colonne de droite (informations, documents, historique
     replié, dans UNE seule zone qui défile, contacts en bas) a une largeur
     bornée. Plus de mode trois colonnes : le correctif C5 de la reprise
     site v2, propre à ce mode, disparaît avec lui. Le seuil de hauteur
     (640 px) est inchangé. */
  .fc-fiche--historique .fc-split { grid-template-columns: minmax(0, 1fr) clamp(380px, 28vw, 440px); }
}

@media (prefers-reduced-motion: reduce) {
  .fc * { transition-duration: .001ms !important; }
}
