/* Preload: a seta do logo "carrega", aterra no logo, abre-o e faz um clique. */

/* Sem JS ou em visitas seguintes nesta sessão não há preload. */
html:not(.clica-js) .clica-curtain,
html.clica-seen .clica-curtain { display: none; }

/* Enquanto o preload está ativo, as animações de entrada da página ficam em pausa
   (a pausa também suspende o atraso, por isso começam quando a cortina sobe). */
html.clica-loading:not(.clica-seen) .clica-rise,
html.clica-loading:not(.clica-seen) .clica-fade,
html.clica-loading:not(.clica-seen) .clica-corner,
html.clica-entering .clica-rise,
html.clica-entering .clica-fade,
html.clica-entering .clica-corner { animation-play-state: paused; }

/* ---------- Transição entre páginas ----------
   Saída: um painel azul sobe de baixo com o nome da página de destino.
   Entrada: a nova página começa tapada e o painel sai por cima. */
.clica-trans {
  position: fixed; inset: 0; z-index: 87;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  padding: 24px;
  background: #0A0A0A; color: #FFFFFF; /* o preto é a faixa que vai à frente do azul */
  visibility: hidden; pointer-events: none;
  clip-path: inset(100% 0 0 0);
  isolation: isolate;
}
.clica-trans::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent, #004AFF);
}

.tr-url {
  max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .7);
}
.tr-label { position: relative; display: inline-block; min-width: 0; max-width: 100%; overflow: hidden; padding: .08em .2em .06em 0; }
.tr-word {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(40px, 8vw, 116px); line-height: .95; letter-spacing: -.055em;
  white-space: nowrap;
}
.tr-bar {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 4px;
  background: #FFFFFF; transform: scaleX(0); transform-origin: 0 50%;
}

/* Saída */
/* Tudo termina antes dos 560ms: o JS só muda de página depois disso, por isso a página
   nova começa exatamente no estado final desta animação (sem saltos). */
html.clica-leaving .clica-trans { visibility: visible; pointer-events: auto; animation: tr-in .46s cubic-bezier(.7, 0, .2, 1) forwards; }
html.clica-leaving .clica-trans::after { animation: tr-in .46s cubic-bezier(.7, 0, .2, 1) .06s both; }
html.clica-leaving .tr-word { animation: tr-word-in .4s cubic-bezier(.2, .8, .2, 1) .14s both; }
html.clica-leaving .tr-url { animation: clica-fade .36s ease .16s both; }
/* A barra é uma só animação longa, que continua na página nova no ponto em que ia (ver --tr-delay). */
html.clica-leaving .tr-bar { animation: tr-bar 4s cubic-bezier(.1, .7, .2, 1) .16s both; }

