/**
 * Usa: assets/css/animations.css — sistema unificado de animações
 * As animações g-* aqui são específicas da Genesis.
 * Animações globais (ads-*) vivem em animations.css.
 */

/**
 * assets/genesis/css/genesis.css
 * Estilos compartilhados de TODAS as telas da Genesis.
 * V2.2 — CSS inline removido das views e centralizado aqui.
 *
 * Importar via: <link rel="stylesheet" href="<?= asset('genesis/css/genesis.css') ?>">
 */

/* ── Reset & Tokens ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --g-bg:       #0d0520;
  --g-card:     rgba(26, 15, 58, 0.88);
  --g-purple:   #7c3aed;
  --g-purple-l: #a78bfa;
  --g-yellow:   #fbbf24;
  --g-orange:   #f97316;
  --g-pink:     #ec4899;
  --g-green:    #4ade80;
  --g-white:    #ffffff;

  /* Tipografia */
  --g-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --g-text: #e2d9ff;

  /* Raios */
  --g-radius:    1rem;
  --g-radius-lg: 1.25rem;
  --g-radius-xl: 1.75rem;

  /* Acessibilidade — tamanhos mínimos */
  --g-touch-min: 52px;
}

/* ── Fundo estrelado compartilhado ──────────────────────────────── */
html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--g-font);
  color: var(--g-white);
}

body.genesis-page {
  background: var(--g-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Canvas de estrelas / fundo */
#genesis-bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Animações ───────────────────────────────────────────────────── */
@keyframes g-fade-in-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes g-pop-in {
  from { opacity: 0; transform: scale(0.84); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes g-float {
  0%, 100% { transform: translateY(0px) scale(1); }
  33%       { transform: translateY(-5px) scale(1.01); }
  66%       { transform: translateY(-8px) scale(1); }
}

@keyframes g-glow-pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.95; }
}

@keyframes g-particle-rise {
  0%   { opacity: 0; transform: translateY(0) scale(0.4); }
  8%   { opacity: 0.85; }
  85%  { opacity: 0.15; }
  100% { opacity: 0; transform: translateY(-92vh) scale(0.2); }
}

@keyframes g-sway {
  0%   { transform: rotate(-0.5deg); }
  33%  { transform: rotate(0.3deg); }
  66%  { transform: rotate(-0.3deg); }
  100% { transform: rotate(-0.5deg); }
}

@keyframes g-leaf-fall {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0); }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(102vh) rotate(520deg); }
}

@keyframes g-bar-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes g-conf-fall {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0); }
  8%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(108vh) rotate(660deg); }
}

/* ── Theo ────────────────────────────────────────────────────────── */
.g-theo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.g-theo img {
  width: min(90px, 22vw);
  height: min(90px, 22vw);
  filter: drop-shadow(0 0 18px rgba(167, 139, 250, 0.65));
  animation: g-float 5s ease-in-out infinite;
}

/* ── Balão de fala ──────────────────────────────────────────────── */
.g-speech {
  background: var(--g-card);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: var(--g-radius-xl);
  padding: 1rem 1.25rem;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(10px);
  min-height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.g-speech-text {
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  line-height: 1.65;
  color: #ddd6fe;
  transition: opacity 0.3s;
}

/* ── Portas ──────────────────────────────────────────────────────── */
.g-doors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

@media (max-width: 340px) {
  .g-doors { grid-template-columns: 1fr; }
}

.g-door {
  background: var(--g-card);
  border: 1.5px solid rgba(167, 139, 250, 0.15);
  border-radius: var(--g-radius-lg);
  padding: 1.25rem 0.875rem 1.1rem;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--g-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-height: 90px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.g-door:hover,
.g-door:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
  outline: none;
}

.g-door:active { transform: scale(0.96); }

.g-door-emoji { font-size: min(2.2rem, 8vw); line-height: 1; user-select: none; }
.g-door-label { font-size: clamp(0.82rem, 3vw, 0.92rem); font-weight: 700; color: #c4b5fd; line-height: 1.3; }
.g-door-sub   { font-size: clamp(0.68rem, 2.5vw, 0.75rem); color: rgba(255,255,255,0.42); line-height: 1.4; }

/* ── Preview do explorador ──────────────────────────────────────── */
.g-preview-wrap {
  position: relative;
  width: min(170px, 50vw);
  height: min(170px, 50vw);
}

.g-preview-glow {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.28), transparent 66%);
  animation: g-glow-pulse 3.5s ease-in-out infinite;
}

