/* =====================================================================
   FICHE PAYS (pays2.php) — panneau « En chiffres » integre a l'en-tete
   du pays (fond bandeau sombre + verre depoli), sous les 6 infos.
   Onglets : Economie / Societe / Identite / Monde.
   Charge APRES pays.css, styles.css et dates_cles.css.
   ===================================================================== */

.page-wrapper-pays .country-header-block .fiche-pays {
    max-width: 800px;                 /* meme largeur que .quick-facts-grid */
    margin: clamp(18px, 2vw, 26px) auto 0;
    padding-top: clamp(16px, 2vw, 22px);
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    text-align: left;
    color: #fff;
}

/* ---------- Bulles de l'en-tete : Regime, Capitale, Langue ----------
   pays.css / styles.css imposent 2 ou 3 colonnes selon la largeur (avec
   !important) : on force 3 colonnes, icone au-dessus, pour les 3 bulles. */
body .page-wrapper-pays .country-header-block .quick-facts-grid.qf-trio {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    overflow: visible;
}
body .page-wrapper-pays .country-header-block .qf-trio .qf-card {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center;
    text-align: center;
    gap: 8px;
    position: relative;
    min-width: 0;
}
body .page-wrapper-pays .country-header-block .qf-trio .qf-data { align-items: center; display: flex; flex-direction: column; }
.page-wrapper-pays .qf-trio .qf-langue:hover { transform: none; }   /* la bulle ne bouge pas sous la liste */
.page-wrapper-pays .qf-trio .qf-val {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.page-wrapper-pays .qf-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 22px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.page-wrapper-pays .qf-plus:hover,
.page-wrapper-pays .qf-plus.is-open { background: #fff; color: #1a3a5c; }
.page-wrapper-pays .qf-plus:focus-visible { outline: 2px solid #ff8c1a; outline-offset: 2px; }

/* Bulle des langues secondaires : posee PAR-DESSUS la page (position absolue),
   elle ne pousse rien et defile si la liste est longue (Inde : 24 langues). */
.page-wrapper-pays .qf-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: max-content;
    min-width: 180px;
    max-width: min(280px, 90vw);
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(20, 35, 52, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    text-align: left;
    animation: fpApparition 0.18s ease;
}
.page-wrapper-pays .qf-pop[hidden] { display: none; }
.page-wrapper-pays .qf-pop::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    width: 10px;
    height: 10px;
    background: rgba(20, 35, 52, 0.96);
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    transform: translateX(-50%) rotate(45deg);
}
.page-wrapper-pays .qf-pop-titre {
    margin-bottom: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}
.page-wrapper-pays .qf-pop ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 190px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.page-wrapper-pays .qf-pop li {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
}
/* L'en-tete est en overflow:hidden : sur la bulle de droite (Langue),
   on ancre la liste a droite pour qu'elle ne soit jamais coupee. */
@media (max-width: 600px) {
    .page-wrapper-pays .qf-pop { left: auto; right: 0; transform: none; }
    .page-wrapper-pays .qf-pop::before { left: auto; right: 22px; transform: rotate(45deg); }
}

/* ---------- En-tete : titre + onglets ---------- */
.fiche-pays .fp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.page-wrapper-pays .fiche-pays .fp-titre {
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.page-wrapper-pays .fiche-pays .fp-titre::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff8c1a;
    box-shadow: 0 0 0 4px rgba(255, 140, 26, 0.22);
}

.fiche-pays .fp-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(10, 25, 40, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.fiche-pays .fp-tabs::-webkit-scrollbar { display: none; }
.fiche-pays .fp-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.fiche-pays .fp-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.fiche-pays .fp-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.10); }
.fiche-pays .fp-tab.is-active {
    background: #fff;
    color: #1a3a5c;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.fiche-pays .fp-tab:focus-visible,
.fiche-pays .fp-panel:focus-visible,
.fiche-pays .fp-loc-switch button:focus-visible {
    outline: 2px solid #ff8c1a;
    outline-offset: 2px;
}

/* ---------- Panneaux ---------- */
.fiche-pays .fp-panel[hidden] { display: none !important; }
.fiche-pays .fp-panel { animation: fpApparition 0.25s ease; }
@keyframes fpApparition {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* Surface « verre » commune */
.fiche-pays .fp-kpi,
.fiche-pays .fp-liste,
.fiche-pays .fp-carte,
.fiche-pays .fp-orgs-bloc {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* ---------- Tuiles chiffres cles ---------- */
.fiche-pays .fp-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.fiche-pays .fp-kpi {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px 12px;
    min-width: 0;
    transition: background 0.18s ease, transform 0.18s ease;
}
.fiche-pays .fp-kpi:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-2px); }
.fiche-pays .fp-kpi-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.25;
}
.fiche-pays .fp-kpi-label svg { width: 14px; height: 14px; flex-shrink: 0; color: #ffb066; }
/* Economie / Societe : libelles parfois sur 1 ligne (« Chômage »), parfois
   sur 2 (« Dette publique (% du PIB) »). On reserve toujours 2 lignes pour
   que valeurs et jauges soient au meme niveau d'une tuile a l'autre. */
.fiche-pays .fp-panel:not(#fp-panel-reperes) .fp-kpi-label {
    align-items: flex-start;
    min-height: 2.5em;            /* 2 lignes x line-height 1.25 */
}
.fiche-pays .fp-panel:not(#fp-panel-reperes) .fp-kpi-label svg { margin-top: 0.05em; }
.fiche-pays .fp-kpi-val {
    font-size: clamp(1.35rem, 2.1vw, 1.75rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: #fff;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
/* Le nombre ne se coupe jamais ; l'unite passe a la ligne si la tuile
   est trop etroite (au lieu de deborder du cadre). */
.fiche-pays .fp-num { white-space: nowrap; }
.fiche-pays .fp-kpi-val.is-texte { font-size: 1.05rem; line-height: 1.25; }
.fiche-pays .fp-kpi-val.is-texte .fp-num { white-space: normal; overflow-wrap: break-word; }
.fiche-pays .fp-kpi-val.is-pos { color: #8ef0b4; }
.fiche-pays .fp-kpi-val.is-neg { color: #ffa293; }
.fiche-pays .fp-unite {
    display: inline-block;
    font-size: 0.5em;
    font-weight: 700;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.75);
}
/* Reperes : unite toujours sous le nombre (« 357 022 » puis « km² »),
   comme « 83,5 » puis « millions d'hab. » : lecture homogene. */
.fiche-pays #fp-panel-reperes .fp-unite {
    display: block;
    margin-top: 5px;
}
.fiche-pays .fp-jauge {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}
.fiche-pays .fp-jauge span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #ffb066, #ff8c1a);
}
.fiche-pays .fp-kpi-note { font-size: 0.74rem; font-weight: 700; color: #ffd2a8; }
.fiche-pays .fp-kpi-meta,
.fiche-pays .fp-sources {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.58);
}
.fiche-pays .fp-kpi-meta { margin-top: auto; }
.fiche-pays .fp-kpi-meta a,
.fiche-pays .fp-sources a {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.fiche-pays .fp-kpi-meta a:hover,
.fiche-pays .fp-sources a:hover { color: #fff; }

/* ---------- Identite : liste libelle / valeur ---------- */
.fiche-pays .fp-liste {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    margin: 0;
    padding: 4px 18px;
}
.fiche-pays .fp-ligne {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.fiche-pays .fp-ligne:nth-last-child(1),
.fiche-pays .fp-ligne:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.fiche-pays .fp-ligne dt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}
.fiche-pays .fp-ligne dt svg { width: 14px; height: 14px; color: #ffb066; }
.fiche-pays .fp-ligne dd {
    margin: 0;
    text-align: right;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}
.fiche-pays .fp-sources { margin: 10px 2px 0; }

/* ---------- Monde : carte + organisations ---------- */
.fiche-pays .fp-monde {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}
.fiche-pays .fp-monde > :only-child { grid-column: 1 / -1; }
.fiche-pays .fp-carte {
    /* pas de backdrop-filter ici : il isolerait l'image et empecherait
       mix-blend-mode de rendre le fond de la carte transparent */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(10, 25, 40, 0.45);   /* fond plus sombre : traits lisibles sur la photo */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
}
.fiche-pays .fp-loc-imgs { width: 100%; text-align: center; line-height: 0; }
/* Carte d'origine : traits noirs sur fond blanc, pays en rouge.
   invert + hue-rotate -> traits blancs, pays toujours rouge ;
   mix-blend-mode screen -> le fond devenu noir disparait sur le verre. */
.fiche-pays .fp-loc-imgs img {
    width: 100%;
    max-width: 360px;
    height: auto;
    filter: invert(1) hue-rotate(180deg) saturate(1.6);
    mix-blend-mode: screen;
}
.fiche-pays .fp-loc-imgs img[hidden] { display: none; }
.fiche-pays .fp-loc-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(10, 25, 40, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
}
.fiche-pays .fp-loc-switch button {
    border: 0;
    background: transparent;
    padding: 4px 14px;
    border-radius: 999px;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}
.fiche-pays .fp-loc-switch button.is-active { background: #fff; color: #1a3a5c; }

.fiche-pays .fp-orgs-bloc {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
}
.fiche-pays .fp-orgs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fiche-pays .fp-orgs li {
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.20);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
}
.fiche-pays .fp-orgs-bloc .fp-sources { margin: auto 0 0; }

/* ---------- Tablette / mobile ---------- */
@media (max-width: 768px) {
    .fiche-pays .fp-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .fiche-pays .fp-tabs { display: flex; }
    .fiche-pays .fp-tab { flex: 1 0 auto; padding: 7px 10px; }
    .fiche-pays .fp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .fiche-pays .fp-kpi { padding: 12px; gap: 6px; }
    .fiche-pays .fp-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* pas de tuile orpheline */
    .fiche-pays .fp-liste { grid-template-columns: 1fr; padding: 2px 14px; }
    .fiche-pays .fp-ligne:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
    .fiche-pays .fp-monde { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .fiche-pays .fp-tab { flex: 1 1 0; min-width: 0; font-size: 0.74rem; padding: 7px 4px; gap: 4px; }
    .fiche-pays .fp-tab svg { display: none; }
    .fiche-pays .fp-kpi-val { font-size: 1.3rem; }
    .fiche-pays .fp-kpi-label { font-size: 0.64rem; }
    .fiche-pays .fp-ligne dd { font-size: 0.86rem; }
}

@media (prefers-reduced-motion: reduce) {
    .fiche-pays .fp-panel { animation: none; }
    .fiche-pays .fp-tab,
    .fiche-pays .fp-kpi { transition: none; }
}
