/* =====================================================================
   FEUILLE DE STYLE DU SITE
   ---------------------------------------------------------------------
   1. Couleurs et polices (variables)     5. Page Performance
   2. Base                                6. Tableaux
   3. Ruban de navigation                 7. Pied de page
   4. Page d'accueil (carrousel, textes)  8. Adaptation mobile
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. COULEURS ET POLICES
   Change une valeur ici : elle change partout sur le site.
   --------------------------------------------------------------------- */
:root {
    /* Palette fournie, de la plus claire à la plus sombre */
    --color-50:  #EAF4FA;
    --color-100: #C4E1F2;
    --color-200: #9FCDEA;
    --color-300: #79BAE2;
    --color-400: #54A6D9;
    --color-500: #2E93D1;
    --color-600: #2678AB;
    --color-700: #1D5E86;
    --color-800: #154360;
    --color-900: #0D293B;
    --color-950: #050F15;

    /* Rôles */
    --fond: var(--color-50);
    --texte: var(--color-950);
    --ruban: var(--color-900);
    --fond-graphique: var(--color-900);

    /* Couleurs de performance */
    --vert-courbe: #2FD07A;   /* courbe du portefeuille sur fond sombre */
    --vert-texte: #13804A;    /* performance positive sur fond clair */
    --rouge-texte: #C0392B;   /* performance négative sur fond clair */

    /* Polices */
    --police-titres: "Newsreader", Georgia, "Times New Roman", serif;
    --police-texte: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

    /* Largeurs */
    --largeur-page: 72rem;
    --largeur-texte: 42rem;
}


/* ---------------------------------------------------------------------
   2. BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: 4.5rem; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: var(--police-texte);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

h1, h2, h3 {
    font-family: var(--police-titres);
    font-weight: 500;
    line-height: 1.15;
    color: var(--color-900);
    margin: 0 0 1rem;
}
h1 { font-size: clamp(2.25rem, 4vw, 3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.625rem, 2.6vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1rem; }

a { color: var(--color-600); }
a:hover { color: var(--color-800); }

:focus-visible {
    outline: 2px solid var(--color-500);
    outline-offset: 3px;
}

.page {
    max-width: var(--largeur-page);
    margin: 0 auto;
    padding: 3rem 1.5rem 0;
}

.chiffre { font-variant-numeric: tabular-nums; }


/* ---------------------------------------------------------------------
   3. RUBAN DE NAVIGATION (rempli par js/commun.js)
   --------------------------------------------------------------------- */
.ruban {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--ruban);
}

.ruban-contenu {
    max-width: var(--largeur-page);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.ruban-titre {
    font-family: var(--police-titres);
    font-size: 1.375rem;
    color: #fff;
    text-decoration: underline;               /* souligné */
    text-decoration-thickness: 1px;           /* épaisseur du trait */
    text-underline-offset: 6px;               /* écart entre le texte et le trait */
    text-decoration-color: var(--color-200);  /* couleur du trait (bleu clair) */
    white-space: nowrap;
}
.ruban-titre:hover { color: var(--color-50); }

.ruban-onglets {
    display: flex;
    height: 100%;
    gap: 0.25rem;
    overflow-x: auto;
}

.ruban-onglets a {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: var(--color-100);
    text-decoration: none;
    font-family: var(--police-titres);      /* même police que « My Value Investments » */
    font-size: 1.0625rem;
    white-space: nowrap;
    box-shadow: inset 0 -3px 0 transparent;
    transition: color 0.15s, box-shadow 0.15s;
}
.ruban-onglets a:hover { color: #fff; }
.ruban-onglets a[aria-current="page"] {
    color: #fff;
    box-shadow: inset 0 -3px 0 var(--color-200);
}
.ruban-onglets a:focus-visible { outline-color: var(--color-200); outline-offset: -4px; }


/* ---------------------------------------------------------------------
   4. PAGE D'ACCUEIL
   --------------------------------------------------------------------- */

/* --- Carrousel : toutes les images ont la même taille (recadrage auto) --- */
.carrousel {
    position: relative;
    height: clamp(28rem, 74vh, 46rem);
    overflow: hidden;
    background: var(--color-900);
    color: #fff;
}

.diapo {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.1s ease, visibility 0s linear 1.1s;
}
.diapo.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 1.1s ease, visibility 0s;
}

.diapo img {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* recadre sans déformer */
    display: block;
}

/* Voile sombre pour la lisibilité de la citation */
.diapo::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(5, 15, 21, 0.88) 0%, rgba(5, 15, 21, 0.45) 38%, rgba(5, 15, 21, 0) 70%),
        linear-gradient(to right, rgba(5, 15, 21, 0.35) 0%, rgba(5, 15, 21, 0) 60%);
}