.g-preview-img,
.g-preview-ph {
  width: 100%;
  height: 100%;
  border-radius: var(--g-radius-lg);
  position: relative;
  z-index: 2;
  border: 3px solid rgba(167, 139, 250, 0.28);
}

.g-preview-img {
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
}

.g-preview-ph {
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

/* ── Mensagem do Theo (balão) ────────────────────────────────────── */
.g-theo-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.16);
  border-radius: var(--g-radius);
  padding: 0.9rem 1rem;
  width: 100%;
  backdrop-filter: blur(8px);
}

.g-theo-msg img { width: 36px; height: 36px; flex-shrink: 0; margin-top: 2px; }
.g-theo-msg p   { font-size: 0.87rem; color: #d4bbff; line-height: 1.65; }
.g-theo-msg strong { color: var(--g-yellow); }

/* ── Botão primário ──────────────────────────────────────────────── */
.g-btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--g-purple), var(--g-pink));
  color: var(--g-white);
  border: none;
  border-radius: var(--g-radius);
  min-height: var(--g-touch-min);
  padding: 0.9rem;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 0.025em;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.g-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(124, 58, 237, 0.5);
}

.g-btn-primary:active { transform: scale(0.97); }
.g-btn-primary:focus-visible { outline: 2px solid var(--g-purple-l); outline-offset: 3px; }
.g-btn-primary:disabled { opacity: 0.42; cursor: not-allowed; transform: none !important; }

/* ── Campo de nome ───────────────────────────────────────────────── */
.g-name-field { position: relative; display: flex; align-items: center; }
.g-name-emoji { position: absolute; left: 0.875rem; font-size: 1.1rem; pointer-events: none; }

.g-name-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(167, 139, 250, 0.27);
  border-radius: var(--g-radius);
  padding: 0.9rem 1rem 0.9rem 2.7rem;
  color: var(--g-white);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  min-height: var(--g-touch-min);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.g-name-input::placeholder { color: rgba(255, 255, 255, 0.28); font-weight: 400; }
.g-name-input:focus { border-color: var(--g-purple-l); box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18); }

/* ── Barra de magia ──────────────────────────────────────────────── */
.g-bar-wrap { width: min(290px, 80vw); }

.g-bar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(74, 222, 128, 0.16);
}

.g-bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  background: linear-gradient(90deg, #4ade80, #a78bfa, #fbbf24);
  background-size: 200%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  animation: g-bar-shimmer 2.5s linear infinite;
}

.g-bar-label {
  text-align: center;
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.42);
  margin-top: 0.4rem;
  transition: opacity 0.3s;
}

/* ── Partículas ──────────────────────────────────────────────────── */
.g-particle {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  border-radius: 50%;
  opacity: 0;
  animation: g-particle-rise linear infinite;
}

.g-leaf {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  animation: g-leaf-fall linear infinite;
  opacity: 0;
}

.g-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  border-radius: 2px;
  opacity: 0;
  animation: g-conf-fall linear infinite;
}

/* ── Link de acesso ──────────────────────────────────────────────── */
.g-access-link { font-size: clamp(0.75rem, 2.8vw, 0.83rem); color: rgba(255,255,255,0.35); text-align: center; }
.g-access-link a { color: var(--g-purple-l); text-decoration: none; }
.g-access-link a:hover { text-decoration: underline; }

/* ── Mensagem de UI ──────────────────────────────────────────────── */
.g-ui-msg {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--g-purple);
  color: var(--g-white);
  border-radius: 0.875rem;
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  animation: g-fade-in-up 0.3s ease;
}

/* ── Acessibilidade ──────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--g-purple-l); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .g-theo img,
  .g-particle,
  .g-leaf,
  .g-confetti,
  .g-door,
  .g-preview-glow,
  .g-bar-fill {
    animation: none !important;
  }
  .g-door { opacity: 1; }
  .g-bar-fill { background: var(--g-green); }
}
