/* Styles propres au module « Toxique ? » : même langage visuel que le reste (kaki, beige neutre, verre, rebond).
   Les couleurs d'urgence sont celles des rappels : vert (sans danger), ambre (prudence), terre cuite (toxique) et terre cuite pleine (très toxique).
   La couleur ne porte jamais seule l'information : chaque niveau a son texte ET la forme de son icône. */

:root {
  --tx-critique-fond: #8E3D2B;      /* = --cp-terre : blanc dessus = 7,5:1 */
  --tx-critique-bord: #6F2D1F;
}

/* ----- Bloc d'urgence : la phrase de prudence et les numéros, toujours visibles ----- */
.tx-urgence { display: grid; gap: var(--cp-espace-2); padding: var(--cp-espace-2) var(--cp-espace-3); border-radius: 18px;
  background: var(--cp-terre-pale); color: var(--cp-terre); border: 1px solid #E8C5BA; }
.tx-urgence p { margin: 0; }
.tx-urgence__phrase { font-size: var(--cp-taille-s); line-height: var(--cp-interligne-s); }
.tx-urgence__numeros { display: flex; flex-wrap: wrap; gap: var(--cp-espace-2); }
.tx-urgence__numeros { flex-direction: column; }
.tx-urgence__numeros .tx-tel { flex: none; width: 100%; justify-content: center; padding-inline: 6px; font-size: 13px; }
.tx-urgence__numeros .tx-tel .ic { display: none; }
@media (min-width: 600px) { .tx-urgence__numeros { flex-direction: row; } .tx-urgence__numeros .tx-tel { width: auto; flex: 0 1 auto; font-size: var(--cp-taille-s); padding-inline: 12px; } .tx-urgence__numeros .tx-tel .ic { display: inline-block; } }
.tx-tel { display: inline-flex; align-items: center; gap: var(--cp-espace-2); min-height: var(--cp-cible-tactile); padding: 4px 10px; border-radius: 999px;
  background: var(--cp-neutre-bouton); color: var(--cp-terre); border: 1px solid var(--cp-contour); font-size: var(--cp-taille-s); line-height: var(--cp-interligne-s); text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2px 5px rgba(var(--cp-ombre-rgb), .12);
  transition: background-color var(--cp-duree-rapide) var(--cp-courbe), transform var(--cp-ressort-duree, 420ms) var(--cp-ressort, cubic-bezier(.34, 1.56, .64, 1)); }
.cp .tx-tel { color: var(--cp-terre); text-decoration: none; }
.tx-tel:hover { background: var(--cp-neutre-survol); }
.tx-tel:active { background: var(--cp-neutre-actif); transform: scale(.94); transition-duration: 90ms; transition-timing-function: ease-out; }
.tx-tel:focus-visible { outline: 2px solid var(--cp-focus); outline-offset: 2px; }
@media (min-width: 600px) { .tx-tel { min-height: 36px; } }
.tx-urgence--dans-fiche { margin-top: var(--cp-espace-3); border-radius: 18px; }

/* ----- Choix de l'espèce, recherche, filtres ----- */
.tx-especes { min-width: 0; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: var(--cp-espace-2); margin-inline: calc(var(--cp-espace-4) * -1); padding: 2px var(--cp-espace-4) var(--cp-espace-2); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tx-especes::-webkit-scrollbar { display: none; }
.tx-especes legend { margin-left: var(--cp-espace-4); }
.tx-especes .cp-choix__option { flex: none; }
.tx-especes .cp-choix__option span { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; min-height: var(--cp-cible-tactile); padding: 6px 14px; border-radius: 999px; white-space: nowrap; }
@media (min-width: 700px) { .tx-especes { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } .tx-especes legend { margin-left: 0; } .tx-especes .cp-choix__option span { min-height: 40px; } }
.tx-defaut, .tx-note-espece, .tx-resultat { margin: 0; font-size: var(--cp-taille-s); line-height: var(--cp-interligne-s); color: var(--cp-texte-doux); }
.tx-defaut strong { color: var(--cp-foret-texte); font-weight: 600; }
.tx-note-espece[hidden], .tx-defaut[hidden], [data-aucun][hidden] { display: none; }
.tx-outils { gap: var(--cp-espace-3); }
.tx-recherche { max-width: 520px; }
@media (max-width: 599px) {
  /* sur téléphone : une seule ligne de filtres qui défile, comme la liste des animaux */
  .tx-filtres { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--cp-espace-4) * -1); padding: 2px var(--cp-espace-4) var(--cp-espace-2); scrollbar-width: none; }
  .tx-filtres::-webkit-scrollbar { display: none; }
  .tx-filtres .cp-filtre { flex: none; }
}

