/* Efectos premium: destellos, marco vivo, insignia, capas del hero, esquinas
   notariales, filetes y marco del retrato. Solo animan transform y opacity
   (o propiedades registradas) y respetan prefers-reduced-motion. */

/* Propiedades registradas para poder animarlas */
@property --angulo-marco
{
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@property --esquina
{
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

/* Destello: una franja de luz blanca que cruza el botón una sola vez */
[data-destello]
{
    overflow: hidden;
    isolation: isolate;
}

[data-destello]::after
{
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.28) 50%,
        transparent 70%
    );
    opacity: 0;
    transform: translateX(-110%);
    pointer-events: none;
}

[data-destello].destella::after
{
    animation: destellar var(--dur-brillo) var(--curva-suave) 1;
}

@keyframes destellar
{
    0%
    {
        opacity: 1;
        transform: translateX(-110%);
    }
    100%
    {
        opacity: 1;
        transform: translateX(110%);
    }
}

/* Marco vivo del verificador: una luz recorre el borde una vez y se apaga */
.marco-vivo::before
{
    content: "";
    position: absolute;
    inset: -2px;
    padding: 2px;
    border-radius: calc(var(--radio) + 2px);
    background: conic-gradient(
        from var(--angulo-marco),
        transparent 0deg,
        rgba(141, 184, 232, 0.95) 50deg,
        rgba(255, 255, 255, 0.9) 70deg,
        transparent 120deg
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#000 0 0) content-box exclude,
        linear-gradient(#000 0 0);
    opacity: 0;
    pointer-events: none;
    animation: recorrerMarco var(--dur-marco) var(--curva-suave) 1.2s 1 both;
}

@keyframes recorrerMarco
{
    0%
    {
        opacity: 0;
        --angulo-marco: 0deg;
    }
    10%
    {
        opacity: 1;
    }
    88%
    {
        opacity: 1;
    }
    100%
    {
        opacity: 0;
        --angulo-marco: 360deg;
    }
}

/* Al usar el verificador, el marco queda encendido y quieto */
.marco-vivo:focus-within::before
{
    animation: none;
    opacity: 1;
    background: linear-gradient(var(--acento), var(--acento));
}

/* Insignia redonda con check en la esquina del verificador */
.verificador-insignia
{
    position: absolute;
    top: -18px;
    right: -10px;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--acento) 0%, var(--acento-osc) 100%);
    color: var(--blanco);
    box-shadow:
        0 0 0 4px var(--blanco),
        0 12px 24px -10px rgba(7, 21, 38, 0.6);
    animation: flotar var(--dur-flotar) ease-in-out infinite;
}

@keyframes flotar
{
    0%,
    100%
    {
        transform: translateY(0);
    }
    50%
    {
        transform: translateY(-6px);
    }
}

/* Pausa de animaciones infinitas: fuera de pantalla o tras 5 s (WCAG 2.2.2) */
.en-pausa
{
    animation-play-state: paused !important;
}

/* Capas de profundidad del hero: sello tenue y hoja de acta */
.hero-capas
{
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Sello notarial grande y tenue que gira apenas con el scroll */
.hero-sello
{
    position: absolute;
    top: -70px;
    right: -120px;
    width: 360px;
    height: 360px;
    color: var(--blanco);
    opacity: 0.07;
    translate: var(--desplazamiento-x, 0px) var(--desplazamiento-y, 0px);
    rotate: var(--giro, 0deg);
    will-change: transform;
}

/* Hoja de acta flotante: solo en computadora */
.hero-hoja
{
    display: none;
}

.hero-hoja-papel
{
    position: relative;
    width: 170px;
    height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0 17px,
            rgba(255, 255, 255, 0.5) 17px 18px
        )
        center 46px / 120px 130px no-repeat;
    animation: flotar var(--dur-flotar) ease-in-out infinite;
}

/* Pequeño sello circular al pie de la hoja */
.hero-hoja-papel span
{
    position: absolute;
    right: 18px;
    bottom: 16px;
    width: 34px;
    height: 34px;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
}

