/* Garde-robe — Fiche (htdocs/assets/garderobe/fiche.css), lot B. Racine : .ec-fiche (§ 8.3) ; la feuille
   de la photo d'usure agrandie a la sienne : .fi-feuille-photo. Les composants g-* ne sont que placés et
   dimensionnés ici ; aucune couleur en dur (jetons seulement) ; deux classes de spécificité au plus. */

/* Une colonne : barre (collée en haut), visuel, corps, fin, barre basse (collée en bas). */
.ec-fiche { position: relative; display: flex; flex-direction: column; }

/* ---------------- Barre superposée au visuel, puis barre compacte au défilement ---------------- */
.ec-fiche .fi-barre { height: 52px; margin-bottom: -52px; padding: 0 12px; }
.ec-fiche .g-barre-droite { gap: 8px; }
.ec-fiche .g-barre-titre { left: 60px; right: 150px; text-align: left; }
.ec-fiche .fi-fermer, .ec-fiche .fi-bureau { display: none; }
.ec-fiche .fi-modifier {
    position: relative; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 18px;
    color: var(--gr-texte); font: 600 17px/1 var(--gr-sans); text-decoration: none; white-space: nowrap;
}
.ec-fiche .fi-modifier::before { content: ''; position: absolute; inset: -4px 0; }
/* Sur une photo, l'encre seule peut tomber sous 3:1 : un liseré du fond détache l'anneau de focus. */
.ec-fiche .fi-modifier:where(:focus-visible) { outline: none; box-shadow: 0 0 0 2px var(--gr-fond), 0 0 0 4px var(--gr-focus); }

/* ---------------- Bandeau visuel : photo carrée sur tirage, ou silhouette xl sur puits teinté ---------------- */
.ec-fiche .fi-visuel { position: relative; height: 232px; flex: none; }
.ec-fiche .fi-visuel-bouton {
    position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0;
    background: none; color: inherit; cursor: pointer; -webkit-touch-callout: none;
}
.ec-fiche .fi-visuel-bouton > :where(.g-vg) { border-radius: 0; }
.ec-fiche .fi-visuel-bouton:where(:focus-visible) { outline-offset: -4px; border-radius: var(--r-tirage); }
.ec-fiche .fi-photo-puce {
    position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
    border-radius: 18px; color: var(--gr-texte); font: 500 13px/1 var(--gr-sans);
}
@media (min-width: 393px) { .ec-fiche .fi-visuel { height: 244px; } }

/* ---------------- Corps ---------------- */
.ec-fiche .fi-corps { padding: 20px var(--gr-marge) 32px; }
.ec-fiche .t-surtitre { color: var(--gr-texte-2); }
/* Au-dessus du nom : la marque en étiquette (capitales espacées, à l'encre, plus grande que la catégorie qui la suit en
   gris), sur la même ligne de base ; un lien (vers ses autres pièces) a 44 px de cible sans pousser la mise en page. */
.ec-fiche .fi-surtitre { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px; margin: 0; }
.ec-fiche .fi-marque {
    position: relative; font: 700 16px/20px var(--gr-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--gr-texte);
    text-decoration: none; overflow-wrap: anywhere;
}
.ec-fiche a.fi-marque::before { content: ''; position: absolute; inset: -12px -6px; }
.ec-fiche a.fi-marque:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.ec-fiche a.fi-marque:focus-visible { outline: 2px solid var(--gr-focus); outline-offset: 4px; border-radius: 2px; }
.ec-fiche .fi-sep { letter-spacing: 0; }
.ec-fiche .fi-nom { margin-top: 8px; overflow-wrap: anywhere; }
/* Un nom très long sans espace (60 caractères) se coupe où il faut, jamais hors de l'écran : surtitres (« Face à
   la… »), chapôs, légendes, chronique (« avec… »), souvent avec. */
