/**
 * Lar Montessoriano - Sistema de Animações & Micro-Interações Premium
 * Arquitetura de Movimento Fluido, Orgânico e Acessível (GPU Accelerated)
 */

/* ==========================================================================
   1. BARRA DE PROGRESSO DE LEITURA (SCROLL PROGRESS)
   ========================================================================== */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3.5px;
  background: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    var(--color-yellow-500) 50%,
    var(--color-gold-500) 100%
  );
  box-shadow: 0 0 10px rgba(255, 184, 0, 0.45);
  z-index: calc(var(--z-header) + 20);
  pointer-events: none;
  transition: width 0.08s cubic-bezier(0.1, 0.9, 0.2, 1);
  will-change: width;
}

/* ==========================================================================
   2. KEYFRAMES PRINCIPAIS
   ========================================================================== */

/* Entrada com Fade e Elevação */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 26px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Entrada com Fade da Esquerda */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translate3d(-30px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Entrada com Fade da Direita */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translate3d(30px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Flutuação Orgânica Suave (Hero Floating Cards) */
@keyframes floatGentle {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, -9px, 0) rotate(0.8deg);
  }
}

@keyframes floatGentleReverse {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, 9px, 0) rotate(-0.8deg);
  }
}

/* Pulsação Solar no Tag Dot (Matrículas Abertas) */
@keyframes pulseBadgeSolar {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 184, 0, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 9px rgba(255, 184, 0, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 184, 0, 0);
  }
}

/* Pulsação do Botão Flutuante de WhatsApp */
@keyframes pulseWhatsappGlow {
  0%, 100% {
    box-shadow: 0 6px 20px rgba(18, 140, 126, 0.4), 0 0 0 0 rgba(18, 140, 126, 0.5);
  }
  50% {
    box-shadow: 0 8px 24px rgba(18, 140, 126, 0.5), 0 0 0 10px rgba(18, 140, 126, 0);
  }
}

/* Reflexo Shimmer em Botões Principais */
@keyframes glintSweep {
  0% {
    left: -80%;
  }
  100% {
    left: 150%;
  }
}

/* Balanço sutil do ícone de Tour 360 */
@keyframes compassWobble {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(10deg);
  }
}

/* Movimento Orgânico dos Orbes de Aurora no Fundo */
@keyframes auroraDrift1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-35px, 25px, 0) scale(1.12); }
  100% { transform: translate3d(20px, -20px, 0) scale(0.96); }
}

@keyframes auroraDrift2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, -30px, 0) scale(1.15); }
  100% { transform: translate3d(-20px, 20px, 0) scale(0.94); }
}

/* Flutuação dos Sólidos Geométricos Montessorianos */
@keyframes floatShape1 {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -14px, 0) rotate(6deg); }
}

@keyframes floatShape2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, 12px, 0) scale(1.08); }
}

@keyframes floatShape3 {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -12px, 0) rotate(-6deg); }
}

@keyframes floatShape4 {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, 15px, 0) rotate(8deg); }
}

/* ==========================================================================
   3. HERO SECTION - ANIMAÇÕES INICIAIS EM CASCATA
   ========================================================================== */
