/* Numériser un document : placement des 4 coins, aperçu du résultat, liste des pages. */

.num-cache { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
/* Le choix « Depuis la galerie » n'est utile que sur téléphone (sur ordinateur, la zone ouvre déjà les fichiers). */
.num-galerie { display: none; min-height: 44px; }
@media (hover: none) and (pointer: coarse) {
  .num-galerie { display: inline-flex; }
}

.zone.num-zone-compacte { padding: .8rem 1rem; }
.zone.num-zone-compacte .trou-zone { display: none; }
.zone.num-zone-compacte .zone-titre { font-size: 1rem; }

.num-editeur { display: grid; gap: .8rem; min-width: 0; }
.num-barre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.num-nav, .num-actions { display: flex; align-items: center; gap: .5rem; }
.num-barre .bouton-icone { width: 44px; height: 44px; font-size: 1.25rem; line-height: 1; }
.num-nav .bouton-icone { font-size: 1.5rem; }
.num-numero { min-width: 7.5em; text-align: center; font-variant-numeric: tabular-nums; color: var(--texte-doux); }
.num-boutons { display: flex; flex-wrap: wrap; gap: .5rem; }
.num-boutons .bouton-secondaire { min-height: 44px; }

.num-cadres { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: start; }
.num-cadre { margin: 0; display: grid; gap: .5rem; min-width: 0; }
.num-cadre figcaption { font-weight: 650; color: var(--texte-doux); font-size: .92rem; }

/* La photo : les poignées sont positionnées en % par le script. Marge pour que les poignées des bords restent attrapables. */
.num-scene {
  position: relative; width: min(100%, calc(70vh * var(--ratio, 1))); aspect-ratio: var(--ratio, 1); margin: 0 auto; background: #000;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.num-photo { display: block; width: 100%; height: 100%; }
.num-contour { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.num-voile { fill: rgba(0, 0, 0, .5); }
.num-trait { fill: none; stroke: #F59E0B; stroke-width: 2.5; stroke-linejoin: round; }

.num-poignee {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: grab; display: grid; place-items: center; touch-action: none; z-index: 1;
}
.num-poignee span {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid #F59E0B; background: rgba(255, 255, 255, .85);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.num-poignee:focus-visible { outline: none; }
.num-poignee:focus-visible span, .num-poignee.active span { border-color: #FCD34D; background: #F59E0B; transform: scale(1.15); }
.num-poignee.active { cursor: grabbing; }

.num-loupe {
  position: absolute; top: 8px; left: 8px; width: 128px; height: 128px; border-radius: 50%;
  border: 3px solid #F59E0B; box-shadow: 0 4px 14px rgba(0, 0, 0, .6); pointer-events: none; z-index: 2;
}
.num-loupe.num-loupe-droite { left: auto; right: 8px; }
.num-loupe.num-loupe-bas { top: auto; bottom: 8px; }

.num-aide { margin: 0; font-size: .85rem; color: var(--texte-doux); }
.num-alerte { margin: 0; padding: .5rem .75rem; border-left: 3px solid var(--erreur); border-radius: 6px; background: var(--teinte-accent); font-size: .9rem; }

.num-scene-resultat { display: grid; justify-items: center; }
.num-resultat { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; background: #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }

.num-pages { list-style: none; padding: 0; margin: 0; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.num-pages .miniature { align-content: start; }
.num-choisir {
  display: grid; justify-items: center; gap: .3rem; width: 100%; min-height: 44px; padding: .2rem; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.num-choisir canvas { max-width: 100%; max-height: 150px; width: auto; height: auto; }
.num-choisir:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.num-pages .commandes { display: flex; justify-content: center; gap: .35rem; }
.num-pages .commandes .bouton-icone { width: 44px; height: 40px; }

@media (prefers-reduced-motion: reduce) {
  .num-poignee:focus-visible span, .num-poignee.active span { transform: none; }
}

/* Groupes de choix (comme Image en PDF). */
.groupe-choix { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: .5rem; }
.groupe-choix legend { font-weight: 650; padding: 0; margin-bottom: .5rem; }
.groupe-choix .choix > label { min-height: 44px; box-sizing: border-box; }
