/* ============================================================
   SETEVIAS — pex01-fix/css/experience.css
   PEX01-FIX — causa raiz do bug de produção: os monitores/
   hotspots eram posicionados em % contra a VIEWPORT (que muda de
   proporção a cada resolução), enquanto o fundo usava
   background-size:cover (que corta a imagem de forma diferente a
   cada proporção). Duas transformações independentes = qualquer
   desalinhamento na hora de comparar telas.

   Correção: Scene Viewport → Scene Canvas. O canvas SEMPRE mantém
   a proporção exata da imagem-fonte (aspect-ratio fixo, calculado
   via JS/ResizeObserver — ver experience.js, fitScene()). Todo
   hotspot/monitor é posicionado em % DENTRO do canvas — nunca
   contra a viewport. O canvas pode encolher/crescer conforme a
   tela, mas a imagem e os elementos HTML sempre escalam JUNTOS,
   pela mesma transformação.
   ============================================================ */

html, body { height: 100%; }
body { overflow: hidden; }

/* Sem isso, [hidden] nativo perde para qualquer regra de classe
   que define display (mesma especificidade, carregada depois da
   UA stylesheet) — já causou bug real nesta linha de protótipos
   (painéis "boot"/"final" da tela mobile aparecendo juntos, telas
   dos monitores não trocando de estado). Correção definitiva,
   cobre qualquer elemento com o atributo. */
[hidden] {
  display: none !important;
}

/* =========================
   APP SHELL
========================= */

.pex-app {
  display: grid;
  grid-template-columns: clamp(220px, 15vw, 290px) 1fr;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
}

/* =========================
   SIDEBAR
========================= */

.pex-sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(2, 10, 6, .97), rgba(1, 7, 4, .99));
  border-right: 1px solid var(--line-green);
  padding: 20px 16px;
  overflow-y: auto;
  min-height: 0;
}

.pex-logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; flex-shrink: 0; }
.pex-logo-name { display: flex; flex-direction: column; line-height: 1.15; }
.pex-logo-name strong { font-family: var(--font-ui); font-weight: 800; font-size: 14px; letter-spacing: .5px; }
.pex-logo-name small { font-family: var(--font-mono); font-size: 8px; letter-spacing: 2px; color: var(--muted); }

.pex-menu { list-style: none; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; }
.pex-menu a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-left: 2px solid transparent;
  transition: background .2s, border-color .2s;
}
.pex-menu a:hover, .pex-menu a:focus-visible { background: rgba(104, 255, 56, .07); border-left-color: var(--cyan); }
.pex-menu a[aria-current="page"] { background: rgba(104, 255, 56, .12); border-left-color: var(--green); }
.pex-menu a:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

.pex-menu-icon { width: 20px; flex-shrink: 0; text-align: center; font-size: 15px; color: var(--muted); }
.pex-menu a[aria-current="page"] .pex-menu-icon { color: var(--green); }
.pex-menu a:hover .pex-menu-icon, .pex-menu a:focus-visible .pex-menu-icon { color: var(--cyan); }

