/* ==========================================================================
   SJ Studio — Motion global F2.5
   Arquitetura: entrada Hero, microinterações, scroll reveal
   Separado do style.css e de campaign/fim-de-ano.css
   ========================================================================== */

/* 0. Motion tokens (Fase A) */
:root {
  --motion-fast: 180ms;
  --motion-base: 220ms;
  --motion-medium: 320ms;
  --motion-slow: 500ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: ease;
}

/* 1. Keyframes base */
@keyframes motion-fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes motion-fadeUpScale {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes motion-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes motion-float-margin {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -6px; }
}

@keyframes hero-halo-breathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes step-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes contact-glow-breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.04); }
}

/* Hero halo turquesa respirando */
#inicio {
  position: relative;
  overflow: hidden;
}
#inicio::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 300px at var(--halo-x1, 75%) var(--halo-y1, 20%), rgba(45,212,191,0.14) 0%, transparent 60%),
    radial-gradient(500px 250px at var(--halo-x2, 25%) var(--halo-y2, 80%), rgba(45,212,191,0.10) 0%, transparent 60%);
  filter: blur(1px);
  animation: hero-halo-breathe 20s ease-in-out infinite;
}
#inicio::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(45,212,191,0.08), transparent);
  mix-blend-mode: screen;
  animation: hero-light-sweep 28s linear infinite;
}
@keyframes hero-light-sweep {
  0% { transform: translateX(0); }
  100% { transform: translateX(300%); }
}
#inicio .hero-content,
#inicio .hero-image {
  position: relative;
  z-index: 1;
}

/* 2. Entrada do Hero — CSS puro, uma execução, delays fixos */
#inicio .hero-content .eyebrow,
#inicio .hero-content .camp-badge,
#inicio .hero-content > p,
#inicio .hero-content .hero-ctas,
#inicio .hero-content .camp-hero-note,
#inicio .hero-content .diferenciais {
  animation: motion-fadeUp 650ms cubic-bezier(0.22,1,0.36,1) both;
}

#inicio .hero-image img {
  animation: motion-fadeUpScale 700ms cubic-bezier(0.22,1,0.36,1) both;
}

#inicio .hero-image {
  position: relative;
}

@media (min-width: 769px) {
  #inicio .hero-image {
    animation: motion-float 11s ease-in-out 900ms infinite;
  }
}

#inicio .hero-content .eyebrow { animation-delay: 0ms; }
#inicio .hero-content .camp-badge { animation-delay: 80ms; }
#inicio .hero-content > p { animation-delay: 360ms; }
#inicio .hero-content .hero-ctas { animation-delay: 460ms; }
#inicio .hero-image img { animation-delay: 260ms; }
#inicio .hero-content .camp-hero-note { animation-delay: 540ms; }
#inicio .hero-content .diferenciais { animation-delay: 640ms; }

/* H1 entrada por linhas */
#inicio .hero-content h1 .hero-title-line {
  display: block;
  animation: motion-fadeUp 650ms cubic-bezier(0.22,1,0.36,1) both;
}
#inicio .hero-content h1 .hero-title-line:nth-of-type(1) { animation-delay: 180ms; }
#inicio .hero-content h1 .hero-title-line:nth-of-type(2) { animation-delay: 240ms; }
#inicio .hero-content h1 .hero-title-line:nth-of-type(3) { animation-delay: 300ms; }
#inicio .hero-content h1 {
  line-height: 1.15;
}

/* Stagger dos diferenciais */
#inicio .diferencial {
  animation: motion-fadeUp 700ms cubic-bezier(0.22,1,0.36,1) both;
}
#inicio .diferencial:nth-child(1) { animation-delay: 640ms; }
#inicio .diferencial:nth-child(2) { animation-delay: 720ms; }
#inicio .diferencial:nth-child(3) { animation-delay: 800ms; }

/* 3. Microinterações */
.btn {
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) ease;
}
.btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(45,212,191,0.18), 0 4px 8px rgba(0,0,0,0.10);
}
.btn:active {
  transform: translateY(0) scale(0.995);
}

