/* =========================================================
   Wiki pathologies — thème Azergo (orange)
   Feuille de style unique. Polices : Montserrat (titres), Inter (texte)
   <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
   ========================================================= */

:root {
  /* Couleurs */
  --orange: #F28C28;          /* couleur majoritaire : bandeau, barres, pastilles numérotées */
  --orange-fonce: #B4500A;    /* boutons (texte blanc), liens, textes orange */
  --orange-clair: #FFE7D1;    /* étiquette famille, bandeau "Problématiques au poste" */
  --orange-pale: #FFF6EC;     /* puces questions fréquentes */
  --orange-bord: #F6C79A;     /* bordures orangées */
  --surligne: #FFE1BF;        /* <mark> des mots trouvés */
  --brun: #3A1F0A;            /* texte posé sur l'orange (jamais de bleu sur orange) */
  --brun-logo: #5C2D04;       /* colonne + marque-page du logo */
  --encre: #0E2A47;           /* texte courant sur fond blanc */
  --gris: #4E6277;            /* texte secondaire */
  --fond: #FAF6F2;            /* fond de page */
  --fond-fiche: #FFFBF7;      /* zone dépliée de la fiche */
  --blanc: #FFFFFF;
  --bord: #DCE5E7;
  --bord-doux: #E6EDEE;
  --bord-fiche: #F3E4D6;

  /* Typo */
  --font-titre: Montserrat, system-ui, sans-serif;
  --font-texte: Inter, system-ui, sans-serif;

  /* Rayons */
  --r-s: 10px;
  --r-m: 12px;
  --r-l: 18px;
  --r-xl: 20px;
  --r-pill: 999px;

  --largeur: 1120px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--font-texte); }
a { color: var(--orange-fonce); }
a:hover { color: var(--brun); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--largeur); margin: 0 auto; padding-inline: 24px; }

/* ---------- En-tête ---------- */
.site-header { background: var(--blanc); border-bottom: 1px solid var(--bord); }
.site-header .wrap { padding-block: 14px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--encre); }
.brand img, .brand svg { width: 44px; height: 44px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name strong { font-family: var(--font-titre); font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.brand-name strong span { font-weight: 600; }
.brand-name small { font-size: 12px; font-weight: 500; color: var(--gris); }

/* ---------- Bandeau orange + recherche ---------- */
.hero { background: var(--orange); color: var(--brun); }
.hero .wrap { padding-block: 56px 64px; display: flex; flex-direction: column; gap: 20px; }
.hero--compact .wrap { padding-block: 32px 36px; gap: 16px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.hero h1 { margin: 0; font-family: var(--font-titre); font-weight: 800; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.02em; max-width: 760px; }
.hero p { margin: 0; font-size: 17px; line-height: 1.6; max-width: 680px; }

.search { display: flex; flex-wrap: wrap; gap: 10px; background: var(--blanc); border-radius: var(--r-l); padding: 8px; box-shadow: 0 12px 32px rgba(120, 50, 0, .22); }
.search-field { flex: 999 1 320px; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.search-field input { flex: 1; min-width: 0; height: 52px; border: 0; outline: none; background: transparent; font: inherit; font-size: 17px; color: var(--encre); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-m); font-family: var(--font-titre); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--orange-fonce); color: var(--blanc); }
.search .btn-primary { flex: 1 1 140px; height: 52px; }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.filter label { font-size: 14px; font-weight: 600; }
.filter select { height: 44px; padding: 0 14px; border: 1px solid var(--blanc); border-radius: var(--r-s); background: var(--blanc); color: var(--brun); font: inherit; font-size: 14px; }

/* ---------- Contenu ---------- */
.content { padding-block: 32px 64px; display: flex; flex-direction: column; gap: 32px; }
.section-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--gris); }
.h2 { margin: 0; font-family: var(--font-titre); font-size: 20px; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--orange-bord); background: var(--orange-pale); color: var(--encre); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }

