/* Hoja de estilos propia. Sin frameworks, sin fuentes externas. */

:root {
  color-scheme: light dark;
  --fondo: #ffffff;
  --fondo-suave: #f3f5f8;
  --borde: #d5dae2;
  --texto: #1a1f29;
  --texto-suave: #4b5563;
  --acento: #0b5bd3;
  --acento-texto: #ffffff;
  --acento-suave: #e4edfb;
  --codigo-fondo: #1e2430;
  --codigo-texto: #e6edf3;
  --exito: #166534;
  --aviso-fondo: #fff6d6;
  --aviso-borde: #b38f00;
  --radio: 8px;
  --max: 68rem;
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0f131a;
    --fondo-suave: #171c25;
    --borde: #2c3442;
    --texto: #e8ecf2;
    --texto-suave: #a3adbd;
    --acento: #7fb0ff;
    --acento-texto: #0b1220;
    --acento-suave: #1b2a44;
    --codigo-fondo: #0a0d12;
    --codigo-texto: #e6edf3;
    --exito: #86efac;
    --aviso-fondo: #2b2510;
    --aviso-borde: #c9a400;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fondo);
}

/* Accesibilidad */
.saltar {
  position: absolute;
  left: -999px;
  top: 0;
  padding: .5rem 1rem;
  background: var(--acento);
  color: var(--acento-texto);
  z-index: 10;
}
.saltar:focus { left: 1rem; top: 1rem; }

:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 2px;
}