.diapo figcaption {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    bottom: 4rem;
    max-width: var(--largeur-page);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.citation-originale {
    font-family: var(--police-titres);
    font-style: italic;
    font-size: clamp(1.375rem, 2.7vw, 2.125rem);
    line-height: 1.28;
    max-width: 38ch;
    margin: 0 0 1rem;
    text-wrap: balance;
}

.citation-traduction {
    max-width: 60ch;
    margin: 0 0 1rem;
    color: var(--color-100);
    font-size: 0.975rem;
    line-height: 1.55;
}

.citation-source {
    margin: 0;
    color: var(--color-200);
    font-size: 0.875rem;
}
.citation-source strong { color: #fff; font-weight: 600; }

/* --- Textes de présentation --- */
.presentation {
    max-width: var(--largeur-texte);
    margin: 0 auto;
    padding: 5rem 1.5rem 0;
}

.presentation section + section { margin-top: 4.5rem; }

.introduction {
    font-family: var(--police-titres);
    font-size: 1.375rem;
    line-height: 1.5;
    color: var(--color-900);
}

/* --- Politique d'investissement : synthèse, critères détaillés, points bonus --- */
.politique h3 { margin-top: 3.5rem; font-size: 1.5rem; }
.politique h2 + h3 { margin-top: 2rem; }

/* Tableau de synthèse (style .tableau de la partie 6) ; chaque critère renvoie à son détail */
.synthese td { vertical-align: top; }
.synthese td:first-child {
    width: 2.25rem;
    font-family: var(--police-titres);
    font-size: 1.25rem;
    line-height: 1.3;
    color: var(--color-600);
}
.synthese td:nth-child(2) { width: 38%; }
.synthese a {
    color: var(--color-900);
    font-weight: 600;
    text-decoration: none;
}
.synthese a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-300);
    text-underline-offset: 3px;
}

/* Un critère : grand numéro à gauche, texte à droite */
.critere {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 0 1rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-100);
    scroll-margin-top: 5rem;       /* le titre reste visible sous le ruban après un clic dans le tableau */
}
.critere .numero {
    font-family: var(--police-titres);
    font-size: 2.5rem;
    line-height: 1;
    color: var(--ruban);
    font-variant-numeric: lining-nums;
}
.critere h4 {
    margin: 0.2rem 0 1rem;
    font-family: var(--police-titres);
    font-size: 1.3125rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--color-900);
}
.critere h5 {
    margin: 1.5rem 0 0.35rem;
    font-family: var(--police-texte);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-800);
}
.critere h5 + p { margin-bottom: 0; }

/* Définition ou introduction du critère */
.chapeau { color: var(--color-800); }

/* Points bonus : même présentation que les critères, avec un « + » plus clair
   à la place du numéro pour les distinguer des critères éliminatoires */
.critere-bonus .numero { color: var(--color-500); }
.critere-bonus .chapeau { margin-bottom: 0; }


/* ---------------------------------------------------------------------
   5. PAGE PERFORMANCE
   --------------------------------------------------------------------- */
.entete-page { margin-bottom: 2rem; }
.entete-page p { color: var(--color-800); margin: 0; }

.bloc { margin-top: 4.5rem; }
.bloc > p { color: var(--color-800); max-width: 60ch; }

/* --- Graphique de performance --- */
.panneau-graphique {
    background: var(--fond-graphique);
    color: #fff;
    padding: 1.5rem 1.5rem 1rem;
}

.legende {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2.75rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}
.legende li { display: flex; flex-direction: column; gap: 0.1rem; }
.legende .nom {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-100);
    font-size: 0.875rem;
}
.legende .trait {
    width: 1.5rem;
    height: 3px;
    border-radius: 2px;
    flex: none;
}
.legende .valeur {
    font-size: 1.625rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.zone-graphique { position: relative; height: 26rem; }

/* Au-dessus du graphique : légende chiffrée à gauche, choix de la période à droite */
.entete-graphique {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem 2rem;
    margin-bottom: 1.5rem;
}
.entete-graphique .legende { margin: 0; }

.choix-periode-graphique {
    display: inline-flex;
    border: 1px solid rgba(159, 205, 234, 0.35);
    border-radius: 4px;
    overflow: hidden;
}
.choix-periode-graphique button {
    padding: 0.45rem 0.85rem;
    border: 0;
    border-left: 1px solid rgba(159, 205, 234, 0.2);
    background: transparent;
    color: var(--color-200);
    font: 500 0.875rem var(--police-texte);
    white-space: nowrap;
    cursor: pointer;
}
.choix-periode-graphique button:first-child { border-left: 0; }
.choix-periode-graphique button:hover { background: rgba(159, 205, 234, 0.1); color: #fff; }
.choix-periode-graphique button[aria-pressed="true"] { background: var(--color-100); color: var(--color-900); }
.choix-periode-graphique button:focus-visible { outline-color: var(--color-200); outline-offset: -3px; }

/* --- Composition --- */
.tableau-composition .activite { color: var(--color-800); }

.note { font-size: 0.8125rem; color: var(--color-700); margin-top: 0.75rem; }

/* --- Messages (données absentes) --- */
.message {
    background: #fff;
    padding: 1.25rem 1.5rem;
    max-width: 44rem;
}
.message code {
    background: var(--color-50);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}


/* ---------------------------------------------------------------------
   6. TABLEAUX
   --------------------------------------------------------------------- */
.defilement { overflow-x: auto; }

.tableau {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
.tableau th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-700);
    padding: 0 0.75rem 0.6rem;
    border-bottom: 1px solid var(--color-300);
    white-space: nowrap;
}
.tableau td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--color-100);
    vertical-align: middle;
}
.tableau th:first-child, .tableau td:first-child { padding-left: 0; }
.tableau th:last-child, .tableau td:last-child { padding-right: 0; }
.tableau .droite { text-align: right; }
.tableau tfoot td { border-bottom: 0; font-weight: 600; }
.tableau tbody tr:hover { background: rgba(196, 225, 242, 0.35); }