.ec-fiche .fi-corps :where(.t-surtitre, .t-chapo, .fi-sous, .fi-face-legende, .fi-sans-ref, .fi-ev-contenu, .fi-avec-nom) { overflow-wrap: anywhere; }
.ec-fiche .fi-sous { margin-top: 6px; color: var(--gr-texte-2); font: 400 17px/24px var(--gr-sans); }
/* Le style d'abord (20/10/2026) : styles, couleurs, coupe, matière, coloris, en tête des sections. Les couleurs : une
   rangée qui ouvre la palette (GR.formulaires.couleurs) ; chacune sa pastille, son nom fin, son groupe en second. */
.ec-fiche .fi-style { margin-top: 24px; }
.ec-fiche .fi-style-couleurs { align-items: center; padding-top: 10px; padding-bottom: 10px; }
.ec-fiche .fi-couleurs { display: flex; flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none;
                         color: var(--gr-texte); font: 400 17px/22px var(--gr-sans); min-width: 0; }
.ec-fiche .fi-couleur { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.ec-fiche .fi-couleur > .g-pastille-couleur { --t: 18px; flex: none; }
.ec-fiche .fi-couleur-nom { overflow-wrap: anywhere; }
.ec-fiche .fi-groupe { color: var(--gr-texte-3); font-size: 15px; }
.ec-fiche .fi-groupe::before { content: '· '; }
/* Un manque du style : « + Préciser », à l'accent, qui ouvre de quoi le remplir. */
.ec-fiche .fi-ajout-valeur { display: inline-flex; align-items: center; gap: 4px; color: var(--gr-accent); font-weight: 600; }
/* Les styles de la pièce : des liens vers leur page. */
.ec-fiche .fi-styles { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 8px; }
.ec-fiche .fi-style-lien { position: relative; color: var(--gr-texte); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ec-fiche .fi-style-lien::before { content: ''; position: absolute; inset: -12px -4px; }
.ec-fiche .fi-style-lien:focus-visible { outline: 2px solid var(--gr-focus); outline-offset: 3px; border-radius: 2px; }
.ec-fiche .fi-style-sep { color: var(--gr-texte-3); }
@media (hover: hover) { .ec-fiche .fi-style-couleurs:hover, .ec-fiche .fi-ajout:hover { background: var(--gr-survol); } }
/* Une référence à plusieurs exemplaires : « 7 paires identiques », sous la marque. */
.ec-fiche .fi-nombre { margin-top: 6px; font: 600 17px/22px var(--gr-sans); color: var(--gr-texte); font-variant-numeric: tabular-nums; }

/* Chiffre héros : « 6 » serif 112, « ports » et ses deux lignes sur la ligne de base — en tête de « Ports et usure »,
   après le style et les infos. */
.ec-fiche .fi-heros { margin-top: 20px; }
.ec-fiche .fi-usage > .fi-heros { margin-top: 4px; }
.ec-fiche .fi-usage-chiffres { margin: 16px 0 0; }
.ec-fiche .fi-heros-ligne { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0 12px; }
.ec-fiche .fi-chiffre { line-height: .8; animation: fi-revele var(--d-long) var(--c-sortie) both; }
.ec-fiche .fi-chiffre-a { font: 400 56px/.85 var(--gr-serif); color: var(--gr-texte-2); animation: fi-revele var(--d-long) var(--c-sortie) 60ms both; }
.ec-fiche .fi-heros-detail { display: flex; flex-direction: column; padding-bottom: 1px; font: 500 13px/18px var(--gr-sans);
                             color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }
.ec-fiche .fi-heros-detail > b { font: 600 17px/22px var(--gr-sans); color: var(--gr-texte); }
.ec-fiche .fi-mort { color: var(--gr-texte-2); }
.ec-fiche .fi-mort b { color: var(--gr-texte-2); }
.ec-fiche .fi-dague { width: 32px; height: 32px; align-self: flex-start; margin-top: 6px; color: var(--gr-texte-2); }
.ec-fiche .fi-zero { display: flex; align-items: center; gap: 8px; font: 400 28px/1.1 var(--gr-serif); animation: fi-revele var(--d-long) var(--c-sortie) both; }
.ec-fiche .fi-zero > :where(.fi-dague) { width: 24px; height: 24px; margin: 0; align-self: center; }
.ec-fiche .fi-heros-avant { margin-top: 8px; color: var(--gr-texte-2); }
/* « ≈ 6 ports par paire » : le signe est l'icône tilde (la police ne l'a pas). */
.ec-fiche .fi-par-ex { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--gr-texte-2); }

/* Rodage (chaussures) : la case « Faites » et sa phrase, juste sous le héros. Non renseigné, « Elles font encore
   mal » se range à droite, sur la ligne du libellé (centré sur ses 24 px, texte aligné au bord) : la section garde
   la hauteur de la case seule, et la barre de vie de « Face à » reste au-dessus du pli à 375 × 812 (cahier
   « Atelier ») dans les trois états. Sa cible de 44 s'étend vers le haut, pas sur la phrase. */
.ec-fiche .fi-rodage { position: relative; display: flex; flex-direction: column; align-items: flex-start; margin-top: 12px; }
.ec-fiche .fi-case { align-self: stretch; }
.ec-fiche .fi-encore-mal { position: absolute; top: 6px; right: -14px; margin: 0; }
.ec-fiche .fi-encore-mal::before { inset: -6px 0 -2px; }
.ec-fiche .fi-apres { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; color: var(--gr-attention); }
.ec-fiche .fi-apres > :where(.g-ic) { margin-top: 1px; }
.ec-fiche .fi-apres a { color: inherit; text-underline-offset: 3px; }
@keyframes fi-revele { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Face à la référence : la barre de vie (étiquettes de zone empilées de 16 s'il y en a plusieurs). */
.ec-fiche .fi-face { margin-top: 24px; }
.ec-fiche .fi-face-chapo { margin-top: 8px; }
/* Plusieurs références : chaque étiquette est bornée à la barre (cqw : la largeur de .fi-vie), de sa zone au
   bord droit, ou du bord gauche à la fin de sa zone ; un nom trop long se coupe (…), la dague et l'étendue restent. */
.ec-fiche .fi-vie { margin-top: 4px; padding-top: calc(22px + var(--etages, 0) * 16px); container-type: inline-size; }
.ec-fiche .g-vie-etiquette { bottom: calc(100% + 2px + var(--k, 0) * 16px); max-width: calc((1 - var(--de) / var(--max)) * 100cqw + 1px); }
.ec-fiche .fi-etiquette-droite { left: auto; right: -1px; max-width: calc(var(--a) / var(--max) * 100cqw + 1px); }
.ec-fiche .fi-ze-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ec-fiche .fi-face-legende { margin-top: 6px; color: var(--gr-texte-2); }
.ec-fiche .fi-legende-zone { color: var(--gr-accent); }
.ec-fiche .fi-legende-ok { color: var(--gr-ok); }
.ec-fiche .fi-sans-ref { color: var(--gr-texte-2); }

/* Redessin de la même pièce (données reçues) : ni révélation, ni remplissage rejoués. */
.ec-fiche:where(.fi-calme) .fi-chiffre, .ec-fiche:where(.fi-calme) .fi-chiffre-a, .ec-fiche:where(.fi-calme) .fi-zero,
.ec-fiche:where(.fi-calme) .g-vie-sur, .ec-fiche:where(.fi-calme) .g-vie-memoire, .ec-fiche:where(.fi-calme) .g-vie-zone { animation: none; }

/* ---------------- Sections racontées ---------------- */
.ec-fiche .fi-section { margin-top: 40px; }
.ec-fiche .fi-section > :where(.t-titre) { margin-bottom: 12px; }

/* Chronique : date (64) · fil et nœuds (10) · contenu. */
.ec-fiche .fi-fil { list-style: none; margin: 0; padding: 0; }
.ec-fiche .fi-ev { position: relative; display: grid; grid-template-columns: 64px 10px minmax(0, 1fr); column-gap: 12px; align-items: start; padding-bottom: 18px; }
.ec-fiche .fi-ev::before { content: ''; position: absolute; left: 80.5px; top: 12px; bottom: -4px; width: 1px; background: var(--gr-ligne); }
.ec-fiche .fi-ev:where(:last-child)::before { display: none; }
.ec-fiche .fi-vers-projection::before { width: 0; background: none; border-left: 1px dashed var(--gr-texte-3); }
.ec-fiche .fi-ev-date { padding-top: 2px; color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }
.ec-fiche .fi-ev-noeud { position: relative; z-index: 1; display: block; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; }
.ec-fiche .n-creux { background: var(--gr-fond); box-shadow: inset 0 0 0 1.5px var(--gr-texte-2); }
.ec-fiche .n-plein { background: var(--gr-texte); }
.ec-fiche .n-usure { background: var(--gr-attention); box-shadow: 0 0 0 2px var(--gr-fond); }
.ec-fiche .n-rebut { background: var(--gr-accent); border-radius: 1px; transform: rotate(45deg) scale(.85); box-shadow: 0 0 0 2px var(--gr-fond); }
.ec-fiche .n-projection { background: var(--gr-fond); box-shadow: inset 0 0 0 1.5px var(--gr-accent); }
.ec-fiche .fi-ev-contenu { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
                           font: 400 15px/21px var(--gr-sans); color: var(--gr-texte-2); }
.ec-fiche .fi-ev-contenu b { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--gr-texte); }
.ec-fiche .fi-ev-corps {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: calc(100% + 16px); margin: -6px -8px; padding: 6px 8px;
    border: 0; border-radius: var(--r-ctrl); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.ec-fiche .fi-ev-corps:where(:active) { background: var(--gr-presse); }
@media (hover: hover) { .ec-fiche .fi-ev-corps:where(:hover) { background: var(--gr-survol); } }
.ec-fiche .fi-ev-desc { overflow-wrap: anywhere; }
.ec-fiche .fi-ev-photo {
    position: relative; display: block; width: 120px; height: 120px; margin-top: 12px; padding: 0; border: 0; overflow: hidden;
    border-radius: var(--r-tirage); background: var(--gr-tirage); cursor: zoom-in;
}
.ec-fiche .fi-ev-photo > img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; display: block; }
.ec-fiche .fi-projection-texte { color: var(--gr-accent); font-size: 19px; line-height: 24px; }
.ec-fiche .fi-vide-ligne { margin-top: 4px; color: var(--gr-texte-3); }

/* Rythme : 12 colonnes (semaines) × 7 lignes (jours), cases de 14, dans l'encre de la pièce. */
.ec-fiche .fi-rythme-sous { margin: -4px 0 12px; color: var(--gr-texte-2); }
.ec-fiche .fi-rythme-grille { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 3px; }
.ec-fiche .fi-rythme-grille > i, .ec-fiche .fi-rythme-legende i { display: block; width: 14px; height: 14px; border-radius: var(--r-tirage); }
.ec-fiche .r-sur { background: var(--c-encre); }
.ec-fiche .r-memoire { background: color-mix(in oklab, var(--c-encre) 45%, transparent); }
.ec-fiche .r-note { background: var(--gr-surface-2); }
.ec-fiche .r-vide { box-shadow: inset 0 0 0 1px var(--gr-ligne); }
.ec-fiche .r-futur { visibility: hidden; }
.ec-fiche .fi-rythme-legende { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 12px; color: var(--gr-texte-2); }
.ec-fiche .fi-rythme-legende > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ec-fiche .fi-rythme-legende i { width: 10px; height: 10px; }

/* Souvent avec : trois vignettes de 64. */
.ec-fiche .fi-avec-liste { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; }
.ec-fiche .fi-avec-liste > li { width: 88px; min-width: 0; }
.ec-fiche .fi-avec-lien { display: flex; flex-direction: column; gap: 6px; --vg: 64px; color: var(--gr-texte); text-decoration: none; border-radius: var(--r-tirage); }
.ec-fiche .fi-avec-nom { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 600 13px/16px var(--gr-sans); }
.ec-fiche .fi-avec-fois { margin-top: -4px; font: 500 13px/18px var(--gr-sans); color: var(--gr-texte-2); font-variant-numeric: tabular-nums; }

/* Détails : rangées de 48, seulement les champs remplis ; rien n'y est cliquable sauf le lien produit. */
.ec-fiche .g-groupe { margin: 0; }
.ec-fiche .fi-statique { cursor: auto; background: none; }
.ec-fiche .g-valeur { white-space: normal; text-align: right; max-width: 65%; overflow-wrap: anywhere; padding-block: 12px; }
.ec-fiche .fi-notes { align-items: flex-start; padding-block: 12px; }
.ec-fiche .g-rangee-libelle small { margin-top: 4px; font: 400 15px/21px var(--gr-sans); color: var(--gr-texte-2); white-space: pre-line; overflow-wrap: anywhere; }

/* Fin de page : « Mettre au rebut » (et, pour une référence multiple, « J'en rachète »), discrets. */
.ec-fiche .fi-fin { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 8px; margin-top: -8px; padding-bottom: 24px; }
.ec-fiche .fi-discret { color: var(--gr-texte-2); font-weight: 500; }

/* Barre basse collée : un seul bouton plein. */
.ec-fiche .fi-bas {
    position: sticky; bottom: 0; z-index: var(--z-barre); margin-top: auto;
    padding: 8px var(--gr-marge) calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--gr-ligne);
}

/* États : squelette, pièce introuvable, chargement en échec. */
.ec-fiche .fi-squelette-visuel { height: 100%; border-radius: 0; }
.ec-fiche .fi-squelette-titre { width: 60%; height: 44px; margin-top: 12px; }
.ec-fiche .fi-squelette-chiffre { width: 30%; height: 96px; margin-top: 24px; }
.ec-fiche .fi-introuvable, .ec-fiche .fi-panne { padding-top: 96px; }
.ec-fiche .fi-panne-ic { width: 32px; height: 32px; color: var(--gr-texte-2); }

/* Photo d'usure agrandie. */
.fi-feuille-photo .fi-photo-grande { margin: 0 var(--gr-marge) 12px; background: var(--gr-tirage); border-radius: var(--r-tirage); overflow: hidden; }
.fi-feuille-photo .fi-photo-grande > img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }

