/* ==================================================================
   style.css — FLORAPYR
   Charte graphique dérivée de la maquette Figma :
   - Police Carlito (Google Fonts)
   - Palette violet/magenta (montagne, flore alpine) sur fond blanc
   - Formes triangulaires décoratives en CSS pur (clip-path), aucun
     asset SVG téléchargé : léger et facile à maintenir.
   ================================================================== */

/* --- 1. Variables de charte graphique ---------------------------- */
:root {
    /* Palette recalibrée sur les couleurs exactes des SVG fournis (vraies teintes Figma) */
    --color-primary:   #3E4294; /* indigo profond (montagne) */
    --color-secondary: #971B81; /* magenta (fleurs alpines)  */
    --color-accent:    #815BA2; /* violet accent              */
    --color-warm:      #F7A600; /* orange (petits triangles)  */
    --color-yellow:    #FFD500; /* jaune (petits triangles)   */
    --color-dark:      #1A1A1A; /* boutons noirs              */
    --color-light:     #FFFFFF;
    --color-bg-muted:  #F7F5FA; /* fond gris très clair pour sections alternées */
    --color-text:      #22202A;
    --color-divider:   #E6E6E6; /* couleur des filets (voir /assets/svg/divider-line.svg) */

    --font-base: 'Carlito', 'Arial', sans-serif;

    --radius-md: 8px;
    --radius-lg: 16px;

    --header-height: 96px; /* 96px; */
}

/* --- 2. Base ------------------------------------------------------ */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    color: var(--color-text);
    background-color: var(--color-light);
    padding-top: var(--header-height); /* compense le header fixe */
}

a {
    text-decoration: none;
}

/* --- 9d. Page d'accueil (index.php, maquette Figma 467:168) --------------- */
.home-title {
    position: absolute;
    z-index: 43;
    left: calc(350 * 100cqw / 1440); 
    top: calc(76 * 100cqw / 1440);
    margin: 0; 
    font-weight: 500;
/*    font-size: max(2rem, calc(74 * 100cqw / 1440)); */
    font-size: 3.5rem;    
    line-height: normal;
    letter-spacing: -0.02em;
    color: var(--color-dark) !important;
}

/* Titres avec taille fluide (s'adapte du mobile au grand écran sans media query) */
.page-title {
    font-weight: 500;
/*    font-size: clamp(2rem, 1.5rem + 2vw, 3.5rem); */
    font-size: 3rem;
/*    color: var(--color-primary); */
    color: var(--color-dark) !important;
    text-align: center;
}

.section-title {
    font-weight: 500;
/*    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.0rem); */
    font-size: 3rem;
    color: var(--color-primary);
}

/* --- 3. Bandeau/hero avec triangles décoratifs --------------------
   Utilise les vrais assets vectoriels de la maquette (/assets/svg),
   posés en CSS background (aucun HTML supplémentaire nécessaire,
   purement décoratif donc pas de balise <img> à annoter pour l'a11y). */
.deco-hero {
    position: relative;
    background-color: var(--color-light);
/*    
    background-image:
        url('../svg/triangle-magenta-wide-01.svg'),
        url('../svg/triangle-purple-tall-02.svg'),
        url('../svg/triangle-orange-01.svg');
    background-repeat: no-repeat;
    background-position:
        right -60px top -40px,
        left -50px bottom -120px,
        left 18% top -30px;
    background-size:
        380px auto,
        160px auto,
        70px auto;
*/        
    overflow: hidden;
/*    padding: 2rem 0 2rem; */
    padding: 1rem 0 1rem;
}

.deco-hero .container {
    position: relative;
    z-index: 1;
}

/* Petit triangle "respiration" utilisé entre certaines sections (asset réel, coloré) */
.deco-divider {
    display: inline-block;
    width: 42px;
    height: 36px;
    margin: 2rem auto;
    background: url('../svg/triangle-yellow-01.svg') no-repeat center / contain;
}

