:root {
  --papel: #fbfbfa;
  --tinta: #16181d;
  --tenue: #62666f;
  --linea: #e3e3e0;
  --acento: #1e5eff;
  --acento-suave: #eef3ff;
  --alerta: #fff8e6;
  --alerta-linea: #e8c96a;
  --max: 70ch;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

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

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* --- Barra superior --- */

.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(251, 251, 250, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linea);
}

.marca {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--tinta);
  text-decoration: none;
}

.marca span { color: var(--acento); }

.barra nav {
  display: flex;
  gap: 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
}

.barra nav a {
  color: var(--tenue);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.barra nav a:hover { color: var(--tinta); }
.barra nav a[aria-current="page"] {
  color: var(--tinta);
  border-bottom-color: var(--acento);
}

/* --- Estructura --- */

.envoltura {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

.encabezado {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--linea);
  margin-bottom: 3rem;
}

.encabezado h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  max-width: 20ch;
}

.fecha {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  color: var(--tenue);
  margin: 0;
}

.columnas {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

@media (min-width: 960px) {
  .columnas {
    grid-template-columns: 240px minmax(0, var(--max));
    gap: 4rem;
  }
}

/* --- Índice --- */

.indice {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (min-width: 960px) {
  .indice {
    position: sticky;
    top: 5.5rem;
    align-self: start;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }
}

.indice h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tenue);
  margin: 0 0 0.85rem;
  letter-spacing: 0.02em;
}

.indice ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: idx;
}

.indice li { counter-increment: idx; }

.indice a {
  display: block;
  padding: 0.35rem 0 0.35rem 1.9rem;
  position: relative;
  color: var(--tenue);
  text-decoration: none;
  border-left: 2px solid var(--linea);
}

.indice a::before {
  content: counter(idx);
  position: absolute;
  left: 0.7rem;
  color: #a8abb2;
  font-variant-numeric: tabular-nums;
}

.indice a:hover {
  color: var(--tinta);
  border-left-color: var(--acento);
}

/* --- Contenido --- */

.contenido { max-width: var(--max); }

.contenido h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 3.25rem 0 1rem;
  padding-top: 0.5rem;
}

.contenido h2:first-child { margin-top: 0; }

.contenido h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.6rem;
}

.contenido p { margin: 0 0 1.1rem; }

.contenido ul, .contenido ol {
  margin: 0 0 1.4rem;
  padding-left: 1.4rem;
}

.contenido li { margin-bottom: 0.5rem; }

.contenido a {
  color: var(--acento);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.contenido strong { font-weight: 700; }

/* --- Tablas --- */

.tabla-envoltura {
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--linea);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--tenue);
  border-bottom-width: 2px;
}

/* --- Bloques destacados --- */

.aviso {
  background: var(--alerta);
  border-left: 3px solid var(--alerta-linea);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

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

.nota {
  background: var(--acento-suave);
  border-left: 3px solid var(--acento);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

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

/* --- Pie --- */

.pie {
  border-top: 1px solid var(--linea);
  margin-top: 4rem;
  padding-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  color: var(--tenue);
}

.pie a { color: var(--acento); }

/* --- Accesibilidad --- */

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 3px;
  border-radius: 2px;
}

.saltar {
  position: absolute;
  left: -9999px;
}

.saltar:focus {
  left: 1rem;
  top: 1rem;
  z-index: 40;
  background: var(--tinta);
  color: #fff;
  padding: 0.6rem 1rem;
  font-family: -apple-system, sans-serif;
  font-size: 0.875rem;
  text-decoration: none;
}
