/* Le fil du jour, couché (synthèse de la refonte 2, écran 01 ; js/fil-du-jour.js).
   Une heure = une position : --x (début) et --l (durée), en fractions de la piste ; étiquettes : --s, --w et --rang.
   --fj-fond : la surface sous le fil (les nœuds en prennent la couleur pour couper le trait) ; à changer sur un îlot. */
.fil-jour {
  --fj-fond: var(--fond);
  --fj-rang: 56px;   /* hauteur d'un rang d'étiquettes : titre sur deux lignes au plus, puis une ligne de détail */
  --fj-air: 16px;    /* entre une étiquette du dessus et le trait */
  --fj-bord: 14px;   /* place pour les nœuds posés à 7 h ou à 22 h, hors du bord du contenu */
  --fj-fondu-g: 0px; --fj-fondu-d: 0px;
  position: relative; margin-inline: calc(-1 * var(--fj-bord)); padding: 4px var(--fj-bord);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fj-fondu-g), #000 calc(100% - var(--fj-fondu-d)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fj-fondu-g), #000 calc(100% - var(--fj-fondu-d)), transparent);
}
.fil-jour.fj-suite-avant { --fj-fondu-g: 28px; }
.fil-jour.fj-suite-apres { --fj-fondu-d: 28px; }
@media (pointer: coarse) { .fil-jour { scrollbar-width: none; } .fil-jour::-webkit-scrollbar { display: none; } }