/* --- 4. Navigation -------------------------------------------------- */
.florapyr-navbar {
/*    color:white; */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--header-height);
    background-color: var(--color-light);
}

/* Variante pour chaque page : illustration couvrant toute la largeur du bandeau */

.florapyr-navbar-home {
    background-image: url('../images/nav_home2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-prez {
    background-image: url('../images/nav_prez2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-taxon {
    background-image: url('../images/nav_taxon2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-veget {
    background-image: url('../images/nav_veget2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-docu {
    background-image: url('../images/nav_docu2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-sem {
    background-image: url('../images/nav_sem2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar-photo {
    background-image: url('../images/nav_photo2.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
}

.florapyr-navbar .navbar-brand img {
    height: 64px;
    width: auto;
}

.florapyr-navbar .nav-link {
    color: var(--color-light) !important; /* blanc */
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0 0.6rem;
}

.florapyr-navbar .nav-link.active {
    text-decoration: underline;
    text-underline-offset: 6px;
}

/* Bouton "Connexion" : noir arrondi, repris sur toutes les pages */
.btn-connexion {
/*    background-color: #D3D800;  var(--color-dark); */
    background-color: #d9d9d9;
    color: var(--color-dark);
    border-radius: var(--radius-md);
    padding: 0.6rem 1.4rem;
    font-weight: 700;
    border: none;
}

.btn-connexion:hover {
    background-color: #000;
    color: var(--color-light);
}

/* --- 5. Cartes / blocs contenu -------------------------------------- */
.card-florapyr {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 100%;
}

/* Bloc de fond pour un formulaire de recherche (ex: form1 sur taxon-carto.php) */
.search-panel {
    background-color: #d9d9d9;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* Portail documentaire — liste verticale des ressources (docu.php)
   Vignette (image de couverture générée depuis le PDF) à gauche,
   métadonnées + lien "Consulter" à droite. Inspiré de cbnpmp.fr/ressources. */
.ressource-list {
    max-width: 820px;
}

.ressource-item {
    gap: 1.5rem;
    padding-bottom: 1.75rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ressource-item:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.ressource-vignette {
    width: 150px;
}

.ressource-vignette img,
.ressource-vignette-fallback {
    display: block;
    width: 150px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    background-color: #f2f2f2;
}

/* Repli quand la vignette JPEG n'a pas pu être générée (Imagick absent, etc.) */
.ressource-vignette-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--color-secondary);
}

.ressource-type {
    letter-spacing: 0.03em;
}

.ressource-item .h5 {
    color: var(--color-primary);
}

@media (max-width: 575.98px) {
    .ressource-item {
        gap: 1rem;
    }
    .ressource-vignette,
    .ressource-vignette img,
    .ressource-vignette-fallback {
        width: 96px;
    }
    .ressource-vignette img,
    .ressource-vignette-fallback {
        height: 128px;
    }
}

.stat-block {
    text-align: center;
    color: var(--color-primary);
}

.stat-block .stat-number {
    font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem);
    font-weight: 700;
    display: block;
}

/* Bandeau photo décoratif sous le titre d'un deco-hero (collage triangulaire, voir maquette Figma) */
.hero-collage {
    margin-top: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1442 / 616;
    background-size: cover;
    background-position: center;
}

/* Carte "programme" : collage photo en fond, logo + texte posés sur la zone claire centrale */
.programme-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1442 / 662;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.programme-card-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 640px;
    padding: 0rem;
}

.programme-card-content img {
    width: clamp(90px, 18vw, 180px);
    height: auto;
    flex-shrink: 0;
}

.programme-card-content p {
    margin-bottom: 0;
    font-size: clamp(0.85rem, 0.6vw + 0.7rem, 1rem);
    text-align: justify;
    font-size: 1.2rem;
}

@media (max-width: 767.98px) {
    .programme-card-content {
        flex-direction: column;
        text-align: center;
    }
    .programme-card-content p {
        text-align: center;
    }
}

/* --- 6. Formulaires -------------------------------------------------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 0.2rem rgba(151, 27, 129, 0.2);
}

/* Formulaires volontairement désactivés (voir README) :
   grisés + curseur "not-allowed" pour signaler clairement que
   l'ajout n'est pas encore fonctionnel dans cette version. */
.form-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-disabled input,
.form-disabled textarea,
.form-disabled button {
    pointer-events: none;
}

/* --- 7. Footer -------------------------------------------------------- */
.florapyr-footer {
    background-color: var(--color-light);
    color: var(--color-dark);
    border-top: 1px solid #eee;
    padding: 3rem 0 2rem;
}

.florapyr-footer .footer-logo img {
    height: 60px;
    width: auto;
}

.florapyr-footer a {
    color: var(--color-dark);
    font-weight: 600;
}

/* --- 7 bis. Mentions légales (mentions-legales.php) --------------------- */
.legal-page {
    max-width: 960px;
    margin-inline: auto;
    line-height: 1.6;
}

.legal-page h2 {
    font-weight: 500;
    font-size: 1.6rem;
    color: var(--color-primary);
    margin: 2rem 0 .75rem;
}

.legal-page a {
    color: var(--color-secondary);
    text-decoration: underline;
}

.legal-page thead th {
    background-color: var(--color-bg-muted);
    color: var(--color-primary);
}

.legal-page table {
    font-size: .95rem;
}

/* --- 8. Carte Leaflet (carto.php) -------------------------------------- */
#map-taxons {
    width: 100%;
    height: 700px;
    z-index: 0; /* évite que la carte passe au-dessus du header fixe */
}

#map-structures {
    width: 100%;
    height: 560px;
/*    border-radius: var(--radius-lg); */
    z-index: 0;
}

/* --- 9. Tableaux de données (taxon.php, recolte.php, veget.php, ...) ---- */
.table thead th {
/*    background-color: #D3D800;  même jaune-vert que .btn-connexion */
    background-color: #d9d9d9;
    color: var(--color-dark);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: none;
    padding-top: .75rem;
    padding-bottom: .75rem;
}

.table thead th a {
    color: var(--color-dark);
}

.table thead th a:hover {
    text-decoration: underline;
    opacity: .9;
}

.table thead th .text-muted {
    color: rgba(26, 26, 26, .5) !important;
}

/* --- 9b. Formes positionnées (maquettes Figma : prez.php, index.php) ------
   Les éléments sont placés en px de la maquette (largeur 1440), convertis en
   unités de conteneur : N px maquette = N * 100cqw / 1440 (voir fig_shape()
   dans includes/helpers.php). Les textes longs restent dans le flux. */
.fig-page {
    container-type: inline-size;
    overflow-x: clip; /* formes qui débordent à gauche/droite, sans barre de défilement */
    isolation: isolate;
}

.fig-band {
    position: relative;
    height: calc(var(--band-h) * 100cqw / 1440);
}

/* Bandeaux de logos (partenaires, financeurs) : logos réduits, centrés sur leur emplacement */
.fig-band--logos .fig-shape {
    transform: scale(.75);
}

.fig-band--clip {
    overflow: hidden;
}

.fig-shape {
    position: absolute;
    z-index: var(--z, 0);
    left: calc(var(--x) * 100cqw / 1440);
    top: calc(var(--y) * 100cqw / 1440);
    width: calc(var(--w) * 100cqw / 1440);
    height: calc(var(--h) * 100cqw / 1440);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Position verticale comptée depuis le bas du parent (--y négatif) */
.fig-shape--from-bottom {
    top: calc(100% + var(--y) * 100cqw / 1440);
}

.fig-shape__inner {
    position: relative;
    flex: none;
    width: calc(var(--iw) * 100cqw / 1440);
    height: calc(var(--ih) * 100cqw / 1440);
}

.fig-shape__inner > span {
    position: absolute;
    display: block;
}

.fig-shape__inner img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
}

.fig-shape--icon img {
    object-fit: contain;
}

.fig-shape--cover img {
    object-fit: cover;
}

/* Recadrage d'une image (planche d'exports) : position/taille de l'image en % du cadre */
.fig-shape--crop .fig-shape__inner {
    overflow: hidden;
}

.fig-shape--crop .fig-shape__inner img {
    position: absolute;
}

/* --- 9c. Page Présentation (prez.php, maquette Figma 463:3) --------------- */
.prez-title {
    position: absolute;
    z-index: 1;
    left: calc(106 * 100cqw / 1440);
    top: calc(138 * 100cqw / 1440);
    margin: 0;
    font-weight: 700;
    font-size: max(2rem, calc(74 * 100cqw / 1440));
    line-height: normal;
    letter-spacing: -0.02em;
    color: #070707;
}

/* Intercalaire entre deux blocs de texte (étoile / montagnes au centre).
   Hauteur en px maquette (1440 de large) : réglage unique de l'espacement. */
.prez-sep {
    --band-h: 300;
}

.prez-text {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 1rem;
    box-sizing: content-box;
    font-size: clamp(1rem, calc(22 * 100cqw / 1440), 1.375rem);
    line-height: 1.5;
    text-align: justify;
    color: #000;
}

.prez-text p {
    margin: 0;
}

.prez-text a {
    color: inherit;
    text-decoration: underline;
}

.home-mid {
    position: relative;
    display: flow-root; /* évite que la marge haute de .home-pres ne décale toute la section */
}

/* Libellés blancs posés sur les triangles verts ("Présentation", "Actualités") */
.home-label {
    position: absolute;
    z-index: 22;
    left: calc(var(--x) * 100cqw / 1440);
    top: calc(var(--y) * 100cqw / 1440);
    margin: 0;
    font-weight: 700;
    font-size: max(1.25rem, calc(45 * 100cqw / 1440));
    line-height: normal;
    letter-spacing: -0.02em;
    color: #fff;
}

.home-link {
    font-weight: 700;
    font-size: max(1.1rem, calc(36 * 100cqw / 1440));
    line-height: normal;
    letter-spacing: -0.02em;
    color: #fff;
    text-decoration: underline;
}

.home-link:hover {
    color: #fff;
}

.home-pres {
    position: relative;
    z-index: 3;
/*    width: calc(1261 * 100cqw / 1440);    */
    width: calc(1310 * 100cqw / 1440);
    min-height: calc(297 * 100cqw / 1440);
    margin-top: calc(223 * 100cqw / 1440);
    margin-left: calc(82 * 100cqw / 1440);
    padding: calc(23 * 100cqw / 1440) calc(32 * 100cqw / 1440) calc(23 * 100cqw / 1440) calc(47 * 100cqw / 1440);
    background-color: rgba(255, 255, 255, 0.7);
    color: #000;
    line-height: 1.5;
}

.home-pres__titre {
    margin: 0 0 calc(37.5 * 100cqw / 1440);
    font-weight: 600;
    font-size: max(1rem, calc(30 * 100cqw / 1440));
    text-align: center;
}

.home-pres__texte {
    margin: 0;
/*    font-size: max(0.95rem, calc(25 * 100cqw / 1440)); */
    font-size: clamp(1rem, calc(22 * 100cqw / 1440), 1.375rem);
    text-align: justify;
}

.home-pres__infos {
    position: absolute;
    left: calc(1042 * 100cqw / 1440);
    top: calc(100% - 10 * 100cqw / 1440);
    white-space: nowrap;
}

.home-actu-panel {
    position: absolute;
    z-index: 4;
    left: calc(80 * 100cqw / 1440);
    top: calc(162 * 100cqw / 1440);
    width: calc(1310 * 100cqw / 1440);
    height: calc(875 * 100cqw / 1440);
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.5);
    /* marges internes : laisse libres le libellé "Actualités" (haut gauche)
       et le logo LinkedIn / "Nous suivre" (bas droite) posés par-dessus */
    padding: calc(100 * 100cqw / 1440) calc(40 * 100cqw / 1440) calc(150 * 100cqw / 1440);
}

/* Publications LinkedIn (includes/linkedin.php) */
.home-actu-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(30 * 100cqw / 1440);
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.home-actu-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    color: #000;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.home-actu-card a:hover,
.home-actu-card a:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    color: #000;
}

.home-actu-card__img {
    flex: none;
    width: 100%;
    height: calc(230 * 100cqw / 1440);
    object-fit: cover;
}

.home-actu-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: calc(8 * 100cqw / 1440);
    padding: calc(14 * 100cqw / 1440) calc(18 * 100cqw / 1440);
    font-size: max(0.8rem, calc(17 * 100cqw / 1440));
    line-height: 1.35;
}