/* Petits écrans (iPhone SE, 375 × 667) : bandeau et chiffre resserrés, la barre de vie reste au-dessus du pli. */
@media (max-width: 1023px) and (max-height: 700px) {
    .ec-fiche .fi-visuel { height: 184px; }
    .ec-fiche .fi-corps { padding-top: 16px; }
    .ec-fiche .fi-nom { font-size: 40px; }
    .ec-fiche .fi-heros { margin-top: 14px; }
    .ec-fiche .fi-chiffre { font-size: 88px; }
    .ec-fiche .fi-chiffre-a { font-size: 44px; }
    .ec-fiche .fi-face { margin-top: 18px; }
}

/* ---------------- Bureau (1024 et plus) : le panneau de 440, la barre d'actions en tête ---------------- */
@media (min-width: 1024px) {
    .ec-fiche { --gr-marge: 24px; min-height: 100%; }
    .ec-fiche .fi-barre { height: 56px; margin-bottom: 0; padding: 0 8px 0 16px; justify-content: flex-end; }
    .ec-fiche .fi-retour, .ec-fiche .g-barre-titre { display: none; }
    .ec-fiche .fi-fermer { display: inline-grid; }
    .ec-fiche .fi-bureau { display: inline-flex; }
    .ec-fiche .g-barre-droite { gap: 4px; }
    .ec-fiche .fi-modifier { height: 36px; margin: 0 4px; background: var(--gr-surface-2); -webkit-backdrop-filter: none; backdrop-filter: none; font-size: 15px; }
    .ec-fiche .fi-visuel { height: 300px; }
    .ec-fiche .fi-bas { display: none; }
    .ec-fiche .fi-corps { padding-bottom: 40px; }
    .ec-fiche .fi-heros-ligne { gap: 0 16px; }
    .ec-fiche .fi-chiffre-a { font-size: 64px; }
}
