/* =========================================================
   Cítara · FX layer oficial (v1 · 2026-08)
   Personalidade de motion: PREMIUM
   350-600ms · cubic-bezier(0.4,0,0.2,1) · zero overshoot
   3 camadas: primária (reveals), secundária (hover/glow),
   ambiente (cordas, aurora, grain).
   Tudo respeita prefers-reduced-motion (bloco no fim).
   ========================================================= */

:root {
  --fx-magenta: #E5348B;
  --fx-magenta-bright: #FF4A9C;
  --fx-magenta-deep: #CC3366;
  --fx-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fx-dur-quick: 200ms;
  --fx-dur: 550ms;
  --fx-dur-slow: 900ms;
}

/* ---------------------------------------------------------
   1. View Transitions entre páginas (MPA nativo)
   Progressive enhancement: sem suporte = navegação normal.
   --------------------------------------------------------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fx-vt-out 240ms var(--fx-ease) both; }
::view-transition-new(root) { animation: fx-vt-in 360ms var(--fx-ease) both; }
@keyframes fx-vt-out { to { opacity: 0; } }
@keyframes fx-vt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar .brand img { view-transition-name: citara-logo; }

/* ---------------------------------------------------------
   2. Grain cinematográfico global (estático, custo zero)
   --------------------------------------------------------- */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------------------------------------------------------
   3. Barra de progresso de leitura
   --------------------------------------------------------- */
.fx-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--fx-magenta-deep), var(--fx-magenta), var(--fx-magenta-bright));
  box-shadow: 0 0 12px rgba(229,52,139,0.6);
  z-index: 300; pointer-events: none;
  will-change: transform;
}

/* ---------------------------------------------------------
   4. Hero · reveal palavra a palavra (mascarado, sem overshoot)
   --------------------------------------------------------- */
.fx-word-mask {
  display: inline-block; overflow: hidden;
  vertical-align: top; padding-bottom: 0.06em; margin-bottom: -0.06em;
}
.fx-word {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  transition: transform var(--fx-dur-slow) var(--fx-ease), opacity var(--fx-dur-slow) var(--fx-ease);
  transition-delay: calc(var(--w, 0) * 60ms + 100ms);
}
.fx-in .fx-word { transform: translateY(0); opacity: 1; }

/* sub e CTAs entram depois do título (camada secundária) */
.fx-hero-late {
  opacity: 0; transform: translateY(18px);
  transition: opacity var(--fx-dur) var(--fx-ease), transform var(--fx-dur) var(--fx-ease);
}
.fx-hero-ready .fx-hero-late { opacity: 1; transform: none; }
.fx-hero-late.two { transition-delay: 520ms; }
.fx-hero-late.three { transition-delay: 640ms; }

/* ---------------------------------------------------------
   5. Reveals escalonados por card (scroll)
   Sem blur (GPU) e sem rotate: translate + scale + opacity.
   --------------------------------------------------------- */
[data-fx] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity var(--fx-dur) var(--fx-ease), transform var(--fx-dur) var(--fx-ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
[data-fx="scale"] { transform: translateY(26px) scale(0.97); }
[data-fx].fx-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------
   6. Marquee de clientes · fade nas bordas + faixa fantasma
   --------------------------------------------------------- */
.marquee {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  position: relative;
}
.marquee .marquee-inner.ghost {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%) scale(0.82);
  opacity: 0.22;
  animation: fx-slide-back 70s linear infinite;
  pointer-events: none;
}
@keyframes fx-slide-back { from { transform: translateY(-50%) scale(0.82) translateX(-50%); } to { transform: translateY(-50%) scale(0.82) translateX(0); } }
.marquee:hover .marquee-inner { animation-play-state: paused; }

/* ---------------------------------------------------------
   7. Anel conic girando ("modo IA") · só onde importa
   --------------------------------------------------------- */
@property --fx-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.fx-ring { position: relative; }
.fx-ring::before {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--fx-angle),
    var(--fx-magenta) 0%, var(--fx-magenta-deep) 25%, transparent 45%,
    transparent 60%, var(--fx-magenta-bright) 85%, var(--fx-magenta) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: fx-spin 4s linear infinite;
  pointer-events: none;
}
@keyframes fx-spin { to { --fx-angle: 360deg; } }

