/* MiSiniestro · base: reinicio ligero, letra, foco, cabecera, pestañas y columna de escritorio. Móvil primero.
   Las medidas de texto van en rem: con la letra del móvil ampliada (hasta 200 %) todo crece y se parte en líneas. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--fondo);
  scrollbar-color: var(--borde-control) transparent;
}

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: var(--texto-base);
  line-height: 1.45;
  caret-color: var(--naranja-texto);
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: #FFD2AB;
  color: var(--texto);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  font-size: var(--texto-titulo);
}

h2 {
  font-size: 1.25rem;
}

p {
  margin: 0;
}

a {
  color: var(--naranja-texto);
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 700;
}

img,
svg {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Foco visible en naranja: el oscuro de texto sobre claro; el de la marca sobre las zonas negras. */
:root {
  --foco: var(--naranja-texto);
}

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

.cabecera,
.pestanas,
.tablero {
  --foco: var(--naranja);
}

/* Texto solo para el lector de pantalla. */
.solo-lector {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- Armazón: cabecera, contenido y pestañas en una columna ---------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fondo);
}

.cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .25rem 1rem;
  min-height: calc(var(--alto-cabecera) + var(--seguro-arriba));
  padding: calc(.5rem + var(--seguro-arriba)) max(1.125rem, var(--seguro-derecha)) .5rem max(1.125rem, var(--seguro-izquierda));
  background: var(--negro-marca);
  border-bottom: 3px solid var(--acero);
  color: var(--letra-panel);
}

/* Logotipo en texto: «mi» gris y «Siniestro» naranja, como el de la marca. */
.logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.2;
  white-space: nowrap;
}

.logo-mi {
  color: var(--letra-panel-suave);
  font-weight: 600;
}

.logo-siniestro {
  color: var(--naranja);
}

.referencia {
  font-family: var(--fuente-panel);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--letra-panel-suave);
  font-variant-numeric: tabular-nums;
}

.contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.contenido:focus {
  outline: none;
}

.hoja-raiz,
.hoja {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Zona de lectura bajo el panel: frases completas a 18 px sobre claro. */
.lectura {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  padding: 1.125rem max(1.125rem, var(--seguro-derecha)) 1.5rem max(1.125rem, var(--seguro-izquierda));
}

/* Pestañas fijas abajo (pegadas al borde mientras se desplaza; ocupan su sitio, nunca tapan contenido). */
.pestanas {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  /* Cuatro en fila; con la letra muy ampliada pasan a dos filas de dos en vez de partir las palabras. */
  grid-template-columns: repeat(auto-fit, minmax(max(22%, 5.4em), 1fr));
  font-size: 1rem;
  padding: .25rem max(.25rem, var(--seguro-derecha)) calc(.375rem + var(--seguro-abajo)) max(.25rem, var(--seguro-izquierda));
  background: var(--negro-marca);
  border-top: 3px solid var(--acero);
}

.sin-sesion .pestanas {
  display: none;
}

.pestana {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .125rem;
  min-height: var(--alto-pestanas);
  padding: .25rem .125rem;
  border-radius: var(--radio);
  color: var(--letra-panel-suave);
  font-family: var(--fuente-panel);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .06em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.pestana:hover {
  color: var(--letra-panel);
}

.pestana[aria-current='page'] {
  color: var(--naranja);
}

.pestana .icono {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.icono {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Aviso estático de navegador no compatible: aparece a los 1,5 s si app.js no llega a quitarlo. */
.aviso-navegador {
  margin: 1rem;
  visibility: hidden;
  opacity: 0;
  animation: aparecer-tarde .3s ease-out 1.5s forwards;
}

.aviso-navegador.aviso-navegador-ya {
  visibility: visible;
  opacity: 1;
  animation: none;
}

@keyframes aparecer-tarde {
  to {
    visibility: visible;
    opacity: 1;
  }
}

/* ---------- Escritorio: la misma app en una columna centrada de 560 px ---------- */
@media (min-width: 900px) {
  html,
  body {
    background: #D9DCE0;
  }

  .app {
    width: 100%;
    max-width: var(--columna);
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--borde), 0 8px 32px rgba(20, 20, 20, .12);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
