/* LA HOJA IMPRIMIBLE (norte §7g · `core/hojaImprimible.js` · `#/imprimir/:id`).
   La misma actividad en papel. Nace limpia (§3): tamaños relativos (em), color
   por token, sin techos fijos. Los tokens `--hoja-*` son de la hoja: el papel
   es blanco y la tinta negra sea cual sea el skin de la pantalla. */
.hoja {
  --hoja-tinta: #000;
  --hoja-papel: #fff;
  --hoja-texto: 1em;
  --hoja-titulo: 1.6em;
  --hoja-hueco: .9em;
  --hoja-grande: 1.35em;       /* letra de escuela: frases, sopa y banco */
  --hoja-interlinea: 2.6;      /* sitio para escribir la tilde o la coma a lápiz */
  color: var(--hoja-tinta);
  background: var(--hoja-papel);
  font-size: var(--hoja-texto);
  max-width: 48em;
  margin: 0 auto;
  padding: 1.5em;
}
.hoja-cabeza { margin-bottom: var(--hoja-hueco); }
.hoja-titulo { font-size: var(--hoja-titulo); font-weight: 800; margin: 0 0 .4em; }
.hoja-datos { display: flex; gap: 2em; margin: 0 0 .6em; }
.hoja-linea {
  display: inline-block; width: 16em; border-bottom: .08em solid currentColor; vertical-align: baseline;
}
.hoja-linea--corta { width: 8em; }
.hoja-instrucciones { font-style: italic; margin: 0; }

/* Preguntas con opciones y casilla */
.hoja-preguntas { padding-left: 1.4em; margin: 0; }
.hoja-fila { margin: 0 0 var(--hoja-hueco); break-inside: avoid; }
.hoja-enunciado { font-weight: 700; margin: 0 0 .35em; }
.hoja-opciones { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3em 1.6em; }
.hoja-opcion { display: inline-flex; align-items: center; gap: .45em; }
.hoja-casilla {
  display: inline-block; width: 1em; height: 1em; border: .1em solid currentColor; border-radius: .15em;
}
.hoja-img { display: block; max-width: 50%; max-height: 12em; margin: .3em 0; }

/* Dos columnas para unir con una línea */
.hoja-unir { display: grid; grid-template-columns: 1fr 1fr; gap: 0 5em; }
.hoja-col { list-style: none; padding: 0; margin: 0; }
.hoja-pieza {
  display: flex; align-items: center; gap: .5em; min-height: 2.6em;
  border: .08em solid currentColor; border-radius: .4em; padding: .3em .6em; margin-bottom: .7em;
  break-inside: avoid;
}
.hoja-col--izq .hoja-punto { margin-left: auto; }
.hoja-col--der .hoja-pieza { flex-direction: row-reverse; justify-content: flex-end; }
.hoja-col--der .hoja-marca { margin-left: auto; }
.hoja-punto {
  display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: currentColor; flex: none;
}
.hoja-marca { font-weight: 800; }
.hoja-pieza .hoja-img { max-width: 30%; max-height: 4em; margin: 0; }

/* Sopa de letras: la rejilla, todas las celdas iguales (no hay solución que ver). */
.hoja-sopa { display: flex; flex-direction: column; align-items: center; gap: var(--hoja-hueco); }
.hoja-sopa__rejilla {
  border-collapse: collapse; border: .1em solid currentColor; font-size: var(--hoja-grande); font-weight: 700; text-align: center;
  break-inside: avoid;
}
.hoja-sopa__rejilla[data-lado="20"] { font-size: var(--hoja-texto); }
.hoja-sopa__rejilla td { border: .04em solid currentColor; width: 1.9em; height: 1.9em; padding: 0; line-height: 1; }

/* Banco de palabras (sopa y diagrama) */
.hoja-banco {
  list-style: none; padding: .5em .8em; margin: 0; display: flex; flex-wrap: wrap; gap: .4em 1.6em;
  border: .08em dashed currentColor; border-radius: .4em; font-size: var(--hoja-grande); break-inside: avoid;
}
.hoja-banco__p { font-weight: 700; }

/* Diagrama: el dibujo con sus números y un recuadro en blanco por número. */
.hoja-diagrama { display: flex; flex-direction: column; gap: var(--hoja-hueco); }
.hoja-diagrama__lienzo { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; break-inside: avoid; }
.hoja-diagrama__lienzo .hoja-img { max-width: 100%; max-height: 28em; margin: 0; }
.hoja-diagrama__num {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.8em; height: 1.8em; border-radius: 50%; font-weight: 800;
  color: var(--hoja-tinta); background: var(--hoja-papel); border: .12em solid currentColor;
}
.hoja-recuadros { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14em, 1fr)); gap: .7em 1.6em; }
.hoja-recuadro { display: flex; align-items: center; gap: .5em; font-size: var(--hoja-grande); break-inside: avoid; }
.hoja-recuadro__caja { flex: 1; min-height: 1.8em; border: .08em solid currentColor; border-radius: .3em; }

/* Frases para corregir a lápiz (Tildes · Comas) */
.hoja-frases { padding-left: 1.6em; margin: 0; font-size: var(--hoja-grande); line-height: var(--hoja-interlinea); }
.hoja-frase { margin: 0 0 var(--hoja-hueco); break-inside: avoid; }
.hoja-frases--coma { word-spacing: .9em; }
.hoja-frases--tilde { letter-spacing: .04em; }

/* Créditos de las imágenes (§24): la atribución viaja al papel. */
.hoja-ref { font-size: smaller; }
.hoja-creditos { margin-top: 1.5em; border-top: .06em solid currentColor; padding-top: .4em; font-size: smaller; break-inside: avoid; }
.hoja-creditos__t { font-weight: 700; margin: 0 0 .2em; }
.hoja-creditos ol { margin: 0; padding-left: 1.6em; overflow-wrap: anywhere; }

/* La barra es de la PANTALLA: volver e imprimir. */
.hoja-barra {
  display: flex; align-items: center; justify-content: space-between; gap: 1em; flex-wrap: wrap;
  max-width: 48em; margin: 0 auto .5em; padding: 0 1.5em;
}
.hoja-barra__nota { opacity: .7; font-size: smaller; }

/* EN PAPEL solo va la hoja: ni la barra de la app ni la nuestra. ACOTADO a la
   página que tiene una hoja MONTADA (`body:has(.hoja)`, como «Imprimir códigos»
   hace con su panel en home.css): fuera de `#/imprimir/:id` esta hoja de
   estilos no toca la impresión de nadie, y al salir de la vista no queda nada
   que quitar (§23: la vista posee su render). */
@media print {
  body:has(.hoja) * { visibility: hidden; }
  body:has(.hoja) .hoja, body:has(.hoja) .hoja * { visibility: visible; }
  body:has(.hoja) .hoja { position: absolute; left: 0; top: 0; width: 100%; max-width: none; padding: 0; }
  .hoja-barra { display: none; }
}