.hero-tag {
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-tag-dot {
  animation: pulseBadgeSolar 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.hero-title {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero-lead {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
}

.hero-cta-group {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.44s both;
}

.hero-stats-row {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.56s both;
}

.hero-visual {
  animation: fadeInRight 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

/* Flutuação Contínua nos Cards Decorativos do Hero */
.hero-floating-card.card-top-right {
  animation: floatGentle 5.5s ease-in-out infinite;
  will-change: transform;
}

.hero-floating-card.card-bottom-left {
  animation: floatGentleReverse 6.5s ease-in-out infinite 0.8s;
  will-change: transform;
}

.hero-floating-card:hover {
  animation-play-state: paused;
}

/* ==========================================================================
   4. SISTEMA DE SCROLL REVEAL (INTERSECTION OBSERVER)
   ========================================================================== */

/* Ativado via JS para garantir Progressive Enhancement */
html.js-animations-active .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

html.js-animations-active .reveal.reveal-left {
  transform: translate3d(-32px, 0, 0);
}

html.js-animations-active .reveal.reveal-right {
  transform: translate3d(32px, 0, 0);
}

html.js-animations-active .reveal.reveal-scale {
  transform: scale(0.94);
}

/* Estado Revelado */
html.js-animations-active .reveal.is-revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Atrasos Escalonados (Stagger Delays) */
html.js-animations-active .stagger-1 { transition-delay: 0.08s; }
html.js-animations-active .stagger-2 { transition-delay: 0.16s; }
html.js-animations-active .stagger-3 { transition-delay: 0.24s; }
html.js-animations-active .stagger-4 { transition-delay: 0.32s; }
html.js-animations-active .stagger-5 { transition-delay: 0.40s; }
html.js-animations-active .stagger-6 { transition-delay: 0.48s; }

/* ==========================================================================
   5. MICRO-INTERAÇÕES & HOVER DINÂMICO DE COMPONENTES
   ========================================================================== */

/* Botões com Elevação e Efeito Shimmer */
.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

/* Brilho Shimmer nos Botões Primários */
.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -80%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    60deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.28) 50%,
    rgba(255, 255, 255, 0) 80%
  );
  transform: rotate(25deg);
  pointer-events: none;
}

.btn-primary:hover::after {
  animation: glintSweep 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Navegação com Linha Indicadora Ativa */
.nav-link:not(.btn) {
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-yellow-500));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: var(--radius-full);
}

.nav-link:not(.btn):hover::after,
.nav-link.active:not(.btn)::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Cards com Elevação Suave e Sombra Profunda */
.card,
.pilar-card,
.agrupamento-card,
.metodologia-card,
.depoimento-card,
.artigo-card,
.ambiente-feature-card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
  will-change: transform, box-shadow;
}

.card:hover,
.pilar-card:hover,
.agrupamento-card:hover,
.metodologia-card:hover,
.depoimento-card:hover,
.artigo-card:hover,
.ambiente-feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 32px -8px rgba(67, 118, 184, 0.14),
              0 4px 12px -2px rgba(0, 0, 0, 0.04);
}

/* Animação do Ícone ao passar o mouse no Card */
.pilar-card:hover .pilar-icon-box,
.metodologia-card:hover .metodologia-icon,
.ambiente-feature-card:hover .feature-icon-box {
  transform: scale(1.1) rotate(4deg);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Zoom Sutil nas Imagens dos Cards */
.ambiente-feature-card .feature-image img,
.hero-image-frame img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ambiente-feature-card:hover .feature-image img {
  transform: scale(1.05);
}

/* Botão Flutuante de WhatsApp */
.whatsapp-trigger-btn {
  animation: pulseWhatsappGlow 3s infinite ease-in-out;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.whatsapp-trigger-btn:hover {
  transform: scale(1.1) rotate(6deg);
}

/* Ícones de FAQ (Accordion) com Rotação Suave */
.faq-toggle svg {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.active .faq-toggle svg {
  transform: rotate(180deg);
}

/* Resposta do FAQ com Expansão Fluida */
.faq-answer {
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              padding 0.35s ease;
}

/* Borda Luminosa na Citação de Maria Montessori */
.quote-banner {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}

.quote-banner:hover {
  transform: translateY(-2px);
  border-left-color: var(--color-yellow-500);
  box-shadow: 0 10px 25px -5px rgba(255, 184, 0, 0.15);
}

/* Card de Resultado do Simulador com Apresentação Fluida */
.simulator-result {
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Tipografia de Impacto com Destaque Solar em Amarelo */
.highlight {
  color: var(--color-yellow-600);
  background: linear-gradient(135deg, #FFC107 0%, #FFB800 45%, #E6A600 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  position: relative;
  font-weight: 700;
  font-style: italic;
}

/* Indicador de Aspas Flutuantes nos Depoimentos das Famílias */
.depoimento-card {
  position: relative;
  overflow: hidden;
}

.depoimento-card::after {
  content: '“';
  position: absolute;
  top: -12px;
  right: 18px;
  font-size: 6.5rem;
  line-height: 1;
  font-family: var(--font-serif);
  color: rgba(255, 184, 0, 0.15);
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s ease;
}

.depoimento-card:hover::after {
  transform: translateY(-4px) scale(1.08) rotate(5deg);
  color: rgba(255, 184, 0, 0.28);
}

/* Efeito de Reflexo Sutil de Borda ao Passar o Mouse nos Cards */
.card:hover,
.pilar-card:hover,
.ciclo-card:hover,
.depoimento-card:hover,
.artigo-card:hover,
.ambiente-feature-card:hover,
.stat-counter-box:hover {
  border-color: rgba(255, 184, 0, 0.45);
  box-shadow: 0 20px 42px -10px rgba(67, 118, 184, 0.16),
              0 6px 16px -2px rgba(255, 184, 0, 0.12);
}

/* Botão Flutuante Voltar ao Topo */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  color: var(--color-forest-700);
  border: 1px solid rgba(67, 118, 184, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 990;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top-btn:hover {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 8px 24px rgba(67, 118, 184, 0.35);
}

.back-to-top-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Divisores de Seção em Curva Orgânica */
.footer-wave-divider {
  width: 100%;
  line-height: 0;
  overflow: hidden;
  margin-bottom: -1px;
}

.footer-wave-divider svg {
  width: 100%;
  height: 52px;
  display: block;
}

.section-curve-dark-top,
.section-curve-dark-bottom {
  width: 100%;
  line-height: 0;
  overflow: hidden;
}

.section-curve-dark-top {
  margin-bottom: -1px;
}

.section-curve-dark-bottom {
  margin-top: -1px;
}

.section-curve-dark-top svg,
.section-curve-dark-bottom svg {
  width: 100%;
  height: 48px;
  display: block;
}

/* ==========================================================================
   ELEMENTOS FLUTUANTES DO MÉTODO MONTESSORI (BRINQUEDOS & FORMAS DA IMAGEM)
   ========================================================================== */

/* Keyframes de Flutuação e Rotação dos Brinquedos */
@keyframes toyBob1 {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, -14px, 0) rotate(2.5deg);
  }
}

@keyframes toyBob2 {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, 16px, 0) rotate(-2deg);
  }
}

@keyframes toyBob3 {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-6px, -10px, 0) scale(1.03);
  }
}

