/* Visor de la ficha (solo PDF): barra de herramientas, hojas A4 como imagen y botón del solucionario. Autocontenido. */
:root {
  --marca: #1f1f1f; --marca-2: #8e7dbe; --tinta: #1f1f1f; --paper: #fff; --taula: #f1eef8;
  --web-linia: #ecdcc9; --web-tinta: #1f1f1f;
  --acento: var(--marca); --acento-suau: #f1eef8;
  --tipus-text: "Andika", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --tipus-marca: "Fredoka", "Andika", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--taula); color: var(--tinta); font-family: var(--tipus-text); }

/* ---------- barra de herramientas ---------- */
.eines {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center;
  min-height: 56.7px; padding: .55rem max(1.2rem, calc((100% - 76rem) / 2 + 1.2rem)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--web-linia); color: var(--web-tinta);
  font: 15px/1 var(--tipus-text);
}
.eines-logo { margin-right: .6rem; font-family: var(--tipus-marca); font-size: 1.55rem; font-weight: 700; color: #1f1f1f; text-decoration: none; letter-spacing: -.01em; }
.eines-logo span { color: #8e7dbe; }
.eines-enrere { color: var(--web-tinta); text-decoration: none; font-weight: 700; padding: .35rem .8rem; border-radius: 999px; background: #fff; border: 1.5px solid var(--web-linia); }
.eines-enrere:hover { border-color: #1f1f1f; }
.eines-accions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.btn {
  font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
  padding: .4rem .95rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  border: 1.5px solid var(--web-linia); background: #fff; color: var(--web-tinta); transition: border-color .12s, background .12s;
}
.btn:hover { border-color: #1f1f1f; }
.btn-primari { background: #8e7dbe; border-color: #8e7dbe; color: #1f1f1f; }
.btn-primari:hover { background: #a99bd0; border-color: #a99bd0; }
.btn-pdf { display: inline-flex; align-items: center; gap: .45rem; animation: pdf-halo 2.4s ease-out 1.2s 3; }
.btn-pdf svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pdf-halo { 0% { box-shadow: 0 0 0 0 rgba(142, 125, 190, .7); } 70%, 100% { box-shadow: 0 0 0 .6rem rgba(142, 125, 190, 0); } }
@media (prefers-reduced-motion: reduce) { .btn-pdf { animation: none; } }
.btn:focus-visible, .eines a:focus-visible { outline: 3px solid #6354a0; outline-offset: 2px; }
@media (max-width: 720px) { .eines-accions { margin-left: 0; width: 100%; } }

/* ---------- hojas A4 (imágenes; la ficha no se puede editar ni descargar desde aquí) ---------- */
.fulls-ext { padding: 1.2rem 1rem 3rem; }
.fulls { width: min(210mm, 100%); margin: 0 auto; }
.pagina { aspect-ratio: 210 / 297; background: var(--paper); margin: 0 auto 1.2rem; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); overflow: hidden; }
.pagina:last-child { margin-bottom: 0; }
.pagina img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }

/* ---------- página de descarga: el solucionario ocupa la fila de debajo de los dos PDF ---------- */
.pdf-btn-sol { grid-column: 1 / -1; background: #fff; color: #1f1f1f; border: 2px dashed #2a2347; }

@media print { .eines, .no-print, .anunci { display: none !important; } .fulls-ext { padding: 0; } .pagina { box-shadow: none; margin: 0; break-after: page; } }