/* Nom + logo de l'entreprise */
.action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}
.logo, .logo-initiales {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 6px;
    flex: none;
}
.logo {
    object-fit: contain;
    background: #fff;
    padding: 3px;
    box-shadow: 0 0 0 1px var(--color-100);
}
.logo-initiales {
    display: grid;
    place-items: center;
    background: var(--color-700);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
}
.logo-initiales.cash { background: var(--color-300); color: var(--color-950); font-size: 0.875rem; }

.secondaire { display: block; font-size: 0.8125rem; color: var(--color-700); }

/* Barre de poids */
.poids {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}
.barre {
    display: none;
    width: 5.5rem;
    height: 6px;
    background: var(--color-100);
    border-radius: 3px;
    overflow: hidden;
}
.barre span { display: block; height: 100%; background: var(--color-500); }
.poids .chiffre { min-width: 3.75rem; text-align: right; }

/* Performance colorée */
.positif { color: var(--vert-texte); font-weight: 600; }
.negatif { color: var(--rouge-texte); font-weight: 600; }


/* ---------------------------------------------------------------------
   7. PIED DE PAGE (mention légale, rempli par js/commun.js)
   --------------------------------------------------------------------- */
.pied-de-page {
    max-width: var(--largeur-page);
    margin: 8rem auto 0;
    padding: 2rem 1.5rem 3rem;
    border-top: 1px solid var(--color-200);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--color-800);
}
.pied-de-page p { max-width: 80ch; margin-bottom: 0.75rem; }
.pied-de-page .titre-mention { font-weight: 600; color: var(--color-900); }


/* ---------------------------------------------------------------------
   8. ADAPTATION MOBILE ET ACCESSIBILITÉ
   --------------------------------------------------------------------- */
@media (max-width: 640px) {
    .ruban-contenu { padding: 0 1rem; gap: 0.75rem; }
    .ruban-titre { font-size: 1.125rem; }
    .ruban-onglets a { padding: 0 0.6rem; font-size: 0.9375rem; }

    .carrousel { height: 82vh; min-height: 32rem; }
    .diapo figcaption { bottom: 3rem; }
    .citation-traduction { font-size: 0.875rem; }

    .presentation { padding-top: 3.5rem; }
    .critere { grid-template-columns: 2rem 1fr; gap: 0 0.75rem; }
    .critere .numero { font-size: 2rem; }

    .page { padding-top: 2rem; }
    .panneau-graphique { padding: 1.25rem 1rem 0.75rem; }
    .zone-graphique { height: 20rem; }
    .choix-periode-graphique { display: flex; width: 100%; }
    .choix-periode-graphique button { flex: 1; padding: 0.45rem 0.25rem; }
    .legende .valeur { font-size: 1.375rem; }
    /* Composition : colonne Pays masquée sur téléphone, pour garder le poids visible */
    .tableau-composition th:nth-child(3),
    .tableau-composition td:nth-child(3) { display: none; }
    .tableau-composition .activite { font-size: 0.8125rem; }
    .barre { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .diapo, .diapo.active { transition: none; }
}


/* ---------------------------------------------------------------------
   Tableau des positions vendues (page Performance) : en-têtes cliquables
   pour trier, même présentation que le tableau Risque
   --------------------------------------------------------------------- */
.tableau-vendues .bouton-tri {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: inherit;
    cursor: pointer;
}
.tableau-vendues .droite .bouton-tri { flex-direction: row-reverse; }
.tableau-vendues .bouton-tri:hover { color: var(--color-900); }
.tableau-vendues .fleche::after { content: "↕"; opacity: 0.35; }
.tableau-vendues [aria-sort="ascending"] .fleche::after { content: "↑"; opacity: 1; }
.tableau-vendues [aria-sort="descending"] .fleche::after { content: "↓"; opacity: 1; }

@media (max-width: 640px) {
    .tableau-vendues [aria-sort="none"] .fleche { display: none; }   /* flèche visible seulement sur la colonne triée */
}
