/* tokens.css */
/* compartido/estilos/tokens.css — CÓDIGO DE COLOR de ICRAL (cambia aquí la paleta de todo el sitio).
   Índigo = logotipo ICRAL · Violeta = apoyo · Naranja y oro = Centro Forindo · Noche = fondo (scripts/fondo.mjs). */
:root {
  --noche: #141236;        /* fondo de la página */
  --tinta: #231c63;        /* títulos */
  --icral: #4a40a8;        /* color principal (logotipo) */
  --violeta: #6b5fd6;      /* apoyo, enlaces sobre fondo claro */
  --icral-suave: #efedfc;
  --icral-borde: #d9d5f6;
  --naranja: #e8572e;      /* acción principal secundaria (Centro Forindo) */
  --naranja-2: #ff9b4a;
  --naranja-suave: #fff0e8;
  --oro: #f0b828;          /* logros, récords, foco */
  --oro-suave: #fff7df;
  --papel: #f7f6fd;
  --hoja: #ffffff;
  --texto: #221f33;
  --texto-2: #5a5672;
  --linea: #e1def0;
  --ok: #1f7a4d;
  --ok-suave: #e5f4ec;
  --aviso: #9a5b00;
  --aviso-suave: #fff4dc;
  --error: #b42318;
  --error-suave: #fdecea;
  --en-fondo: #f4f2ff;     /* texto sobre el fondo oscuro */
  --en-fondo-2: #c9c4ef;

  --nivel-inicial: #e8572e;
  --nivel-desarrollo: #d99a12;
  --nivel-esperado: #4a6fd8;
  --nivel-destacado: #1f8a55;

  --deg-principal: linear-gradient(135deg, #4a40a8 0%, #6b5fd6 100%);
  --deg-calido: linear-gradient(135deg, #e8572e 0%, #ff9b4a 100%);
  --deg-oro: linear-gradient(135deg, #f0b828 0%, #ffd56b 100%);

  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --sombra: 0 1px 2px rgb(20 18 54 / .08), 0 12px 32px rgb(20 18 54 / .18);
  --sombra-suave: 0 1px 2px rgb(20 18 54 / .06), 0 6px 16px rgb(20 18 54 / .08);
  --ancho: 900px;
  --tam-lectura: 1.35rem;
}

/* base.css */
/* compartido/estilos/base.css — tipografía y elementos básicos. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.55; color: var(--texto); background: var(--noche); }
h1, h2, h3 { color: var(--tinta); line-height: 1.2; margin: 1.4em 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin-top: .3em; }
h2 { font-size: clamp(1.3rem, 3.2vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p { margin: .6em 0; }
a { color: var(--icral); text-underline-offset: 2px; }
a:hover { color: var(--violeta); }
img, svg { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; border-radius: 6px; }
::selection { background: #d9d5f6; }
.muted { color: var(--texto-2); }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--oro); color: var(--noche); padding: 8px 14px; z-index: 99; font-weight: 700; }
.saltar:focus { left: 8px; top: 8px; }
[hidden] { display: none !important; }
.etiqueta { display: inline-block; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--violeta); }
.centro { text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* estructura.css */
/* compartido/estilos/estructura.css — fondo, encabezado, menú, hoja central y pie.
   Fondo: degradado nocturno índigo → amanecer naranja (src/recursos/fondo-icral*.webp, lo dibuja scripts/fondo.mjs),
   con un velo para que el contenido siempre resalte. En teléfono se usa la versión vertical. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: var(--noche) url("/recursos/fondo-icral.webp") center / cover no-repeat;
  animation: fondo-vivo 80s ease-in-out infinite alternate; transform-origin: 50% 70%;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgb(20 18 54 / .35) 0%, rgb(20 18 54 / .1) 45%, rgb(20 18 54 / .3) 100%);
}
@media (max-width: 760px) and (orientation: portrait) { body::before { background-image: url("/recursos/fondo-icral-movil.webp"); } }
@keyframes fondo-vivo { from { transform: scale(1); } to { transform: scale(1.05) translate3d(-1%, -1%, 0); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

.hoja { max-width: var(--ancho); margin: 0 auto; padding: 0 16px 24px; }
.marca { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 20px 4px 14px; }
.marca-logo { display: grid; place-items: center; width: 74px; height: 74px; border-radius: 22px; background: #fff; box-shadow: var(--sombra); }
.marca-logo img { display: block; height: 58px; width: auto; }
.marca-texto { text-align: center; line-height: 1.15; }
.marca-texto strong { display: block; font-size: clamp(1.8rem, 5.5vw, 2.4rem); color: #fff; letter-spacing: .08em; text-shadow: 0 2px 12px rgb(0 0 0 / .25); }
.marca-texto span { display: block; font-size: .88rem; color: var(--en-fondo-2); margin-top: 2px; }
.marca-cf { font-size: .76rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--naranja-2); text-decoration: none; }
.marca-cf:hover { color: var(--oro); }
.menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 6px; border-radius: 999px;
  background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.menu a { padding: 9px 16px; border-radius: 999px; text-decoration: none; color: var(--en-fondo); font-weight: 700; font-size: .95rem; transition: background .15s, color .15s; }
.menu a:hover { background: rgb(255 255 255 / .14); color: #fff; }
.menu a[aria-current="page"] { background: #fff; color: var(--tinta); box-shadow: 0 2px 10px rgb(0 0 0 / .2); }
@media (max-width: 560px) {
  .marca { gap: 8px; padding-top: 14px; }
  .marca-logo { width: 54px; height: 54px; border-radius: 16px; }
  .marca-logo img { height: 42px; }
  .marca-texto span { font-size: .74rem; }
  .menu { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 18px; }
  .menu a { text-align: center; padding: 8px 4px; font-size: .86rem; }
  .menu a:last-child { grid-column: span 2; }
}
.quien-lee { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 10px 4px 0; font-size: .92rem; color: var(--en-fondo); }
.quien-lee .btn.enlace { color: var(--oro); }
.quien-lee .estado-nube { color: var(--en-fondo-2); }
main { display: block; }
.pie { margin-top: 40px; padding: 22px 8px 8px; border-top: 1px solid rgb(255 255 255 / .16); text-align: center; font-size: .86rem; color: var(--en-fondo-2); }
.pie a { color: var(--en-fondo); }
.pie a:hover { color: var(--oro); }
.pie nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 8px; }

/* botones.css */
/* compartido/estilos/botones.css */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: 999px;
  border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .15s, background .15s, filter .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primario { background: var(--deg-principal); color: #fff; box-shadow: 0 6px 16px rgb(74 64 168 / .35); }
.btn.primario:hover { color: #fff; filter: brightness(1.08); }
.btn.naranja { background: var(--deg-calido); color: #fff; box-shadow: 0 6px 16px rgb(232 87 46 / .32); }
.btn.naranja:hover { color: #fff; filter: brightness(1.06); }
.btn.verde { background: linear-gradient(135deg, #1f7a4d, #2fa36a); color: #fff; box-shadow: 0 6px 16px rgb(31 122 77 / .3); }
.btn.rojo { background: linear-gradient(135deg, #b42318, #e8572e); color: #fff; }
.btn.borde { background: var(--hoja); color: var(--tinta); border-color: var(--icral-borde); }
.btn.borde:hover { border-color: var(--violeta); background: var(--icral-suave); }
.btn.enlace { min-height: 0; padding: 2px 4px; background: none; color: var(--icral); text-decoration: underline; border-radius: 6px; }
.btn.enlace:hover { transform: none; }
.btn.ancho { width: 100%; }
.btn.grande { min-height: 58px; font-size: 1.15rem; padding: 12px 30px; }
.btn small { display: block; font-weight: 400; font-size: .8rem; color: var(--texto-2); }
.btn-redondo { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--icral-borde); background: var(--hoja); color: var(--tinta); font: inherit; font-weight: 700; cursor: pointer; }
.btn-redondo:hover { background: var(--icral-suave); }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.acciones.centro { justify-content: center; }
.letra { display: flex; gap: 6px; }
kbd { font-family: inherit; font-size: .8em; background: var(--papel); border: 1px solid var(--linea); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

/* formularios.css */
/* compartido/estilos/formularios.css */
.formulario { display: grid; gap: 14px; }
.campo { display: grid; gap: 4px; }
.campo label { font-weight: 700; color: var(--tinta); font-size: .95rem; }
.campo small { color: var(--texto-2); font-size: .82rem; }
input[type=text], input:not([type]), input[type=email], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--icral-borde); border-radius: var(--r-sm); background: #fff; font: inherit; color: var(--texto); }
input:focus, select:focus { border-color: var(--violeta); box-shadow: 0 0 0 3px rgb(107 95 214 / .18); outline: none; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .fila-2 { grid-template-columns: 1fr; } }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.casilla input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--icral); }
.error { color: var(--error); font-weight: 700; margin: 0; }
input[type=range] { width: 100%; accent-color: var(--icral); }

/* tarjetas.css */
/* compartido/estilos/tarjetas.css — tarjetas, avisos, cifras, tablas y gráficas. */
.tarjeta { background: rgb(255 255 255 / .97); border: 1px solid rgb(255 255 255 / .7); border-radius: var(--r-lg); box-shadow: var(--sombra); padding: clamp(18px, 4vw, 34px); margin: 20px 0; }
.tarjeta > h2:first-child, .tarjeta > h1:first-child { margin-top: 0; }
.aviso { border-radius: var(--r-md); padding: 12px 16px; margin: 12px 0; background: var(--icral-suave); }
.aviso.ok { background: var(--ok-suave); }
.aviso.atencion { background: var(--aviso-suave); }
.aviso.error { background: var(--error-suave); color: var(--texto); }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.cifra { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--r-md); padding: 14px; text-align: center; }
.cifra b { display: block; font-size: 1.9rem; color: var(--tinta); line-height: 1.1; }
.cifra span { font-size: .88rem; color: var(--texto-2); }
.cifra a { font-size: .8rem; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.opcion { display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: var(--r-md); border: 2px solid var(--linea); background: var(--hoja);
  font: inherit; cursor: pointer; color: var(--texto); text-decoration: none; transition: transform .12s, border-color .15s, box-shadow .15s; }
.opcion:hover { transform: translateY(-2px); box-shadow: var(--sombra-suave); }
.opcion:hover { border-color: var(--violeta); }
.opcion strong { color: var(--tinta); font-size: 1.05rem; }
.opcion span { color: var(--texto-2); font-size: .9rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla th, .tabla td { padding: 8px 10px; border-bottom: 1px solid var(--linea); text-align: left; }
.tabla th { color: var(--tinta); background: var(--icral-suave); }
.tabla-scroll { overflow-x: auto; max-height: 380px; overflow-y: auto; }
.grafica { margin: 8px 0; }
.grafica svg { width: 100%; height: auto; }
.g-rejilla { stroke: var(--linea); stroke-width: 1; }
.g-eje { font-size: 12px; fill: var(--texto-2); font-family: var(--sans); }
.g-referencia { stroke: var(--naranja); stroke-width: 1.5; stroke-dasharray: 6 5; }
.g-ref-texto { fill: var(--naranja); }
.g-leyenda { display: flex; gap: 14px; justify-content: center; font-size: .85rem; }
.g-leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.barra { height: 12px; border-radius: 6px; background: var(--linea); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--deg-principal); border-radius: 6px; transition: width .3s; }
.lista-perfiles { list-style: none; padding: 0; display: grid; gap: 8px; }
.lista-perfiles .btn { justify-content: space-between; }

/* Plan de entrenamiento, calendario y logros (compartido/interfaz/plan.js) */
.plan-cabeza { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.plan-enfoque { font-weight: 700; color: var(--tinta); margin: .2em 0 .4em; }
.plan-racha { text-align: center; background: var(--naranja-suave); border: 1px solid #ffd9c7; border-radius: var(--r-md); padding: 8px 12px; min-width: 86px; }
.plan-racha b { display: block; font-size: 1.7rem; color: var(--naranja); line-height: 1; }
.plan-racha span { font-size: .75rem; color: var(--texto-2); }
.plan-sub { margin: .8em 0 .4em; color: var(--texto-2); font-size: .92rem; }
.plan-hoy { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.plan-ej { display: block; text-align: center; padding: 12px 10px; border-radius: var(--r-md); border: 2px solid var(--icral-borde); background: var(--icral-suave);
  color: var(--tinta); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.plan-ej:hover { background: var(--deg-principal); border-color: transparent; color: #fff; }
.plan-ej.hecho { border-color: var(--ok); background: var(--ok-suave); color: var(--ok); }
.plan-semana { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.plan-semana span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--papel); border: 1px solid var(--linea); font-size: .8rem; font-weight: 700; color: var(--texto-2); }
.plan-semana span.activo { background: var(--icral); color: #fff; border-color: var(--icral); }
.plan-semana span.hoy { outline: 2px solid var(--oro); outline-offset: 1px; }
.plan-semana small { color: var(--texto-2); margin-left: 6px; }
.plan-nota { font-size: .9rem; color: var(--texto-2); margin-bottom: 0; }
.calendario { display: grid; grid-template-columns: repeat(7, 22px); grid-auto-flow: row; gap: 4px; }
.calendario i { width: 22px; height: 22px; border-radius: 5px; background: var(--linea); }
.calendario i.n1 { background: #c9c4ef; } .calendario i.n2 { background: #8f86dc; } .calendario i.n3 { background: var(--icral); }
.calendario i.futuro { background: transparent; border: 1px dashed var(--linea); }
.calendario-leyenda { font-size: .8rem; }
.logros { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.logros li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r-md); background: var(--papel); opacity: .55; }
.logros li.logrado { opacity: 1; background: #fff8e6; }
.logros b { font-size: 1.3rem; color: var(--oro); line-height: 1.1; }
.logros strong { display: block; color: var(--tinta); }
.logros span { font-size: .85rem; color: var(--texto-2); }
.codigo-caja { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--icral-suave); border: 2px dashed var(--icral); border-radius: var(--r-md); padding: 14px 16px; }
.codigo { font-family: ui-monospace, Consolas, monospace; font-size: clamp(1.1rem, 4vw, 1.45rem); font-weight: 700; letter-spacing: .06em; color: var(--tinta); }
.estado-nube { font-size: .85rem; color: var(--texto-2); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 700; font-size: .85rem; flex: none; }
.fila-perfil { display: inline-flex; align-items: center; gap: 10px; }
.quien-lee .avatar { width: 26px; height: 26px; font-size: .75rem; }
.cifra b { overflow-wrap: anywhere; }
.cifra.cifra-texto b { font-size: 1.25rem; line-height: 1.3; padding: 6px 0; }

/* dialogos.css */
/* compartido/estilos/dialogos.css — ventanas (confirmar, velo de salida). */
.dialogo { border: 0; border-radius: var(--r-lg); padding: 24px; max-width: min(460px, 92vw); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
.dialogo::backdrop { background: rgb(20 18 50 / .55); }
.dialogo h2 { margin-top: 0; }
.dialogo .acciones { justify-content: flex-end; }

/* legal.css */
/* compartido/estilos/legal.css — páginas de texto largo (términos, aviso, ¿qué es ICRAL?). */
.articulo h2 { scroll-margin-top: 12px; }
.articulo ol, .articulo ul { padding-left: 1.3em; }
.articulo li { margin: .3em 0; }
.resumen { background: var(--icral-suave); border-radius: var(--r-md); padding: 14px 18px; }
.indice { columns: 2 220px; font-size: .95rem; }
.formula { font-family: var(--serif); background: var(--papel); border-left: 4px solid var(--icral); padding: 8px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; overflow-x: auto; }
.glosario dt { font-weight: 700; color: var(--tinta); margin-top: 14px; }
.glosario dd { margin: 4px 0 0; }
details { border: 1px solid var(--linea); border-radius: var(--r-sm); padding: 10px 14px; margin: 8px 0; background: var(--hoja); }
details summary { cursor: pointer; font-weight: 700; color: var(--tinta); }
.fuentes { font-size: .9rem; }

/* impresion.css */
/* compartido/estilos/impresion.css */
@media print {
  .menu, .pie nav, .no-imprimir, .quien-lee, .saltar { display: none !important; }
  body { background: #fff; } body::before, body::after { display: none; } .marca-texto strong { color: var(--tinta); text-shadow: none; }
  .tarjeta { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
