/* =========================================================================
   ALISIOS · base
   Reset corto, tipografía y comportamiento del documento.
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--alto-cabecera) + 1.5rem);
}

body {
  margin: 0;
  background-color: var(--papel);
  color: var(--tinta);
  font-family: var(--texto-fuente);
  font-size: var(--t-cuerpo);
  line-height: 1.62;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* El grano. Muy poco, pero quita el plástico del fondo plano. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* --- Titulares ----------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 460;
  line-height: 1.02;
  letter-spacing: -0.014em;
  margin: 0;
  text-wrap: balance;
  font-variation-settings: 'opsz' 96, 'SOFT' 0;
}

h1 {
  font-size: var(--t-h1);
  line-height: 0.98;
  letter-spacing: -0.026em;
  font-variation-settings: 'opsz' 144, 'SOFT' 0;
}

h2 {
  font-size: var(--t-h2);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--t-h3);
  line-height: 1.14;
  font-weight: 520;
  font-variation-settings: 'opsz' 40;
}

p {
  margin: 0 0 var(--e-3);
  hyphens: auto;
  -webkit-hyphens: auto;
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: 660;
}

em {
  font-style: italic;
}

small {
  font-size: var(--t-pie);
}

ul,
ol {
  margin: 0 0 var(--e-3);
  padding-left: 1.15em;
}

li {
  margin-bottom: var(--e-1);
}

li::marker {
  color: color-mix(in srgb, var(--acento) 70%, transparent);
}

img,
svg,
video,
iframe {
  max-width: 100%;
  display: block;
}

img {
  height: auto;
}

hr {
  border: 0;
  border-top: 1px solid var(--filete);
  margin: var(--e-5) 0;
}

/* --- Enlaces -------------------------------------------------------------
   El subrayado se dibuja al pasar por encima en lugar de aparecer de golpe. */

a {
  color: inherit;
  text-decoration: none;
}

.texto-largo a,
a.enlace {
  background-image: linear-gradient(var(--acento), var(--acento));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: background-size var(--medio) var(--curva), color var(--rapido) linear;
}

.texto-largo a:hover,
a.enlace:hover {
  color: var(--acento);
  background-size: 100% 2px;
}

/* --- Foco visible --------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--terracota);
  outline-offset: 3px;
  border-radius: 1px;
}

.en-oscuro :focus-visible,
.en-azul :focus-visible {
  outline-color: var(--ambar);
}

/* --- Utilidades ----------------------------------------------------------- */

.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.saltar {
  position: absolute;
  top: 0;
  left: var(--margen);
  z-index: 10000;
  transform: translateY(-140%);
  background: var(--verde-hondo);
  color: var(--crema);
  padding: 0.7rem 1.2rem;
  font-size: var(--t-pie);
  letter-spacing: 0.04em;
  transition: transform var(--rapido) var(--curva);
}

.saltar:focus {
  transform: translateY(0);
}

::selection {
  background: var(--arena);
  color: var(--verde-hondo);
}

/* --- Transición entre páginas -------------------------------------------
   Da continuidad sin framework. Los navegadores que no la soportan
   simplemente navegan como siempre. */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: salida 220ms var(--curva-suave) both;
}

::view-transition-new(root) {
  animation: entrada 420ms var(--curva) both;
}

@keyframes salida {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes entrada {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* --- Menos movimiento ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

@media print {
  body::before,
  .cabecera,
  .pie-nav,
  .cookies,
  .flotante {
    display: none !important;
  }
}
