/* Conocimiento DIGITO: letra grande, alto contraste, botones grandes. Movil primero. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --fondo: #f6f8fb;
  --papel: #ffffff;
  --texto: #111111;
  --marino: #0b1a2a;
  --marino-2: #13304d;
  --amarillo: #ffd54a;
  --acento: #8a5200;          /* ambar oscuro: 6,4:1 sobre blanco */
  --acento-oscuro: #6b3f00;
  --enlace: #0b4ea2;          /* 8:1 sobre blanco */
  --enlace-oscuro: #073366;
  --linea: #6b7788;
}

html { font-size: 20px; -webkit-text-size-adjust: 100%; }
html.texto-grande { font-size: 24px; }
html.texto-muy-grande { font-size: 28px; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fondo);
  overflow-wrap: break-word;
}

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

h1, h2, h3 { line-height: 1.25; color: var(--marino); margin: 1.5rem 0 .75rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
@media (min-width: 48em) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.9rem; }
}

p, ul, ol { margin: .75rem 0; max-width: 70ch; }
ul, ol { padding-left: 1.5rem; }
li + li { margin-top: .4rem; }

a { color: var(--enlace); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
a:hover { color: var(--enlace-oscuro); text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--enlace); outline-offset: 3px; border-radius: 4px; }

.solo-lector {
  position: absolute !important;
  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;
}