.result-meta { margin: 0; font-size: 15px; color: var(--gris); }
.result-meta strong { color: var(--encre); }

/* ---------- Fiche (carte résultat) ---------- */
.fiche { background: var(--blanc); border: 1px solid var(--orange-bord); border-radius: var(--r-xl); overflow: hidden; box-shadow: 0 10px 30px rgba(120, 50, 0, .08); }
.fiche-head { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.famille { align-self: flex-start; padding: 6px 12px; border-radius: var(--r-pill); background: var(--orange-clair); color: var(--orange-fonce); font-size: 13px; font-weight: 600; }
.fiche-title { margin: 0; font-family: var(--font-titre); font-size: 30px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; }
mark { background: var(--surligne); color: inherit; border-radius: 6px; padding: 0 4px; }
.label-caps { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--gris); }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { padding: 8px 14px; border-radius: var(--r-s); background: var(--fond); border: 1px solid #EFE3D8; font-size: 15px; }

/* Dépliant "Voir toute la fiche" : <details> natif */
.fiche details { border-top: 1px solid var(--bord-fiche); }
.fiche summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 28px; cursor: pointer; font-family: var(--font-titre); font-weight: 700; font-size: 16px; color: var(--orange-fonce); }
.fiche summary::-webkit-details-marker { display: none; }
.fiche summary svg { transition: transform .15s ease; }
.fiche details[open] summary svg { transform: rotate(90deg); }

.fiche-body > * { border-top: 1px solid var(--bord-fiche); padding: 28px; }
.fiche-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.fiche-grid--tinted { background: var(--fond-fiche); }
.fiche-section { display: flex; flex-direction: column; gap: 8px; }
.fiche-section h4 { margin: 0; display: flex; align-items: center; gap: 10px; font-family: var(--font-titre); font-size: 17px; font-weight: 700; }
.fiche-section p { margin: 0; font-size: 16px; line-height: 1.65; }
.icon-tile { width: 32px; height: 32px; flex: none; border-radius: var(--r-s); background: var(--orange-clair); color: var(--orange-fonce); display: flex; align-items: center; justify-content: center; }

.poste { background: var(--orange-clair); display: flex; flex-direction: column; gap: 12px; }
.poste .tags li { border: 0; border-radius: var(--r-pill); background: var(--blanc); color: var(--brun); font-size: 14px; font-weight: 500; }

.sources { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sources a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 15px; font-weight: 500; }

/* ---------- Autres résultats ---------- */
.others { display: flex; flex-direction: column; background: var(--blanc); border: 1px solid var(--bord); border-radius: 16px; overflow: hidden; }
.other { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 18px 22px; text-decoration: none; color: var(--encre); border-bottom: 1px solid var(--bord-doux); }
.other:last-child { border-bottom: 0; }
.other:hover { background: var(--orange-pale); }
.other-main { flex: 999 1 320px; display: flex; flex-direction: column; gap: 4px; }
.other-title { font-family: var(--font-titre); font-weight: 700; font-size: 17px; }
.other-sub { font-size: 14px; color: var(--gris); }
.other-side { flex: 1 1 200px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; font-size: 13px; color: var(--gris); }
.score { width: 72px; height: 6px; border-radius: 3px; background: var(--bord-doux); overflow: hidden; }
.score > span { display: block; height: 100%; border-radius: 3px; background: var(--orange); }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--bord); background: var(--blanc); }
.site-footer .wrap { padding-block: 24px; display: flex; gap: 12px; align-items: flex-start; }
.site-footer p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--gris); max-width: 760px; }

button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--brun); outline-offset: 2px; }

/* Ajouts pour l'application (boutons « Autres fiches », message vide) */
button.other { width: 100%; border: 0; background: var(--blanc); font: inherit; text-align: left; cursor: pointer; }
.empty { padding: 20px 22px; color: var(--gris); background: var(--blanc); border: 1px solid var(--bord); border-radius: 16px; }
[hidden] { display: none !important; }

