/* ====================================================================
   Ressources pour l'atlas des punaises — feuille de style du site
   (le quizz conserve sa propre feuille css/style.css)
   ==================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --green-1: #2f6b3a;
    --green-2: #4c9a5b;
    --green-light: #e8f5e9;
    --text: #26312a;
    --gris-doux: #5b6b60;
    --gris-clair: #8a9690;
    --bordure: #dde7de;
    --fond: #f4f7f4;
    --blanc: #fff;
    --bleu: #2d7dd2;
    --orange: #d98324;
    --rouge: #a8322a;
    --radius: 14px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--fond);
    color: var(--text);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--green-1); }

/* ---------------- En-tête ---------------- */
.site-header {
    background: linear-gradient(135deg, var(--green-1) 0%, var(--green-2) 100%);
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}

.site-header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.site-marque {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

/* Le logo garde ses couleurs d'origine (bleu et gris foncé) : sur le bandeau
   vert, il est posé sur une pastille claire plutôt que recoloré. */
.site-logo {
    display: inline-flex;
    line-height: 1;
    background: #fff;
    border-radius: 10px;
    padding: 5px;
}

.icone-punaise { width: 34px; height: 34px; display: block; }
.icone-punaise.grande { width: 42px; height: 42px; }
.icone-punaise.titre { width: 1em; height: 1em; vertical-align: -0.12em; display: inline-block; }
.site-noms { display: flex; flex-direction: column; }
.site-titre { font-size: 1.15em; font-weight: 800; line-height: 1.2; }
.site-sous-titre { font-size: 0.82em; opacity: 0.9; font-style: italic; }

.site-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Rembourrage resserré : avec quatre rubriques, les libellés complets ne
   tiennent plus à côté du titre sans cet ajustement. */
.site-nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 11px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.35);
    transition: background 0.15s;
}

