/* ================================================================
   OVNI (link discreto para acervo.lucasmori.com)
   Aparece num dos cantos de baixo, fala e se esconde de novo.
   A entrada/saída e as falas são controladas pelo assets/js/ufo.js.
================================================================ */

/* Cores da nave: cinza escuro com luzes no --orange-2 (tema vermelho);
   no tema azul (stars) ela continua clara, com luzes no --accent-3 */
.ufo{
  --ufo-gap:24px;
  --ufo-hull-a:#8b929c;
  --ufo-hull-b:#4f5660;
  --ufo-hull-c:#262a31;
  --ufo-rim:#1d2026;
  --ufo-shine:.2;
  --ufo-light:var(--orange-2);

  position:fixed;
  right:var(--ufo-gap);
  bottom:var(--ufo-gap);
  z-index:25;
  display:block;
  width:72px;
  height:43px;
  color:var(--text);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  will-change:transform;
  -webkit-tap-highlight-color:transparent;
}

:root[data-concept-theme="stars"] .ufo{
  --ufo-hull-a:#eef1f5;
  --ufo-hull-b:#a9b0ba;
  --ufo-hull-c:#5f6670;
  --ufo-rim:#4b525c;
  --ufo-shine:.35;
  --ufo-light:var(--accent-3);
}

.ufo-hull-a{ stop-color:var(--ufo-hull-a); }
.ufo-hull-b{ stop-color:var(--ufo-hull-b); }
.ufo-hull-c{ stop-color:var(--ufo-hull-c); }
.ufo-rim{ fill:var(--ufo-rim); }
.ufo-shine{ fill-opacity:var(--ufo-shine); }

.ufo.at-left{
  left:var(--ufo-gap);
  right:auto;
}

.ufo.at-right{
  right:var(--ufo-gap);
  left:auto;
}

.ufo.is-visible,
.ufo.is-parked{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

.ufo:hover,
.ufo:focus-visible{
  color:var(--text);
}

.ufo:focus-visible{
  outline:none;
}

.ufo:focus-visible .ufo-ship{
  outline:2px solid var(--accent-3);
  outline-offset:6px;
  border-radius:50%;
}

/* Nave: balanço leve enquanto está na tela */
.ufo-ship{
  position:relative;
  z-index:2;
  display:block;
  width:100%;
  height:100%;
  overflow:visible;
  filter:drop-shadow(0 6px 14px rgba(0,0,0,.45));
  transform-origin:50% 60%;
  animation:ufo-wobble 3.2s ease-in-out infinite;
}

.ufo-light{
  fill:var(--ufo-light);
  animation:ufo-blink 1.4s steps(2, jump-none) infinite;
}

.ufo-light:nth-of-type(2){ animation-delay:.28s; }
.ufo-light:nth-of-type(3){ animation-delay:.56s; }
.ufo-light:nth-of-type(4){ animation-delay:.84s; }
.ufo-light:nth-of-type(5){ animation-delay:1.12s; }

/* ---------------- Balão de fala e rótulo ----------------
   Os dois ficam acima da nave, voltados para o meio da tela. */

.ufo-say,
.ufo-label{
  position:absolute;
  z-index:3;
  bottom:calc(100% + 14px);
  pointer-events:none;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .22s ease, transform .22s ease;
}

.ufo.at-right .ufo-say,
.ufo.at-right .ufo-label{
  right:4px;
}

.ufo.at-left .ufo-say,
.ufo.at-left .ufo-label{
  left:4px;
}

.ufo-say{
  width:max-content;
  max-width:min(240px, calc(100vw - 48px));
  min-height:2.6em;
  padding:10px 14px;
  border-radius:16px;
  border:1px solid color-mix(in srgb, var(--card-text) 14%, transparent);
  background:var(--card);
  color:var(--card-text);
  box-shadow:0 14px 32px rgba(0,0,0,.45);
  font-size:.88rem;
  font-weight:600;
  line-height:1.4;
}

.ufo-say{
  display:grid;
}

/* frase inteira invisível reservando o tamanho; a digitada fica por cima */
.ufo-say-sizer,
.ufo-say-text{
  grid-area:1 / 1;
}

.ufo-say-sizer{
  visibility:hidden;
}

/* rabinho do balão apontando para a nave */
.ufo-say::after{
  content:"";
  position:absolute;
  bottom:-6px;
  width:14px;
  height:14px;
  background:var(--card);
  transform:rotate(45deg);
  border-radius:2px;
}

.ufo.at-right .ufo-say::after{ right:26px; }
.ufo.at-left .ufo-say::after{ left:26px; }

.ufo.is-talking .ufo-say{
  opacity:1;
  transform:none;
}

.ufo-label{
  display:grid;
  gap:2px;
  min-width:max-content;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid var(--line-strong);
  background:color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter:blur(8px);
  box-shadow:0 12px 30px rgba(0,0,0,.35);
  line-height:1.25;
}

.ufo.at-right .ufo-label{ text-align:right; }
.ufo.at-left .ufo-label{ text-align:left; }

.ufo-label strong{
  font-size:.86rem;
  font-weight:700;
}

.ufo-label span{
  color:var(--muted);
  font-size:.74rem;
}

/* No hover a fala dá lugar ao destino do link */
.ufo:hover .ufo-say,
.ufo:focus-visible .ufo-say{
  opacity:0;
}

.ufo:hover .ufo-label,
.ufo:focus-visible .ufo-label{
  opacity:1;
  transform:none;
}

/* Movimento reduzido: a nave fica estacionada no canto, sem entrar e sair */
.ufo.is-parked{
  opacity:.5;
  transform:none !important;
  transition:opacity .2s ease;
}

.ufo.is-parked:hover,
.ufo.is-parked:focus-visible{
  opacity:1;
}

@media (max-width: 640px){
  .ufo{
    --ufo-gap:14px;

    width:56px;
    height:34px;
  }

  .ufo-say{
    max-width:min(200px, calc(100vw - 40px));
    font-size:.82rem;
  }
}

@media (prefers-reduced-motion: reduce){
  .ufo-ship,
  .ufo-light{
    animation:none;
  }
}

@media print{
  .ufo{
    display:none !important;
  }
}

@keyframes ufo-wobble{
  0%, 100%{ transform:rotate(-4deg) translateY(0); }
  50%{ transform:rotate(4deg) translateY(-3px); }
}

@keyframes ufo-blink{
  0%{ opacity:1; }
  100%{ opacity:.25; }
}