.pex-menu-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pex-menu-text strong { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pex-menu-text small { font-family: var(--font-mono); font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pex-menu-soon {
  margin-left: auto; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: .5px;
  color: var(--muted); border: 1px solid var(--line); padding: 2px 5px; text-transform: uppercase;
}
.pex-menu a[data-soon] .pex-menu-text { opacity: .68; }

.pex-sidebar-footer { flex-shrink: 0; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.pex-status { font-family: var(--font-mono); font-size: 10px; letter-spacing: .5px; color: var(--green); line-height: 1.6; }
.pex-status small { color: var(--muted); font-weight: 400; }
.pex-status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pexPulse 2.4s ease-in-out infinite; }
.pex-quote { margin: 0; font-size: 11px; font-style: italic; color: var(--text); line-height: 1.5; border: none; }
.pex-brand-sig { margin: 0; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.pex-version { margin: 0; font-family: var(--font-mono); font-size: 9px; color: var(--muted); line-height: 1.6; opacity: .7; }

/* =========================
   WORKSPACE
========================= */

.pex-workspace {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* --- HUD flutuante: prompt + CTA, posições do master, % do canvas
   (não reservam altura própria — ver item 5 do briefing R2) --- */
.pex-hud-terminal {
  position: absolute;
  left: 69%;
  top: 1.5%;
  z-index: 4;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.5; color: var(--green);
  background: rgba(2, 10, 6, .55); border: 1px solid var(--line-green); padding: 5px 10px;
  backdrop-filter: blur(2px);
}
.pex-prompt { color: var(--cyan); display: block; }
.pex-cursor { display: inline-block; width: 6px; height: 11px; background: var(--green); margin-left: 3px; vertical-align: -2px; animation: pexBlink 1.1s step-end infinite; }
.pex-cta-header {
  position: absolute;
  right: 1.5%;
  top: 1.5%;
  z-index: 4;
  border: 1px solid var(--line-green); color: var(--green);
  font-family: var(--font-mono); font-weight: 700; font-size: 10.5px; padding: 8px 14px;
  white-space: nowrap; background: rgba(2, 10, 6, .55); backdrop-filter: blur(2px);
  transition: background .2s, border-color .2s;
}
.pex-cta-header:hover, .pex-cta-header:focus-visible { background: rgba(104, 255, 56, .18); border-color: var(--green); }
.pex-cta-header:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* =========================
   SCENE VIEWPORT — área flexível; centraliza o canvas
========================= */

.pex-scene-viewport {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* =========================
   SCENE CANVAS — proporção fixa (1274:706), tamanho calculado via
   JS (fitScene em experience.js) e escrito em --canvas-w/--canvas-h.
   Fallback 100%/100% garante que, mesmo sem JS, o canvas ainda
   ocupa o viewport inteiro (só perde o "contain" preciso — ainda
   assim nada quebra, porque os hotspots são % DELE, não da
   viewport, então continuam coerentes entre si).
========================= */

.pex-scene-canvas {
  position: relative;
  width: var(--canvas-w, 100%);
  height: var(--canvas-h, 100%);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 4px;
}

.pex-scene-bg {
  position: absolute;
  inset: 0;
  background-image: url("../assets/scenario/01-BACKGROUND-CLEAN-v2.webp?v=fix3");
  background-size: 100% 100%; /* seguro aqui: o canvas SEMPRE tem a
     mesma proporção da imagem-fonte, então "esticar" pra 100% 100%
     nunca distorce — é matematicamente idêntico a "cover" quando
     as proporções já coincidem, sem o corte imprevisível do cover. */
}
.pex-scene-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 95% 85% at 50% 45%, transparent 55%, rgba(1, 6, 4, .55) 100%),
    linear-gradient(180deg, rgba(1, 6, 4, .25), transparent 18%, transparent 78%, rgba(1, 6, 4, .35));
  pointer-events: none;
}

/* --- quadro "Conexões de Hoje" — objeto físico, não Hero flutuante.
   Posição/tamanho calibrados sobre a moldura real (scene plate),
   ciclo de conteúdo trocado por js/experience.js (cycleBoard()). --- */
.pex-board {
  position: absolute;
  left: 2%;
  top: 2%;
  width: 24%;
  min-width: 190px;
  z-index: 3;
}
.pex-board-eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 1.5px; color: var(--cyan); margin: 0 0 10px; transition: opacity .3s; }
.pex-board-title {
  font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.05rem, 1.9vw, 1.65rem);
  line-height: 1.26; color: var(--white); margin: 0 0 10px; text-shadow: 0 0 18px rgba(104, 255, 56, .3);
  transition: opacity .3s;
}
.pex-board-title span { color: var(--green); display: block; }
.pex-board-mark {
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1; margin: 4px 0 10px; letter-spacing: -1px;
  text-shadow: 0 0 22px rgba(104, 255, 56, .35);
}
.pex-board-mark .n7 { color: var(--white); }
.pex-board-mark .nv { color: var(--green); }
.pex-board-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; color: var(--muted); margin: 0; transition: opacity .3s; }
.pex-board.is-changing .pex-board-eyebrow,
.pex-board.is-changing .pex-board-title,
.pex-board.is-changing .pex-board-sub { opacity: 0; }

/* =========================
   CRT + MONITOR — posições em % do SCENE CANVAS (não da viewport),
   calibradas contra o recorte scene-*.webp (1274×640).
========================= */

.pex-crt, .pex-map-monitor {
  position: absolute;
  border: none; padding: 0; background: none; font: inherit; color: inherit;
  cursor: pointer; z-index: 2;
}
.pex-crt          { left: 37.55%; top: 33.90%; width: 15.75%; height: 16.60%; }
.pex-map-monitor  { left: 56.90%; top: 35.10%; width: 25.25%; height: 20.80%; }

.pex-crt-frame { position: absolute; inset: 0; border-radius: 5px; transition: box-shadow .2s; }
.pex-crt:hover .pex-crt-frame, .pex-crt:focus-visible .pex-crt-frame,
.pex-map-monitor:hover .pex-crt-frame, .pex-map-monitor:focus-visible .pex-crt-frame {
  box-shadow: 0 0 0 1px rgba(104, 255, 56, .4), 0 0 24px rgba(104, 255, 56, .2);
}
.pex-crt:focus-visible, .pex-map-monitor:focus-visible { outline: none; }

