/* Banco · Scheda Prima Lettura (Atto I)
   Fase A: inventario strumenti + lente bloccabile + superficie di lettura.
   La scheda 3 zone (.pl-scheda) è dormiente — torna in Fase C.
   I @media mobile del Banco vivono in banco-scene.css (consolidamento Fase A).
*/

/* ───── STAGE — contenitore strumenti+reperto+pannello, riempie .banco-body
   Posizione (absolute/static) gestita in banco-scene.css con specificità più alta
   (.banco-scene--prima-lettura .pl-stage) per evitare collisioni col @media mobile.
*/
.pl-stage {
  display: flex;
  flex-direction: column;
  pointer-events: none;
  /* Offset lente rispetto al dito (sopra-destra default; X specchiata per mancini in JS) */
  --lente-offset-x-desktop: 30px;
  --lente-offset-y-desktop: -55px;
  --lente-offset-x-mobile: 40px;
  --lente-offset-y-mobile: -90px;
}
.pl-stage > * { pointer-events: auto; }

/* ───── INVENTARIO — caselline strumenti in alto ───── */
.pl-inventory {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(180deg, rgba(14, 9, 5, 0.92) 0%, rgba(8, 5, 3, 0.96) 100%);
  border-bottom: 1px solid rgba(185, 161, 116, 0.22);
  flex-shrink: 0;
  z-index: 25;
  position: relative;
}
.pl-tool {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-main);
  background: rgba(185, 161, 116, 0.06);
  border: 1px solid rgba(185, 161, 116, 0.32);
  padding: 0.45rem 0.65rem;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, box-shadow 160ms;
}
.pl-tool:hover:not(:disabled) {
  background: rgba(185, 161, 116, 0.12);
  border-color: rgba(185, 161, 116, 0.55);
}
.pl-tool.is-active {
  background: rgba(183, 131, 59, 0.18);
  border-color: var(--amber);
  box-shadow: 0 0 8px rgba(183, 131, 59, 0.35) inset;
  color: var(--amber);
}
.pl-tool.is-locked,
.pl-tool:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pl-tool-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.pl-tool-icon-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.pl-tool-icon-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.pl-tool-icon:has(.pl-tool-icon-img) .pl-tool-icon-fallback {
  display: none;
}
/* Slot PNG inventario: lente.png · matita.png · gomma.png (fallback emoji se assenti) */
.pl-tool-label {
  font-weight: 500;
}
/* .pl-tool--matita e .pl-tool--gomma: ereditano stile base da .pl-tool.
   Stato attivo gestito via .is-active (toggleato da setToolState in FSM).
   Stato disabilitato gestito via .is-locked + disabled attr (R0: sempre disabilitati;
   R3 rimuoverà il lock quando contesto A05-alterata/pagina-vuota è attivo). */
.pl-tool--matita,
.pl-tool--gomma {
  /* nessuna sovrascrittura necessaria in R0 */
}

.pl-tool-flash {
  margin: 0 0 0 0.7rem;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--amber);
  opacity: 0;
  transition: opacity 280ms ease-out;
}
.pl-tool-flash.is-visible {
  opacity: 1;
}

/* Toggle destrorso / mancino — angolo inventario */
.pl-handedness-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  color: rgba(185, 161, 116, 0.72);
  background: rgba(185, 161, 116, 0.05);
  border: 1px solid rgba(185, 161, 116, 0.22);
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms, border-color 160ms, background 160ms;
}
.pl-handedness-toggle:hover {
  color: var(--amber);
  border-color: rgba(183, 131, 59, 0.45);
  background: rgba(183, 131, 59, 0.1);
}
.pl-handedness-toggle.is-left {
  color: var(--amber);
  border-color: rgba(183, 131, 59, 0.45);
}
.pl-handedness-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform-origin: center;
  transition: transform 160ms ease-out;
}
.pl-handedness-toggle.is-left .pl-handedness-icon {
  transform: scaleX(-1);
}

/* ───── AREA REPERTO — img + lente cursor + pulsante "Blocca" ───── */
.pl-reperto-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  touch-action: none;
  cursor: default;
}
.pl-reperto-area[data-tool-state="lente-mobile"] {
  cursor: none;
}

.pl-reperto-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(8px 12px 14px rgba(0, 0, 0, 0.55));
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Lente che segue il puntatore (LENTE_MOBILE) */
.pl-lente-cursor {
  position: absolute;
  width: 140px;
  height: 140px;
  margin-left: -70px;
  margin-top: -70px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease-out;
  z-index: 10;
}
.pl-lente-cursor.is-visible {
  opacity: 1;
}
.pl-lente-cursor-glass {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  border: 2px solid rgba(183, 131, 59, 0.85);
  background: radial-gradient(circle at 35% 30%, rgba(245, 237, 216, 0.12) 0%, rgba(245, 237, 216, 0.02) 55%, transparent 100%);
  box-shadow:
    0 0 0 1px rgba(14, 9, 5, 0.5),
    0 8px 22px rgba(0, 0, 0, 0.45),
    inset 0 0 10px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.pl-lente-magnifier {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #0e0905;
  isolation: isolate;
  contain: paint;
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
}
.pl-lente-magnifier-img {
  position: absolute;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* Ingrandisce il contenuto del foglio, non la cornice del reperto sorgente */
  border-radius: 0;
  box-shadow: none;
  border: none;
  outline: none;
  clip-path: none;
  -webkit-clip-path: none;
}

/* Pulsante "Leggi qui" (mobile esplicito) — visibile solo in LENTE_MOBILE */
.pl-lente-mobile-actions {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
}
.pl-lente-blocca {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(14, 9, 5, 0.85);
  border: 1px solid rgba(183, 131, 59, 0.55);
  padding: 0.6rem 1.2rem;
  min-height: 44px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.pl-lente-blocca:hover {
  background: rgba(183, 131, 59, 0.18);
  border-color: var(--amber);
}

/* ───── SCHEDA DORMIENTE (Fase C — segnaposto) ───── */
.pl-scheda.is-dormant {
  display: none;
}

/* ───── CHROME BAR — tab reperti (status zone rimosso in Fase A) ───── */
.pl-chrome-section {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pl-chrome-tabs { flex: 0 0 auto; }
.pl-chrome-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--amber);
  text-transform: uppercase;
}
.pl-tabs {
  display: flex;
  gap: 0.3rem;
}
.pl-tab {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--text-main);
  background: rgba(185, 161, 116, 0.04);
  border: 1px solid rgba(185, 161, 116, 0.2);
  border-bottom: 2px solid transparent;
  padding: 0.4rem 0.65rem;
  min-height: 44px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.pl-tab:hover { background: rgba(185, 161, 116, 0.08); }
.pl-tab.is-active {
  background: rgba(185, 161, 116, 0.14);
  border-bottom-color: var(--amber);
  color: var(--text-main);
}

/* ───── reduced-motion: la lente non smooth-segue, niente animazioni ───── */
@media (prefers-reduced-motion: reduce) {
  .pl-lente-cursor,
  .pl-tool,
  .pl-tool-flash,
  .pl-tab,
  .pl-lente-blocca,
  .pl-handedness-toggle,
  .pl-handedness-icon {
    transition: none !important;
    animation: none !important;
  }
}