.visualmente-oculto {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Estructura */
.contenedor {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

main { padding-block: 2rem 4rem; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.5vw, 3rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
p, ul, ol, table, pre, dl { margin: 0 0 1rem; }

a { color: var(--acento); text-decoration-thickness: .08em; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: .15em; }

.entradilla { font-size: 1.25rem; color: var(--texto-suave); max-width: 46rem; }
.nota { color: var(--texto-suave); font-size: .95rem; }

/* Cabecera */
.cabecera {
  border-bottom: 1px solid var(--borde);
  background: var(--fondo);
}
.cabecera-interior {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-block: .9rem;
}
.marca {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--texto);
  text-decoration: none;
}
.cabecera nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cabecera nav a {
  display: inline-block;
  padding: .3rem .1rem;
  color: var(--texto);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.cabecera nav a:hover { border-bottom-color: var(--borde); }
.cabecera nav a[aria-current="page"] {
  border-bottom-color: var(--acento);
  font-weight: 600;
}

/* Pie */
.pie {
  border-top: 1px solid var(--borde);
  background: var(--fondo-suave);
  color: var(--texto-suave);
  font-size: .95rem;
}
.pie-interior { padding-block: 2rem; }
.pie ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  list-style: none;
  padding: 0;
}
.pie-nota { margin: 0; }

/* Portada */
.portada { padding-block: 2rem 1rem; }
.portada h1 { max-width: 20ch; }
.acciones { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0; }

.boton {
  display: inline-block;
  padding: .7rem 1.3rem;
  border-radius: var(--radio);
  border: 2px solid var(--acento);
  background: var(--acento);
  color: var(--acento-texto);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.boton:hover { filter: brightness(1.08); }
.boton-secundario {
  background: transparent;
  color: var(--acento);
}

.tarjetas {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  list-style: none;
  padding: 0;
}
.tarjeta {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1.25rem;
  background: var(--fondo-suave);
}
.tarjeta h3, .tarjeta h2 { margin-top: 0; }
.tarjeta p:last-child { margin-bottom: 0; }

.franja {
  margin: 2.5rem 0;
  padding: 1.5rem;
  border-radius: var(--radio);
  background: var(--acento-suave);
}
.franja h2 { margin-top: 0; }

.lista-ventajas { padding-left: 1.2rem; }
.lista-ventajas li { margin-bottom: .4rem; }

/* Tablas */
.tabla-envoltorio { overflow-x: auto; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: .97rem; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--borde);
}
th { background: var(--fondo-suave); font-weight: 600; }
caption { text-align: left; font-weight: 600; padding-bottom: .5rem; caption-side: top; }
td.numero, th.numero { text-align: right; white-space: nowrap; }

/* Código */
code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--fondo-suave);
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: .05em .35em;
}
pre {
  position: relative;
  background: var(--codigo-fondo);
  color: var(--codigo-texto);
  border-radius: var(--radio);
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
  tab-size: 2;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: .9rem;
}
.copiar {
  position: absolute;
  top: .5rem;
  right: .5rem;
  font: inherit;
  font-size: .8rem;
  padding: .25rem .6rem;
  border-radius: 4px;
  border: 1px solid #5b6675;
  background: #2b3340;
  color: #e6edf3;
  cursor: pointer;
}
.copiar:hover { background: #3a4452; }
.copiar:focus-visible { outline-color: #e6edf3; }

/* Avisos */
.aviso {
  border-left: 4px solid var(--aviso-borde);
  background: var(--aviso-fondo);
  padding: .75rem 1rem;
  border-radius: 0 var(--radio) var(--radio) 0;
  margin: 1rem 0;
}
.aviso p:last-child { margin-bottom: 0; }

/* Documentación de la API */
.ruta {
  display: inline-block;
  font-family: var(--mono);
  font-size: .95rem;
  background: var(--fondo-suave);
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: .15rem .5rem;
}
.metodo { font-weight: 700; color: var(--exito); }
.indice {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1rem 1.25rem;
  background: var(--fondo-suave);
  margin-bottom: 2rem;
}
.indice p { margin: 0; font-weight: 600; }
.indice ol { margin: .5rem 0 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.indice li { break-inside: avoid; }
dl.parametros dt { font-family: var(--mono); font-weight: 600; margin-top: .6rem; }
dl.parametros dd { margin: 0 0 .25rem 0; color: var(--texto-suave); }

/* Precios */
.planes {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  list-style: none;
  padding: 0;
}
.plan {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.plan h3 { margin-top: 0; }
.plan .precio { font-size: 2rem; font-weight: 700; margin: 0; }
.plan .precio small { font-size: 1rem; font-weight: 400; color: var(--texto-suave); }
.plan ul { padding-left: 1.2rem; flex: 1; }
.plan-destacado { border-color: var(--acento); border-width: 2px; }

/* Calendario del modelo */
.calendario { list-style: none; padding: 0; margin-left: .5rem; border-left: 3px solid var(--borde); }
.calendario li { position: relative; padding: 0 0 1.25rem 1.5rem; }
.calendario li::before {
  content: "";
  position: absolute;
  left: -.6rem;
  top: .45rem;
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  background: var(--acento);
  border: 2px solid var(--fondo);
}
.calendario time { font-weight: 600; display: block; }

/* Formulario */
form { max-width: 40rem; }
.campo { margin-bottom: 1.1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: .6rem .75rem;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--fondo);
  color: var(--texto);
}
textarea { min-height: 8rem; resize: vertical; }
.campo-ayuda { font-size: .9rem; color: var(--texto-suave); margin: .25rem 0 0; }
.casilla { display: flex; gap: .6rem; align-items: flex-start; }
.casilla input { width: auto; margin-top: .35rem; }
.casilla label { font-weight: 400; margin: 0; }

/* Legal */
.legal h2 { scroll-margin-top: 1rem; }
.legal dt { font-weight: 600; margin-top: .75rem; }
.legal dd { margin-left: 0; }

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .indice ol { columns: 1; }
  .copiar { position: static; display: block; margin-top: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .cabecera nav, .copiar, .saltar { display: none; }
  pre { white-space: pre-wrap; }
}

/* ---------- Diario del proyecto ---------- */
.cifras { display: flex; flex-wrap: wrap; gap: .75rem 2rem; list-style: none; padding: 0; margin: 1.5rem 0; color: var(--texto-suave); }
.cifras strong { font-size: 1.6rem; color: var(--texto); margin-right: .3rem; }
.insignia { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--borde); vertical-align: middle; }
.insignia-hecho { color: var(--exito); border-color: currentColor; }
.insignia-en-curso { color: var(--acento); border-color: currentColor; }
.insignia-propuesto { color: var(--texto-suave); }
.proximo { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.proximo li { padding: .6rem .8rem; background: var(--fondo-suave); border-radius: var(--radio); }
.diario { display: grid; gap: 1.5rem; margin-top: 1rem; }
.entrada { border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem 1.5rem; background: var(--fondo); }
.entrada h2 { margin: .4rem 0 .6rem; font-size: 1.35rem; }
.entrada h2 a { color: inherit; text-decoration: none; }
.entrada h2 a:hover { text-decoration: underline; }
.entrada-cabecera { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; color: var(--texto-suave); font-size: .95rem; }
.entrada-cuerpo h3 { font-size: 1.05rem; margin: 1rem 0 .3rem; }
.entrada-cuerpo ul { padding-left: 1.2rem; }
.etiquetas { margin: .75rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.etiqueta { font-size: .8rem; background: var(--acento-suave); color: var(--texto); padding: .1rem .5rem; border-radius: 999px; }
.entrada-sola { border: 0; padding: 0; }
.entrada-sola h1 { margin-top: .4rem; }

/* Entradas del diario: imágenes, figuras, citas y tablas */
.entrada-cuerpo img, .entrada-cuerpo svg { max-width: 100%; height: auto; }
.entrada-cuerpo figure { margin: 1rem 0; }
.entrada-cuerpo figcaption { font-size: .9rem; opacity: .75; margin-top: .3rem; }
.entrada-cuerpo blockquote { margin: 1rem 0; padding: .5rem 1rem; border-left: 3px solid currentColor; opacity: .9; }
.entrada-cuerpo table { display: block; overflow-x: auto; margin: 1rem 0; }
.entrada-cuerpo th, .entrada-cuerpo td { padding: .35rem .6rem; border-bottom: 1px solid rgba(128,128,128,.35); text-align: left; vertical-align: top; }
.entrada-cuerpo th { font-weight: 600; }

/* Consulta pública de normativa */
.respuesta-normativa { white-space: pre-wrap; background: var(--fondo-suave, rgba(128,128,128,.08)); padding: 1rem; border-radius: .5rem; }
#estado:not(:empty) { margin-top: .75rem; color: var(--texto-suave); }
