/* Estilos globales de Shanotei: fuentes, base y tipografía. Los componentes tienen su propio .razor.css. */

/* Fuentes alojadas en el propio servidor (RGPD: nada se carga desde Google). Licencia SIL OFL. */
@font-face {
    font-family: "Lexend";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fuentes/lexend-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Lexend";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fuentes/lexend-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-display: swap;
    font-weight: 300 900;
    src: url("fuentes/figtree-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-display: swap;
    font-weight: 300 900;
    src: url("fuentes/figtree-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--superficie);
    color: var(--tinta);
    font: 400 16px/24px var(--font-texto);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1,
h2,
h3 {
    text-wrap: balance;
}

img {
    max-width: 100%;
}

/* Lo que un script muestra u oculta con el atributo hidden no debe reaparecer por un display de su clase. */
[hidden] {
    display: none !important;
}

a {
    color: var(--primario);
}

a:hover {
    color: var(--primario-hover);
}

:focus-visible {
    outline: 2px solid var(--foco);
    outline-offset: 2px;
}

h1:focus {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tipografía de la guía */
.titulo-xl {
    font: 600 28px/34px var(--font-titulos);
    letter-spacing: -0.01em;
}

.titulo {
    font: 600 22px/28px var(--font-titulos);
}

.subtitulo {
    font: 500 18px/24px var(--font-titulos);
}

.cifra {
    font: 600 32px/36px var(--font-titulos);
    font-variant-numeric: tabular-nums;
}

.cuerpo-fuerte {
    font-weight: 600;
}

.secundario {
    font-size: 14px;
    line-height: 20px;
    color: var(--tinta-suave);
}

.etiqueta {
    font: 600 12px/16px var(--font-texto);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tinta-suave);
}

@media (min-width: 840px) {
    .titulo-xl {
        font-size: 32px;
        line-height: 38px;
    }
}

/* Accesibilidad */
.solo-lectores {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Errores de Blazor */
.blazor-error-boundary {
    padding: var(--espacio-4);
    border: 2px solid var(--error);
    border-radius: var(--radio-md);
    color: var(--error);
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error. Recarga la página.";
}

.validation-message {
    color: var(--error);
    font-size: 14px;
    line-height: 20px;
}

/* Botones (globales: los usan Boton y otros controles, como el botón de passkey) */
.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--espacio-2);
    min-height: var(--objetivo-tactil);
    padding: 0 var(--espacio-4);
    border: 1px solid transparent;
    border-radius: var(--radio-md);
    font: 600 16px/24px var(--font-texto);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.boton-ancho {
    width: 100%;
}

.boton-principal {
    background: var(--primario);
    color: var(--sobre-primario);
}

.boton-principal:hover {
    background: var(--primario-hover);
    color: var(--sobre-primario);
}

.boton-secundario {
    background: var(--superficie-elevada);
    border-color: var(--borde-control);
    color: var(--primario);
}

.boton-peligro {
    background: transparent;
    color: var(--error);
}

.boton:disabled {
    background: var(--superficie-hundida);
    border-color: transparent;
    color: var(--tinta-suave);
    cursor: not-allowed;
}

/* Formularios */
.formulario {
    display: flex;
    flex-direction: column;
    gap: var(--espacio-4);
}

.campo {
    display: flex;
    flex-direction: column;
    gap: var(--espacio-1);
}

.campo > label {
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
}

.entrada {
    min-height: var(--objetivo-tactil);
    padding: 0 var(--espacio-3);
    border: 1px solid var(--borde-control);
    border-radius: var(--radio-sm);
    background: var(--superficie-elevada);
    color: var(--tinta);
    font: 400 16px/24px var(--font-texto);
}

.entrada.invalid {
    border: 2px solid var(--error);
}

.ayuda {
    font-size: 14px;
    line-height: 20px;
    color: var(--tinta-suave);
}

.casilla {
    display: flex;
    align-items: flex-start;
    gap: var(--espacio-3);
    min-height: var(--objetivo-tactil);
    font-size: 14px;
    line-height: 20px;
}

.casilla input {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--primario);
}

.separador {
    display: flex;
    align-items: center;
    gap: var(--espacio-3);
    color: var(--tinta-suave);
    font-size: 14px;
}

.separador::before,
.separador::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--borde);
}

.enlace-discreto {
    font-weight: 600;
    text-decoration: none;
}

/* Ventana de confirmación (js/confirmar.js): una pregunta y dos botones, el de aceptar en rojo porque lo que se confirma
   borra o no se deshace. */
dialog.confirmacion {
    width: min(92vw, 420px);
    padding: var(--espacio-6);
    border: 1px solid var(--borde);
    border-radius: var(--radio-md);
    background: var(--superficie-elevada);
    color: var(--tinta);
    box-shadow: 0 12px 32px rgb(0 0 0 / .25);
}

dialog.confirmacion::backdrop {
    background: rgb(0 0 0 / .5);
}

.confirmacion-texto {
    margin: 0 0 var(--espacio-6);
    white-space: pre-line;
}

.confirmacion-botones {
    display: flex;
    gap: var(--espacio-3);
}

.confirmacion-botones .boton {
    flex: 1;
}

.confirmacion-aceptar {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
}

/* Indicador de carga (js/cargando.js): barra fina arriba del todo y botón en espera tras enviar un formulario */
.barra-carga {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1000;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.barra-carga[data-visible] {
    opacity: 1;
}

.barra-carga::before {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    background: var(--primario);
    border-radius: 0 3px 3px 0;
    animation: barra-carga 1.1s ease-in-out infinite;
}

@keyframes barra-carga {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(250%);
    }
}

.boton-cargando {
    pointer-events: none;
    opacity: 0.75;
}

.boton-cargando::before {
    content: "";
    flex: none;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: giro-carga 700ms linear infinite;
}

@keyframes giro-carga {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .barra-carga::before {
        width: 100%;
        border-radius: 0;
        animation: none;
    }

    .boton-cargando::before {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.5;
    }
}

/* Campo trampa de los formularios: fuera de la vista y del foco, pero no con display:none (algunos bots lo detectan). */
.trampa {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