@keyframes toyBob4 {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(6px, 12px, 0) rotate(3deg);
  }
}

/* Rotação Contínua das Engrenagens de Madeira */
@keyframes gearSpinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes gearSpinSlowRev {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg);
  }
}

/* Deriva e Balanço das Esferas Coloridas */
@keyframes sphereDrift1 {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-10px, -18px, 0);
  }
}

@keyframes sphereDrift2 {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(12px, 15px, 0);
  }
}

@keyframes triangleFloatSpin {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, -12px, 0) rotate(16deg);
  }
}

/* Camada de Partículas Flutuantes de Fundo */
.montessori-particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* Esferas Coloridas 3D com Brilho (Estilo da Imagem) */
.montessori-sphere {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.montessori-sphere::after {
  content: '';
  position: absolute;
  top: 18%;
  left: 22%;
  width: 25%;
  height: 25%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  filter: blur(0.5px);
}

.sphere-yellow {
  background: radial-gradient(circle at 35% 35%, #FFF2A3 0%, #FFB800 58%, #D48800 100%);
}

.sphere-red {
  background: radial-gradient(circle at 35% 35%, #FFA4A4 0%, #E63946 58%, #B81D2A 100%);
}

.sphere-blue {
  background: radial-gradient(circle at 35% 35%, #BBE3FD 0%, #2A75D3 58%, #164687 100%);
}

.sphere-green {
  background: radial-gradient(circle at 35% 35%, #C2F0C8 0%, #2ECC71 58%, #1E8449 100%);
}

.sphere-purple {
  background: radial-gradient(circle at 35% 35%, #E1BEE7 0%, #9B59B6 58%, #6A1B9A 100%);
}

.sphere-orange {
  background: radial-gradient(circle at 35% 35%, #FFE0B2 0%, #FF9800 58%, #E65100 100%);
}

.sphere-xs { width: 12px; height: 12px; }
.sphere-sm { width: 18px; height: 18px; }
.sphere-md { width: 26px; height: 26px; }
.sphere-lg { width: 36px; height: 36px; }

/* Triângulos Geométricos Flutuantes da Imagem */
.montessori-triangle {
  position: absolute;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.07));
}

/* Tokens dos Brinquedos Montessori */
.montessori-toy-token {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.toy-card {
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(226, 197, 151, 0.55);
  border-radius: var(--radius-full);
  box-shadow: 0 12px 30px -8px rgba(35, 25, 12, 0.13),
              0 3px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.toy-card:hover,
.toy-card:focus {
  transform: scale(1.1) translateY(-5px);
  border-color: var(--color-yellow-500);
  background: #ffffff;
  box-shadow: 0 20px 42px -10px rgba(255, 184, 0, 0.35),
              0 6px 18px rgba(67, 118, 184, 0.15);
}

.toy-figure {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.09));
  transition: transform 0.35s ease;
}

.toy-card:hover .toy-figure,
.toy-card:focus .toy-figure {
  transform: rotate(4deg) scale(1.06);
}

.toy-figure svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Rotação interna de engrenagens do brinquedo */
.gear-spin-slow {
  transform-origin: 58px 42px;
  animation: gearSpinSlow 18s linear infinite;
}

.gear-spin-reverse {
  transform-origin: 34px 62px;
  animation: gearSpinSlowRev 14s linear infinite;
}

.gear-spin-reverse-sm {
  transform-origin: 32px 30px;
  animation: gearSpinSlowRev 10s linear infinite;
}

.toy-caption {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.42s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              padding 0.3s ease;
}

.toy-card:hover .toy-caption,
.toy-card:focus .toy-caption {
  max-width: 250px;
  opacity: 1;
  padding-right: 0.5rem;
}

.toy-title {
  font-family: var(--font-sans);
  font-size: 0.775rem;
  font-weight: 800;
  color: var(--color-blue-900);
  line-height: 1.25;
}

.toy-area {
  font-family: var(--font-sans);
  font-size: 0.675rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.2;
}

/* Animações Atribuídas aos Tokens */
.toy-motion-1 {
  animation: toyBob1 6.5s ease-in-out infinite;
}

.toy-motion-2 {
  animation: toyBob2 7.5s ease-in-out infinite 0.6s;
}

.toy-motion-3 {
  animation: toyBob3 8s ease-in-out infinite 1.2s;
}

.toy-motion-4 {
  animation: toyBob4 7s ease-in-out infinite 1.8s;
}

/* Posições relativas nas seções */
.token-pos-top-left {
  top: 40px;
  left: clamp(1rem, 3.5vw, 4.5rem);
}

.token-pos-top-right {
  top: 50px;
  right: clamp(1rem, 3.5vw, 4.5rem);
}

.token-pos-bottom-left {
  bottom: 35px;
  left: clamp(1rem, 3.5vw, 4.5rem);
}

.token-pos-bottom-right {
  bottom: 40px;
  right: clamp(1rem, 3.5vw, 4.5rem);
}

.token-pos-mid-left {
  top: 45%;
  left: clamp(1rem, 3vw, 3.5rem);
  transform: translateY(-50%);
}

.token-pos-mid-right {
  top: 45%;
  right: clamp(1rem, 3vw, 3.5rem);
  transform: translateY(-50%);
}

/* Oculta em celulares menores para priorizar leitura ergonômica */
@media (max-width: 900px) {
  .montessori-toy-token {
    display: none;
  }
  .montessori-particle-layer .montessori-sphere:not(.keep-mobile) {
    display: none;
  }
}

/* Classes de Animação para Esferas e Triângulos */
.float-sphere-1 { animation: sphereDrift1 6s ease-in-out infinite; }
.float-sphere-2 { animation: sphereDrift2 7.2s ease-in-out infinite 0.7s; }
.float-sphere-3 { animation: sphereDrift1 8.5s ease-in-out infinite 1.4s; }
.float-sphere-4 { animation: sphereDrift2 6.8s ease-in-out infinite 0.3s; }
.float-triangle-1 { animation: triangleFloatSpin 8s ease-in-out infinite; }
.float-triangle-2 { animation: triangleFloatSpin 9.5s ease-in-out infinite 1.2s; }

/* ==========================================================================
   6. CUBO MÁGICO TRIDIMENSIONAL (RUBIK'S CUBE 3D) - PEDAGOGIA MONTESSORI
   Arquitetura CSS 3D Acelerada por GPU (preserve-3d, perspective)
   Cores padrão da escola: Amarelo Solar (Topo), Azul Institucional (Frente),
   Vermelho de Ação (Direita), Verde Sensorial (Trás), Laranja (Esquerda), Branco (Baixo)
   ========================================================================== */

:root {
  --rubik-cube-size: 160px;
  --rubik-mini-size: 40px;
}

/* Palco da Cena 3D */
.rubik-scene {
  width: var(--rubik-cube-size);
  height: var(--rubik-cube-size);
  perspective: 900px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* O Cubo 3D */
.rubik-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(35deg);
  transition: transform 0.08s ease-out;
  cursor: grab;
  will-change: transform;
}

.rubik-cube:active {
  cursor: grabbing;
}

.rubik-cube.is-auto-rotating {
  animation: rubikAutoSpinSmooth 16s linear infinite;
}

.rubik-cube.is-shuffling {
  animation: rubikShuffleSpin 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rubik-cube.is-solving {
  animation: rubikSolveGlow 0.8s ease-out;
}

/* Faces do Cubo */
.rubik-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  background-color: #161a22; /* Polímero escuro de cubo de velocidade profissional */
  border-radius: 10px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
  backface-visibility: visible;
}

/* Orientação das 6 Faces no Espaço Tridimensional */
.rubik-face.face-up {
  transform: rotateX(90deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

.rubik-face.face-down {
  transform: rotateX(-90deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

.rubik-face.face-front {
  transform: rotateY(0deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

.rubik-face.face-back {
  transform: rotateY(180deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

.rubik-face.face-left {
  transform: rotateY(-90deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

.rubik-face.face-right {
  transform: rotateY(90deg) translateZ(calc(var(--rubik-cube-size) / 2));
}

/* Adesivos / Peças Individuais (Stickers) */
.rubik-sticker {
  border-radius: 5px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1.5px 2px rgba(255, 255, 255, 0.5), inset 0 -1.5px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.35s ease, transform 0.2s ease, filter 0.3s ease;
}

.rubik-sticker::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(0, 0, 0, 0.12) 100%);
  pointer-events: none;
  border-radius: inherit;
}

/* Cores Oficiais dos Stickers */
/* 1. Amarelo Solar da Escola (Face Superior) */
.rubik-sticker.sticker-yellow,
.face-up .rubik-sticker {
  background: linear-gradient(135deg, #FFF085 0%, #FFB800 60%, #D48800 100%);
}

/* 2. Azul Institucional da Escola (Face Frontal) */
.rubik-sticker.sticker-blue,
.face-front .rubik-sticker {
  background: linear-gradient(135deg, #7BB2F8 0%, #4376B8 60%, #285591 100%);
}

/* 3. Vermelho de Ação da Escola (Face Direita) */
.rubik-sticker.sticker-red,
.face-right .rubik-sticker {
  background: linear-gradient(135deg, #FF7B7B 0%, #EE3A3A 60%, #B51E1E 100%);
}

/* 4. Verde Sensorial (Face Traseira) */
.rubik-sticker.sticker-green,
.face-back .rubik-sticker {
  background: linear-gradient(135deg, #5EE699 0%, #2ECC71 60%, #1E8449 100%);
}

/* 5. Laranja Criatividade (Face Esquerda) */
.rubik-sticker.sticker-orange,
.face-left .rubik-sticker {
  background: linear-gradient(135deg, #FFB959 0%, #FF9800 60%, #E65100 100%);
}

/* 6. Branco Pérola da Base (Face Inferior) */
.rubik-sticker.sticker-white,
.face-down .rubik-sticker {
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F7FA 60%, #CFD8DC 100%);
}

/* Versão Miniatura para o Hero Token Flutuante */
.rubik-scene.mini-scene {
  width: var(--rubik-mini-size);
  height: var(--rubik-mini-size);
  perspective: 400px;
}

.rubik-cube.mini-cube {
  animation: rubikMiniAutoRotate 14s linear infinite;
  cursor: pointer;
}

.mini-scene .rubik-face {
  gap: 2px;
  padding: 2.5px;
  border-radius: 4px;
}

.mini-scene .rubik-face.face-up {
  transform: rotateX(90deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-face.face-down {
  transform: rotateX(-90deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-face.face-front {
  transform: rotateY(0deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-face.face-back {
  transform: rotateY(180deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-face.face-left {
  transform: rotateY(-90deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-face.face-right {
  transform: rotateY(90deg) translateZ(calc(var(--rubik-mini-size) / 2));
}

.mini-scene .rubik-sticker {
  border-radius: 2px;
}

/* Keyframes de Animação 3D */
@keyframes rubikAutoSpinSmooth {
  0% {
    transform: rotateX(-22deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(-22deg) rotateY(360deg);
  }
}

@keyframes rubikMiniAutoRotate {
  0% {
    transform: rotateX(-24deg) rotateY(0deg) rotateZ(0deg);
  }
  50% {
    transform: rotateX(-15deg) rotateY(180deg) rotateZ(8deg);
  }
  100% {
    transform: rotateX(-24deg) rotateY(360deg) rotateZ(0deg);
  }
}

@keyframes rubikShuffleSpin {
  0% {
    transform: rotateX(-22deg) rotateY(35deg) scale(1);
  }
  25% {
    transform: rotateX(65deg) rotateY(160deg) scale(1.1);
  }
  50% {
    transform: rotateX(-80deg) rotateY(290deg) scale(0.95);
  }
  75% {
    transform: rotateX(45deg) rotateY(410deg) scale(1.08);
  }
  100% {
    transform: rotateX(-22deg) rotateY(515deg) scale(1);
  }
}

@keyframes rubikSolveGlow {
  0% {
    transform: scale(0.96);
    filter: drop-shadow(0 0 0 rgba(255, 184, 0, 0));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 25px rgba(255, 184, 0, 0.8));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 184, 0, 0));
  }
}

/* Terceira animação de movimento flutuante para o toy token do Cubo */
.toy-motion-3 {
  animation: floatToy3 7s ease-in-out infinite alternate;
}

@keyframes floatToy3 {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-16px) rotate(2.5deg);
  }
  100% {
    transform: translateY(-8px) rotate(-1.5deg);
  }
}

/* ==========================================================================
   WIDGET FLUTUANTE GLOBAL DO CUBO MÁGICO 3D (FLUTUANDO POR TODA A PÁGINA)
   Acompanha a rolagem da página com física de levitação e rotação tridimensional contínua
   ========================================================================== */

.floating-rubik-global {
  position: fixed;
  top: clamp(160px, 42vh, 460px);
  right: 1.5rem;
  z-index: 940;
  display: flex;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  filter: drop-shadow(0 14px 32px rgba(27, 44, 71, 0.22));
  will-change: transform;
  cursor: grab;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.floating-rubik-global.is-floating {
  animation: rubikGlobalFloating 7.5s ease-in-out infinite alternate;
}

.floating-rubik-global.is-dragging {
  animation: none !important;
  cursor: grabbing;
}

@keyframes rubikGlobalFloating {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  30% {
    transform: translateY(-18px) translateX(-5px) rotate(2deg);
  }
  65% {
    transform: translateY(12px) translateX(4px) rotate(-1.5deg);
  }
  100% {
    transform: translateY(-8px) translateX(-3px) rotate(1deg);
  }
}

.rubik-float-card {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.95rem 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.8px solid rgba(255, 184, 0, 0.7);
  border-radius: var(--radius-full);
  box-shadow: 0 14px 34px -6px rgba(255, 184, 0, 0.35),
              0 6px 18px rgba(67, 118, 184, 0.16);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.rubik-float-card:hover {
  transform: scale(1.08);
  border-color: var(--color-yellow-500);
  background: #ffffff;
  box-shadow: 0 20px 45px -6px rgba(255, 184, 0, 0.5),
              0 8px 25px rgba(67, 118, 184, 0.24);
}

.rubik-float-figure {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.14));
}

.rubik-float-caption {
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.rubik-float-title {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-blue-900);
  line-height: 1.25;
  white-space: nowrap;
}

.rubik-float-sub {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  white-space: nowrap;
}

/* Responsividade Mobile para o Widget Flutuante */
@media (max-width: 768px) {
  .floating-rubik-global {
    right: 0.85rem;
    top: clamp(140px, 35vh, 320px);
  }
  .rubik-float-card {
    padding: 0.45rem;
    gap: 0;
  }
  .rubik-float-caption {
    display: none;
  }
  .rubik-float-figure {
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   7. ACESSIBILIDADE - PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .scroll-progress-bar {
    display: none !important;
  }

  html.js-animations-active .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-floating-card {
    animation: none !important;
  }

  .whatsapp-trigger-btn {
    animation: none !important;
  }

  .rubik-cube,
  .rubik-cube.mini-cube,
  .toy-motion-3,
  .floating-rubik-global.is-floating {
    animation: none !important;
  }
}