.pex-crt-screen {
  position: absolute; inset: 3%;
  display: flex; flex-direction: column;
  background: transparent;
  overflow: hidden;
  padding: 5% 6%;
  font-family: var(--font-mono);
  font-size: clamp(6.5px, .62vw, 9px);
  line-height: 1.5;
  color: var(--green);
  text-shadow: 0 0 4px rgba(104, 255, 56, .8), 0 0 10px rgba(104, 255, 56, .4);
  text-align: left;
  animation: pexFlicker 6s linear infinite;
}
.pex-crt-screen--map { padding: 6%; justify-content: center; align-items: stretch; gap: 4px; }

.pex-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0px, rgba(0,0,0,.18) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.pex-terminal-body { display: flex; flex-direction: column; gap: 2px; white-space: pre-wrap; }
.pex-t-out { color: var(--text); }
.pex-t-ok { color: var(--green); }
.pex-t-prompt { color: var(--cyan); }

.pex-map-svg { flex: 1 1 55%; min-width: 0; }
.pex-map-line { fill: none; stroke: var(--cyan); stroke-width: .4; opacity: .8; transition: opacity .2s, stroke-width .2s; }
.pex-map-line.is-active { stroke: var(--green); opacity: 1; stroke-width: .7; }
.pex-map-dot { fill: var(--green); filter: drop-shadow(0 0 2px var(--green)); }
.pex-service-list { flex: 0 0 42%; list-style: none; display: flex; flex-direction: column; justify-content: center; gap: 4px; font-size: clamp(6px,.55vw,8px); color: var(--text); min-width: 0; }
.pex-service-list li { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; border-radius: 2px; transition: background .15s, color .15s; }
.pex-service-list li:hover, .pex-service-list li:focus-visible { background: rgba(104,255,56,.12); color: var(--white); outline: none; }
.pex-service-list li i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 4px var(--green); }

@media (prefers-reduced-motion: reduce) { .pex-crt-screen { animation: none; } }

/* =========================
   HOTSPOTS EM OBJETOS — % do canvas
========================= */

.pex-hotspot {
  position: absolute; border: none; background: none; cursor: pointer;
  border-radius: 4px; transition: box-shadow .2s; z-index: 2;
}
.pex-hotspot:hover, .pex-hotspot:focus-visible { box-shadow: 0 0 0 1px rgba(104, 255, 56, .35), 0 0 22px rgba(104, 255, 56, .16); }
.pex-hotspot:focus-visible { outline: none; }

.pex-hotspot--books  { left: 0%;     top: 53.9%; width: 10.75%; height: 17.5%;  }
.pex-hotspot--tower  { left: 74.4%;  top: 43%;   width: 18%;    height: 48.4%;  }
.pex-hotspot--logo   { left: 81.5%;  top: 63.3%; width: 4.7%;   height: 7.8%;   }
.pex-hotspot--floppy { left: 2.35%;  top: 81.1%; width: 18%;    height: 14.4%;  }

/* --- relógio — moldura física preservada no scene plate; só os
   dígitos são HTML real (hora de São Paulo, atualizada sozinha
   por experience.js, updateClock()). --- */
.pex-clock {
  position: absolute;
  left: 79.75%;
  top: 30.78%;
  width: 9.89%;
  height: 10.62%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(9px, .9vw, 15px);
  letter-spacing: 1px;
  color: #ffb020;
  text-shadow: 0 0 6px rgba(255, 176, 32, .7), 0 0 14px rgba(255, 176, 32, .35);
  pointer-events: none;
}
.pex-clock-colon { animation: pexClockBlink 1s step-end infinite; margin-left: 1px; }
@media (prefers-reduced-motion: reduce) { .pex-clock-colon { animation: none; } }

.pex-hotspot-tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 190px;
  background: rgba(1, 8, 5, .97); border: 1px solid var(--line-green);
  padding: 8px 10px; font-family: var(--font-ui); text-align: left;
  opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s;
  pointer-events: none; z-index: 4;
}
.pex-hotspot-tip strong { display: block; font-size: 11px; color: var(--green); margin-bottom: 2px; }
.pex-hotspot-tip small { display: block; font-size: 10.5px; color: var(--text); line-height: 1.4; }
.pex-crt:hover .pex-hotspot-tip, .pex-crt:focus-visible .pex-hotspot-tip,
.pex-map-monitor:hover .pex-hotspot-tip, .pex-map-monitor:focus-visible .pex-hotspot-tip,
.pex-hotspot:hover .pex-hotspot-tip, .pex-hotspot:focus-visible .pex-hotspot-tip {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.pex-hotspot-tip--egg strong { color: var(--cyan); }

/* =========================
   DEBUG OVERLAY (?debug=scene)
========================= */

.pex-scene-canvas.is-debug .pex-crt,
.pex-scene-canvas.is-debug .pex-map-monitor,
.pex-scene-canvas.is-debug .pex-hotspot {
  outline: 1px dashed #ff2ec4;
  outline-offset: -1px;
}
.pex-scene-canvas.is-debug .pex-board {
  outline: 1px dashed #ffd12e;
}
.pex-debug-info {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 10;
  background: rgba(0, 0, 0, .85);
  border: 1px solid #ff2ec4;
  color: #ff2ec4;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  padding: 8px 10px;
  white-space: pre;
  pointer-events: none;
}

/* =========================
   CARDS
========================= */

.pex-cards {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 2%;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2%;
}
.pex-card {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-green);
  background: rgba(2, 10, 6, .68);
  backdrop-filter: blur(2px);
  padding: 3% 4%;
}
.pex-card-icon { font-size: clamp(14px, 1.6vw, 22px); color: var(--green); flex-shrink: 0; }
.pex-card strong { display: block; font-size: clamp(9.5px, .85vw, 13px); letter-spacing: .3px; color: var(--white); line-height: 1.25; }
.pex-card small { display: block; font-family: var(--font-mono); font-size: clamp(8px, .68vw, 10.5px); color: var(--cyan); margin-top: 2px; }

