/* Conviene: estilos del sitio.
   Idea visual: la hoja de quien hizo la tarea. Hoja cuadriculada con margen rojo,
   la opción elegida marcada a mano y sellos de goma para el veredicto.
   Un solo gesto audaz por pantalla: el círculo o el sello. Lo demás, quieto. */

@font-face { font-family: "Archivo"; src: url("/static/fuentes/Archivo-variable.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/static/fuentes/AtkinsonHyperlegible-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/static/fuentes/AtkinsonHyperlegible-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("/static/fuentes/Kalam-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("/static/fuentes/Kalam-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap; }

:root {
  /* Papel y tinta */
  --papel: #F6F8FA;        /* fondo de página */
  --hoja: #FFFFFF;         /* fichas y hojas */
  --cuadricula: #DCE7F1;   /* líneas de la hoja cuadriculada */
  --tinta: #1B2440;        /* texto principal */
  --suave: #46526B;        /* texto secundario */
  --tenue: #66728A;        /* notas y fechas */
  --borde: #D5DCE6;
  /* Útiles escolares */
  --birome: #2251C3;       /* links y notas a mano */
  --margen: #E2574C;       /* línea de margen; "Esperá" */
  --resaltador: #C8F2D2;   /* lo elegido */
  /* Sellos */
  --sello: #197A4C;        /* la marca y "Conviene" */
  --ocre: #8F5C08;         /* "Precio normal" */
  --esperar: #B8323A;      /* "Esperá" (texto; el margen es solo línea) */
  --violeta: #7A3E9D;      /* "Descuento trucho" */
  --gris-sello: #5B6B85;   /* "Juntando datos" */

  --f-titulo: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-texto: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mano: "Kalam", "Comic Neue", cursive;

  --ancho-texto: 40rem;
  --ancho-pagina: 72rem;
  --cuadro: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0F1626;
    --hoja: #151F35;
    --cuadricula: #21304C;
    --tinta: #E8EDF6;
    --suave: #B6C1D6;
    --tenue: #8E9BB3;
    --borde: #2A3756;
    --birome: #93B4FF;
    --margen: #F07468;
    --resaltador: #1E4A33;
    --sello: #45C486;
    --ocre: #E0B04A;
    --esperar: #F07A82;
    --violeta: #C79BE0;
    --gris-sello: #9AA8C2;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 1.0625rem/1.6 var(--f-texto);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--birome); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--birome); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 1em; }

h1, h2, h3 {
  font-family: var(--f-titulo);
  font-weight: 800;
  font-stretch: 106%;
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0 0 0.45em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 3.2vw, 1.8rem); }
h3 { font-size: 1.2rem; font-stretch: 100%; letter-spacing: -0.01em; }

.envoltura { max-width: var(--ancho-pagina); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.saltar { position: absolute; left: 16px; top: -4rem; background: var(--tinta); color: var(--papel);
  padding: 0.5rem 0.9rem; border-radius: 8px; z-index: 10; }
.saltar:focus { top: 0.75rem; }

/* --- Cabecera ----------------------------------------------------------- */
.cabecera { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-block: 0.9rem 0.6rem; }
.logo { display: block; line-height: 0; }
.logo img { width: 150px; height: auto; }
.menu { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; }
.menu a { color: var(--tinta); text-decoration: none; font-weight: 700; padding: 0.3rem 0; }
.menu a:hover, .menu a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--sello);
  text-decoration-thickness: 3px; text-underline-offset: 0.35em; }

.banda-borrador { background: repeating-linear-gradient(-45deg,
    color-mix(in srgb, var(--ocre) 22%, var(--hoja)) 0 14px, var(--hoja) 14px 28px);
  border-block: 1px solid var(--ocre); font-weight: 700; text-align: center; padding: 0.6rem 16px; }

.aviso-corto { color: var(--tenue); font-size: 0.9rem; margin: 0; }
.aviso-corto.envoltura { margin: 0 auto; padding-bottom: 0.5rem; }

/* --- La hoja cuadriculada ------------------------------------------------- */
.hoja {
  position: relative;
  background-color: var(--hoja);
  background-image:
    linear-gradient(var(--cuadricula) 1px, transparent 1px),
    linear-gradient(90deg, var(--cuadricula) 1px, transparent 1px);
  background-size: var(--cuadro) var(--cuadro);
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: 2.4rem 1.25rem 2rem 3.4rem;
}
.hoja::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2.1rem; width: 2px;
  background: var(--margen); opacity: 0.8; }

.contenido { padding-block: 1.25rem 3.5rem; }

/* --- Portada --------------------------------------------------------------- */
.portada { margin-top: 0.5rem; }
.portada-titulo { font-size: clamp(2.6rem, 10vw, 5.6rem); font-stretch: 110%; letter-spacing: -0.045em;
  line-height: 0.95; margin-bottom: 0.3em; }
.nota-mano { font-family: var(--f-mano); font-weight: 400; color: var(--birome); letter-spacing: 0;
  font-stretch: normal; display: inline-block; transform: rotate(-4deg); }
.portada-titulo .nota-mano { font-size: 0.36em; margin-left: 0.25em; vertical-align: 0.35em; white-space: nowrap; }
.portada-bajada { font-size: clamp(1.1rem, 2.4vw, 1.3rem); color: var(--suave); max-width: 36rem; }
.resaltado { background: linear-gradient(transparent 56%, var(--resaltador) 56%, var(--resaltador) 94%, transparent 94%);
  padding: 0 0.1em; }
.portada-pie { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* --- Bloques -------------------------------------------------------------- */
.bloque { margin-top: 3.25rem; }
.bloque > h2 { margin-bottom: 0.9rem; }
.bajada { color: var(--suave); font-size: 1.15rem; max-width: var(--ancho-texto); }
.nota { color: var(--tenue); font-size: 0.92rem; }
.vacio { color: var(--suave); border: 1.5px dashed var(--borde); border-radius: 6px; padding: 1.1rem 1.25rem;
  max-width: var(--ancho-texto); background: var(--hoja); }

.confianza { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.confianza li { padding-left: 2rem; position: relative; }
.confianza li::before { content: ""; position: absolute; left: 0; top: 0.2rem; width: 1.3rem; height: 1rem;
  background: var(--sello);
  -webkit-mask: url("/static/marca/tilde.svg") center / contain no-repeat; mask: url("/static/marca/tilde.svg") center / contain no-repeat; }
.confianza strong { display: block; font-family: var(--f-titulo); font-stretch: 100%; font-size: 1.05rem; }

.guias { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.guia { display: grid; gap: 0.35rem; align-content: start; height: 100%; padding: 1rem 1.1rem 1.1rem;
  background: var(--hoja); border: 1px solid var(--borde); border-radius: 6px; text-decoration: none; color: var(--tinta);
  border-top: 3px solid var(--margen); }
.guia:hover { border-color: var(--tinta); border-top-color: var(--margen); }
.guia-titulo { font-family: var(--f-titulo); font-weight: 800; font-size: 1.2rem; line-height: 1.15; letter-spacing: -0.015em; }
.guia-texto { color: var(--suave); font-size: 0.97rem; }
.guia-accion { color: var(--birome); font-weight: 700; font-size: 0.95rem; }

.fechas { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.fechas li { background: var(--hoja); border: 1px solid var(--borde); border-radius: 6px; padding: 0.55rem 0.9rem; display: grid; }
.fechas strong { font-family: var(--f-titulo); font-stretch: 100%; }
.fechas span { color: var(--suave); }

.enlaces { list-style: none; padding: 0; margin: 0; max-width: var(--ancho-texto); }
.enlaces li { padding: 0.65rem 0; border-bottom: 1px solid var(--borde); }
.enlaces li:last-child { border-bottom: 0; }
.enlaces a { font-weight: 700; font-size: 1.08rem; }
.enlaces .nota { display: block; }

/* --- Sellos de goma --------------------------------------------------------- */
.sello {
  --c: var(--gris-sello);
  display: inline-block;
  color: var(--c);
  font-family: var(--f-titulo);
  font-weight: 800;
  font-stretch: 108%;
  font-size: 0.92rem;
  line-height: 1;
  letter-spacing: -0.005em;
  white-space: nowrap;
  padding: 0.4em 0.62em 0.44em;
  border: 2px solid currentColor;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--hoja), inset 0 0 0 3.5px currentColor;
  background: color-mix(in srgb, var(--c) 6%, var(--hoja));
  transform: rotate(-3deg);
  margin: 0;
}
.sello--comprar, .sello--elegida { --c: var(--sello); }
.sello--normal { --c: var(--ocre); }
.sello--esperar { --c: var(--esperar); }
.sello--inflado { --c: var(--violeta); }
.sello--sin_historial { --c: var(--gris-sello); }
.sello--hoy { --c: var(--birome); }
.sello--grande { font-size: clamp(1.3rem, 4vw, 1.7rem); border-width: 3px;
  box-shadow: inset 0 0 0 3px var(--hoja), inset 0 0 0 5px currentColor; transform: rotate(-5deg); }
.texto .sello { transform: rotate(-2deg); font-size: 0.82rem; vertical-align: 0.1em; }

/* --- Fichas de producto (como las fichas rayadas del colegio) ---------------- */
.lista { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.producto { position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 0 1rem; align-items: start;
  background: var(--hoja); border: 1px solid var(--borde); border-radius: 6px; padding: 0 1rem 1rem; }
.producto--sin-foto { grid-template-columns: 1fr; }
.producto-foto { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 4px; margin-top: 1rem; }
.producto-cuerpo { min-width: 0; }
.producto-titulo { font: 700 1rem/1.35 var(--f-texto); letter-spacing: 0; margin: 0 -1rem 0.75rem; padding: 0.9rem 1rem 0.6rem;
  border-bottom: 2px solid var(--margen); }
.producto--sin-foto .producto-titulo { margin-inline: -1rem; }
.producto:not(.producto--sin-foto) .producto-titulo { margin-left: 0; padding-left: 0; }
.producto-titulo a { color: var(--tinta); text-decoration: none; }
.producto-titulo a:hover { text-decoration: underline; }
.producto-linea { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.4rem; }
.precio { font-family: var(--f-titulo); font-weight: 750; font-stretch: 80%; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.producto-precio { font-size: 1.9rem; line-height: 1.1; }
.producto-precio small { font-family: var(--f-texto); font-weight: 400; font-stretch: 100%; font-size: 0.85rem; color: var(--tenue);
  letter-spacing: 0; margin-left: 0.35rem; }
.producto-explicacion { color: var(--suave); font-size: 0.95rem; margin-bottom: 0.85rem; }
.producto--elegida { border-color: var(--sello); box-shadow: 0 0 0 1px var(--sello); }
.producto-sello-elegida { position: absolute; right: 0.75rem; top: -0.95rem; }
.producto--elegida .producto-titulo { padding-top: 1.45rem; }
.producto--elegida { margin-top: 1.4rem; }
.comparativa .producto { margin: 1.25rem 0 1.5rem; max-width: var(--ancho-texto); }

/* --- Botones ----------------------------------------------------------------- */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 46px;
  padding: 0.6rem 1.1rem; border-radius: 8px; background: var(--tinta); color: var(--papel); font: 700 1rem/1.2 var(--f-texto);
  text-decoration: none; border: 2px solid var(--tinta); cursor: pointer; }
.boton:hover { background: color-mix(in srgb, var(--tinta) 86%, var(--birome)); text-decoration: none; }
.boton--grande { font-size: 1.08rem; padding: 0.75rem 1.4rem; }
.boton--secundario { background: transparent; color: var(--tinta); }
.boton--secundario:hover { background: color-mix(in srgb, var(--birome) 10%, transparent); }
.boton--whatsapp { background: transparent; color: var(--tinta); border-color: var(--sello); }
.boton--whatsapp:hover { background: color-mix(in srgb, var(--sello) 12%, transparent); }
.boton svg { width: 1.15em; height: 1.15em; flex: none; }

/* --- Ficha de producto --------------------------------------------------------- */
.miga { margin-bottom: 0.75rem; font-weight: 700; font-size: 0.95rem; }
.miga a { color: var(--suave); }
.ficha-titulo { font-size: clamp(1.6rem, 4.5vw, 2.4rem); max-width: 48rem; }
.ficha-veredicto { display: grid; gap: 1rem; justify-items: start; max-width: var(--ancho-texto); margin-top: 1.25rem; }
.ficha-precio { display: grid; gap: 0.2rem; }
.ficha-precio-valor { font-size: clamp(2.6rem, 9vw, 3.8rem); line-height: 1; }
.ficha-precio-nota { color: var(--suave); }
.ficha-explicacion { font-size: 1.08rem; margin: 0; }
.ficha-acciones { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.ficha-actualizado { color: var(--tenue); font-size: 0.9rem; margin: 0; }

.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); margin: 0; max-width: 52rem; }
.datos div { padding: 0.6rem 0; border-bottom: 1px solid var(--borde); margin-right: 1.5rem; }
.datos dt { color: var(--tenue); font-size: 0.88rem; }
.datos dd { margin: 0; font-weight: 700; }

/* --- Alertas y novedades -------------------------------------------------------- */
.aviso-baja { max-width: var(--ancho-texto); background: var(--hoja); border: 1px solid var(--borde); border-radius: 6px;
  padding: 1.25rem; display: grid; gap: 0.75rem; }
.aviso-baja h2, .aviso-baja h3 { margin: 0; }
.aviso-baja p { margin: 0; color: var(--suave); }
.formulario { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: stretch; }
.formulario label.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.formulario input[type="email"] { flex: 1 1 14rem; min-width: 0; min-height: 46px; padding: 0.55rem 0.8rem;
  font: inherit; color: var(--tinta); background: var(--papel); border: 1.5px solid var(--borde); border-radius: 8px; }
.formulario input[type="email"]:focus { border-color: var(--birome); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--birome) 25%, transparent); }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.consentimiento { font-size: 0.85rem; color: var(--tenue); }
.alternativa { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 0.95rem; color: var(--suave); }

/* --- Gráfico de historial --------------------------------------------------------- */
.grafico { width: 100%; max-width: var(--ancho-texto); height: auto; display: block; margin-bottom: 1rem; }
.g-grilla { stroke: var(--cuadricula); stroke-width: 1; }
.g-eje { fill: var(--tenue); font: 12px var(--f-texto); }
.g-justo { stroke: var(--suave); stroke-width: 1.5; stroke-dasharray: 5 4; }
.g-justo-texto { fill: var(--suave); font: 700 12px var(--f-texto); }
.g-linea { fill: none; stroke: var(--birome); stroke-width: 2.5; stroke-linejoin: round; }
.g-punto { fill: var(--birome); }

/* --- Textos largos y comparativas ---------------------------------------------------- */
.texto, .comparativa-cuerpo { max-width: var(--ancho-texto); }
.texto h2, .comparativa-cuerpo h2 { margin-top: 2.2rem; }
.texto ul, .comparativa-cuerpo ul { padding-left: 1.2rem; }
.texto li, .comparativa-cuerpo li { margin-bottom: 0.45rem; }
.comparativa-cabeza { margin-bottom: 1.5rem; }
.comparativa-cabeza .bajada { margin-bottom: 0.75rem; }
.firma { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; color: var(--tenue); font-size: 0.92rem; }
.comparativa-cuerpo table { border-collapse: collapse; width: 100%; margin: 1.25rem 0 1.75rem; font-size: 0.97rem;
  display: block; overflow-x: auto; background: var(--hoja); border: 1px solid var(--borde); border-radius: 6px; }
.comparativa-cuerpo th, .comparativa-cuerpo td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.comparativa-cuerpo tr:last-child td { border-bottom: 0; }
.comparativa-cuerpo th { font-family: var(--f-titulo); font-weight: 700; font-stretch: 100%; }
/* La opción recomendada va en negrita en la tabla y se resalta como con un marcador. */
.comparativa-cuerpo td strong { background: linear-gradient(transparent 52%, var(--resaltador) 52%, var(--resaltador) 92%, transparent 92%); }
.compartir { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2.5rem; padding-top: 1.25rem;
  border-top: 2px dashed var(--borde); max-width: var(--ancho-texto); }
.compartir p { margin: 0; flex: 1 1 14rem; font-family: var(--f-mano); font-size: 1.25rem; color: var(--birome); line-height: 1.3; }

/* --- Pie -------------------------------------------------------------------------- */
.pie { border-top: 1px solid var(--borde); padding-block: 2rem 2.75rem; color: var(--suave); font-size: 0.95rem; }
.pie-grilla { display: grid; gap: 1.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.pie p { max-width: var(--ancho-texto); margin-bottom: 0.5rem; }
.pie-logo img { width: 120px; margin-bottom: 0.5rem; }
.pie-lema { font-family: var(--f-titulo); font-weight: 800; font-size: 1.15rem; color: var(--tinta); }
.pie-enlaces { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }

/* --- Un solo momento animado: el sello cae sobre la ficha ------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .ficha-veredicto .sello--grande { animation: sellar 420ms cubic-bezier(.2, .9, .3, 1.25) 180ms both; }
  @keyframes sellar { from { opacity: 0; transform: rotate(-12deg) scale(1.6); } to { opacity: 1; transform: rotate(-5deg) scale(1); } }
}

@media (min-width: 720px) {
  .hoja { padding: 3.25rem 2.5rem 2.75rem 5.5rem; }
  .hoja::before { left: 3.6rem; }
  .logo img { width: 170px; }
}
@media (max-width: 520px) {
  .producto { grid-template-columns: 64px 1fr; }
  .producto-foto { width: 64px; height: 64px; }
  .producto--sin-foto { grid-template-columns: 1fr; }
}