.service-card,
.project-card {
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) ease, border-color var(--motion-base) ease;
}
.service-icon-wrap {
  transition: transform var(--motion-base) ease, box-shadow var(--motion-base) ease;
}
.project-image img {
  transition: transform var(--motion-slow) var(--ease-out);
}
.project-card:hover .project-image img {
  transform: scale(1.05) translateY(-2px);
}
.service-card {
  position: relative;
  overflow: hidden;
}
.service-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, rgba(45,212,191,0.9), rgba(45,212,191,0.2));
  transition: height 300ms cubic-bezier(0.22,1,0.36,1);
}
.service-card:hover::before {
  height: 100%;
}
.service-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.14), 0 0 0 1px rgba(45,212,191,0.45) inset;
}
.service-card:hover .service-icon-wrap {
  transform: scale(1.08);
  box-shadow: 0 0 0 5px rgba(45,212,191,0.14);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 44px rgba(0,0,0,0.18), 0 8px 16px rgba(45,212,191,0.08);
  border-color: rgba(45,212,191,0.6);
}

.service-link,
.project-link {
  transition: transform var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.service-link:hover,
.project-link:hover {
  transform: translateX(5px);
}

/* Hero pointer interaction (Fase C3) */
@media (hover: hover) and (pointer: fine) {
  #inicio:not(.campaign-active) .hero-image img {
    transition: transform var(--motion-base) var(--ease-out);
    will-change: transform;
  }
  #inicio:not(.campaign-active) .hero-image img {
    transform: translate3d(var(--hero-x, 0px), var(--hero-y, 0px), 0) scale(1);
  }
  #inicio:not(.campaign-active):hover .hero-image img {
    transform: translate3d(var(--hero-x, 0px), var(--hero-y, 0px), 0) scale(1);
  }
  /* Halo segue o ponteiro suavemente via CSS variables nos radial-gradients */
  #inicio:not(.campaign-active)::before {
    transition: background 220ms var(--ease-out);
  }
}

/* Spotlight sutil nos cards (Fase C1) */
@media (hover: hover) and (pointer: fine) {
  .service-card,
  .project-card {
    position: relative;
  }
  .service-card::after,
  .project-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(
      circle at var(--spot-x, 50%) var(--spot-y, 50%),
      rgba(45, 212, 191, 0.14) 0%,
      rgba(45, 212, 191, 0.055) 28%,
      transparent 62%
    );
    transition: opacity var(--motion-base) var(--ease-out);
    z-index: 1;
  }
  .service-card:hover::after,
  .project-card:hover::before {
    opacity: 1;
  }
}

.diferencial-icon {
  transition: transform var(--motion-base) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .diferencial:hover {
    transform: translateY(-1px);
  }
  .diferencial:hover .diferencial-icon {
    transform: scale(1.08) rotate(1deg);
  }
}

/* Nav underline sutil */
.nav-list a {
  position: relative;
  transition: color var(--motion-fast) var(--ease-out);
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 3px;
  background: var(--accent);
  transition: width var(--motion-base) var(--ease-out);
}
.nav-list a:hover::after,
.nav-list a:focus-visible::after {
  width: 100%;
}

/* Processo — linha com luz percorrendo */
.process-track {
  position: relative;
  overflow: hidden;
}
.process-track::before {
  content: "";
  position: absolute;
  top: 25px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
  z-index: 0;
}
.process-track::after {
  content: "";
  position: absolute;
  top: 25px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(45,212,191,0.95), transparent);
  filter: blur(0.4px);
  z-index: 0;
  transform-origin: left center;
  transform: scaleX(0);
  /* Fallback: loop contínuo (14s) para navegadores sem suporte a scroll-driven */
  animation: process-light-travel 14s linear infinite;
}
@keyframes process-light-travel {
  0% { transform: translateX(-30%) scaleX(0.35); }
  100% { transform: translateX(130%) scaleX(0.35); }
}

