/* Fil de l'app : plein écran, une affiche par geste, entre la barre noire du haut
 * (filtres) et celle du bas (onglets). Servie après /style.css et /app/app.css
 * sur /app (app.FIL_CSS). Les textes ouverts dans la feuille de lecture gardent
 * le style des pages du site (.texte, style.css). Sur ordinateur : colonne 9:16
 * au centre, actions à sa droite.
 */

body.app { overflow: hidden; background: var(--noir); }
.symboles { position: absolute; width: 0; height: 0; overflow: hidden; }

/* -- la barre du haut ----------------------------------------------------- */

.haut-app {
  position: fixed;
  inset: 0 0 auto;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 14px;
  height: calc(var(--haut-app) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  background: var(--noir);
  color: var(--fluo);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.pastille-jour {
  flex: none;
  margin: 0;
  padding: 4px 8px;
  background: var(--fluo);
  color: var(--noir);
  animation: pastille-bat var(--t-scene) var(--c-sortie) infinite alternate;
}
@keyframes pastille-bat {
  to { transform: scale(var(--pression)); }
}
.filtres {
  display: flex;
  flex: 1;
  gap: 18px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filtres::-webkit-scrollbar { display: none; }
.filtres button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 3px 0 0;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  opacity: 0.6;
  cursor: pointer;
}
.filtres button[aria-pressed="true"] { border-bottom-color: var(--fluo); opacity: 1; }
.haut-app [hidden] { display: none; }

/* Ce qui vient d'arriver : une pastille, jamais un saut dans la lecture. */
.nouveaux {
  position: fixed;
  top: calc(var(--haut-app) + env(safe-area-inset-top) + 14px);
  left: 50%;
  z-index: 3;
  min-height: 40px;
  padding: 0 16px;
  border: 2px solid var(--noir);
  border-radius: 0;
  background: var(--fluo);
  color: var(--noir);
  box-shadow: 4px 4px 0 var(--noir);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  translate: -50% 0;
  cursor: pointer;
  animation: nouveaux-arrive var(--t-ample) var(--c-ressort) both;
}
.nouveaux:active { box-shadow: 0 0 0 var(--noir); transform: translate(4px, 4px); }
@keyframes nouveaux-arrive {
  from { opacity: 0; transform: translateY(calc(-1 * var(--monte))); }
}
.hors-ligne {
  position: fixed;
  top: calc(var(--haut-app) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 3;
  margin: 0;
  padding: 7px 14px;
  background: var(--fluo);
  color: var(--noir);
}

/* -- le fil : le défilement s'arrête net sur chaque affiche --------------- */

.fil {
  position: fixed;
  top: calc(var(--haut-app) + env(safe-area-inset-top));
  bottom: calc(var(--barre-app) + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: var(--noir);
}
.fil::-webkit-scrollbar { display: none; }

.affiche {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  height: 100%;
  container-type: inline-size;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}
.affiche[hidden] { display: none; }
.affiche-cr { background: var(--fluo); color: var(--noir); }
.affiche-ag { background: var(--noir); color: var(--fluo); }
.affiche-agenda { background: var(--papier); color: var(--encre); }
.affiche-luttes { background: var(--papier-creux); color: var(--encre); }
.fin-fil { display: flex; flex-direction: column; background: var(--noir); color: var(--blanc-casse); }

/* Étiquette en haut ; date, titre et le reste posés en bas, comme la légende d'une vidéo. */
.affiche-corps {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding: 18px 6px 24px var(--marge);
}
.affiche-corps > .oeil { margin-bottom: auto; padding-bottom: 18px; }
.affiche-date {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "wdth" 112;
  font-weight: 900;
  font-size: clamp(26 * var(--px), 9cqi, 46 * var(--px));
  line-height: 0.86;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.affiche-date span { display: block; font-size: 3.1em; line-height: 0.8; }
.affiche-titre {
  margin: 18px 0 0;
  font-family: var(--display);
  font-variation-settings: "wdth" 104;
  font-weight: 800;
  font-size: clamp(22 * var(--px), 7cqi, 34 * var(--px));
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}
.affiche-ag .affiche-titre { color: var(--blanc-casse); }
.affiche-resume {
  display: -webkit-box;
  margin: 12px 0 0;
  overflow: hidden;
  font-size: calc(16 * var(--px));
  font-weight: 700;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.affiche-resume.ouvert { display: block; }
.plus {
  align-self: flex-start;
  min-width: 44px;
  min-height: 44px;
  text-align: left;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  font-size: calc(12 * var(--px));
  font-weight: 800;
  text-decoration: underline;
  text-transform: uppercase;
  cursor: pointer;
}
.plus[hidden] { display: none; }
.affiche-infos {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: calc(12 * var(--px));
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.affiche-ag .affiche-infos { color: var(--blanc-casse); }
.rebours {
  align-self: flex-start;
  margin: 16px 0 0;
  padding: 6px 10px;
  background: var(--fluo);
  color: var(--noir);
  font-family: var(--mono);
  font-size: calc(13 * var(--px));
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.affiche .boutons { margin-top: 18px; }
.affiche .bande { flex: none; height: 18px; margin: 22px 0 0; }
/* Sur le papier le blanc de la bande se confond avec le fond : gris du liseré du pied à
   la place. */
.affiche-agenda .bande {
  background: linear-gradient(90deg, var(--tricolore-bleu) 0 33.34%, var(--papier-creux) 33.34% 66.67%,
    var(--tricolore-rouge) 66.67% 100%);
}
.fin-fil .affiche-corps { flex: 1; padding-right: var(--marge); }
.fin-fil .affiche-corps p:not(.oeil) { max-width: 34em; margin: 14px 0 0; font-size: calc(16 * var(--px)); line-height: 1.5; }
.fin-fil .affiche-titre { color: var(--fluo); }
.fin-fil .vide { color: var(--fluo); font-weight: 700; }
.fin-fil .vide[hidden] { display: none; }
.fin-fil .lisere { margin-top: 0; }
.mentions-app {
  margin: 0;
  padding: 12px var(--marge) 16px;
  font-family: var(--mono);
  font-size: calc(11 * var(--px));
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* -- la colonne d'actions ------------------------------------------------- */

.affiche-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  width: 70px;
  padding: 0 8px 24px 2px;
}
/* Le type en étiquette noire, pas en icône : une étoile se confondait avec la réaction
   Étoile juste dessous. */
.pastille-type {
  margin-bottom: 6px;
  padding: 4px 6px;
  background: var(--noir);
  color: var(--fluo);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.affiche-ag .pastille-type { background: var(--fluo); color: var(--noir); }
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.action[hidden] { display: none; }
.action .icone {
  width: 34px;
  height: 34px;
  padding: 3px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-rapide) var(--c-ressort);
}
.action:active .icone { transform: scale(var(--pression)); }
/* Donné : icône pleine de sa couleur, sur un carré noir, comme un autocollant. */
.action[aria-pressed="true"] .icone { background: var(--noir); stroke: var(--noir); }
.action[data-reagir="coeur"][aria-pressed="true"] .icone { fill: var(--rouge); }
.action[data-reagir="etoile"][aria-pressed="true"] .icone,
.action[data-garder][aria-pressed="true"] .icone { fill: var(--fluo); }
.disque { width: 44px; height: 44px; margin-top: 6px; }
.affiche.active .disque { animation: disque-tourne var(--t-tour) linear infinite; }
@keyframes disque-tourne {
  to { transform: rotate(1turn); }
}

/* -- l'éclat du double appui ---------------------------------------------- */

.eclat { position: absolute; z-index: 2; width: 0; height: 0; pointer-events: none; }
.eclat i {
  position: absolute;
  left: -8px;
  top: -8px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--noir);
  background: var(--fluo);
  animation: eclat-part var(--t-ample) var(--c-sortie) both;
}
.eclat.coeur i { background: var(--rouge); }
.eclat i:nth-child(2) { rotate: 45deg; }
.eclat i:nth-child(3) { rotate: 90deg; }
.eclat i:nth-child(4) { rotate: 135deg; }
.eclat i:nth-child(5) { rotate: 180deg; }
.eclat i:nth-child(6) { rotate: 225deg; }
.eclat i:nth-child(7) { rotate: 270deg; }
.eclat i:nth-child(8) { rotate: 315deg; }
/* Chaque éclat part dans sa direction (rotate, ci-dessus), posé en losange. */
@keyframes eclat-part {
  from { opacity: 1; transform: translateY(0) rotate(45deg) scale(0.4); }
  70% { opacity: 1; }
  to { opacity: 0; transform: translateY(-72px) rotate(45deg) scale(1); }
}

/* -- les feuilles qui montent du bas --------------------------------------
 * Sur le papier : un texte long s'y lit comme sur le site. Elles portent aussi
 * la classe `feuille` (composants.css) : ce qui suit en reprend la main.
 */

.lecture {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 720px;
  /* Pleine hauteur dès l'ouverture, avant que le texte arrive. */
  height: 100dvh;
  max-height: none;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  border: 0;
  border-radius: 0;
  background: var(--papier);
  color: var(--encre);
  transition: transform var(--t-ample) var(--c-sortie), display var(--t-ample) allow-discrete,
              overlay var(--t-ample) allow-discrete;
}
.lecture[open] { display: flex; flex-direction: column; overflow: hidden; animation: none; }
.lecture .oeil { color: inherit; }
@starting-style {
  .lecture[open]:not(.transition) { transform: translateY(100%); }
}
/* Ouverte par une transition de vue : le titre de l'affiche glisse jusqu'à
   celui de la feuille, la feuille monte autour de lui (fil.js). */
.lecture.transition { view-transition-name: feuille; }
::view-transition-group(*) { animation-duration: var(--t-ample); animation-timing-function: var(--c-sortie); }
::view-transition-new(feuille) { animation: feuille-monte var(--t-ample) var(--c-sortie) both; }
::view-transition-old(feuille) { display: none; }
@keyframes feuille-monte {
  from { transform: translateY(100%); }
}
/* La barre de lecture : liée au défilement du texte, ou réglée par fil.js. */
.feuille-tete { position: relative; }
.progression {
  position: absolute;
  inset: auto 0 -3px;
  height: 3px;
  background: var(--fluo);
  --lu: 0;
  transform: scaleX(var(--lu));
  transform-origin: left;
}
@supports (animation-timeline: scroll()) {
  .lecture { timeline-scope: --lecture; }
  .feuille-corps { scroll-timeline: --lecture block; }
  .progression { animation: progression linear both; animation-timeline: --lecture; }
}
@keyframes progression {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.lecture.part { transform: translateY(100%); transition-duration: var(--t-base); transition-timing-function: var(--c-entree); }
.lecture.tiree { transition: none; }
.lecture::backdrop { background: var(--voile); }
.poignee { display: flex; flex: none; justify-content: center; padding: 10px 0 8px; cursor: grab; touch-action: none; }
.poignee i { width: 44px; height: 4px; background: var(--encre-douce); }
.feuille-tete {
  display: grid;
  flex: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  padding: 0 var(--marge) 14px;
  border-bottom: 3px solid var(--encre);
  touch-action: none;
}
.feuille-tete .oeil { grid-column: 1; }
.feuille-tete h2 {
  grid-column: 1;
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "wdth" 104;
  font-weight: 800;
  font-size: calc(22 * var(--px));
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.fermer {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--encre);
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  font-size: calc(11.5 * var(--px));
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}
.feuille-corps { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--marge) 40px; }
.feuille-corps .texte > :first-child { margin-top: 18px; }
.options { margin: 0; padding: 0 0 8px; list-style: none; }
.options li { border-top: 1px solid var(--trait); }
.options li[hidden] { display: none; }
.options button,
.options a {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 58px;
  padding: 0 var(--marge);
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--display);
  font-variation-settings: "wdth" 104;
  font-weight: 800;
  font-size: calc(18 * var(--px));
  letter-spacing: -0.015em;
  text-align: left;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.options .icone {
  flex: none;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -- le message bref ------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: calc(var(--barre-app) + env(safe-area-inset-bottom) + 16px);
  left: 50%;
  z-index: 6;
  margin: 0;
  padding: 10px 16px;
  border: 2px solid var(--fluo);
  background: var(--noir);
  color: var(--fluo);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  translate: -50% 0;
  animation: nouveaux-arrive var(--t-base) var(--c-sortie) both;
}
.toast[hidden] { display: none; }

/* -- la barre du bas : la prochaine AG au centre -------------------------- */

.barre-app {
  position: fixed;
  inset: auto 0 0;
  z-index: 4;
  height: calc(var(--barre-app) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--fluo-filet);
  background: var(--noir);
  color: var(--fluo);
}
.barre-app ul {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 560px;
  height: 100%;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.barre-app a,
.barre-app button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0.66;
  cursor: pointer;
}
.barre-app button[hidden] { display: none; }
.barre-app [aria-current="page"],
.barre-app [aria-pressed="true"],
.barre-app .centre a { opacity: 1; }
.barre-app .icone {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.barre-app .autocollant {
  width: 52px;
  height: 52px;
  margin-top: -20px;
  transition: transform var(--t-rapide) var(--c-ressort);
}
.barre-app .centre a:active .autocollant { transform: scale(var(--pression)); }

/* -- sur ordinateur : une colonne 9:16, les actions à sa droite ----------- */

@media (min-width: 760px) {
  /* Un filet de chaque côté : l'affiche noire ne se perd pas dans le fond. */
  .affiche {
    width: min(100%, calc((100dvh - var(--haut-app) - var(--barre-app)) * 9 / 16));
    margin: 0 auto;
    overflow: visible;
    border-inline: 1px solid var(--fluo-filet);
  }
  .affiche-actions { position: absolute; left: 100%; bottom: 0; padding-left: 14px; color: var(--fluo); }
  .affiche-actions .pastille-type { background: var(--fluo); color: var(--noir); }
  .fin-fil { width: min(100%, 720px); }
  .filtres { justify-content: center; }
}

/* -- l'affiche qui se pose : ses éléments entrent en cascade --------------
 * `data-pret` et `entree` sont posés par fil.js : sans script, rien n'est caché.
 */
@media (prefers-reduced-motion: no-preference) {
  .fil[data-pret] .affiche:not(.active) :is(.affiche-corps, .affiche-actions) > * { opacity: 0; }
  .fil[data-pret] .affiche.entree.active :is(.affiche-corps, .affiche-actions) > * {
    animation: affiche-entre var(--t-ample) var(--c-sortie) both;
  }
  .fil[data-pret] .affiche.entree.active .affiche-corps > :nth-child(2) { animation-delay: calc(1 * var(--cascade)); }
  .fil[data-pret] .affiche.entree.active .affiche-corps > :nth-child(3) { animation-delay: calc(2 * var(--cascade)); }
  .fil[data-pret] .affiche.entree.active .affiche-corps > :nth-child(n + 4) { animation-delay: calc(3 * var(--cascade)); }
  .fil[data-pret] .affiche.entree.active .affiche-actions > * { animation-delay: calc(4 * var(--cascade)); }
}
@keyframes affiche-entre {
  from { opacity: 0; translate: 0 var(--monte); }
}

/* -- tiré vers le bas en haut du fil : l'étoile tourne avec le doigt -------- */

.tirette {
  position: fixed;
  top: calc(var(--haut-app) + env(safe-area-inset-top));
  left: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  margin: 0 0 0 -22px;
  pointer-events: none;
  --tire: 0px;
  --tour: 0deg;
  translate: 0 calc(var(--tire) - 100%);
  rotate: var(--tour);
}
.tirette[hidden] { display: none; }
.tirette svg { display: block; width: 100%; height: 100%; transition: scale var(--t-rapide) var(--c-ressort); }
.tirette.pret svg { scale: 1.15; }
.tirette.charge { translate: 0 calc(var(--tirer-seuil) - 100%); transition: translate var(--t-base) var(--c-sortie); }
.tirette.charge svg { animation: disque-tourne var(--t-scene) linear infinite; }

/* Un nombre de réactions qui change roule depuis le bas. */
.action [data-nombre].roule { display: inline-block; animation: nombre-roule var(--t-base) var(--c-sortie); }
@keyframes nombre-roule {
  from { opacity: 0; translate: 0 60%; }
}

@media (prefers-reduced-motion: reduce) {
  .pastille-jour,
  .affiche.active .disque { animation: none; }
}