/* ---- Barre de recherche : pas de cadre noir au clic, repère discret sur la barre ---- */
.search-field input:focus-visible { outline: none; }

/* ---- Fiche ouverte ---- */
.fiche summary .lbl-open { display: none; }
.fiche details[open] > summary .lbl-open { display: inline; }
.fiche details[open] > summary .lbl-closed { display: none; }
.fiche details[open] > summary { background: var(--orange-pale); }

.fiche-body { background: var(--fond-fiche); border-top: 1px solid var(--bord-fiche); padding: 24px; display: grid; gap: 16px; }
.fiche-body > * { border-top: 0; padding: 0; }
.fiche-body .fiche-grid, .fiche-body .fiche-grid--tinted { background: none; gap: 16px; }
.fiche-body .fiche-section { background: var(--blanc); border: 1px solid var(--bord-fiche); border-radius: var(--r-l); padding: 20px 22px; gap: 10px; }
.fiche-body .fiche-section h4::before { content: ""; flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--orange); }

.fiche-body .poste { background: linear-gradient(135deg, var(--orange-clair), var(--orange-pale)); border: 1px solid var(--orange-bord); border-radius: var(--r-l); padding: 20px 22px; }
.fiche-body .poste .label-caps { color: var(--orange-fonce); display: flex; align-items: center; gap: 10px; }
.fiche-body .poste .label-caps::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--orange-fonce); }
.fiche-body .poste .tags li { box-shadow: 0 1px 2px rgba(120,50,0,.08); transition: transform .15s, box-shadow .15s; }
.fiche-body .poste .tags li:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(120,50,0,.12); }

.fiche-body .sources { gap: 8px; }
.fiche-body .sources a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-s); background: var(--orange-pale); border: 1px solid var(--bord-fiche); color: var(--orange-fonce); font-weight: 600; text-decoration: none; transition: background .15s; }
.fiche-body .sources a::after { content: "↗"; flex: none; }
.fiche-body .sources a:hover { background: var(--orange-clair); }

.fiche details[open] .fiche-body { animation: ficheIn .25s ease-out; }
@keyframes ficheIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Exploration par famille (section repliée sous la recherche) ---- */
.explore { background: var(--blanc); border: 1px solid var(--bord); border-radius: 16px; margin-bottom: 24px; }
.explore > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 22px; font-family: var(--font-titre); font-weight: 700; font-size: 16px; color: var(--orange-fonce); }
.explore > summary::-webkit-details-marker { display: none; }
.explore > summary::after { content: "+"; font-size: 22px; line-height: 1; }
.explore[open] > summary::after { content: "−"; }
.explore[open] > summary { border-bottom: 1px solid var(--bord-doux); }
.explore-body { display: grid; gap: 16px; padding: 18px 22px 22px; }
.explore-help { margin: 0; color: var(--gris); font-size: 14px; }
.chip.family-chip[aria-pressed="true"] { background: var(--orange); border-color: var(--orange-fonce); font-weight: 600; }

/* ===== Brief v3 ===== */

/* Tâche 1 : cadre noir du champ de recherche */
.search-field input:focus-visible { outline: none; }

