/* ==========================================================================
   portailaccpt — application de la charte graphique LFPL (kit 1.0.0)
   --------------------------------------------------------------------------
   Dernière feuille chargée (templates/partials/charte-lfpl-head.php), après :
     app.css · fafa.css · theme-guw.css      (outils et administration)
     portail.css · connexion.css             (portail, comptes, connexion)
     charte-lfpl/css/lfpl-tokens.css · lfpl-fonts.css · theme-verre.css (kit)

   Elle ne fait que de l'habillage : couleurs, fonds, surfaces, bordures,
   ombres, états, police. Aucune règle de mise en page n'est réécrite, et les
   fichiers du kit ne sont pas modifiés. Retirer l'inclusion de
   charte-lfpl-head.php restitue l'habillage précédent.

   Aucune couleur en dur ici : uniquement les variables du kit (--lfpl-* de
   lfpl-tokens.css, jetons du thème « Verre » de theme-verre.css).

   Principe retenu pour le thème « Verre » :
     - le fond à trois halos est peint par theme-verre.css derrière <body> ;
     - ce qui est posé directement sur le fond (barres, onglets, tuiles du
       portail, pieds de page) prend les jetons du verre et suit le thème
       sombre ou clair ;
     - les cartes de formulaire, les tableaux et les fenêtres modales restent
       blancs dans les deux thèmes, comme le kit l'impose.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Jetons partagés
   app.css et theme-verre.css utilisent tous deux les noms --fond et --texte,
   avec des sens différents. Les valeurs du thème « Verre » sont donc copiées
   ici sous un autre nom, au niveau de <html>, avant que les pages d'outils ne
   redonnent à --texte et --fond leur sens « carte blanche » (section 3).
   -------------------------------------------------------------------------- */
html {
    --verre-texte: var(--texte);
    --verre-fond: var(--fond);
    --verre-focus: var(--focus);
}

/* --------------------------------------------------------------------------
   2. Police de la charte : Heebo partout, servie par le site
   -------------------------------------------------------------------------- */
body.page-outil,
body.page-portail,
body.tl-body,
.tl-page {
    font-family: var(--lfpl-police-texte);
}

/* --------------------------------------------------------------------------
   3. Outils et administration (app.css, fafa.css, theme-guw.css)
   Le contenu de ces pages vit dans des cartes blanches : à l'intérieur de
   <body>, les jetons d'app.css gardent donc leurs valeurs claires, recalées
   sur les couleurs de la charte.
   -------------------------------------------------------------------------- */
body.page-outil {
    color-scheme: light;

    --font-sans: var(--lfpl-police-texte);
    --font-titre: var(--lfpl-police-titre);

    --texte: var(--carte-texte);
    --texte-doux: var(--carte-texte-2);
    --fond: var(--carte);
    --surface: var(--carte);
    --focus: var(--carte-focus);

    --primaire: var(--lfpl-bleu-survol);
    --primaire-clair: var(--lfpl-bleu);
    --primaire-degrade: linear-gradient(135deg, var(--lfpl-bleu-survol) 0%, var(--lfpl-marine-fonce) 100%);
    --sur-primaire: var(--lfpl-blanc);
    --texte-inverse: var(--lfpl-blanc);

    --succes: var(--lfpl-vert-fonce);
    --succes-doux: var(--carte-succes-fond);
    --danger: var(--lfpl-rouge-fonce);
    --danger-doux: var(--carte-erreur-fond);
    --info: var(--lfpl-marine);

    --serie-cout: var(--lfpl-bleu-survol);

    /* Le fond est celui du thème « Verre », peint derrière <body>. */
    background: transparent;
    color: var(--carte-texte);
}

.page-outil h1,
.page-outil h2,
.page-outil h3,
.page-outil h4 {
    font-weight: 800;
}

/* Heebo est plus large que la police condensée précédente : les grandes
   valeurs des tuiles sont réduites et peuvent passer à la ligne plutôt que
   d'être rognées. */
.page-outil .tuile__valeur {
    font-size: 1.9rem;
    overflow-wrap: anywhere;
}

/* --- 3.1 Barre supérieure ------------------------------------------------
   La barre reste collée en haut de page : elle est donc opaque (teinte de la
   barre de verre posée sur la couleur de fond), sans flou d'arrière-plan. */
.page-outil .entete {
    --focus: var(--verre-focus);
    background: linear-gradient(var(--barre), var(--barre)), var(--verre-fond);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 0;
    box-shadow: none;
    color: var(--titre);
}

