/* L'apprentissage des végétaux — complément numérique */

@font-face { font-family: "Manrope"; src: url(polices/manrope-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --bordeaux: #973c3e;
    --bordeaux-fonce: #7a2f31;
    --rose: #fbeeee;
    --papier: #f7f3ec;
    --carte: #ffffff;
    --texte: #232323;
    --discret: #6b6560;
    --trait: #e3dcd1;
    --fond-doux: #f1ece3;
    --vert: #2e7d32;
    --vert-clair: #e7f3e8;
    --rouge: #c62828;
    --rouge-clair: #fbe9e9;
    --ombre: 0 1px 2px rgba(60, 40, 30, .06), 0 4px 16px rgba(60, 40, 30, .07);
    --rayon: 12px;
    --latin: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
    margin: 0; min-height: 100vh; display: flex; flex-direction: column;
    background: var(--papier); color: var(--texte);
    font: 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--bordeaux); }
:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }

/* ---------- Bandeau ---------- */
.bandeau {
    position: sticky; top: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: var(--bordeaux); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.bandeau-papier {
    justify-self: start; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px;
    padding: 7px 12px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
}
.bandeau-papier:hover { background: rgba(255, 255, 255, .12); }
.bandeau-titre { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; color: #fff; text-decoration: none; }
.bandeau-livre { font-weight: 800; font-size: 18px; }
.bandeau-auteur { font-size: 13px; opacity: .85; }
.bandeau-nav { justify-self: end; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.bandeau-nav a {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 14px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.bandeau-nav a:hover { background: rgba(255, 255, 255, .14); }
.bandeau-nav a.actif { background: #fff; color: var(--bordeaux); }
.bandeau-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mise en page ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 16px 32px; }
.pied { text-align: center; font-size: 13px; color: var(--discret); padding: 16px; border-top: 1px solid var(--trait); }
.chargement, .vide { text-align: center; color: var(--discret); padding: 40px 0; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); }
.surtitre { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--bordeaux); text-transform: uppercase; letter-spacing: .06em; }
.surtitre a { color: inherit; text-decoration: none; }
.surtitre a:hover { text-decoration: underline; }
h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; font-weight: 800; }
h2.section { margin: 26px 0 12px; font-size: 18px; font-weight: 800; }
.latin { font-family: var(--latin); font-style: italic; }
.latin.rouge { font-weight: 700; color: var(--bordeaux); }
.legende-rouge { font-size: 13px; color: var(--discret); margin: 6px 0 0; }
.legende-rouge .latin { font-size: 15px; }

.bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1.5px solid var(--bordeaux); background: #fff; color: var(--bordeaux);
    border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none;
}
.bouton:hover:not(:disabled) { background: var(--rose); }
.bouton-principal { background: var(--bordeaux); color: #fff; }
.bouton-principal:hover:not(:disabled) { background: var(--bordeaux-fonce); }
.bouton:disabled { opacity: .45; cursor: default; }

/* ---------- Accueil ---------- */
.accueil-tete { text-align: center; margin: 6px 0 18px; }
.accueil-tete p { margin: 6px 0 0; color: var(--discret); }
.recherche { position: relative; max-width: 640px; margin: 0 auto 16px; }
.recherche input {
    width: 100%; padding: 14px 18px 14px 46px; border: 1.5px solid var(--trait); border-radius: 999px;
    background: #fff; font-size: 16px; box-shadow: var(--ombre);
}
.recherche input:focus { outline: none; border-color: var(--bordeaux); }
.recherche svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; stroke: var(--discret); fill: none; stroke-width: 2.2; }
.onglets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 20px; }
.onglets a { padding: 8px 16px; border-radius: 999px; background: #fff; border: 1.5px solid var(--trait); color: var(--texte); text-decoration: none; font-weight: 600; font-size: 14px; }
.onglets a.actif { background: var(--bordeaux); border-color: var(--bordeaux); color: #fff; }
.onglets a:hover:not(.actif) { border-color: var(--bordeaux); }

.chapitres { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.carte-chapitre { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; padding: 10px; color: var(--texte); text-decoration: none; }
.carte-chapitre:hover { box-shadow: 0 0 0 2px var(--bordeaux), var(--ombre); }
.carte-chapitre img { width: 76px; height: 76px; object-fit: cover; border-radius: 9px; background: var(--fond-doux); }
.carte-chapitre .num { font-size: 12px; font-weight: 800; color: var(--bordeaux); text-transform: uppercase; letter-spacing: .05em; }
.carte-chapitre strong { display: block; font-size: 15px; line-height: 1.25; margin: 2px 0; }
.carte-chapitre small { color: var(--discret); }

.familles { columns: 3 220px; column-gap: 24px; }
.familles a { display: flex; justify-content: space-between; gap: 8px; break-inside: avoid; padding: 7px 10px; border-radius: 8px; color: var(--texte); text-decoration: none; }
.familles a:hover { background: #fff; }
.familles small { color: var(--discret); }

/* ---------- Listes de plantes ---------- */
.liste-tete { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.liste-tete .centre { text-align: center; }
.liste-tete p { margin: 4px 0 0; color: var(--discret); font-size: 14px; }
.plantes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.carte-plante { display: flex; flex-direction: column; overflow: hidden; color: var(--texte); text-decoration: none; }
.carte-plante:hover { box-shadow: 0 0 0 2px var(--bordeaux), var(--ombre); }
.carte-plante .photo { aspect-ratio: 4 / 5; background: var(--fond-doux); overflow: hidden; }
.carte-plante img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carte-plante .texte { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.carte-plante .num { font-size: 12px; font-weight: 800; color: var(--bordeaux); }
.carte-plante strong { font-size: 15px; line-height: 1.25; }
.carte-plante .latin { font-size: 15px; line-height: 1.25; }
.carte-plante small { color: var(--discret); font-size: 13px; }

.nav {
    width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--trait); background: var(--carte);
    box-shadow: var(--ombre); cursor: pointer; font-size: 28px; line-height: 1; color: var(--bordeaux);
    display: grid; place-items: center; text-decoration: none;
}
.nav:hover { background: var(--rose); }
.nav.inactif { opacity: .3; pointer-events: none; box-shadow: none; }

/* ---------- Fiche plante ---------- */
.fiche-tete { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 18px; }
.fiche-tete .centre { text-align: center; }
.fiche-tete .latin { font-size: clamp(19px, 2.4vw, 23px); margin: 4px 0 2px; }
.fiche-tete .famille { margin: 2px 0 0; font-size: 15px; }
.fiche-corps { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.galerie { padding: 12px; }
.vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.vignettes button { position: relative; padding: 0; border: 0; background: var(--fond-doux); border-radius: 9px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 5; }
.vignettes img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignettes button:hover img { opacity: .85; }
.badge-livre { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(151, 60, 62, .92); color: #fff; font-size: 11px; font-weight: 800; }
.galerie-aide { margin: 8px 0 0; font-size: 13px; color: var(--discret); text-align: center; }

.caracteristiques { padding: 6px 14px; }
.caracteristiques dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.caracteristiques div { padding: 11px 4px; border-bottom: 1px solid var(--trait); }
.caracteristiques div:nth-last-child(-n+2) { border-bottom: 0; }
.caracteristiques dt { font-size: 12px; font-weight: 800; color: var(--bordeaux); text-transform: uppercase; letter-spacing: .05em; }
.caracteristiques dd { margin: 2px 0 0; font-weight: 600; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- Cartes du monde ---------- */
.carte-monde { display: block; }
.carte-monde svg { display: block; width: 100%; height: auto; }
.carte-monde path { fill: #e4ddd0; stroke: #fff; stroke-width: .5; }
.carte-monde path.origine { fill: var(--bordeaux); }
.carte-monde .point { fill: #f0b429; stroke: #5a1f20; stroke-width: 1.6; }
.origine-carte { padding: 14px; margin-top: 16px; }
.origine-carte h2 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.origine-texte { margin: 0 0 10px; color: var(--discret); }
.origine-carte .carte-monde { background: #f4f8fb; border-radius: 10px; padding: 6px; }
.origine-points { margin: 8px 0 0; font-size: 14px; display: flex; align-items: baseline; gap: 6px; }
.puce-point { flex: none; width: 11px; height: 11px; border-radius: 50%; background: #f0b429; border: 2px solid #5a1f20; transform: translateY(1px); }
.origine-horticole { margin: 8px 0 0; font-size: 14px; color: var(--discret); }
.origine-regions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.origine-regions a { padding: 4px 10px; border-radius: 999px; background: var(--rose); color: var(--bordeaux); font-size: 13px; font-weight: 700; text-decoration: none; }
.origine-regions a:hover { background: #f6dede; }
.regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.carte-region { display: flex; flex-direction: column; gap: 4px; padding: 12px; color: var(--texte); text-decoration: none; }
.carte-region:hover { box-shadow: 0 0 0 2px var(--bordeaux), var(--ombre); }
.carte-region .mini { background: #f4f8fb; border-radius: 8px; padding: 4px; margin-bottom: 6px; aspect-ratio: 805 / 358; }
.carte-region strong { font-size: 15px; line-height: 1.25; }
.carte-region small { color: var(--discret); }
.horticole-icone { display: grid !important; place-items: center; font-size: 42px; color: var(--bordeaux); }
.carte-monde.grande { padding: 12px; background: #f4f8fb; margin-bottom: 14px; }
.horticole-texte { padding: 16px; margin-bottom: 14px; }

/* ---------- Révision ---------- */
.rev-config { max-width: 760px; margin: 0 auto; }
.rev-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 18px; }
.rev-mode label { display: block; padding: 12px 14px; border: 2px solid var(--trait); border-radius: 12px; background: #fff; cursor: pointer; }
.rev-mode input { accent-color: var(--bordeaux); margin-right: 6px; }
.rev-mode label:has(input:checked) { border-color: var(--bordeaux); background: var(--rose); }
.rev-mode small { display: block; color: var(--discret); margin-top: 2px; }
.rev-liste { display: grid; gap: 8px; }
.rev-liste button { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; border: 0; cursor: pointer; }
.rev-liste button:hover { box-shadow: 0 0 0 2px var(--bordeaux), var(--ombre); }
.rev-liste small { color: var(--discret); }
.meilleur { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--fond-doux); color: var(--discret); white-space: nowrap; }
.meilleur.bien { background: var(--vert-clair); color: var(--vert); }

.quiz { max-width: 640px; margin: 0 auto; }
.quiz-progression { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--discret); margin-bottom: 8px; }
.barre { height: 6px; border-radius: 3px; background: var(--trait); overflow: hidden; margin-bottom: 14px; }
.barre span { display: block; height: 100%; background: var(--bordeaux); transition: width .3s; }
.quiz-photo { padding: 0; border: 0; width: 100%; display: block; background: var(--fond-doux); border-radius: var(--rayon); overflow: hidden; cursor: zoom-in; }
.quiz-photo img { display: block; width: 100%; max-height: 52vh; object-fit: contain; background: #fff; }
.quiz-question { font-size: 18px; font-weight: 800; margin: 14px 0 10px; }
.propositions { display: grid; gap: 8px; }
.proposition { padding: 13px 16px; border: 2px solid var(--trait); border-radius: 12px; background: #fff; text-align: left; font-size: 16px; font-weight: 600; cursor: pointer; }
.proposition:hover:not(:disabled) { border-color: var(--bordeaux); }
.proposition:disabled { cursor: default; }
.proposition.juste { border-color: var(--vert); background: var(--vert-clair); color: #1b4d1e; }
.proposition.fausse { border-color: var(--rouge); background: var(--rouge-clair); color: #7f1d1d; }
.proposition.latin-choix { font-family: var(--latin); font-style: italic; font-size: 17px; }
.retour-reponse { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.retour-reponse.bravo { background: var(--vert-clair); color: #1b4d1e; }
.retour-reponse.rate { background: var(--rouge-clair); color: #7f1d1d; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quiz-fin { text-align: center; padding: 26px 18px; }
.quiz-fin .score { font-size: 48px; font-weight: 800; color: var(--bordeaux); line-height: 1; }
.erreurs-liste { text-align: left; margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.erreurs-liste a { display: block; padding: 8px 12px; background: var(--fond-doux); border-radius: 8px; text-decoration: none; color: var(--texte); }

/* ---------- Visionneuse ---------- */
.fenetre { border: 0; border-radius: 16px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); color: var(--texte); }
.fenetre::backdrop { background: rgba(20, 12, 12, .8); }
.fenetre-loupe { width: 96vw; height: 92vh; max-width: none; max-height: none; background: #111; overflow: hidden; }
.loupe-defilement { position: relative; width: 100%; height: 100%; overflow: hidden; touch-action: none; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.loupe-defilement.zoome { cursor: grab; }
.loupe-defilement img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; -webkit-user-drag: none; pointer-events: none; }
.fermer { border: 0; width: 42px; height: 42px; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; }
.fenetre-loupe .fermer { position: fixed; top: calc(4vh + 10px); right: calc(2vw + 10px); z-index: 3; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.loupe-nav {
    position: fixed; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--bordeaux);
    font-size: 30px; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.loupe-prec { left: calc(2vw + 10px); }
.loupe-suiv { right: calc(2vw + 10px); }
.loupe-legende { position: fixed; left: 50%; top: calc(4vh + 16px); transform: translateX(-50%); z-index: 3; margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); font-size: 14px; font-weight: 600; line-height: 1.3; max-width: 60vw; text-align: center; white-space: pre-line; }
.loupe-aide { position: fixed; left: 50%; bottom: calc(4vh + 14px); transform: translateX(-50%); z-index: 3; margin: 0; padding: 6px 14px; border-radius: 16px; background: rgba(35, 35, 35, .78); color: #fff; font-size: 13px; line-height: 1.35; pointer-events: none; text-align: center; width: max-content; max-width: calc(92vw - 24px); transition: opacity .4s; }
.manipule .loupe-aide { opacity: 0; }

.avertissement { background: var(--rouge-clair); padding: 14px; border-radius: 10px; }

/* ---------- Petits écrans ---------- */
@media (max-width: 860px) {
    .fiche-corps { grid-template-columns: minmax(0, 1fr); }
    .vignettes { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
    main { padding: 12px 10px 24px; }
    .bandeau { grid-template-columns: auto 1fr auto; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
    .bandeau-livre { font-size: 15px; }
    .bandeau-auteur { font-size: 11px; }
    .bandeau-papier { padding: 6px 10px; font-size: 13px; }
    /* Deux boutons côte à côte sur une seconde ligne du bandeau */
    .bandeau { grid-template-columns: auto 1fr; row-gap: 8px; }
    .bandeau-titre { align-items: flex-end; text-align: right; }
    .bandeau-nav { grid-column: 1 / -1; justify-self: stretch; }
    .bandeau-nav a { flex: 1 1 0; padding: 8px 10px; }
    .plantes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .carte-plante .texte { padding: 8px 10px 10px; }
    .carte-plante strong, .carte-plante .latin { font-size: 14px; }
    .nav { width: 42px; height: 42px; font-size: 24px; }
    .vignettes { grid-template-columns: repeat(2, 1fr); }
    .caracteristiques dl { grid-template-columns: 1fr; }
    .caracteristiques div:nth-last-child(2) { border-bottom: 1px solid var(--trait); }
    .rev-mode { grid-template-columns: 1fr; }
    .loupe-legende { max-width: 70vw; font-size: 13px; }
    .loupe-nav { width: 40px; height: 40px; font-size: 26px; }
}
@media (prefers-reduced-motion: no-preference) {
    .carte-plante, .carte-chapitre, .bouton, .nav, .proposition { transition: background-color .15s, border-color .15s, box-shadow .15s; }
}
