/* =========================================================
   Denis Tassone — Efeitos e Animações
   Dependências: css/style.css + GSAP/ScrollTrigger/Lenis (CDN)
   Tudo é progressive: sem JS o conteúdo continua visível.
   ========================================================= */

/* ---------- Loader de entrada ---------- */
.loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  background: var(--gradient, linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 50%, #172554 100%));
}

.js-anim .loader { display: flex; }

.loader__mark {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.9rem;
  backdrop-filter: blur(6px);
  animation: loaderPulse 1.4s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.06) rotate(4deg); }
}

.loader__mark--img {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.9);
  padding: 6px;
}

.loader__mark img {
  width: 100%;
  height: 100%;
  max-width: 68px;
  max-height: 68px;
  object-fit: contain;
}

.loader__text {
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.85;
}

.loader__bar {
  width: 140px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.loader__bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: #fff;
  border-radius: 3px;
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---------- Cursor personalizado ---------- */
.cursor { display: none; }

@media (hover: hover) and (pointer: fine) {
  .js-anim .cursor { display: block; }
}

.cursor__dot,
.cursor__ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9997;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.cursor__dot {
  width: 7px;
  height: 7px;
  background: #fff;
}

.cursor__ring {
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  transition: width 0.28s ease, height 0.28s ease, background-color 0.28s ease, border-color 0.28s ease;
}

.cursor.is-hover .cursor__ring {
  width: 68px;
  height: 68px;
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
}

.cursor.is-down .cursor__ring { width: 30px; height: 30px; }

/* ---------- Split de texto ---------- */
.split-word { display: inline-block; will-change: transform; }

/* ---------- Revelações (estado inicial aplicado via GSAP) ---------- */
[data-reveal], [data-stagger] > *, [data-split] { will-change: transform, opacity; }

/* ---------- Marquee infinito ---------- */
.marquee {
  overflow: hidden;
  background: var(--dark, #0F172A);
  color: #fff;
  padding: 16px 0;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.marquee--light {
  background: var(--light, #F1F5F9);
  color: var(--dark-3, #334155);
  border-color: rgba(0, 0, 0, 0.05);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 32s linear infinite;
}

.marquee:hover .marquee__track { animation-play-state: paused; }

.marquee__track span {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-right: 26px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee__track span i {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--secondary, #DC2626);
  display: inline-block;
}

@keyframes marqueeScroll {
  to { transform: translateX(-50%); }
}

/* ---------- Formas flutuantes (parallax) ---------- */
.hero__floaters {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.floater { position: absolute; opacity: 0.28; }
.floater--1 { top: 14%; right: 20%; width: 120px; }
.floater--2 { top: 58%; right: 8%; width: 76px; }
.floater--3 { bottom: 16%; left: 5%; width: 92px; }
.floater--4 { top: 24%; left: 12%; width: 54px; opacity: 0.18; }

@media (max-width: 768px) {
  .floater--2, .floater--4 { display: none; }
  .floater--1 { width: 84px; right: 4%; top: 10%; }
  .floater--3 { width: 64px; }
}

/* ---------- Seção Serviços: faixa horizontal ---------- */
.servicos__track-wrap { position: relative; }

.servicos__track,
.servicos__grid { perspective: 1200px; }

.servicos--h .section__header {
  max-width: none;
  margin-bottom: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  text-align: left;
}

.servicos--h .section__header .section__desc { max-width: 420px; text-align: right; }

.h-progress {
  position: relative;
  display: none;
  height: 4px;
  margin-top: 36px;
  border-radius: 4px;
  background: rgba(29, 78, 216, 0.12);
  overflow: hidden;
}

.servicos--h .h-progress { display: block; }

.h-progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gradient, linear-gradient(135deg, #1D4ED8, #1E3A8A));
  border-radius: 4px;
  transform: scaleX(0);
  transform-origin: left center;
}

.h-hint {
  display: none;
  margin-top: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray, #64748B);
}

.servicos--h .h-hint { display: block; }

/* ---------- Sobre: cubo 3D ---------- */
.cube-stage {
  position: relative;
  z-index: 1;
  perspective: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.cube {
  position: relative;
  width: 170px;
  height: 170px;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-32deg);
  will-change: transform;
}

.cube__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.4;
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.12);
}

.cube__face--front  { transform: translateZ(85px); }
.cube__face--back   { transform: rotateY(180deg) translateZ(85px); }
.cube__face--right  { transform: rotateY(90deg) translateZ(85px); background: rgba(220, 38, 38, 0.28); }
.cube__face--left   { transform: rotateY(-90deg) translateZ(85px); background: rgba(220, 38, 38, 0.28); }
.cube__face--top    { transform: rotateX(90deg) translateZ(85px); background: rgba(249, 115, 22, 0.3); }
.cube__face--bottom { transform: rotateX(-90deg) translateZ(85px); background: rgba(249, 115, 22, 0.3); }

.cube-shadow {
  position: absolute;
  bottom: 76px;
  left: 50%;
  width: 190px;
  height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 70%);
  filter: blur(4px);
}

/* Diferenciais sincronizados com o cubo (só quando o scrub está ativo) */
.sobre.cube-scrub .diferencial {
  opacity: 0.4;
  border-left: 3px solid transparent;
  padding-left: 14px;
  margin-left: -17px;
  transition: opacity 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
}

.sobre.cube-scrub .diferencial.is-active {
  opacity: 1;
  border-color: var(--primary, #1D4ED8);
  transform: translateX(4px);
}

/* ---------- Tilt 3D nos cards ---------- */
[data-tilt] { will-change: transform; transform-style: preserve-3d; }

/* Transições CSS não podem competir com o transform controlado pelo GSAP */
.gsap-anim [data-tilt],
.gsap-anim [data-magnetic] {
  transition-property: box-shadow, background-color, background, color, border-color;
}

/* ---------- Botão voltar ao topo ---------- */
.totop {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 998;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--dark, #0F172A);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.15));
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.totop.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.totop:hover { background: var(--primary, #1D4ED8); }

/* ---------- Lightbox com transição ---------- */
.lightbox {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox__content { transform: scale(0.94); transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
.lightbox.open .lightbox__content { transform: scale(1); }

/* ---------- Header ---------- */
.js-anim .header { will-change: transform; }

/* ---------- Lenis (scroll suave) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Acessibilidade: movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader { display: none !important; }
  .marquee__track { animation: none; }
  .loader__mark { animation: none; }
  .cursor { display: none !important; }
  .split-word { transform: none !important; opacity: 1 !important; }
}
