/*
 * Splash de arranque (index.html), antes de que monte Vue: sin Vuetify ni tokens.
 *
 * Es el mismo dibujo que FibadyPageLoader (src/components/FibadyPageLoader.vue)
 * para que el relevo se lea como un solo cargador:
 *   - anillo con la geometría y la animación de VProgressCircular indeterminado
 *     (vuetify/lib/components/VProgressCircular/VProgressCircular.css);
 *   - pista al `border-color` del tema al 12 %, arco y marca en `primary`;
 *   - 72 px, y 56 por debajo de 600 px (el `xs` de Vuetify);
 *   - con reduced motion, anillo entero y quieto y la opacidad que respira.
 *
 * Los colores son los de theme.ts con la skin `bordered` (fondo = `surface`), por
 * tema. El script de <head> pone `data-boot-theme`. Si cambian en theme.ts,
 * cambian aquí: lo vigila tests/lib/app-status/bootSplash.spec.ts.
 */

body {
  margin: 0;
}

html {
  overflow: hidden scroll;
}

:root {
  --initial-loader-bg: #fff;
  --initial-loader-color: #2a865d;
  --initial-loader-track: rgba(46, 38, 61, 12%);
  --initial-loader-text: #1a1a1a;
}

:root[data-boot-theme="dark"] {
  --initial-loader-bg: #312d4b;
  --initial-loader-color: #2bd680;
  --initial-loader-track: rgba(231, 227, 252, 12%);
  --initial-loader-text: #e7e3fc;
}

#loading-bg {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--initial-loader-bg);
  inset: 0;
}

.fibady-boot-splash__sr {
  position: absolute;
  overflow: hidden;
  block-size: 1px;
  clip: rect(0, 0, 0, 0);
  inline-size: 1px;
  white-space: nowrap;
}

.fibady-boot-splash__badge {
  display: grid;
  block-size: 72px;
  inline-size: 72px;
  place-items: center;
}

/* La marca se centra sobre el anillo, que ocupa la misma celda del grid. */
.fibady-boot-splash__badge > * {
  grid-area: 1 / 1;
}

.fibady-boot-splash__ring {
  block-size: 100%;
  inline-size: 100%;

  /* Como VProgressCircular: el SVG arranca girado −90° y da una vuelta cada 1,4 s. */
  animation: fibady-boot-rotate 1.4s linear infinite;
  animation-delay: var(--initial-loader-phase, 0ms);
  transform: rotate(-90deg);
  transform-origin: center center;
}

.fibady-boot-splash__ring--phone {
  display: none;
}

.fibady-boot-splash__track {
  stroke: var(--initial-loader-track);
}

.fibady-boot-splash__arc {
  animation: fibady-boot-dash 1.4s ease-in-out infinite, fibady-boot-rotate 1.4s linear infinite;
  animation-delay: var(--initial-loader-phase, 0ms);
  stroke: var(--initial-loader-color);
  stroke-dasharray: 25, 200;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center center;
}

/* La marca ocupa la mitad del diámetro, como en FibadyPageLoader. */
.fibady-boot-splash__mark {
  display: block;
  block-size: 36px;
  color: var(--initial-loader-color);
  inline-size: 36px;
}

@media (max-width: 599.98px) {
  .fibady-boot-splash__badge {
    block-size: 56px;
    inline-size: 56px;
  }

  .fibady-boot-splash__ring--desktop {
    display: none;
  }

  .fibady-boot-splash__ring--phone {
    display: block;
  }

  .fibady-boot-splash__mark {
    block-size: 28px;
    inline-size: 28px;
  }
}

/* Reduced motion: el anillo entero y quieto; solo respira la opacidad. */
@media (prefers-reduced-motion: reduce) {
  .fibady-boot-splash__ring,
  .fibady-boot-splash__arc {
    animation: none;
  }

  .fibady-boot-splash__arc {
    stroke-dasharray: none;
  }

  .fibady-boot-splash__badge {
    animation: fibady-boot-breathe 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
    animation-delay: var(--initial-loader-phase, 0ms);
  }
}

@keyframes fibady-boot-rotate {
  100% {
    transform: rotate(270deg);
  }
}

@keyframes fibady-boot-dash {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 100, 200;
    stroke-dashoffset: -15px;
  }

  100% {
    stroke-dasharray: 100, 200;
    stroke-dashoffset: -124px;
  }
}

@keyframes fibady-boot-breathe {
  to {
    opacity: 0.56;
  }
}