/* Tâche 2 : fiche ouverte (libellés en spans, Définition déjà retirée du corps) */
.fiche summary { background: var(--orange-pale); }
.fiche-body { background: var(--fond-fiche); border-top: 1px solid var(--bord-fiche); padding: 24px; display: grid; gap: 16px; }
.fiche-body > * { border-top: 0; padding: 0; }
.fiche-body .fiche-grid, .fiche-body .fiche-grid--tinted { background: none; gap: 16px; }
.fiche-body .fiche-section { background: var(--blanc); border: 1px solid var(--bord-fiche); border-radius: var(--r-l); padding: 20px 22px; gap: 10px; }
.fiche-body .fiche-section h4::before { content: ""; flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--orange); }
.fiche-body .poste { background: linear-gradient(135deg, var(--orange-clair), var(--orange-pale)); border: 1px solid var(--orange-bord); border-radius: var(--r-l); padding: 20px 22px; }
.fiche-body .poste .label-caps { color: var(--orange-fonce); display: flex; align-items: center; gap: 10px; }
.fiche-body .poste .label-caps::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--orange-fonce); }
.fiche-body .poste .tags li { box-shadow: 0 1px 2px rgba(120,50,0,.08); transition: transform .15s, box-shadow .15s; }
.fiche-body .poste .tags li:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(120,50,0,.12); }
.fiche-body .sources { gap: 8px; }
.fiche-body .sources a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-s); background: var(--orange-pale); border: 1px solid var(--bord-fiche); color: var(--orange-fonce); font-weight: 600; text-decoration: none; transition: background .15s; }
.fiche-body .sources a::after { content: "↗"; flex: none; }
.fiche-body .sources a:hover { background: var(--orange-clair); }
.fiche details[open] .fiche-body { animation: ficheIn .25s ease-out; }
@keyframes ficheIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Tâche 3 : exploration discrète sous la barre de recherche */
.hero .explore { background: none; border: 0; border-radius: 0; margin: -4px 0 0; }
.hero .explore > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 4px 0; font-family: var(--font-texte); font-weight: 600; font-size: 14px; color: var(--brun); opacity: .8; transition: opacity .15s; }
.hero .explore > summary::after { content: "▾"; font-size: 12px; transition: transform .15s; }
.hero .explore[open] > summary::after { transform: rotate(180deg); }
.hero .explore > summary:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.hero .explore-body { padding: 12px 0 0; border: 0; display: flex; flex-direction: column; gap: 14px; }
.hero .explore-help { display: none; }
.hero .chip { min-height: 34px; padding: 0 14px; font-size: 13px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.5); color: var(--brun); transition: background .15s; }
.hero .chip:hover { background: rgba(255,255,255,.4); }
.hero .chip[aria-pressed="true"] { background: var(--blanc); border-color: var(--blanc); color: var(--orange-fonce); font-weight: 600; }
.hero .explore[open] .explore-body { animation: exIn .2s ease-out; }
@keyframes exIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Tâche 4 : questions fréquentes repliées par défaut */
.faq { margin-bottom: 8px; }
.faq > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; opacity: .85; transition: opacity .15s; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after { content: "▾"; font-size: 11px; transition: transform .15s; }
.faq[open] > summary::after { transform: rotate(180deg); }
.faq > summary:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.faq > .chips { margin-top: 12px; }
.faq[open] > .chips { animation: exIn .2s ease-out; }