/* Liseré bleu et rouge de la charte, à la place des pointillés rouges. */
.page-outil .entete::after {
    background: var(--lfpl-lisere);
    opacity: 1;
}

.page-outil .entete__titre {
    color: var(--titre);
}

.page-outil .entete__sous-titre {
    color: var(--texte-2);
    opacity: 1;
}

.page-outil .entete__logo {
    background: var(--pastille-bleu);
    box-shadow: none;
    color: var(--pastille-icone);
}

/* Heebo est plus large que la police précédente : boutons resserrés pour
   que la barre garde sa hauteur. La cible reste de 44 px. */
.page-outil .entete .bouton {
    padding-inline: var(--espace-3);
    font-size: .8125rem;
    background: var(--bouton-2-fond);
    border-color: var(--bouton-2-trait);
    color: var(--bouton-2-texte);
}

.page-outil .entete .bouton:hover {
    background: var(--bouton-2-survol);
    border-color: var(--bouton-2-trait);
    color: var(--bouton-2-texte);
}

.page-outil .entete .bouton--primaire {
    background: var(--bouton);
    border-color: transparent;
    color: var(--bouton-texte);
}

.page-outil .entete .bouton--primaire:hover {
    background: var(--bouton-survol);
    border-color: transparent;
    color: var(--bouton-texte);
}

.page-outil .entete .bandeau-club {
    background: var(--encart);
    border-color: var(--encart-trait);
    color: var(--verre-texte);
}

.page-outil .entete .indicateur-calcul {
    color: var(--texte-2);
}

.page-outil .entete :focus-visible {
    outline-color: transparent;
}

/* --- 3.2 Onglets de l'administration : rail de verre --------------------- */
.page-outil .onglets {
    --focus: var(--verre-focus);
    gap: 4px;
    padding: 8px;
    background: var(--verre);
    border: 1px solid var(--verre-trait);
    border-radius: 18px;
    box-shadow: var(--verre-ombre);
}

.page-outil .onglet {
    background: transparent;
    border: 0;
    border-radius: 11px;
    color: var(--filtre-texte);
    transition: background .18s ease, color .18s ease;
}

.page-outil .onglet:hover {
    background: var(--filtre-survol);
    color: var(--filtre-texte);
}

.page-outil .onglet--actif,
.page-outil .onglet--actif:hover {
    background: var(--filtre-actif);
    color: var(--filtre-actif-texte);
}

.page-outil .onglet--actif::after {
    display: none;
}

.page-outil .onglets .onglet .onglet__compteur {
    background: var(--encart);
    border-color: var(--encart-trait);
    color: var(--filtre-texte);
}

.page-outil .onglets .onglet--actif .onglet__compteur {
    background: transparent;
    border-color: currentColor;
    color: inherit;
}

.page-outil .onglets .onglet .onglet__compteur--alerte {
    background: var(--lfpl-rouge-fonce);
    border-color: var(--lfpl-blanc);
    color: var(--lfpl-blanc);
}

/* --- 3.3 Sous-onglets : filtres en pastille ------------------------------ */
.page-outil .sous-onglets {
    --focus: var(--verre-focus);
}

.page-outil .sous-onglet {
    background: var(--filtre);
    border-color: var(--filtre-trait);
    color: var(--filtre-texte);
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.page-outil .sous-onglet:hover {
    background: var(--filtre-survol);
    color: var(--filtre-texte);
}

.page-outil .sous-onglet--actif,
.page-outil .sous-onglet--actif:hover {
    background: var(--filtre-actif);
    border-color: var(--filtre-actif);
    color: var(--filtre-actif-texte);
}

.page-outil .sous-onglet .onglet__compteur {
    background: transparent;
    border-color: currentColor;
    color: inherit;
}

/* --- 3.4 Corrections de lisibilité ---------------------------------------
   Première colonne figée des trois tableaux du plan : son en-tête recevait
   un fond blanc sous un texte blanc. Il reprend le fond des autres en-têtes. */
@media screen {
    .page-outil #table-charges thead th:first-child,
    .page-outil #table-recettes thead th:first-child,
    .page-outil #table-resultat thead th:first-child {
        background: var(--primaire);
    }
}

/* Numéro de l'étape en cours du dossier FAFA : 4,35:1 auparavant. */
.page-outil .etape[aria-current="step"] .etape__numero {
    background: var(--lfpl-marine-fonce);
    color: var(--lfpl-blanc);
}