/* ----- Liste de fiches : chaque fiche est une carte de verre repliable ----- */
.tx-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--cp-espace-3); grid-template-columns: minmax(0, 1fr); }
.tx-carte { padding: 0; overflow: hidden; }
.tx-carte__titre { margin: 0; font-size: inherit; line-height: inherit; font-weight: inherit; font-family: inherit; letter-spacing: 0; }
.tx-carte__tete { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--cp-espace-2); width: 100%; min-height: 52px; padding: 6px 12px; border: 0; background: none; font: inherit; color: var(--cp-texte); text-align: left; cursor: pointer;
  transition: background-color var(--cp-duree-rapide) var(--cp-courbe), transform var(--cp-ressort-duree, 420ms) var(--cp-ressort, cubic-bezier(.34, 1.56, .64, 1)); }
.tx-carte__tete:hover { background: var(--cp-sauge-verre); }
.tx-carte__tete:active { transform: scale(.985); transition-duration: 90ms; transition-timing-function: ease-out; }
.tx-carte__tete:focus-visible { outline: 2px solid var(--cp-focus); outline-offset: -4px; border-radius: 26px; }
.tx-carte__icone { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--cp-surface-2); color: var(--cp-foret-texte); }
.tx-carte__nom { font-family: var(--cp-police-titre); font-weight: var(--cp-graisse-titre); font-size: var(--cp-taille-m); line-height: var(--cp-interligne-s); color: var(--cp-foret-texte); flex: 1 1 11ch; min-width: min-content; overflow-wrap: normal; word-break: normal; hyphens: manual; }
/* Le nom garde sa place : il ne se coupe jamais au milieu d'un mot. Si le badge ne tient pas à côté, il passe SOUS le nom (le retour à la ligne se fait entre les deux, pas dans le mot). */
.tx-carte__corps { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--cp-espace-3); min-width: 0; }
.tx-carte__fleche { display: inline-flex; color: var(--cp-texte-doux); transition: transform var(--cp-ressort-duree, 420ms) var(--cp-ressort, cubic-bezier(.34, 1.56, .64, 1)); }
.tx-carte__tete[aria-expanded="true"] .tx-carte__fleche { transform: rotate(180deg); }
@media (max-width: 479px) {
  /* petit téléphone : le badge reste à droite, en plus petit ; le nom peut passer sur deux lignes */
  .tx-carte__tete .cp-badge { font-size: var(--cp-taille-xs); padding-inline: 8px; text-align: left; }
}

.tx-carte__detail { display: grid; gap: var(--cp-espace-2); padding: 0 16px 16px; }
.tx-carte__detail[hidden] { display: none; }
.tx-carte__detail p { margin: 0; font-size: var(--cp-taille-m); line-height: var(--cp-interligne-m); }
.tx-titre { margin: var(--cp-espace-2) 0 0; font-family: var(--cp-police-titre); font-weight: var(--cp-graisse-titre); font-size: var(--cp-taille-s); line-height: var(--cp-interligne-s); color: var(--cp-foret-texte); text-transform: none; }
.tx-etapes { margin: 0; padding-left: 1.3em; display: grid; gap: var(--cp-espace-1); font-size: var(--cp-taille-m); line-height: var(--cp-interligne-m); }
.tx-note { font-size: var(--cp-taille-s) !important; line-height: var(--cp-interligne-s) !important; color: var(--cp-texte-doux); }
.tx-conseil { display: flex; align-items: flex-start; gap: var(--cp-espace-2); font-size: var(--cp-taille-s) !important; line-height: var(--cp-interligne-s) !important; color: var(--cp-foret-texte); }
.tx-conseil .ic { flex: none; margin-top: 2px; }
.tx-source { font-size: var(--cp-taille-xs) !important; line-height: var(--cp-interligne-xs) !important; color: var(--cp-texte-doux); overflow-wrap: anywhere; }
.tx-source a { color: var(--cp-foret-texte); text-decoration: underline; text-underline-offset: 2px; }

