/* ============================================================
   BOUTON PARTAGE "PAGE PRECEDENTE"
   ------------------------------------------------------------
   En haut a gauche, sous la barre de navigation. Va avec
   js/back-to-prev.js. Markup attendu dans la page :
     <button id="backToPrev" class="back-to-prev" aria-label="Back">
       <svg viewBox="0 0 24 24" ...>...</svg>
     </button>

   Jumeau de css/scroll-to-top.css : meme palette, meme geometrie,
   memes replis var(--token, repli) pour les 5 pages encore sur
   l ancien theme qui chargent ce fichier sans nocturne-base.css.

   admin-nocturne.css et business-edit-nocturne.css repositionnent
   ce bouton (coin bas-gauche, barre d outils) : ils surchargent la
   POSITION par-dessus ces regles, pas les couleurs.
   ============================================================ */

.back-to-prev {
  --btp-accent: var(--color-accent, #4e4199);
  --btp-fill: color-mix(in srgb, var(--btp-accent) 18%, transparent);
  --btp-ring: color-mix(in srgb, var(--btp-accent) 45%, transparent);
  --btp-ink: var(--color-accent-200, #d9d3f2);

  position: fixed;
  left: clamp(14px, 2vw, 22px);
  top: calc(66px + clamp(16px, 2vw, 24px));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 13px;
  background: var(--btp-fill);
  box-shadow: inset 0 0 0 1px var(--btp-ring);
  color: var(--btp-ink);
  /* Masque tant que js/back-to-prev.js n a pas pose .show. */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity .3s ease, transform .3s ease, background .2s ease, visibility .3s;
}

.back-to-prev.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-prev:hover {
  background: color-mix(in srgb, var(--btp-accent) 28%, transparent);
}

.back-to-prev:active { transform: scale(.94); }

.back-to-prev svg {
  display: block;
  width: 18px;
  height: 18px;
  transition: transform .2s ease;
}

/* La fleche recule legerement : le seul rappel de l ancien bouton
   qui valait la peine d etre garde. */
.back-to-prev:hover svg { transform: translateX(-2px); }

@media (max-width: 600px) {
  .back-to-prev {
    top: 72px;
    left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .back-to-prev svg { width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-prev { transition: opacity .01s, visibility .01s; transform: none; }
  .back-to-prev.show { transform: none; }
  .back-to-prev:active { transform: none; }
  .back-to-prev:hover svg { transform: none; }
}
