/* ==========================================================================
   back-to-top.css
   Botón flotante "Volver arriba" (js/back-to-top.js).
   Círculo con el degradado oficial, flecha y un anillo que muestra cuánto
   se ha avanzado en la página (mismo concepto que la barra del encabezado).
   Va abajo a la IZQUIERDA para no chocar con el botón "Solicita información"
   (.fab), que está abajo a la derecha. Comparte markup en el pie
   (tools/sync_shared.py lo mantiene igual en todas las páginas).
   ========================================================================== */

/* Botón: oculto hasta que se baja de la portada */
.totop {
  position: fixed;
  left: 1.2rem;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgb(var(--c-sombra-rgb) / .3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.9);
  transition: opacity .3s, visibility .3s, transform .3s, box-shadow .3s;
}

/* Visible: sube suavemente y aparece */
.totop.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.totop.show:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgb(var(--c-sombra-rgb) / .38);
}

/* Anillo de avance: círculo tenue de fondo + arco blanco que crece con el scroll.
   El perímetro (2π·21 ≈ 132) es el valor de stroke-dasharray; js/back-to-top.js mueve el dashoffset. */
.totop .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.totop .ring circle {
  fill: none;
  stroke-width: 3;
}
.totop .ring-bg {
  stroke: rgba(255, 255, 255, .28);
}
.totop .ring-bar {
  stroke: #fff;
  stroke-linecap: round;
  stroke-dasharray: 132;
  stroke-dashoffset: 132;
}

/* Flecha: sube un poco al pasar el cursor */
.totop .ic {
  position: relative;
  width: 22px;
  height: 22px;
  transition: transform .25s;
}
.totop:hover .ic {
  transform: translateY(-2px);
}

/* Responsive ≤480px: un poco más pequeño */
@media (max-width: 480px) {
  .totop {
    width: 46px;
    height: 46px;
  }
}