/* --- 3.5 Fenêtres modales : pas de flou derrière la fenêtre -------------- */
.page-outil dialog::backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* --------------------------------------------------------------------------
   4. Portail : accueil, « Mon compte », mot de passe, accès refusé
   (portail.css). Les couleurs de portail.css sont recalées sur la charte.
   -------------------------------------------------------------------------- */
body.page-portail,
body.tl-body {
    --navy: var(--lfpl-marine);
    --blue: var(--lfpl-bleu);
    --blue-2: var(--lfpl-bleu-survol);
    --gold: var(--lfpl-or);
    --gold-fonce: var(--lfpl-or-pastille);
    --green: var(--lfpl-vert-fonce);
    --red: var(--lfpl-rouge);
    --red-fonce: var(--lfpl-rouge-fonce);
    --ink: var(--carte-texte);
    --muted: var(--carte-texte-2);
    background: transparent;
}

.page-portail h1 {
    color: var(--titre);
}

.page-portail .h1__accroche,
.page-portail .sub {
    color: var(--texte-2);
}

.page-portail .fil a,
.page-portail footer.site a {
    color: var(--lien);
}

.page-portail .fil a:hover,
.page-portail footer.site a:hover {
    color: var(--lien-survol);
}

/* --- 4.1 Barre supérieure ------------------------------------------------ */
.page-portail .top {
    background: var(--barre);
    border-bottom-color: var(--barre-trait);
}

.page-portail .top .brand {
    color: var(--titre);
}

.page-portail .top .help {
    background: var(--bouton-2-fond);
    border-color: var(--bouton-2-trait);
    color: var(--bouton-2-texte);
}

.page-portail .top .help:hover {
    background: var(--bouton-2-survol);
    border-color: var(--bouton-2-trait);
    color: var(--bouton-2-texte);
}

