/* Entiende Guate — colores de la bandera, el quetzal y el tejido. Una sola letra: Montserrat. */
:root {
  /* marca */
  --marino: #13294B;        /* texto principal (el lema del logo) */
  --rey: #1A56C4;           /* "ENTIENDE" */
  --celeste: #4997D0;       /* bandera */
  --celeste-claro: #EAF4FC; /* fondos de sección */
  --celeste-medio: #CFE5F6;
  --quetzal: #1E7A3E;
  --turquesa: #0F8F83;
  --rojo: #C8341F;
  --naranja: #E07A1F;
  --amarillo: #F5BE2E;      /* solo adorno, nunca para datos */
  --blanco: #FFFFFF;

  /* texto */
  --tinta: var(--marino);
  --tinta-2: #3D5274;
  --tinta-3: #6A7A93;
  --linea: #D9E3EF;

  /* datos: 6 colores validados para daltonismo (en este orden) + gris para "otros" */
  --d1: #1A56C4; --d2: #E07A1F; --d3: #0F8F83; --d4: #C8341F; --d5: #4997D0; --d6: #1E7A3E; --d-otros: #9AA6B2;

  /* estados (semáforo): siempre con ícono y palabra */
  --bien: #1E7A3E; --medio: #B7791F; --mal: #C8341F;

  --radio-grande: 28px;
  --radio: 16px;
  --radio-chico: 10px;
  --sombra: 0 2px 0 #13294B14, 0 10px 30px -12px #13294B33;
  --ancho: 1080px;
  --lado: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--blanco);
  color: var(--tinta);
  font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px; /* espacio para el menú de abajo en celular */
}
img { max-width: 100%; display: block; }
a { color: var(--rey); font-weight: 700; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; border-radius: 6px; }
.saltar { position: absolute; left: -999px; top: 8px; background: var(--marino); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.saltar:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- encabezado y menú ---------- */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px var(--lado);
  background: #ffffffee; backdrop-filter: blur(8px);
}
.barra__logo img { height: 58px; width: auto; }
.menu { display: flex; gap: 4px; }
.menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px;
  color: var(--tinta-2); text-decoration: none; font-weight: 700; font-size: 15px;
}
.menu a:hover { background: var(--celeste-claro); color: var(--marino); }
.menu a[aria-current="page"] { background: var(--marino); color: #fff; }
.ico svg { width: 22px; height: 22px; display: block; }

@media (max-width: 820px) {
  /* sin backdrop-filter: si no, el menú fijo de abajo queda atrapado dentro del encabezado */
  .barra { justify-content: center; backdrop-filter: none; background: #fff; }
  .barra__logo img { height: 50px; }
  .menu {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--linea);
    box-shadow: 0 -8px 24px -16px #13294B55;
  }
  .menu a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11.5px; border-radius: 14px; min-width: 62px; }
  .menu a[aria-current="page"] { background: var(--celeste-claro); color: var(--rey); }
  .ico svg { width: 26px; height: 26px; }
}

/* ---------- la franja de tejido (lo memorable) ---------- */
.tejido {
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='14'%3E%3Crect width='56' height='14' fill='%23C8341F'/%3E%3Cpath d='M0 14 L14 3 L28 14 L42 3 L56 14Z' fill='%23E07A1F'/%3E%3Cpath d='M0 14 L14 8 L28 14 L42 8 L56 14Z' fill='%23F5BE2E'/%3E%3Crect width='56' height='2.5' fill='%231A56C4'/%3E%3Crect x='12' y='4' width='4' height='2' fill='%230F8F83'/%3E%3Crect x='40' y='4' width='4' height='2' fill='%230F8F83'/%3E%3C/svg%3E");
  background-size: 56px 14px;
  background-repeat: repeat-x;
  animation: tejer 1.4s cubic-bezier(.2,.8,.2,1) both;
}
.tejido--fino { height: 8px; background-size: 32px 8px; animation: none; }
@keyframes tejer { from { background-position-x: -560px; clip-path: inset(0 100% 0 0); } to { background-position-x: 0; clip-path: inset(0 0 0 0); } }

/* ---------- estructura ---------- */
main { display: block; outline: none; }
.envoltura { max-width: var(--ancho); margin: 0 auto; padding: 0 var(--lado); }
.seccion { padding: 40px 0; }
.seccion--celeste { background: var(--celeste-claro); }
.cargando { text-align: center; padding: 80px 16px; color: var(--tinta-3); }

h1, h2, h3 { margin: 0; color: var(--marino); line-height: 1.12; letter-spacing: -0.02em; }
h1 { font-size: clamp(32px, 7vw, 58px); font-weight: 900; }
h2 { font-size: clamp(24px, 4.6vw, 34px); font-weight: 800; margin-bottom: 14px; }
h3 { font-size: 19px; font-weight: 800; }
p { margin: 0 0 12px; max-width: 64ch; }
.bajada { font-size: clamp(18px, 2.6vw, 21px); color: var(--tinta-2); font-weight: 500; margin-top: 14px; }
.chico { font-size: 14.5px; color: var(--tinta-3); }