/* =========================
   FOOTER
========================= */

.pex-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px clamp(16px, 2.2vw, 32px); border-top: 1px solid var(--line);
  background: rgba(1, 7, 12, .6); font-family: var(--font-mono); flex-wrap: wrap;
}
.pex-footer-brand { font-size: 10px; color: var(--text); text-align: center; margin: 0; line-height: 1.4; }
.pex-footer-brand small { color: var(--muted); letter-spacing: .5px; }
.pex-social { display: flex; gap: 10px; }
.pex-social a {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--text); font-size: 9px; text-transform: uppercase;
  transition: border-color .2s, color .2s;
}
.pex-social a:hover, .pex-social a:focus-visible { border-color: var(--green); color: var(--green); }
.pex-social a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.pex-footer-tag { font-size: 9.5px; color: var(--muted); letter-spacing: 1px; margin: 0; }

/* =========================
   TOAST
========================= */

.pex-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(1, 8, 5, .97); border: 1px solid var(--line-green); color: var(--green);
  font-family: var(--font-mono); font-size: 12px; padding: 12px 18px; z-index: 20; max-width: 90vw;
}

/* =========================
   ANIMAÇÕES
========================= */

@keyframes pexClockBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: .15; } }
@keyframes pexPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes pexBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@keyframes pexFlicker {
  0%, 96%, 100% { filter: brightness(1); }
  97% { filter: brightness(.92); }
  98% { filter: brightness(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .pex-status-dot { animation: none; }
  .pex-cursor { animation: none; opacity: 1; }
}


/* =========================
   RESPONSIVO DESKTOP
========================= */

@media (max-height: 800px) {
  .pex-footer { padding-top: 6px; padding-bottom: 6px; }
  .pex-sidebar { padding-top: 14px; padding-bottom: 14px; }
  .pex-menu a { padding: 7px 10px; }
  .pex-quote { display: none; }
  .pex-card { padding: 2.5% 3.5%; }
}
@media (max-width: 1180px) {
  .pex-board-sub { display: none; }
}

/* =========================================================
   TRANSIÇÃO ENTRE PÁGINAS — MASTER UI v1.5
   A sidebar é a "casca" fixa da experiência. Em navegadores com
   View Transitions entre documentos (Chrome/Edge atuais), somente
   o cenário central recebe movimento; menu/logo/gato permanecem
   visualmente imóveis. Navegadores sem suporte navegam normalmente.
   ========================================================= */
@view-transition { navigation: auto; }
.pex-sidebar { view-transition-name: sv-sidebar; }
.pex-scene-viewport { view-transition-name: sv-scene; }

/* O snapshot da página inteira não anima: evita o menu "viajar". */
::view-transition-old(root),
::view-transition-new(root),
::view-transition-old(sv-sidebar),
::view-transition-new(sv-sidebar){ animation:none; }

/* Só a área/cenário à direita troca de ambiente. */
::view-transition-old(sv-scene){
  animation:svSceneOut .20s cubic-bezier(.4,0,1,1) both;
}
::view-transition-new(sv-scene){
  animation:svSceneIn .34s cubic-bezier(.16,1,.3,1) both;
}
@keyframes svSceneOut{
  to{opacity:0;filter:brightness(.82) blur(1.5px);transform:scale(.996)}
}
@keyframes svSceneIn{
  from{opacity:0;filter:brightness(.84) blur(2px);transform:scale(1.006)}
  to{opacity:1;filter:none;transform:none}
}
@media (prefers-reduced-motion:reduce){
  ::view-transition-old(sv-scene),::view-transition-new(sv-scene){animation-duration:.001ms!important}
}
