/*
  Proyecto........: AR Cartas
  Archivo.........: styles.css
  Versión.........: 01.03 (Piloto · Diagnóstico técnico)
  Fecha...........: 2026-07-14
  Descripción.....: Estilos base de la portada y del escáner WebAR.
  Funcionalidades.:
    - Diseño mobile-first.
    - Escena AR ajustada al viewport completo.
    - Panel informativo no intrusivo para los targets detectados.
    - Respeto de las zonas seguras de dispositivos móviles.
    - Panel técnico fijo y conmutables desde scanner.js.
*/

:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #111111;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Pantalla inicial
   -------------------------------------------------------------------------- */

.home-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
}

.home {
  width: min(100%, 32rem);
  padding:
    max(2rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  text-align: center;
}

.home__title {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.5rem);
  line-height: 1;
}

.home__subtitle {
  margin: 0.9rem 0 2rem;
  color: #c9c9c9;
  font-size: 1rem;
  line-height: 1.45;
}

.player-button {
  display: flex;
  width: 100%;
  min-height: 3.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffffff;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #111111;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
}

.player-button:focus-visible {
  outline: 3px solid #8ec5ff;
  outline-offset: 4px;
}

@media (hover: hover) {
  .player-button:hover {
    background: #dedede;
  }
}

/* --------------------------------------------------------------------------
   Escáner WebAR
   -------------------------------------------------------------------------- */

.scanner-page {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #000000;
}

.scanner {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
}

/*
  Solo dimensionamos el contenedor de A-Frame. MindAR conserva el control de la
  cámara, del vídeo y del canvas para adaptarlos a cada navegador y dispositivo.
*/
.scanner a-scene {
  width: 100%;
  height: 100%;
}

.detection-panel,
.technical-panel,
.system-message {
  position: fixed;
  z-index: 10000;
  max-width: calc(100% - 1.5rem - env(safe-area-inset-left) - env(safe-area-inset-right));
  border-radius: 0.35rem;
  background: rgb(0 0 0 / 76%);
  color: #ffffff;
  font-family: Consolas, "Courier New", monospace;
  pointer-events: none;
}

.detection-panel {
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  padding: 0.55rem 0.7rem;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-line;
}

/*
  Posición fija e independiente del panel de detecciones. No se calcula su
  ubicación según el número de targets visibles.
*/
.technical-panel {
  left: max(0.75rem, env(safe-area-inset-left));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  width: min(29rem, calc(100% - 1.5rem));
  max-height: min(58dvh, 36rem);
  overflow: auto;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px solid rgb(255 255 255 / 18%);
  font-size: clamp(0.625rem, 1.75vw, 0.75rem);
  line-height: 1.32;
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.technical-panel__title {
  display: block;
  margin-bottom: 0.4rem;
  color: #5fffd5;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.technical-panel__data {
  margin: 0;
  color: #ffffff;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.system-message {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: auto;
  padding: 0.7rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
}

[hidden] {
  display: none !important;
}
