/* ══════════════════════════════════════════════════════════════════════════
   POSTE ANTIFRAGILE — feuille de style du tableau de bord 3D.

   Palette reprise telle quelle du bloc :root d'accueil.css. Aucune couleur
   inventee : le poste 3D doit rester reconnaissable comme du Capital
   Antifragile, pas comme une demo technique.
   ══════════════════════════════════════════════════════════════════════════ */

.pa-stage {
  --pa-bg-deep: #050b1a;
  --pa-bg-elev: #0a1530;
  --pa-cyan:    #3d8bff;
  --pa-cyan-l:  #74aeff;
  --pa-fg:      #eaf2fb;
  --pa-fg-2:    #b8c5d9;
  --pa-muted:   #6b7a99;

  position: relative;
  width: 100%;
  height: calc(100vh - 56px);
  min-height: 460px;
  background: var(--pa-bg-deep);
  overflow: hidden;
  border-radius: 4px;
  cursor: grab;
}
.pa-stage[data-mode="fallback"] { cursor: default; }
.pa-stage.pa-dragging { cursor: grabbing; }

.pa-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Repli : WebGL absent, ecran etroit, tactile, ou animations reduites ──
   Personne ne doit tomber sur une page qui rame. Le tableau de bord 2D porte
   exactement les memes donnees, donc le repli n'est pas une degradation. */
.pa-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  background: radial-gradient(120% 100% at 50% 0%, var(--pa-bg-elev) 0%, var(--pa-bg-deep) 70%);
  color: var(--pa-fg-2);
}
.pa-stage[data-mode="fallback"] .pa-fallback { display: flex; }

.pa-fallback h2 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
  color: var(--pa-fg);
}
.pa-fallback p {
  margin: 0;
  max-width: 46ch;
  line-height: 1.6;
  font-size: 15px;
}
.pa-fallback .pa-cta {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 18px;
  border-radius: 5px;
  background: var(--pa-cyan);
  color: var(--pa-bg-deep);
  font-weight: 700;
  text-decoration: none;
}
.pa-fallback .pa-cta:hover,
.pa-fallback .pa-cta:focus {
  background: var(--pa-cyan-l);
  color: var(--pa-bg-deep);
  text-decoration: none;
}

/* ── Message d'attente : visible pendant le chargement du moteur seulement ── */
.pa-todo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--pa-muted);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  pointer-events: none;
}
.pa-todo strong {
  color: var(--pa-cyan-l);
  font-size: 15px;
  letter-spacing: .22em;
  font-weight: 700;
}
/* Des que la salle tourne — ou qu'on est en repli — l'attente disparait. */
.pa-stage[data-mode="fallback"] .pa-todo,
.pa-stage[data-mode="salle"]    .pa-todo { display: none; }

/* ── Aide aux commandes ───────────────────────────────────────────────────
   Affichee uniquement quand la salle tourne reellement. */
.pa-aide {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: none;
  gap: 20px;
  padding: 8px 16px;
  border-radius: 5px;
  background: rgba(5, 11, 26, .78);
  border: 1px solid rgba(61, 139, 255, .18);
  color: var(--pa-muted);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.pa-stage[data-mode="salle"] .pa-aide { display: flex; }
.pa-aide b { color: var(--pa-cyan-l); font-weight: 700; }

/* ── Etat des donnees ─────────────────────────────────────────────────────
   Visible en permanence : sur un tableau de bord financier, savoir si ce
   qu'on regarde est en direct ou perime n'est pas un detail d'interface. */
.pa-donnees {
  position: absolute;
  right: 14px;
  bottom: 16px;
  padding: 5px 11px;
  border-radius: 4px;
  background: rgba(5, 11, 26, .72);
  border: 1px solid rgba(61, 139, 255, .15);
  color: var(--pa-muted);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  display: none;
}
.pa-stage[data-mode="salle"] .pa-donnees { display: block; }

/* ── Mode lecture ─────────────────────────────────────────────────────────
   Quand la camera a fini de cadrer un ecran, on pose PAR-DESSUS le meme
   widget redessine a la taille exacte qu'il occupe, en pixels physiques. Le
   texte est alors trace a sa resolution finale au lieu d'etre une texture
   agrandie : c'est la difference entre « lisible » et « net ».
   Le pied relie la salle au reste du site — sans lui, le poste 3D serait une
   impasse. */
.pa-lecture {
  position: absolute;
  z-index: 6;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .3s ease, visibility .3s, transform .3s ease;
  pointer-events: none;
}
.pa-lecture.ouverte {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}
.pa-lecture canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
  cursor: zoom-out;
  box-shadow: 0 0 0 1px rgba(61, 139, 255, .35), 0 26px 70px rgba(2, 5, 12, .85);
}
.pa-lecture-pied {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.pa-lecture-pied a,
.pa-lecture-pied button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid rgba(61, 139, 255, .35);
  background: rgba(5, 11, 26, .9);
  color: var(--pa-cyan-l);
  text-decoration: none;
  cursor: pointer;
}
.pa-lecture-pied a:hover,
.pa-lecture-pied a:focus,
.pa-lecture-pied button:hover,
.pa-lecture-pied button:focus {
  background: rgba(61, 139, 255, .16);
  color: var(--pa-fg);
  text-decoration: none;
}
.pa-lecture-pied a[hidden] { display: none; }

/* ── Etiquette du poste cadre ─────────────────────────────────────────────
   Alimentee par data-focus, pose par le moteur au moment du travelling. */
.pa-focus {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 15px;
  border-radius: 5px;
  background: rgba(5, 11, 26, .82);
  border: 1px solid rgba(61, 139, 255, .3);
  color: var(--pa-cyan-l);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
/* Le texte est ecrit par le moteur (textContent) : attr() ne sait pas lire un
   attribut porte par un AUTRE element que celui qu'il stylise. */
.pa-stage[data-focus]:not([data-focus=""]) .pa-focus { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .pa-stage * {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