/* ===== Brief v4 : deux liens côte à côte sous la recherche, un seul panneau ===== */
.hero-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 2px; }
.hero-link { min-height: 36px; padding: 4px 0; border: 0; background: none; font: inherit; font-family: var(--font-texte); font-weight: 600; font-size: 14px; color: var(--brun); opacity: .8; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.hero-link::after { content: "▾"; font-size: 12px; transition: transform .15s; }
.hero-link[aria-expanded="true"]::after { transform: rotate(180deg); }
.hero-link:hover, .hero-link[aria-expanded="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.hero-panel { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; animation: exIn .2s ease-out; }
#pan-explore, #pan-faq { display: flex; flex-direction: column; gap: 12px; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .chip { min-height: 34px; padding: 0 14px; font-size: 13px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.5); color: var(--brun); transition: background .15s; }
.hero .chip:hover { background: rgba(255,255,255,.4); }
.hero .chip[aria-pressed="true"] { background: var(--blanc); border-color: var(--blanc); color: var(--orange-fonce); font-weight: 600; }

/* Autres fiches : une carte blanche par fiche, bien séparée de la fiche principale */
.content-block { margin-top: 28px; display: grid; gap: 12px; }
.content-block .h2 { margin: 0; }
.content-block .others { background: none; border: 0; border-radius: 0; overflow: visible; gap: 10px; }
.content-block .other { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--r-l); box-shadow: 0 1px 2px rgba(120,50,0,.06); transition: transform .15s, box-shadow .15s; }
.content-block .other:hover { background: var(--blanc); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(120,50,0,.12); }

/* ===== Brief v5 : page de résultats aérée ===== */
#results { display: flex; flex-direction: column; gap: 40px; }
.content-block { display: flex; flex-direction: column; gap: 14px; margin-top: 0; }
.content-block > h2 { margin: 0; font-family: var(--font-titre); font-size: 18px; font-weight: 700; color: var(--encre); }
.content-block .other { padding: 16px 20px; }

/* ===== Version mobile : liste simple, pas de défilement horizontal ===== */
img, svg { max-width: 100%; }
.fiche-title, .fiche-section p, .tags li, .other-title, .other-sub, mark { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .wrap { padding-inline: 16px; }
  .hero .wrap { padding-block: 28px 32px; gap: 16px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .hero--compact .wrap { padding-block: 16px 20px; }
  .search { padding: 6px; }
  .search .btn-primary { flex: 1 1 100%; }

  /* Zones de clic d'au moins 44 px */
  .hero-link { min-height: 44px; font-size: 15px; }
  .hero .chip, .chip { min-height: 44px; font-size: 14px; }

  /* Fiche : une seule colonne, marges réduites */
  .fiche-grid { grid-template-columns: 1fr; gap: 14px; }
  .fiche-head { padding: 18px; gap: 16px; }
  .fiche-title { font-size: 22px; }
  .fiche summary { padding: 0 18px; font-size: 15px; }
  .fiche-body { padding: 14px; gap: 14px; }
  .fiche-body .fiche-section, .fiche-body .poste { padding: 16px; }

  /* Autres fiches : liste compacte, une fiche par ligne */
  .content-block { gap: 10px; }
  .content-block > h2, .content-block .h2 { font-size: 17px; }
  .content-block .other { padding: 14px 16px; }
  .other { padding: 14px 16px; gap: 8px 12px; }
  .other-side { flex: 1 1 100%; justify-content: space-between; font-size: 12px; }
  .other-title { font-size: 16px; }
  .score { width: 96px; }

  .fiche-body .sources a { padding: 12px 14px; }
  #results { gap: 28px; }
}

/* Mots de la question retrouvés dans la fiche */
.why { margin: 0; font-size: 14px; color: var(--gris); }
.why strong { color: var(--orange-fonce); font-weight: 600; }

/* ===== Mobile (≤ 600 px) : bandeau compact, zones tactiles, fiche plus lisible ===== */
@media (max-width: 600px) {
  .hero .wrap { padding-block: 24px 28px; gap: 14px; }
  .hero h1 { font-size: 24px; line-height: 1.2; }
  #lede { font-size: 14px; line-height: 1.5; }

  /* 16 px minimum : pas de zoom automatique d'iOS au focus */
  .search-field input { font-size: 16px; }

  /* Liens du bandeau : zone tactile d'environ 44 px */
  .hero-links { gap: 0 20px; }
  .hero-link { padding: 10px 0; }
  .hero .chip { min-height: 36px; padding: 0 12px; }

  /* Étiquettes plus compactes */
  .tags { gap: 6px; }
  .tags li { padding: 6px 10px; font-size: 14px; }

  /* Fiche ouverte : marges réduites */
  .fiche-body { padding: 14px; gap: 12px; }
  .fiche-body .fiche-section,
  .fiche-body .poste { padding: 16px; }
  .fiche-section p { font-size: 15px; line-height: 1.6; }

  #results { gap: 28px; }
  .content { padding-block: 20px 40px; }
}