/* La respuesta en una frase: los números van más gruesos y en azul rey */
.respuesta { font-size: clamp(27px, 5.6vw, 44px); font-weight: 600; line-height: 1.18; letter-spacing: -0.02em; max-width: 26ch; }
.respuesta b { font-weight: 900; color: var(--rey); white-space: nowrap; }
.miga { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 15px; text-decoration: none; margin: 22px 0 14px; color: var(--tinta-2); }
.miga:hover { color: var(--rey); }

/* ---------- portada ---------- */
.portada { position: relative; overflow: hidden; padding: 28px 0 40px; }
.portada__grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 24px; }
.portada h1 { max-width: 13ch; }
.portada__quetzal { width: min(360px, 100%); justify-self: center; animation: flotar 6s ease-in-out infinite; }
@keyframes flotar { 50% { transform: translateY(-10px) rotate(-1.5deg); } }
@media (max-width: 720px) {
  .portada__grid { grid-template-columns: 1fr; }
  .portada__quetzal { width: 150px; order: -1; margin-bottom: -6px; }
  .portada { padding-top: 14px; }
}

.puertas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 30px; }
@media (min-width: 980px) { .puertas { grid-template-columns: repeat(5, 1fr); } .puerta strong { font-size: 21px; } }
.puerta {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  min-height: 168px; padding: 20px 20px 18px; border-radius: var(--radio-grande);
  color: #fff; text-decoration: none; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: var(--sombra);
}
.puerta:hover, .puerta:focus-visible { transform: translateY(-4px) rotate(-.4deg); }
.puerta:active { transform: scale(.98); }
.puerta .ico svg { width: 40px; height: 40px; }
.puerta strong { font-size: 23px; font-weight: 900; line-height: 1.1; margin-top: auto; }
.puerta span.dato { font-size: 15px; font-weight: 600; opacity: .95; }
.puerta::after { /* hilo del tejido en la esquina */
  content: ""; position: absolute; right: -18px; top: -18px; width: 90px; height: 90px; border-radius: 50%;
  border: 10px dotted #ffffff40;
}
.puerta--pais { background: var(--rey); }
.puerta--compras { background: var(--turquesa); }
.puerta--proveedores { background: var(--naranja); color: #2B1600; }
.puerta--proveedores::after { border-color: #2B160026; }
.puerta--diputados { background: var(--rojo); }
.puerta--munis { background: var(--quetzal); }

.dato-del-dia {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
  margin-top: 34px; padding: 20px 22px; border-radius: var(--radio);
  background: var(--celeste-claro); border-left: 8px solid var(--amarillo);
}
.dato-del-dia .grande { font-size: 46px; font-weight: 900; color: var(--rey); line-height: 1; }
.dato-del-dia p { margin: 0; font-size: 18px; font-weight: 600; }

/* ---------- el billete de Q100 ---------- */
.billete {
  position: relative; margin: 26px 0 10px; padding: 16px; border-radius: 22px;
  background: linear-gradient(135deg, #D7ECDC, #EAF4FC 60%, #D7ECDC);
  border: 3px solid var(--quetzal);
  box-shadow: inset 0 0 0 6px #ffffffaa;
}
.billete__marca { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 10px; color: var(--quetzal); }
.billete__marca b { font-size: 30px; font-weight: 900; letter-spacing: -0.03em; }
.billete__marca span { font-size: 13px; font-weight: 700; }
.hilos { display: flex; height: 74px; gap: 3px; border-radius: 12px; overflow: hidden; }
.hilo { position: relative; height: 100%; min-width: 6px; transform-origin: left; animation: hilar .9s cubic-bezier(.2,.8,.2,1) both; }
.hilo::before { /* textura de hilo */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, #ffffff22 0 4px, transparent 4px 9px);
}
.hilo:hover, .hilo:focus-visible { filter: brightness(1.12); }
@keyframes hilar { from { transform: scaleX(0); } }

.leyenda { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px 18px; }
.leyenda li { display: grid; grid-template-columns: 14px 64px 1fr; gap: 10px; align-items: baseline; }
.leyenda i { width: 14px; height: 14px; border-radius: 4px; transform: translateY(2px); }
.leyenda b { font-size: 20px; font-weight: 900; }
.leyenda span { font-weight: 600; line-height: 1.3; }
.leyenda small { display: block; color: var(--tinta-3); font-weight: 500; font-size: 13.5px; }

/* ---------- barras horizontales (un solo color: tamaño) ---------- */
.barras { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.barras li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.barras li:last-child { border-bottom: 0; }
.barras .nombre { font-weight: 700; line-height: 1.3; }
.barras .nombre a { color: var(--marino); text-decoration: none; }
.barras .nombre a:hover { color: var(--rey); text-decoration: underline; }
.barras .nombre small { display: block; font-weight: 500; color: var(--tinta-3); font-size: 14px; margin-top: 2px; }
.barras .monto { font-weight: 800; text-align: right; white-space: nowrap; }
.barras .monto small { display: block; font-weight: 600; color: var(--tinta-3); font-size: 13px; }
.barras .riel { grid-column: 1 / -1; height: 12px; border-radius: 0 6px 6px 0; background: var(--celeste-claro); overflow: hidden; }
.barras .relleno { height: 100%; background: var(--rey); border-radius: 0 6px 6px 0; transform-origin: left; animation: hilar .7s cubic-bezier(.2,.8,.2,1) both; }
.barras--verde .relleno { background: var(--turquesa); }
.barras--naranja .relleno { background: var(--naranja); }
.barras--rojo .relleno { background: var(--rojo); }

/* ---------- columnas por mes ---------- */
.columnas { display: flex; align-items: flex-end; gap: 6px; height: 180px; margin-top: 18px; padding-bottom: 26px; border-bottom: 1px solid var(--linea); }
.columna { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: default; }
.columna span.alto { display: block; background: var(--turquesa); border-radius: 6px 6px 0 0; min-height: 3px; transform-origin: bottom; animation: crecer .7s cubic-bezier(.2,.8,.2,1) both; }
.columna:hover span.alto, .columna:focus-visible span.alto { background: var(--rey); }
.columna em { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-style: normal; font-size: 12px; font-weight: 700; color: var(--tinta-3); }
@keyframes crecer { from { transform: scaleY(0); } }

.globo { position: fixed; z-index: 60; pointer-events: none; background: var(--marino); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; max-width: 260px; box-shadow: var(--sombra); }

/* ---------- cifras clave ---------- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 24px 0 6px; }
.cifra { padding: 16px 18px; border-radius: var(--radio); background: #fff; border: 2px solid var(--celeste-medio); }
.cifra b { display: block; font-size: 26px; font-weight: 900; color: var(--marino); line-height: 1.1; }
.cifra span { font-size: 14.5px; font-weight: 600; color: var(--tinta-2); }

/* ---------- semáforo ---------- */
.semaforo { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 999px; font-weight: 800; margin-top: 16px; }
.semaforo::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px #ffffffaa; }
.semaforo--bien { color: var(--bien); background: #E2F2E7; }
.semaforo--medio { color: var(--medio); background: #FBF0D9; }
.semaforo--mal { color: var(--mal); background: #FBE3DF; }

/* ---------- buscador, filtros, pestañas ---------- */
.buscador { position: relative; margin: 18px 0 12px; }
.buscador input {
  width: 100%; padding: 16px 18px 16px 52px; border-radius: 999px;
  border: 3px solid var(--celeste-medio); background: #fff; font-size: 18px; font-weight: 600;
}
.buscador input:focus { border-color: var(--rey); outline: none; }
.buscador svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; color: var(--tinta-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.chip {
  border: 2px solid var(--celeste-medio); background: #fff; color: var(--tinta-2);
  padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 14.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--marino); border-color: var(--marino); color: #fff; }
.etiqueta { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--celeste-claro); color: var(--tinta-2); }
.etiqueta--alerta { background: #FBE3DF; color: var(--rojo); }
.resultados-vacio { padding: 26px; border-radius: var(--radio); background: var(--celeste-claro); text-align: center; font-weight: 600; }

/* ---------- compras recientes ---------- */
.compras { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.compra { padding: 16px 18px; border-radius: var(--radio); border: 2px solid var(--linea); background: #fff; }
.compra__arriba { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.compra__monto { font-size: 21px; font-weight: 900; white-space: nowrap; }
.compra__que { font-weight: 700; margin: 4px 0 6px; line-height: 1.35; }
.compra__quien { font-size: 15px; color: var(--tinta-2); margin: 0; }

/* ---------- diputados ---------- */
.diputados { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 12px 0 0; }
.diputado a {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--radio); border: 2px solid var(--linea); background: #fff;
  text-decoration: none; color: var(--marino);
}
.diputado a:hover { border-color: var(--rey); }
.inicial { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 18px; }
.diputado strong { display: block; font-weight: 800; line-height: 1.25; font-size: 15.5px; }
.diputado small { color: var(--tinta-3); font-weight: 600; font-size: 13.5px; }
.sueldo { display: grid; gap: 8px; margin-top: 16px; }
.sueldo div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radio-chico); background: #fff; border: 2px solid var(--celeste-medio); font-weight: 600; }
.sueldo div b { font-weight: 900; }
.sueldo .total { background: var(--marino); border-color: var(--marino); color: #fff; font-size: 19px; }
.pendiente { padding: 20px 22px; border-radius: var(--radio); border: 3px dashed var(--celeste-medio); background: #fff; }

/* ---------- fuente del dato ---------- */
.fuente { margin-top: 26px; padding: 16px 18px; border-radius: var(--radio); background: #fff; border: 2px solid var(--linea); font-size: 14.5px; color: var(--tinta-2); }
.fuente strong { color: var(--marino); }
details.tabla { margin-top: 14px; }
details.tabla summary { cursor: pointer; font-weight: 700; color: var(--rey); }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--linea); vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- pie ---------- */
.pie { margin-top: 30px; background: var(--marino); color: #DCE7F5; }
.pie__dentro { max-width: var(--ancho); margin: 0 auto; padding: 26px var(--lado) 34px; font-size: 15px; }
.pie strong { color: #fff; }

/* ---------- movimiento: respetar a quien no lo quiere ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