@keyframes tr-in { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes tr-word-in { from { transform: translateY(105%) rotate(4deg); } to { transform: none; } }
@keyframes tr-bar { from { transform: scaleX(0); } to { transform: scaleX(.94); } }

/* Troca de documento sem corte: o browser segura a imagem da página antiga até a nova estar
   pronta a pintar e funde as duas (ambas estão tapadas pelo mesmo painel, por isso não se nota). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .14s; }

/* Entrada: começa tapado (igual ao fim da saída)... */
html.clica-entering { background: var(--accent, #004AFF); } /* nunca há um frame claro entre páginas */
html.clica-entering .clica-trans { visibility: visible; pointer-events: auto; clip-path: inset(0 0 0 0); }
html.clica-entering .tr-bar { animation: tr-bar 4s cubic-bezier(.1, .7, .2, 1) var(--tr-delay, -.6s) both; }
/* ...e abre para cima */
html.clica-trans-out .clica-trans { visibility: visible; animation: tr-out .8s cubic-bezier(.7, 0, .2, 1) .12s both; }
html.clica-trans-out .clica-trans::after { animation: tr-out .8s cubic-bezier(.7, 0, .2, 1) both; }
html.clica-trans-out .tr-bar { animation: none; transform: scaleX(1); transition: transform .2s; }
html.clica-trans-out .tr-word,
html.clica-trans-out .tr-url { animation: tr-up .7s cubic-bezier(.7, 0, .2, 1) .1s both; }

@keyframes tr-out { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }
@keyframes tr-up { to { transform: translateY(-60px); opacity: 0; } }

/* Ao navegar dentro do site, o cabeçalho e o botão CLICA já lá estão (não voltam a entrar). */
html.clica-via .clica-root > header.clica-fade,
html.clica-via [data-fab].clica-fade { animation: none; }

/* O contador de cliques dá um pulo a cada clique */
.clica-clicks.is-bump { animation: clica-bump .35s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes clica-bump { 40% { transform: scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  .clica-trans { display: none; }
}

.clica-curtain {
  --w: min(420px, 62vw);
  --cp-ease: cubic-bezier(.2, .9, .2, 1);
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: #0A0A0A;
  transition: transform .9s cubic-bezier(.8, 0, .2, 1);
}
.clica-curtain.out { transform: translateY(-100%); }

.cp-logo {
  position: relative;
  width: var(--w);
  aspect-ratio: 1200 / 434;
  transition: transform .6s cubic-bezier(.7, 0, .2, 1), opacity .5s;
}
.clica-curtain.out .cp-logo { transform: translateY(-60px); opacity: 0; }

/* O logo (sem a seta, que é desenhada à parte) abre a partir da seta. */
.cp-img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  clip-path: circle(0% at 16.4% 12.7%);
}
.go .cp-img { animation: cp-open .85s cubic-bezier(.7, 0, .2, 1) .38s forwards; }
@keyframes cp-open { to { clip-path: circle(150% at 16.4% 12.7%); } }

/* Tapa a seta que vem desenhada no PNG. */
.cp-mask {
  position: absolute;
  left: calc(12% - 2px); top: -2px;
  width: calc(8.83% + 4px); height: calc(25.35% + 4px);
  background: #0A0A0A;
}

/* A seta. Na fase de espera está ao centro, maior, a rodar aos "cliques" de 90°. */
.cp-corner {
  position: absolute; z-index: 3;
  left: 12%; top: 0; width: 8.83%; height: 25.35%;
  box-sizing: border-box;
  border-top: calc(var(--w) * .035) solid var(--accent, #004AFF);
  border-right: calc(var(--w) * .0375) solid var(--accent, #004AFF);
  translate: calc(var(--w) * .336) calc(var(--w) * .135);
  scale: 1.7;
  filter: drop-shadow(0 0 22px rgba(0, 74, 255, .55));
  animation: cp-spin .9s infinite;
}
@keyframes cp-spin {
  0%   { rotate: 0deg;   animation-timing-function: cubic-bezier(.7, 0, .2, 1.4); }
  22%  { rotate: 90deg;  animation-timing-function: linear; }
  25%  { rotate: 90deg;  animation-timing-function: cubic-bezier(.7, 0, .2, 1.4); }
  47%  { rotate: 180deg; animation-timing-function: linear; }
  50%  { rotate: 180deg; animation-timing-function: cubic-bezier(.7, 0, .2, 1.4); }
  72%  { rotate: 270deg; animation-timing-function: linear; }
  75%  { rotate: 270deg; animation-timing-function: cubic-bezier(.7, 0, .2, 1.4); }
  97%  { rotate: 360deg; }
  100% { rotate: 360deg; }
}
.go .cp-corner {
  animation:
    cp-land .6s cubic-bezier(.3, 1.35, .45, 1) forwards,
    cp-glow .6s ease .3s forwards,
    cp-press .32s ease .98s;
}
@keyframes cp-land {
  from { translate: calc(var(--w) * .336) calc(var(--w) * .135); scale: 1.7; rotate: 0deg; }
  to   { translate: 0 0; scale: 1; rotate: 0deg; }
}
@keyframes cp-glow { to { filter: drop-shadow(0 0 0 rgba(0, 74, 255, 0)); } }
@keyframes cp-press { 0%, 100% { scale: 1; } 40% { scale: .78; } }

/* Onda ao aterrar e ao clicar. */
.cp-ring {
  position: absolute; z-index: 2;
  left: 16.4%; top: 12.7%;
  width: calc(var(--w) * .3); height: calc(var(--w) * .3);
  margin: calc(var(--w) * -.15) 0 0 calc(var(--w) * -.15);
  border: 2px solid var(--accent, #004AFF); border-radius: 50%;
  opacity: 0; scale: .2;
}
.go .cp-ring { animation: cp-ring .7s ease-out .42s, cp-ring .7s ease-out 1.05s; }
@keyframes cp-ring { 0% { opacity: .9; scale: .2; } 100% { opacity: 0; scale: 2.4; } }

/* Mini-setas que saltam no clique. */
.cp-spark {
  position: absolute; z-index: 2;
  left: 16.4%; top: 12.7%;
  width: 16px; height: 12px; margin: -6px 0 0 -8px;
  border-top: 4px solid var(--accent, #004AFF); border-right: 4px solid var(--accent, #004AFF);
  opacity: 0;
}
.go .cp-spark { animation: cp-spark .75s cubic-bezier(.2, .8, .2, 1) 1.05s; }
.cp-s1 { --dx: 70px;  --dy: -70px; --r: 0deg; }
.cp-s2 { --dx: 110px; --dy: -20px; --r: 35deg; }
.cp-s3 { --dx: 25px;  --dy: -105px; --r: -35deg; }
@keyframes cp-spark {
  0%   { opacity: 1; transform: translate(0, 0) rotate(var(--r)) scale(.6); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(1.3); }
}

/* Contador e legenda em baixo. */
.cp-foot {
  position: absolute; left: 32px; right: 32px; bottom: 28px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: #8A8A85;
  transition: opacity .4s;
}
.cp-count {
  font-size: clamp(48px, 7vw, 96px); font-weight: 700; line-height: .85;
  letter-spacing: -.05em; color: #FFFFFF; font-variant-numeric: tabular-nums;
}
.clica-curtain.out .cp-foot { opacity: 0; }