/* ---------------------------------------------------------
   8. Profundidade Linear/Vercel · shadow stack nos cards dark
   --------------------------------------------------------- */
[data-theme="dark"] .service-card,
[data-theme="dark"] .case-card,
[data-theme="dark"] .testi,
[data-theme="dark"] .eco-item {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 1px 2px rgba(0,0,0,0.5),
    0 12px 32px -16px rgba(0,0,0,0.7);
}
[data-theme="dark"] .service-card:hover,
[data-theme="dark"] .case-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 1px 2px rgba(0,0,0,0.5),
    0 18px 44px -16px rgba(0,0,0,0.8),
    0 0 40px -12px rgba(229,52,139,0.25);
}

/* ---------------------------------------------------------
   9. Canvas ambientes (cordas no hero · pontos no método)
   --------------------------------------------------------- */
.fx-strings, .fx-dots {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.hero .hero-inner { position: relative; z-index: 1; }

/* ---------------------------------------------------------
   10. Ticker honesto (sem selo verde de fake "ao vivo")
   --------------------------------------------------------- */
.ticker-cell .chg { color: var(--fg-3); }

/* ---------------------------------------------------------
   11. CTA cinematográfico · scrub por scroll (nativo CSS)
   Fallback: sem suporte, o CTA aparece como hoje.
   --------------------------------------------------------- */
@supports (animation-timeline: view()) {
  .cinematic-cta h2 {
    animation: fx-cta-carve linear both;
    animation-timeline: view();
    animation-range: entry 5% entry 55%;
  }
  @keyframes fx-cta-carve {
    from { clip-path: inset(0 0 100% 0); transform: translateY(28px); }
    to { clip-path: inset(0 0 -10% 0); transform: none; }
  }
  .cinematic-cta .aurora {
    animation: aurora-breathe 8s ease-in-out infinite alternate, fx-cta-drift linear both;
    animation-timeline: auto, view();
    animation-range: normal, entry 0% exit 100%;
  }
  @keyframes fx-cta-drift { from { translate: 0 -6%; } to { translate: 0 6%; } }
}

/* ---------------------------------------------------------
   11b. Vídeo de fundo do CTA (gerado no Higgsfield)
   --------------------------------------------------------- */
.cinematic-cta .cta-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: brightness(0.55) saturate(1.15);
  z-index: 0;
  pointer-events: none;
}
/* scrim: véu escuro entre o vídeo e o texto, garante a leitura */
.cinematic-cta::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 58% at 50% 52%, rgba(0,0,0,0.55), rgba(0,0,0,0.22) 62%, transparent 100%),
    linear-gradient(180deg, rgba(0,0,0,0.45), transparent 28%, transparent 68%, rgba(0,0,0,0.55));
}
.cinematic-cta .sub { color: rgba(255,255,255,0.82); text-shadow: 0 1px 12px rgba(0,0,0,0.7); }
.cinematic-cta h2 { filter: drop-shadow(0 0 24px rgba(229,52,139,0.2)) drop-shadow(0 4px 24px rgba(0,0,0,0.65)); }

/* ---------------------------------------------------------
   12. Lenis (recomendações oficiais)
   --------------------------------------------------------- */
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; }

/* ---------------------------------------------------------
   13. PRM · reduced motion desliga TUDO que se move sozinho
   (cobre também animações antigas do site.css/brand.css)
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fx-word { transform: none; opacity: 1; transition: none; }
  .fx-hero-late { opacity: 1; transform: none; transition: none; }
  [data-fx] { opacity: 1; transform: none; transition: none; }
  .fx-progress, .fx-strings, .fx-dots, .cinematic-cta .cta-bg { display: none; }
  .fx-ring::before { animation: none; }
  .marquee .marquee-inner,
  .marquee .marquee-inner.ghost,
  .cinematic-cta .diag-marquee .track { animation-play-state: paused; }
  .hero-eyebrow .dot,
  .ai-banner .flow,
  .ai-banner .tag .pulse,
  .hv-badge .pulse,
  .hero-video .hv-halo,
  .cinematic-cta .aurora,
  .cinematic-cta .crafted .heart,
  .ticker-cell .lbl .live::before { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .cinematic-cta h2 { animation: none; clip-path: none; transform: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   14. HERO OBJECT · símbolo oficial como objeto 3D real
   Face frontal = arte oficial intacta (sem recolorir/distorcer).
   A espessura são camadas atrás dela, como um bloco de acrílico.
   ========================================================= */
