/* ═══════════════════════════════════════════════════════════
   UTILITIES & ANIMATIONS
   Grid texture global, scroll reveal, keyframes compartilhados.
   ═══════════════════════════════════════════════════════════ */

/* ── Textura global de grid topográfico ── */
.grid-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 59px, rgba(168, 240, 216, 0.6) 60px),
    repeating-linear-gradient(90deg, transparent, transparent 59px, rgba(168, 240, 216, 0.6) 60px);
  animation: gridDrift 40s linear infinite;
}

/* ═══════════════════════════════════════════════════════════
   Sprint 12 — SKELETON LOADING (sistema reutilizável)
   Use a classe .skeleton em qualquer elemento pra mostrar placeholder
   animado enquanto o conteúdo carrega.
   ═══════════════════════════════════════════════════════════ */

.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(168, 240, 216, 0.04) 0%,
    rgba(168, 240, 216, 0.10) 50%,
    rgba(168, 240, 216, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
  color: transparent;
  pointer-events: none;
  user-select: none;
}

@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Variante light (pra fundos claros como cards mist) */
.skeleton--light {
  background: linear-gradient(
    90deg,
    rgba(13, 40, 24, 0.04) 0%,
    rgba(13, 40, 24, 0.08) 50%,
    rgba(13, 40, 24, 0.04) 100%
  );
  background-size: 200% 100%;
}

/* Variantes de forma comuns */
.skeleton--text    { height: 12px; border-radius: var(--radius-sm); }
.skeleton--text-lg { height: 18px; border-radius: var(--radius-sm); }
.skeleton--circle  { border-radius: 50%; }
.skeleton--image   { aspect-ratio: 4 / 3; border-radius: var(--radius-md); }

/* Reduced motion: skeleton fica estático (sem shimmer) */
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .skeleton--light {
    animation: none;
    background: rgba(168, 240, 216, 0.06);
  }
}

/* ─── Sprint 9.3 — Scroll progress bar (no topo da página) ─── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg,
    var(--color-electric-green) 0%,
    var(--color-mint) 100%);
  z-index: 99999;
  pointer-events: none;
  transition: opacity 250ms ease,
              width 80ms linear;
  box-shadow: 0 0 8px rgba(29, 158, 117, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress {
    transition: opacity 200ms ease;
  }
}

/* ── Scroll reveal ── */
/* Blindagem: começa invisível e o JS (IntersectionObserver) adiciona
   .is-visible. Se o JS falhar ou o observer não disparar (acontece em
   alguns mobiles), a animação de fallback revela o conteúdo após 3s —
   nunca fica invisível pra sempre. */
@keyframes revealFallback {
  to { opacity: 1; transform: none; }
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 700ms var(--ease-out),
              transform 700ms var(--ease-out);
  animation: revealFallback 600ms 3000ms both;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  animation: none; /* JS funcionou — cancela o fallback, usa a transition */
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 700ms var(--ease-out),
              transform 700ms var(--ease-out);
  animation: revealFallback 600ms 3000ms both;
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
  animation: none;
}

/* ── Helpers tipográficos ── */
.text-mint { color: var(--color-mint); }
.text-green { color: var(--color-electric-green); }
.text-white { color: var(--color-white); }
.text-muted { color: rgba(255, 255, 255, 0.55); }

.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

/* ── Acessibilidade — visually hidden ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════
   KEYFRAMES GLOBAIS
   ═══════════════════════════════════════════ */

@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 60px 60px; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(29, 158, 117, 0.2)); }
  50% { filter: drop-shadow(0 0 32px rgba(29, 158, 117, 0.45)); }
}

@keyframes scrollHint {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

@keyframes particleFloat {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-12px); opacity: 1; }
}

/* Reduced motion override pros reveals */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left {
    opacity: 1;
    transform: none;
    animation: none; /* sem fallback animado — mostra na hora */
  }
}

/* ═══════════════════════════════════════════════════════════
   ACESSIBILIDADE — Skip link (primeiro foco do Tab)
   ═══════════════════════════════════════════════════════════ */

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-5);
  background: var(--color-electric-green);
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.5px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--duration-normal) var(--ease-out);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: var(--space-4);
  outline: 2px solid var(--color-mint);
  outline-offset: 4px;
}