.home-actu-card__date {
    color: #555;
    font-size: 0.9em;
}

.home-actu-card__titre,
.home-actu-card__texte {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-actu-card__titre {
    -webkit-line-clamp: 2;
    font-size: 1.1em;
}

.home-actu-card__texte {
    -webkit-line-clamp: 4;
    min-height: 0;
}

.home-actu-card__suite {
    margin-top: auto;
    font-weight: 700;
    color: var(--color-primary);
}

/* Écrans étroits : le panneau rapetisse avec la maquette, on n'affiche
   plus qu'une vignette et le titre de chaque publication */
@media (max-width: 767.98px) {
    .home-actu-panel {
        padding: calc(170 * 100cqw / 1440) 0.5rem 0.5rem;
    }
    .home-actu-list {
        grid-template-columns: 1fr;
        grid-auto-rows: 1fr;
        gap: 0.25rem;
    }
    .home-actu-card a {
        flex-direction: row;
    }
    .home-actu-card__img {
        width: 30%;
        height: 100%;
    }
    .home-actu-card__body {
        padding: 0.15rem 0.4rem;
        font-size: 0.75rem;
    }
    .home-actu-card__date,
    .home-actu-card__texte,
    .home-actu-card__suite {
        display: none;
    }
}

/* Lien (image cliquable) positionné en coordonnées maquette : actualités, drapeaux */
.home-pos-link {
    position: absolute;
    z-index: var(--z);
    left: calc(var(--x) * 100cqw / 1440);
    top: calc(var(--y) * 100cqw / 1440);
    width: calc(var(--w) * 100cqw / 1440);
    height: calc(var(--h) * 100cqw / 1440);
}

.home-pos-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sélecteur de langue : la langue active est soulignée d'un filet */
.home-flag {
    transition: transform .15s ease;
}

.home-flag:hover,
.home-flag:focus-visible {
    transform: scale(1.08);
}

.home-flag[aria-current="true"] {
    outline: 2px solid var(--color-dark);
    outline-offset: 2px;
}

.home-actu__linkedin {
    position: absolute;
    z-index: 42;
    left: calc(1098 * 100cqw / 1440);
    top: calc(1006 * 100cqw / 1440);
}

.home-section-title {
    position: relative;
    z-index: 18; /* au-dessus du fond montagne de la section précédente */
    margin: 0;
    padding-left: calc(40 * 100cqw / 1440);
    font-weight: 500;
    font-size: max(1.5rem, calc(44 * 100cqw / 1440));
    line-height: normal;
    letter-spacing: -0.02em;
    color: #000;
}

.home-cofin {
    position: relative;
    z-index: 18;
    margin: 0;
    padding-inline: calc(130 * 100cqw / 1440) 1rem;
    font-size: max(1rem, calc(32 * 100cqw / 1440));
    line-height: 1.5;
    color: #000;
}

/* --- 10. Utilitaires responsives ----------------------------------------- */
@media (max-width: 991.98px) {
    :root {
        --header-height: 76px;
    }
    .florapyr-navbar .nav-link {
        color: var(--color-primary) !important;
    }
}