/* --- 4.2 Tuiles : surfaces de verre -------------------------------------- */
.page-portail .tile {
    background: var(--verre);
    border-color: var(--verre-trait);
    border-radius: 20px;
    box-shadow: var(--verre-ombre);
    color: var(--verre-texte);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

/* Au survol, la surface s'éclaire mais ne bouge pas (règle du thème). */
.page-portail a.tile:hover,
.page-portail a.tile:focus-visible,
.page-portail a.tile:active {
    transform: none;
    background: var(--verre-survol);
    border-color: var(--verre-trait-survol);
    box-shadow: var(--verre-ombre-survol);
    color: var(--verre-texte);
}

.page-portail a.tile:focus-visible {
    box-shadow: var(--focus), var(--verre-ombre);
}

.page-portail .tile__titre {
    color: var(--titre);
}

.page-portail .tile .sub2,
.page-portail .tile p {
    color: var(--texte-2);
}

.page-portail .tile .go {
    color: var(--lien-verre);
}

.page-portail .tile .badge {
    background: var(--encart);
    box-shadow: inset 0 0 0 1px var(--encart-trait);
    color: var(--verre-texte);
}

.page-portail .tile .ic {
    color: var(--pastille-icone);
}

.page-portail .tile--bleu { --pastille: var(--pastille-bleu); }
.page-portail .tile--vert { --pastille: var(--pastille-vert); }
.page-portail .tile--or { --pastille: var(--pastille-or); }

.page-portail .tile .bar,
.page-portail .tile .ic {
    background: var(--pastille);
}

/* En thème clair, le kit assombrit les pastilles de 18 %. */
[data-theme="clair"] .page-portail .tile .bar,
[data-theme="clair"] .page-portail .tile .ic {
    background: color-mix(in srgb, var(--pastille) 82%, var(--lfpl-noir));
}

.page-portail .tile.off {
    background: var(--encart);
    border-color: var(--encart-trait);
    box-shadow: none;
}

.page-portail .tile.off .go {
    color: var(--texte-2);
}

/* --- 4.3 Panneaux de formulaire : cartes blanches dans les deux thèmes ----
   Mêmes redéfinitions de jetons que la classe .carte-blanche du kit. */
.page-portail .panneau,
.tl-carte {
    color-scheme: light;
    --texte: var(--carte-texte);
    --titre: var(--carte-titre);
    --texte-2: var(--carte-texte-2);
    --lien: var(--carte-titre);
    --lien-survol: var(--carte-bouton-survol);
    --focus: var(--carte-focus);
    background: var(--carte);
    border-color: transparent;
    box-shadow: var(--carte-ombre);
    color: var(--carte-texte);
}

.page-portail .panneau--bleu { --pastille: var(--lfpl-marine); }
.page-portail .panneau--vert { --pastille: var(--lfpl-vert-fonce); }
.page-portail .panneau--or { --pastille: var(--lfpl-or-pastille); }

.page-portail .panneau .controle,
.tl-carte .controle {
    border-color: var(--carte-trait);
    color: var(--carte-texte);
}

.page-portail .panneau .controle::placeholder,
.tl-carte .controle::placeholder {
    color: var(--carte-texte-2);
    opacity: 1;
}

.page-portail .bouton--primaire,
.tl-carte .bouton--primaire {
    background: var(--carte-bouton);
    color: var(--carte-bouton-texte);
}

.page-portail .bouton--primaire:hover,
.tl-carte .bouton--primaire:hover {
    background: var(--carte-bouton-survol);
    color: var(--carte-bouton-texte);
}

/* --- 4.4 Pied de page ---------------------------------------------------- */
.page-portail footer.site {
    color: var(--texte-2);
}

/* --------------------------------------------------------------------------
   5. Page de connexion (connexion.css)
   L'affiche garde son tracé de terrain ; le fond bleu uni laisse la place au
   fond du thème « Verre ».
   -------------------------------------------------------------------------- */
.tl-page {
    --gold: var(--lfpl-or);
    --b: var(--lfpl-marine);
    --text: var(--carte-texte);
    --muted: var(--carte-texte-2);
    --border: var(--carte-trait);
    background: transparent;
    color: var(--verre-texte);
}

.tl-pelouse {
    background-image: repeating-linear-gradient(115deg, var(--barre) 0 64px, transparent 64px 128px);
}

[data-theme="clair"] .tl-pelouse {
    opacity: .3;
}

.tl-traces,
.tl-traces::after {
    border-color: var(--ligne);
}

.tl-traces::before {
    background: var(--ligne);
}

/* Les halos du thème « Verre » remplacent le halo doré de l'affiche. */
.tl-halo {
    display: none;
}

.tl-tete-txt {
    color: var(--titre);
}

.tl-eyebrow {
    color: var(--surtitre);
}

.tl-tete .bascule-theme {
    margin-left: auto;
}

.tl-accroche {
    color: var(--verre-texte);
}

.tl-accroche h1 {
    color: var(--titre);
    text-shadow: none;
}

.tl-accroche h1 em {
    color: var(--surtitre);
}

.tl-accroche p {
    color: var(--texte-2);
}

.tl-retour {
    color: var(--lien);
}

.tl-retour:hover {
    color: var(--lien-survol);
}

.tl-pied {
    border-top-color: var(--ligne);
    color: var(--texte-2);
}

.tl-pied a {
    color: var(--lien);
}

.tl-pied a:hover {
    color: var(--lien-survol);
}

/* --------------------------------------------------------------------------
   6. Bouton de bascule du thème (templates/partials/bascule-theme.php)
   aria-pressed="true" = thème clair actif : le bouton passe en fond plein.
   -------------------------------------------------------------------------- */
.bascule-theme {
    flex: none;
    font-size: 14px;
    white-space: nowrap;
}

.bascule-theme[aria-pressed="true"],
.bascule-theme[aria-pressed="true"]:hover {
    background: var(--filtre-actif);
    border-color: var(--filtre-actif);
    color: var(--filtre-actif-texte);
}

/* Dans la barre des outils, déjà chargée en boutons, seule l'icône est
   affichée. Le libellé reste lu par les lecteurs d'écran. */
.page-outil .entete .bascule-theme {
    width: 44px;
    padding: 0;
}

.page-outil .entete .bascule-theme__texte {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. Impression : pas de fond sombre ni de surface de verre sur le papier
   -------------------------------------------------------------------------- */
@media print {
    html {
        background: var(--lfpl-blanc);
    }

    body::before,
    body::after,
    .bascule-theme {
        display: none;
    }

    .page-outil .entete {
        background: var(--lfpl-blanc);
        color: var(--carte-texte);
    }

    .page-outil .entete::after {
        display: none;
    }

    .page-outil .entete__titre,
    .page-outil .entete__sous-titre {
        color: var(--carte-texte);
    }

    .page-outil .onglets {
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .page-outil .onglet,
    .page-outil .onglet--actif {
        background: transparent;
        color: var(--carte-texte);
    }
}