.site-nav a:hover { background: rgba(255,255,255,0.18); }
.site-nav a.actif { background: #fff; color: var(--green-1); border-color: #fff; }

/* En dessous de 1100 px, le menu complet ne tient plus à côté du titre :
   on n'affiche que le premier mot de chaque rubrique (le libellé entier
   reste accessible en infobulle et pour les lecteurs d'écran). */
@media (max-width: 1100px) {
    .nav-detail {
        position: absolute;
        width: 1px; height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* ---------------- Corps ---------------- */
.site-main {
    flex: 1;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 20px 48px 20px;
}

h1 { font-size: 1.8em; color: var(--green-1); margin-bottom: 10px; line-height: 1.25; }
h2 { font-size: 1.25em; color: var(--green-1); margin: 28px 0 12px 0; }
h3 { font-size: 1.05em; color: var(--green-1); margin: 18px 0 8px 0; }
p { margin-bottom: 12px; }

.chapeau { font-size: 1.05em; color: var(--gris-doux); max-width: 70ch; }

.bloc {
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 22px;
}

.note {
    background: var(--green-light);
    border-left: 4px solid var(--green-2);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 0.9em;
    color: var(--gris-doux);
}

.note ul { margin: 8px 0 0 20px; }
.note li { margin-bottom: 3px; }
.note p:last-child { margin-bottom: 0; }

/* ---------------- Accueil ---------------- */
.hero { margin-bottom: 26px; }

.rubriques {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.rubrique {
    display: block;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.rubrique:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(47,107,58,0.16);
    border-color: var(--green-2);
}

.rubrique-icone { font-size: 2em; display: block; margin-bottom: 8px; color: var(--green-1); }
.rubrique h2 { margin: 0 0 8px 0; font-size: 1.15em; }
.rubrique p { color: var(--gris-doux); font-size: 0.92em; margin: 0; }

.chiffres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.chiffre {
    background: var(--green-light);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.chiffre-nombre { font-size: 1.9em; font-weight: 800; color: var(--green-1); line-height: 1.1; }
.chiffre-label { font-size: 0.85em; color: var(--gris-doux); }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 14px;
    font-size: 0.8em;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.rar-commune    { background: #2e7d32; }
.rar-assez-rare { background: var(--bleu); }
.rar-rare       { background: var(--orange); }
.rar-non-revue  { background: var(--rouge); }
.rar-inconnue   { background: var(--gris-clair); }

.badge-statut {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 14px;
    font-size: 0.8em;
    font-weight: 700;
    background: var(--green-light);
    color: var(--green-1);
    border: 1px solid var(--green-2);
}

/* ---------------- Liste des espèces ---------------- */
.barre-outils {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.champ-recherche {
    flex: 1;
    min-width: 220px;
    padding: 11px 15px;
    font-size: 1em;
    border: 2px solid var(--bordure);
    border-radius: 10px;
    font-family: inherit;
}

.champ-recherche:focus { outline: none; border-color: var(--green-2); }

.compteur-resultats { color: var(--gris-doux); font-size: 0.9em; }

.tableau-conteneur {
    overflow-x: auto;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
}

table.especes {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

table.especes th,
table.especes td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eef4ee;
    white-space: nowrap;
}

table.especes thead th {
    background: var(--green-light);
    color: var(--green-1);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    position: sticky;
    top: 0;
    z-index: 1;
}

table.especes th.triable {
    cursor: pointer;
    user-select: none;
}

table.especes th.triable:hover { background: #d8ecd9; }

table.especes th.triable::after {
    content: ' ⇅';
    opacity: 0.35;
    font-size: 0.9em;
}

table.especes th.tri-asc::after  { content: ' ▲'; opacity: 1; }
table.especes th.tri-desc::after { content: ' ▼'; opacity: 1; }

table.especes tbody tr:hover { background: #f7fbf7; }
table.especes tbody tr:last-child td { border-bottom: none; }

.nom-sci { font-style: italic; }
.col-photos { text-align: center; }
.sans-photo { color: var(--gris-clair); }

.lien-fiche {
    display: inline-block;
    padding: 5px 13px;
    background: var(--green-1);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
}

.lien-fiche:hover { background: var(--green-2); }

.aucun-resultat {
    padding: 22px;
    text-align: center;
    color: var(--gris-doux);
    font-style: italic;
}

/* ---------------- Fiche espèce ---------------- */
.fil-ariane { font-size: 0.88em; color: var(--gris-doux); margin-bottom: 14px; }
.fil-ariane a { color: var(--green-1); }

.fiche-entete { margin-bottom: 8px; }
.fiche-entete h1 { font-style: italic; margin-bottom: 4px; }
.fiche-entete .auteur { font-style: normal; color: var(--gris-clair); font-size: 0.6em; font-weight: 400; }
.fiche-vern { color: var(--gris-doux); margin-bottom: 16px; }

.fiche-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

table.taxonomie { width: 100%; border-collapse: collapse; }

table.taxonomie th,
table.taxonomie td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eef4ee;
    font-size: 0.94em;
}

table.taxonomie th {
    width: 190px;
    color: var(--gris-doux);
    font-weight: 600;
}

table.taxonomie tr:last-child th,
table.taxonomie tr:last-child td { border-bottom: none; }

.galerie {
    display: grid;
    /* Le min() est indispensable : sans lui, une largeur minimale de 400 px
       déborderait de l'écran sur un téléphone plus étroit que ça. */
    grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
    gap: 18px;
}

.galerie figure {
    background: var(--green-light);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bordure);
}

.galerie img {
    width: 100%;
    height: 330px;
    object-fit: contain;
    display: block;
    background: var(--green-light);
}

.galerie figcaption {
    padding: 8px 10px;
    font-size: 0.78em;
    color: var(--gris-doux);
    text-align: center;
    background: var(--blanc);
}

.galerie .variante {
    display: inline-block;
    background: var(--green-light);
    color: var(--green-1);
    border-radius: 12px;
    padding: 1px 9px;
    font-weight: 600;
    text-transform: capitalize;
    margin-bottom: 3px;
}

.vide { color: var(--gris-clair); font-style: italic; }

/* Élément porteur d'une infobulle : le curseur signale qu'un survol apporte une précision. */
.aide-survol { border-bottom: 1px dotted var(--gris-clair); cursor: help; }

.source-donnees { color: var(--gris-clair); font-size: 0.87em; margin-top: 12px; font-style: italic; }

.confusion { font-size: 0.93em; color: var(--gris-doux); }

/* Bloc repris de l'INPN : liseré distinct pour qu'on ne le confonde pas
   avec les textes rédigés pour l'atlas. */
.bloc-inpn { border-left: 4px solid var(--bleu); }

.inpn-meta {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    font-size: 0.92em;
    color: var(--gris-doux);
    padding-bottom: 10px;
    border-bottom: 1px solid #eef4ee;
}

.sous-espece { color: var(--gris-doux); }

.bloc-espace { margin-top: 22px; }

.liste-interactions { list-style: none; }

.liste-interactions li {
    padding: 8px 0;
    border-bottom: 1px solid #eef4ee;
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}

.liste-interactions li:last-child { border-bottom: none; }
.liste-interactions .cible { font-style: italic; font-weight: 600; }
.liste-interactions .type { color: var(--gris-doux); font-size: 0.85em; }

.liens-externes { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.lien-externe {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--green-light);
    border: 1px solid var(--bordure);
    border-radius: 10px;
    text-decoration: none;
    color: var(--green-1);
    font-weight: 600;
    font-size: 0.92em;
}

.lien-externe:hover { border-color: var(--green-2); background: #dcefdd; }
.lien-externe .source { color: var(--gris-doux); font-weight: 400; font-size: 0.9em; }
.lien-externe::after { content: '↗'; font-size: 0.9em; }

/* Page « Contribuer » : les ressources sont présentées par territoire */
.territoires {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 18px;
    margin-top: 14px;
}

.territoire {
    background: var(--green-light);
    border-radius: 12px;
    padding: 16px 18px;
}

.territoire h3 { margin: 0 0 10px 0; font-size: 1em; }
.territoire .lien-externe { background: #fff; }
.territoire .aide {
    font-size: 0.88em;
    color: var(--gris-doux);
    margin: 10px 0 0 0;
}

.nav-especes {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.nav-especes a {
    text-decoration: none;
    color: var(--green-1);
    font-size: 0.9em;
    font-weight: 600;
}

/* ---------------- Pied de page ---------------- */
.site-footer {
    background: var(--green-1);
    color: rgba(255,255,255,0.9);
    font-size: 0.85em;
    margin-top: auto;
}

.site-footer-inner { max-width: 1180px; margin: 0 auto; padding: 22px 20px; }
.site-footer p { margin-bottom: 6px; }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer a { color: #fff; }

/* ---------------- Intégration de la page quizz ---------------- */
body.page-quizz {
    background: linear-gradient(135deg, var(--green-1) 0%, var(--green-2) 60%, #8bc34a 100%);
}

body.page-quizz .site-main { max-width: none; padding: 0; }
body.page-quizz .app { min-height: 0; padding: 24px 16px 40px 16px; }
body.page-quizz .site-header { box-shadow: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 780px) {
    .site-header-inner { padding: 14px 16px; }
    .site-titre { font-size: 1em; }
    .site-nav a { font-size: 0.82em; padding: 7px 11px; }
    .site-main { padding: 20px 14px 36px 14px; }
    .bloc { padding: 18px 16px; }
    /* Sur un écran étroit la photo occupe déjà toute la largeur : on réduit la
       hauteur pour qu'elle ne prenne pas tout l'écran en vertical. */
    .galerie img { height: 260px; }
    h1 { font-size: 1.45em; }
    table.taxonomie th { width: auto; }
    table.taxonomie th, table.taxonomie td { display: block; }
    table.taxonomie th { padding-bottom: 0; border-bottom: none; font-size: 0.85em; }
}