/* Esquinas notariales que se trazan en las tarjetas de pasos */
.paso-tarjeta::after
{
    --tinta: var(--acento);
    content: "";
    position: absolute;
    inset: 8px;
    pointer-events: none;
    background:
        linear-gradient(var(--tinta), var(--tinta)) top left / var(--esquina) 2px no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) top left / 2px var(--esquina) no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) top right / var(--esquina) 2px no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) top right / 2px var(--esquina) no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) bottom left / var(--esquina) 2px no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) bottom left / 2px var(--esquina) no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) bottom right / var(--esquina) 2px no-repeat,
        linear-gradient(var(--tinta), var(--tinta)) bottom right / 2px var(--esquina) no-repeat;
    transition: --esquina var(--dur-trazo) var(--curva-salida);
}

.paso-tarjeta:hover::after,
.paso-tarjeta:focus-within::after
{
    --esquina: 22px;
}

/* En pantallas táctiles las esquinas se trazan al hacerse visible */
@media (hover: none)
{
    .paso-tarjeta.visible::after
    {
        --esquina: 22px;
        transition-delay: calc(var(--orden, 0) * 120ms + 300ms);
    }
}

/* Filete que se dibuja antes de cada antetítulo */
.antetitulo::before
{
    content: "";
    display: inline-block;
    width: 28px;
    height: 2px;
    margin-right: 12px;
    vertical-align: middle;
    background: currentColor;
    transform-origin: left center;
}

.js .aparece .antetitulo::before
{
    transform: scaleX(0);
    transition: transform var(--dur-trazo) var(--curva-salida) 200ms;
}

.js .aparece.visible .antetitulo::before
{
    transform: scaleX(1);
}

.antetitulo.entra::before
{
    animation: trazarFilete var(--dur-trazo) var(--curva-salida) 300ms both;
}

@keyframes trazarFilete
{
    from
    {
        transform: scaleX(0);
    }
    to
    {
        transform: scaleX(1);
    }
}

/* Tramo de tarifa activo: filete de acento a la izquierda y elevación */
.tarjeta-zona
{
    position: relative;
}

.tarjeta-zona.activa
{
    border-color: var(--acento);
    box-shadow:
        inset 4px 0 0 var(--acento),
        0 16px 30px -20px rgba(11, 31, 58, 0.5);
    transform: translateY(-2px);
}

/* Marco del retrato que se traza al aparecer */
.notario-retrato::before,
.notario-retrato::after
{
    content: "";
    position: absolute;
    inset: 12px;
    pointer-events: none;
    transition: transform var(--dur-trazo) var(--curva-salida) 250ms;
}

.notario-retrato::before
{
    border-top: 1px solid var(--azul);
    border-bottom: 1px solid var(--azul);
    transform: scaleX(0);
}

.notario-retrato::after
{
    border-left: 1px solid var(--azul);
    border-right: 1px solid var(--azul);
    transform: scaleY(0);
}

.notario-retrato.visible::before,
.notario-retrato.visible::after,
html:not(.js) .notario-retrato::before,
html:not(.js) .notario-retrato::after
{
    transform: none;
}

/* Tablet: el sello del hero crece */
@media (min-width: 768px)
{
    .hero-sello
    {
        top: -90px;
        right: -110px;
        width: 480px;
        height: 480px;
    }
}

/* Computadora: sello detrás del verificador y hoja de acta visible */
@media (min-width: 1100px)
{
    .hero-sello
    {
        top: -120px;
        right: -80px;
        width: 620px;
        height: 620px;
    }

    .hero-hoja
    {
        display: block;
        position: absolute;
        bottom: 56px;
        left: calc(50% + 10px);
        opacity: 0.08;
        rotate: -7deg;
        translate: var(--desplazamiento-x, 0px) var(--desplazamiento-y, 0px);
    }
}

/* Sin movimiento: nada flota, nada gira, el marco no recorre */
@media (prefers-reduced-motion: reduce)
{
    .verificador-insignia,
    .hero-hoja-papel,
    .marco-vivo::before
    {
        animation: none;
    }

    .hero-sello,
    .hero-hoja
    {
        translate: none;
        rotate: none;
    }

    .paso-tarjeta::after
    {
        --esquina: 22px;
    }

    .antetitulo::before,
    .js .aparece .antetitulo::before,
    .notario-retrato::before,
    .notario-retrato::after
    {
        transform: none;
    }
}