/* Progressive Enhancement: Scroll-Driven Animation para navegadores compatíveis */
@supports (animation-timeline: view()) {
  .process-track::after {
    /* Substitui fallback por progressão baseada no scroll */
    animation: process-light-progress linear forwards;
    animation-timeline: view();
    animation-range: entry 10% cover 80%;
  }
  @keyframes process-light-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

/* Respeita prefers-reduced-motion: desativa ambas as animações */
@media (prefers-reduced-motion: reduce) {
  .process-track::after {
    animation: none !important;
    transform: scaleX(0.15);
  }
}

/* Mobile: se layout muda para vertical, o scroll-driven horizontal pode não fazer sentido.
   Mantemos fallback leve; enhancement desativado em telas estreitas onde a seção é vertical. */
@media (max-width: 768px) {
  @supports (animation-timeline: view()) {
    .process-track::after {
      animation: process-light-travel 14s linear infinite;
    }
  }
}

/* Processo — números/ícones respirando */
.step {
  position: relative;
  z-index: 2;
}
.step-number,
.step-icon {
  position: relative;
  z-index: 3;
  animation: step-breathe 6s ease-in-out infinite;
}
.step:nth-child(1) .step-number,
.step:nth-child(1) .step-icon { animation-delay: 0s; }
.step:nth-child(2) .step-number,
.step:nth-child(2) .step-icon { animation-delay: 1.5s; }
.step:nth-child(3) .step-number,
.step:nth-child(3) .step-icon { animation-delay: 3s; }
.step:nth-child(4) .step-number,
.step:nth-child(4) .step-icon { animation-delay: 4.5s; }

.step:hover .step-number {
  transform: scale(1.06);
}

/* Sobre — detalhe sutil */
#sobre {
  position: relative;
}
#sobre::before {
  content: "";
  position: absolute;
  top: 10%;
  right: 5%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45,212,191,0.08) 0%, transparent 70%);
  filter: blur(1px);
  animation: step-breathe 10s ease-in-out infinite;
  pointer-events: none;
}

/* FAQ — interação refinada */
.faq-item summary {
  transition: color var(--motion-base) var(--ease-out), background-color var(--motion-base) var(--ease-out), border-color var(--motion-base) var(--ease-out);
  cursor: pointer;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}
.faq-item summary:hover {
  color: var(--accent);
  background-color: rgba(45,212,191,0.03);
  border-left-color: rgba(45,212,191,0.5);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  float: right;
  transition: transform var(--motion-base) var(--ease-out), color var(--motion-base) var(--ease-out);
  font-weight: 300;
}
.faq-item[open] summary {
  border-left-color: var(--accent);
}
.faq-item[open] summary::after {
  content: "−";
  transform: rotate(180deg);
  color: var(--accent);
}

/* Contato — glow radial respirando */
#contato {
  position: relative;
  overflow: hidden;
}
#contato::before {
  content: "";
  position: absolute;
  inset: -25%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(900px 450px at 50% -10%, rgba(45,212,191,0.14) 0%, transparent 65%);
  animation: contact-glow-breathe 28s ease-in-out infinite;
}
#contato .container {
  position: relative;
  z-index: 1;
}

/* CTA contato mais responsivo */
#contato .btn {
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) ease, background var(--motion-base) var(--ease-out);
}
#contato .btn:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow: 0 10px 24px rgba(45,212,191,0.22), 0 4px 8px rgba(0,0,0,0.10);
}
#contato .btn:active {
  transform: translateY(0) scale(0.995);
}

/* 4. Scroll reveal removido temporariamente — conteúdo nunca pode depender de JS para ser visível */

/* 5. Mobile simplificado */
@media (max-width: 768px) {
  #inicio .hero-content .eyebrow,
  #inicio .hero-content .camp-badge,
  #inicio .hero-content h1,
  #inicio .hero-content > p,
  #inicio .hero-content .hero-ctas,
  #inicio .hero-image,
  #inicio .hero-content .camp-hero-note,
  #inicio .hero-content .diferenciais {
    animation-duration: 380ms;
  }
  #inicio .hero-content .camp-badge { animation-delay: 40ms; }
  #inicio .hero-content h1 { animation-delay: 80ms; }
  #inicio .hero-content > p { animation-delay: 120ms; }
  #inicio .hero-content .hero-ctas { animation-delay: 160ms; }
  #inicio .hero-content .camp-hero-note { animation-delay: 200ms; }
  #inicio .hero-content .diferenciais { animation-delay: 240ms; }
  .service-card:hover,
  .project-card:hover {
    transform: none;
  }
  #inicio .hero-image {
    animation: none !important;
  }
  #inicio .hero-image img {
    animation: motion-fadeUpScale 380ms cubic-bezier(0.22,1,0.36,1) both !important;
  }
  #inicio::before,
  #contato::before,
  .process-track::before {
    animation: none !important;
  }
  .step-number,
  .step-icon {
    animation: none !important;
  }
}

/* 6. 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;
  }
  #inicio .hero-content .eyebrow,
  #inicio .hero-content .camp-badge,
  #inicio .hero-content h1,
  #inicio .hero-content > p,
  #inicio .hero-content .hero-ctas,
  #inicio .hero-image,
  #inicio .hero-content .camp-hero-note,
  #inicio .hero-content .diferenciais,
  #inicio .diferencial {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