.fj-piste {
  --fj-ligne: calc(max(var(--fj-rangs-haut, 1) * var(--fj-rang) + var(--fj-air), 24px) + 6px); /* sans rien au-dessus : la place du repère d'or */
  position: relative; min-width: calc(var(--fj-heures, 15) * 64px);
  height: calc(var(--fj-ligne) + 19px + var(--fj-rangs-bas, 1) * var(--fj-rang) + 8px);
}
.fj-trait { position: absolute; left: 0; right: 0; top: var(--fj-ligne); height: 1.5px; margin-top: -.75px; border-radius: 1px; background: var(--fil); }
.fj-liste { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.fj-el { position: absolute; inset: 0; pointer-events: none; }

/* La cible : 44 pt, transparente, posée sur la marque ; le bouton porte le nom lu et le cercle de focus. */
.fj-cible {
  position: absolute; top: calc(var(--fj-ligne) - 22px); left: calc(var(--x) * 100% - 22px); width: 44px; height: 44px;
  padding: 0; border: 0; border-radius: 12px; background: none; color: inherit; cursor: pointer; pointer-events: auto;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
.fj-rdv .fj-cible, .fj-libre .fj-cible { left: calc((var(--x) + var(--l) / 2) * 100% - max(22px, var(--l) * 50%)); width: max(44px, var(--l) * 100%); }
/* Les nœuds ronds passent devant les traits des rendez-vous (une tâche pendant un rendez-vous reste visible et touchable). */
.fj-tache .fj-marque, .fj-habitude .fj-marque, .fj-message .fj-marque, .fj-tache .fj-cible, .fj-habitude .fj-cible, .fj-message .fj-cible { z-index: 1; }
.fj-repere { z-index: 2; }
.fj-marque { position: absolute; display: grid; place-items: center; pointer-events: none; transition: transform 140ms var(--ease-out), opacity 140ms ease, background-color 160ms var(--ease-out); }

/* Rendez-vous : un trait épais de sa durée */
.fj-rdv .fj-marque { left: calc(var(--x) * 100%); width: calc(var(--l) * 100%); min-width: 6px; top: calc(var(--fj-ligne) - 3.5px); height: 7px; border-radius: 4px; background: var(--c, var(--accent)); }
.fj-rdv.fj-chevauche .fj-marque { transform: translateY(-10px); }
/* Rendez-vous sans heure de fin : un point, jamais une durée inventée */
.fj-rdv.fj-ponctuel .fj-marque { left: calc(var(--x) * 100% - 5.5px); width: 11px; min-width: 0; top: calc(var(--fj-ligne) - 5.5px); height: 11px; border-radius: 50%; box-shadow: 0 0 0 3px var(--fj-fond); }
.fj-rdv .fj-cible:active ~ .fj-marque { opacity: .7; }

/* Tâche : un rond à la couleur de l'espace ou du projet ; habitude : le même, en pointillés */
.fj-tache .fj-marque, .fj-habitude .fj-marque {
  left: calc(var(--x) * 100% - 10px); top: calc(var(--fj-ligne) - 10px); width: 20px; height: 20px; border-radius: 50%;
  background: var(--fj-fond); box-shadow: inset 0 0 0 1.75px var(--c, var(--accent)); color: var(--sur-c, var(--accent-contraste));
}
.fj-marque .ic { width: 13px; height: 13px; stroke-width: 2.6; opacity: 0; transition: opacity 120ms ease; }
.fj-habitude .fj-marque { box-shadow: none; }
.fj-habitude .fj-marque::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, transparent 8.2px, var(--c, var(--accent)) 8.6px, var(--c, var(--accent)) 10px, transparent 10.4px);
  -webkit-mask: repeating-conic-gradient(#000 0 18deg, transparent 18deg 30deg); mask: repeating-conic-gradient(#000 0 18deg, transparent 18deg 30deg);
}
.fj-fait .fj-marque { background: var(--c, var(--accent)); }
.fj-fait .fj-marque::before { display: none; }
.fj-fait .fj-marque .ic { opacity: 1; }
.fj-tache .fj-cible:active ~ .fj-marque, .fj-habitude .fj-cible:active ~ .fj-marque, .fj-message .fj-cible:active ~ .fj-marque { transform: scale(.88); }

/* Message : une bulle sur le trait */
.fj-message .fj-marque { left: calc(var(--x) * 100% - 11px); top: calc(var(--fj-ligne) - 11px); width: 22px; height: 22px; background: var(--fj-fond); color: var(--c, var(--accent)); }
.fj-message .fj-marque .ic { width: 18px; height: 18px; stroke-width: 1.75; opacity: 1; }

/* Créneau libre : le trait s'efface en pointillés */
.fj-libre .fj-marque { left: calc(var(--x) * 100%); width: calc(var(--l) * 100%); top: calc(var(--fj-ligne) - 4px); height: 8px; background: var(--fj-fond); }
.fj-libre .fj-marque::before { content: ""; position: absolute; left: 3px; right: 3px; top: 3.25px; height: 1.5px; background: repeating-linear-gradient(to right, var(--fil) 0 4px, transparent 4px 8px); }

/* Maintenant : le repère d'or, la seule touche d'or */
.fj-repere { position: absolute; left: calc(var(--x) * 100%); top: calc(var(--fj-ligne) - 17px); width: 0; height: 34px; }
.fj-repere::before { content: ""; position: absolute; left: -1px; top: 0; width: 2px; height: 34px; border-radius: 1px; background: var(--or); }
.fj-repere::after { content: ""; position: absolute; left: -6px; top: 11px; width: 12px; height: 12px; border-radius: 50%; background: var(--or); box-shadow: 0 0 0 3px var(--fj-fond); }
.fj-mt { position: absolute; left: calc(var(--x) * 100%); top: calc(var(--fj-ligne) + 21px); transform: translateX(-50%); font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--or-texte); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Étiquettes : au-dessus (rendez-vous, messages, libres), en dessous (tâches, habitudes) ; en rangs qui ne se chevauchent pas */
.fj-lb {
  position: absolute; left: calc(var(--s) * 100%); width: calc(var(--w) * 100%); height: var(--fj-rang);
  display: flex; flex-direction: column; min-width: 0; pointer-events: auto; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.fj-el[data-voie="haut"] .fj-lb { top: calc(var(--fj-ligne) - var(--fj-air) - (var(--rang) + 1) * var(--fj-rang)); justify-content: flex-end; }
.fj-el[data-voie="bas"] .fj-lb { top: calc(var(--fj-ligne) + 19px + var(--rang) * var(--fj-rang)); }
.fj-lb-fin { align-items: flex-end; text-align: right; }
.fj-lb-centre { align-items: center; text-align: center; }
.fj-lb-titre { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.fj-lb-sous { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-size: 12.5px; line-height: 1.3; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.fj-libre .fj-lb { cursor: default; }
.fj-fait .fj-lb-titre { color: var(--texte-doux); font-weight: 500; }
.fj-passe .fj-marque, .fj-passe .fj-lb { opacity: .72; }
@media (hover: hover) and (pointer: fine) { .fj-el:not(.fj-libre) .fj-lb:hover .fj-lb-titre { color: var(--accent-texte); } }

/* Heures, sous le fil */
.fj-heures { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; font-size: 11.5px; line-height: 16px; color: var(--texte-doux); font-variant-numeric: tabular-nums; pointer-events: none; }
.fj-heures span { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); white-space: nowrap; }
.fj-heures .fj-h-debut { transform: none; }
.fj-heures .fj-h-fin { transform: translateX(-100%); }

/* ================= Le ruban (téléphone, écran 02 de la synthèse finale) =================
   La journée entière sur une piste : rendez-vous et habitudes en blocs à l'icône de leur espace, créneaux libres en pointillés,
   tâches et messages à heure en petits signes sous la piste, maintenant en trait d'or. Un toucher ouvre le moment : sa fiche
   s'affiche dessous, en îlot. */
.fil-jour.fj-forme-ruban { margin-inline: 0; padding: 14px 0 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
.fj-forme-ruban .fj-piste { min-width: 0; height: 83px; }
.fj-bande { position: absolute; left: 0; right: 0; top: 0; height: 46px; border-radius: 14px; background: color-mix(in srgb, var(--texte) 5%, var(--fj-fond)); cursor: pointer; }
.fj-bloc {
  position: absolute; top: 3px; height: 40px; left: calc(var(--x) * 100%); width: max(calc(var(--l) * 100% - 2px), 24px);
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 11px; pointer-events: auto; cursor: pointer;
  color: var(--c, var(--accent-texte)); background: color-mix(in srgb, var(--c, var(--accent)) 18%, var(--carte));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 28%, transparent);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.fj-bloc .ic { width: 16px; height: 16px; stroke-width: 2; }
/* Moment sans durée (habitude, rendez-vous sans fin) : un bloc de 24 px centré sur son heure */
.fj-ponctuel .fj-bloc { left: calc(var(--x) * 100% - 12px); width: 24px; }
.fj-bloc:active { transform: scale(.94); }
.fj-forme-ruban .fj-habitude:not(.fj-fait) .fj-bloc { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c, var(--accent)) 60%, transparent); }
.fj-forme-ruban .fj-libre .fj-bloc { top: 9px; height: 28px; background: transparent; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--texte-doux) 45%, transparent); border-radius: 8px; }
.fj-forme-ruban .fj-passe .fj-bloc { opacity: .6; }
.fj-forme-ruban .fj-choisi .fj-bloc { opacity: 1; background: var(--c, var(--accent)); color: var(--sur-c, var(--accent-contraste)); box-shadow: 0 0 0 2px var(--fj-fond), 0 0 0 3.5px var(--c, var(--accent)); }
.fj-forme-ruban .fj-libre.fj-choisi .fj-bloc { background: var(--accent-voile); border-color: var(--accent-texte); box-shadow: none; }
/* Sous la piste : les tâches à heure (petits ronds) et les messages (petites bulles), avec une cible de 44 pt */
.fj-forme-ruban .fj-cible { top: 46px; left: calc(var(--x) * 100% - 22px); width: 44px; height: 44px; }
.fj-forme-ruban .fj-tache .fj-marque, .fj-forme-ruban .fj-message .fj-marque { left: calc(var(--x) * 100% - 5px); top: 51px; width: 10px; height: 10px; border-radius: 50%; background: none; box-shadow: inset 0 0 0 1.75px var(--c, var(--accent)); }
.fj-forme-ruban .fj-message .fj-marque { left: calc(var(--x) * 100% - 7px); top: 49px; width: 14px; height: 14px; box-shadow: none; color: var(--c, var(--accent)); }
.fj-forme-ruban .fj-message .fj-marque .ic { width: 14px; height: 14px; stroke-width: 2; }
.fj-forme-ruban .fj-tache.fj-fait .fj-marque, .fj-forme-ruban .fj-tache.fj-choisi .fj-marque { background: var(--c, var(--accent)); }
.fj-forme-ruban .fj-choisi .fj-marque { box-shadow: inset 0 0 0 1.75px var(--c, var(--accent)), 0 0 0 2px var(--fj-fond), 0 0 0 3.5px var(--c, var(--accent)); }
/* Maintenant : le trait d'or traverse la piste */
.fj-forme-ruban .fj-repere { top: -8px; height: 60px; }
.fj-forme-ruban .fj-repere::before { height: 100%; }
.fj-forme-ruban .fj-repere::after { left: -5px; top: -4px; width: 10px; height: 10px; box-shadow: none; }
.fj-forme-ruban .fj-heures { top: 65px; bottom: auto; height: 18px; font-size: 12px; line-height: 18px; }
.fj-heures .fj-h-mt { color: var(--or-texte); font-weight: 600; }
/* La fiche du moment choisi : un îlot sous la piste */
.fj-fiche { margin-top: 12px; }
.fj-fiche-carte {
  width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 12px; border: 0; border-radius: 18px;
  font: inherit; text-align: left; color: var(--texte); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transform-origin: 30% 0; transition: transform 140ms var(--ease-out);
}
.fj-fiche-carte:active { transform: scale(.985); }
.fj-fiche-entre { animation: fj-fiche 220ms var(--ease-out) both; }
@keyframes fj-fiche { from { opacity: 0; transform: scale(.97) translateY(-4px); } }
.fj-fiche-sceau { width: 36px; height: 36px; border-radius: 11.5px; display: grid; place-items: center; background: var(--c, var(--accent)); color: var(--sur-c, var(--accent-contraste)); }
.fj-fiche-sceau .ic { width: 20px; height: 20px; stroke-width: 1.9; }
.fj-fiche-texte { min-width: 0; }
.fj-fiche-texte b { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.fj-fiche-texte span { display: block; margin-top: 1px; font-size: 13.5px; line-height: 1.35; color: var(--texte-doux); }
.fj-fiche-fl { width: 16px; height: 16px; color: var(--texte-doux); }

@media (prefers-reduced-motion: reduce) {
  .fj-bloc, .fj-fiche-carte { transition: none; }
  .fj-bloc:active, .fj-fiche-carte:active { transform: none; }
  .fj-fiche-entre { animation: fj-fondu 160ms ease-out both; }
  @keyframes fj-fondu { from { opacity: 0; } }
  .fj-marque, .fj-marque .ic { transition: none; }
  .fj-tache .fj-cible:active ~ .fj-marque, .fj-habitude .fj-cible:active ~ .fj-marque, .fj-message .fj-cible:active ~ .fj-marque { transform: none; }
}