/* Sections déroulantes par niveau */
.tx-section { display: grid; gap: var(--cp-espace-2); margin-bottom: var(--cp-espace-3); }
.tx-section__titre { margin: 0; font-size: inherit; line-height: inherit; font-weight: inherit; font-family: inherit; letter-spacing: 0; }
.tx-section__tete { display: flex; align-items: center; justify-content: space-between; gap: var(--cp-espace-2); width: 100%; min-height: var(--cp-cible-tactile); padding: 6px 12px; border: 0; border-radius: 16px; background: var(--cp-surface-2); font: inherit; color: var(--cp-foret-texte); text-align: left; cursor: pointer; }
.tx-section__tete:focus-visible { outline: 2px solid var(--cp-focus); outline-offset: 2px; }
.tx-section__tete:active { background: var(--cp-bordure-forte); }
.tx-section__nom { display: inline-flex; align-items: center; gap: var(--cp-espace-2); font-family: var(--cp-police-titre); font-weight: var(--cp-graisse-titre); font-size: var(--cp-taille-m); }
.tx-section__n { font-weight: 400; color: var(--cp-texte-doux); }
.tx-section__tete[aria-expanded="true"] .tx-carte__fleche { transform: rotate(180deg); }
.tx-liste[hidden], [data-sections]:empty { display: none; }

/* Bandeau de niveau en tête du détail */
.tx-bandeau { display: flex; align-items: flex-start; gap: var(--cp-espace-3); padding: var(--cp-espace-3) var(--cp-espace-4); border-radius: 18px; border: 1px solid transparent; }
.tx-bandeau .ic { flex: none; margin-top: 1px; }
.tx-bandeau p { font-size: var(--cp-taille-m); }
.tx-bandeau--ok { background: var(--cp-succes-pale); color: var(--cp-succes-texte); border-color: #BFD3B9; }
.tx-bandeau--prudence { background: var(--cp-ambre-pale); color: var(--cp-ambre); border-color: #E6D2A3; }
.tx-bandeau--toxique { background: var(--cp-terre-pale); color: var(--cp-terre); border-color: #E8C5BA; }
.tx-bandeau--tres { background: var(--tx-critique-fond); color: #FFFFFF; border-color: var(--tx-critique-bord); }
.tx-bandeau--aucune { background: var(--cp-desactive-fond); color: var(--cp-texte); border-color: var(--cp-bordure-forte); }

/* Badge « très toxique » : terre cuite PLEINE (le « toxique » reste en terre cuite pâle) */
.cp-badge--critique { background: var(--tx-critique-fond); color: #FFFFFF; }

.tx-pied { display: grid; gap: var(--cp-espace-2); padding-bottom: calc(96px + env(safe-area-inset-bottom)); } /* la capsule du bas flotte : la note finale ne passe pas dessous */
@media (min-width: 600px) { .tx-pied { padding-bottom: 0; } }
.tx-pied p { margin: 0; font-size: var(--cp-taille-xs); line-height: var(--cp-interligne-xs); color: var(--cp-texte-doux); max-width: 70ch; }

@media (min-width: 900px) {
  .tx-liste { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  .tx-carte__tete, .tx-carte__fleche, .tx-tel { transition-duration: 1ms; }
  .tx-carte__tete:active, .tx-tel:active { transform: none; }
}

/* Moins d'espace entre le bloc d'urgence et les pastilles d'espèces */
.pg.pg--toxique { gap: var(--cp-espace-3); }
.pg--toxique .tx-especes legend { margin-bottom: 4px; }