.salto { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.salto:focus {
  position: fixed; left: 1rem; top: 1rem; width: auto; height: auto; z-index: 1000;
  padding: .75rem 1.25rem; background: #fff; color: var(--texto);
  border: 3px solid var(--enlace); border-radius: .5rem; font-weight: 700; text-decoration: none;
}

.ancho { max-width: 64rem; margin-inline: auto; padding-inline: 1rem; }
main.ancho { padding-block: 2rem 3rem; min-height: 60vh; }

/* Cabecera */
.cabecera { background: var(--marino); color: #fff; }
.cabecera > .ancho { display: flex; flex-direction: column; gap: .9rem; padding-block: 1rem; }
@media (min-width: 48em) {
  .cabecera > .ancho { flex-direction: row; align-items: center; justify-content: space-between; }
}
.cabecera a { color: #fff; }
.cabecera a:hover { color: var(--amarillo); }
.cabecera :focus-visible { outline-color: var(--amarillo); }

.marca { display: flex; align-items: center; gap: .8rem; text-decoration: none; font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.marca-sello {
  display: inline-grid; place-items: center; flex: 0 0 3rem;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--amarillo); color: var(--marino); font-size: 1.75rem; font-weight: 800;
}
.marca small { display: block; font-size: .9rem; font-weight: 400; color: #d6e2f0; }

.cabecera nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.cabecera nav a {
  display: inline-flex; align-items: center; min-height: 48px; padding: .5rem 1rem;
  border: 2px solid #3d5a78; border-radius: .6rem; background: var(--marino-2);
  text-decoration: none; font-weight: 600;
}
.cabecera nav a:hover { background: #1d4468; color: #fff; text-decoration: underline; }
.cabecera nav a[aria-current="page"] { background: var(--amarillo); border-color: var(--amarillo); color: var(--marino); font-weight: 800; }
.cabecera nav a[aria-current="page"]:hover { background: #ffe27a; color: var(--marino); }

/* Barra de accesibilidad (la inyecta accesibilidad.js) */
.barra-accesibilidad { background: #07121e; color: #fff; border-bottom: 1px solid #2b4560; }
.barra-accesibilidad > .ancho { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding-block: .6rem; }
.barra-titulo { font-weight: 700; }
.barra-sep { color: #c4d2e2; }
.barra-botones { display: flex; flex-wrap: wrap; gap: .5rem; }
.barra-accesibilidad button {
  min-height: 48px; min-width: 48px; padding: .4rem .9rem;
  font: inherit; font-weight: 700; color: #fff; cursor: pointer;
  background: var(--marino-2); border: 2px solid #7f9bb8; border-radius: .6rem;
}
.barra-accesibilidad button:hover { background: #1d4468; }
.barra-accesibilidad button[aria-pressed="true"] { background: var(--amarillo); border-color: var(--amarillo); color: var(--marino); }
.barra-accesibilidad :focus-visible { outline-color: var(--amarillo); }

/* Pie */
.pie { margin-top: 3rem; background: #e6ecf4; color: var(--texto); border-top: 2px solid var(--linea); }
.pie > .ancho { padding-block: 2rem; }

/* Rejilla y tarjetas */
.rejilla { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 1.5rem 0; }
.tarjeta {
  display: flex; flex-direction: column; gap: .6rem; padding: 1.5rem;
  background: var(--papel); border: 2px solid var(--linea); border-radius: 1rem;
}
.tarjeta h3 { margin: 0; }
.tarjeta p { margin: 0; max-width: none; }
.tarjeta .boton { margin-top: auto; width: 100%; }

.etiqueta {
  align-self: flex-start; margin: 0; padding: .2rem .7rem; border-radius: .4rem;
  background: #e6ecf4; color: var(--marino); font-size: .9rem; font-weight: 700;
}

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; min-width: 48px; padding: .6rem 1.25rem;
  border: 2px solid transparent; border-radius: .75rem;
  background: var(--acento); color: #fff; font: inherit; font-weight: 700; font-size: 1.1rem; line-height: 1.25;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color .2s ease;
}
.boton:hover, .boton:focus-visible { background: var(--acento-oscuro); color: #fff; text-decoration: underline; }
.boton.secundario { background: #fff; color: var(--marino); border-color: var(--marino); }
.boton.secundario:hover, .boton.secundario:focus-visible { background: #e6ecf4; color: var(--marino); }

/* Avisos */
.aviso {
  margin: 1.5rem 0; padding: 1rem 1.25rem;
  background: #e6f0fb; border: 2px solid var(--enlace); border-left-width: .6rem; border-radius: .75rem;
}
.alerta {
  position: relative; margin: 1.5rem 0; padding: 1rem 1.25rem 1rem 3.75rem;
  background: #fff4e0; border: 3px solid var(--acento); border-radius: .75rem; color: var(--texto);
}
.alerta::before {
  content: "!"; position: absolute; left: 1rem; top: 1rem;
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--acento); color: #fff; font-size: 1.25rem; font-weight: 800; line-height: 1;
}
.alerta.grave { background: #fdecec; border-color: #a40000; }
.alerta.grave::before { background: #a40000; }
.aviso > :first-child, .alerta > :first-child { margin-top: 0; }
.aviso > :last-child, .alerta > :last-child { margin-bottom: 0; }

/* Pasos numerados */
ol.pasos { list-style: none; padding: 0; margin: 1.5rem 0; max-width: none; counter-reset: paso; }
ol.pasos > li { position: relative; counter-increment: paso; min-height: 2.75rem; margin: 0 0 1.25rem; padding: .25rem 0 0 3.75rem; }
ol.pasos > li::before {
  content: counter(paso); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: var(--marino); color: #fff; font-size: 1.5rem; font-weight: 800; line-height: 1;
}

/* Migas de pan */
.migas { font-size: .95rem; margin: 0 0 1rem; }
.migas ol, .migas ul { display: flex; flex-wrap: wrap; gap: .3rem .5rem; list-style: none; padding: 0; margin: 0; max-width: none; }
.migas li { margin: 0; }
.migas li + li::before { content: "›"; margin-right: .5rem; color: #333; }

/* Navegacion entre lecciones */
.leccion-nav { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; margin: 2.5rem 0 1rem; padding-top: 1.5rem; border-top: 2px solid var(--linea); }
.leccion-nav .boton { flex: 1 1 12rem; }

/* Lista de saltos */
.saltos { list-style: none; padding: 0; display: grid; gap: .6rem; max-width: none; }
.saltos li { margin: 0; }
.saltos a {
  display: flex; align-items: center; min-height: 48px; padding: .6rem 1rem;
  background: var(--papel); border: 2px solid var(--linea); border-radius: .75rem;
  text-decoration: none; font-weight: 600;
}
.saltos a:hover { border-color: var(--enlace); text-decoration: underline; }

/* Tablas */
.tabla-wrap { overflow-x: auto; margin: 1.5rem 0; }
table, .tabla { width: 100%; border-collapse: collapse; background: var(--papel); }
caption { text-align: left; font-weight: 700; padding-bottom: .5rem; }
th, td { padding: .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linea); }
th { background: var(--marino); color: #fff; }

/* Alto contraste (clase en <html>) */
html.alto-contraste { background: #000; }
html.alto-contraste body { background: #000; color: #fff; }
html.alto-contraste h1, html.alto-contraste h2, html.alto-contraste h3, html.alto-contraste .marca { color: #fff; }
html.alto-contraste a { color: #ffe600; text-decoration-thickness: 3px; }
html.alto-contraste a:hover { color: #fff; }
html.alto-contraste .cabecera, html.alto-contraste .barra-accesibilidad, html.alto-contraste .pie { background: #000; color: #fff; border-color: #ffe600; }
html.alto-contraste .cabecera { border-bottom: 3px solid #ffe600; }
html.alto-contraste .pie { border-top: 3px solid #ffe600; }
html.alto-contraste .marca-sello { background: #ffe600; color: #000; }
html.alto-contraste .cabecera nav a, html.alto-contraste .barra-accesibilidad button,
html.alto-contraste .saltos a, html.alto-contraste .tarjeta, html.alto-contraste .aviso { background: #000; color: #fff; border-color: #fff; }
html.alto-contraste .cabecera nav a[aria-current="page"],
html.alto-contraste .barra-accesibilidad button[aria-pressed="true"] { background: #ffe600; color: #000; border-color: #ffe600; }
html.alto-contraste .boton { background: #ffe600; color: #000; border-color: #ffe600; }
html.alto-contraste .boton:hover, html.alto-contraste .boton:focus-visible { background: #fff; color: #000; }
html.alto-contraste .boton.secundario { background: #000; color: #ffe600; border-color: #ffe600; }
html.alto-contraste .etiqueta { background: #fff; color: #000; }
html.alto-contraste .alerta { background: #000; color: #fff; border-color: #ffe600; }
html.alto-contraste .alerta::before, html.alto-contraste ol.pasos > li::before { background: #ffe600; color: #000; }
html.alto-contraste table, html.alto-contraste .tabla { background: #000; color: #fff; }
html.alto-contraste th { background: #ffe600; color: #000; }
html.alto-contraste th, html.alto-contraste td { border-bottom-color: #fff; }
html.alto-contraste :focus-visible { outline-color: #ffe600; }

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