.hero-object {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  justify-self: end;
  display: grid;
  place-items: center;
  perspective: 1400px;
  perspective-origin: 50% 45%;
}
@media (max-width: 1024px) { .hero-object { justify-self: center; max-width: 380px; } }

/* halo magenta que respira atrás do objeto */
.ho-glow {
  position: absolute; inset: 2%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(229,52,139,0.62), transparent 74%);
  filter: blur(54px);
  animation: ho-breathe 7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ho-breathe { from { opacity: 0.55; transform: scale(0.94); } to { opacity: 1; transform: scale(1.08); } }

/* anéis de ressonância: a marca é um instrumento de cordas */
.ho-rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ho-rings .ring {
  position: absolute;
  width: 56%; aspect-ratio: 1;
  border: 1px solid rgba(229,52,139,0.65);
  border-radius: 30%;
  opacity: 0;
  animation: ho-ring 5.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.ho-rings .ring:nth-child(2) { animation-delay: 1.8s; }
.ho-rings .ring:nth-child(3) { animation-delay: 3.6s; }
@keyframes ho-ring {
  0% { transform: scale(0.82) rotate(0deg); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: scale(1.85) rotate(12deg); opacity: 0; }
}

/* pilha de transformações: tilt (mouse) > float (respiro) > spin (giro) */
.hero-object { --ho-ready: 1; }
.ho-tilt, .ho-float, .ho-spin, .ho-slab { transform-style: preserve-3d; }
.ho-tilt {
  position: relative;
  width: 68%; aspect-ratio: 1;
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.ho-float, .ho-spin { width: 100%; height: 100%; }
.ho-float { animation: ho-levitate 6.5s ease-in-out infinite alternate; }
@keyframes ho-levitate { from { transform: translateY(-10px); } to { transform: translateY(10px); } }
.ho-spin { animation: ho-turn 14s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; }
@keyframes ho-turn {
  from { transform: rotateY(-11deg) rotateX(3deg); }
  to { transform: rotateY(11deg) rotateX(-2deg); }
}

.ho-slab { position: relative; width: 100%; height: 100%; }
.ho-face, .ho-slab .layer {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 24%;
  display: block;
}
/* face frontal: arte oficial, sem filtro nenhum */
.ho-face {
  z-index: 2;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.8);
}
/* camadas de espessura (injetadas pelo fx.js) */
.ho-slab .layer {
  background-image: url('assets/simbolo-citara.png');
  background-size: cover;
  filter: brightness(var(--b, 0.5)) saturate(0.9);
}

/* piso: sombra + reflexo do objeto */
.ho-floor {
  position: absolute; left: 50%; bottom: 8%;
  width: 46%; height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.75), transparent 70%);
  filter: blur(14px);
  animation: ho-floor 6.5s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ho-floor { from { transform: translateX(-50%) scale(1.06); opacity: 0.85; } to { transform: translateX(-50%) scale(0.9); opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  .ho-glow, .ho-float, .ho-spin, .ho-floor, .ho-rings .ring { animation: none; }
  .ho-rings .ring { opacity: 0.25; }
  .ho-tilt { transition: none; }
}

/* ---------------------------------------------------------
   15. Ecossistema · cards com nome e tag
   --------------------------------------------------------- */
.eco-item .eco-logo { color: var(--fx-magenta); height: 40px; display: flex; align-items: center; }
.eco-item .eco-name {
  font-family: 'Poppins', sans-serif;
  font-size: 19px; font-weight: 600;
  color: #FFFFFF;
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
}
.eco-item .eco-tag {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fx-magenta);
  border: 1px solid rgba(229,52,139,0.4);
  border-radius: 999px;
  padding: 3px 8px;
}
.eco-item .eco-desc { font-size: 13px; line-height: 1.55; }
a.eco-item { position: relative; }
a.eco-item::after {
  content: "→";
  position: absolute; right: 20px; bottom: 18px;
  color: var(--fx-magenta);
  opacity: 0; transform: translateX(-6px);
  transition: opacity var(--fx-dur-quick) var(--fx-ease), transform var(--fx-dur-quick) var(--fx-ease);
}
a.eco-item:hover::after { opacity: 1; transform: translateX(0); }
