/* ==========================================================
   Kacire — movimento (técnicas de animação inspiradas no
   repositório de referência, reescritas com a paleta da Kacire)
   Carregar DEPOIS de pages.css.
   Tudo que esconde conteúdo só vale com <html class="js">.
   ========================================================== */

/* ---------- Revelação ao rolar ---------- */
.js .reveal,
.js .reveal-left,
.js .reveal-right {
  opacity: 0;
  transition:
    opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1) var(--reveal-delay, 0s),
    transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) var(--reveal-delay, 0s);
}
.js .reveal {
  transform: translateY(40px);
}
.js .reveal-left {
  transform: translateX(-40px);
}
.js .reveal-right {
  transform: translateX(40px);
}
.js .reveal.visible,
.js .reveal-left.visible,
.js .reveal-right.visible {
  opacity: 1;
  transform: translate(0);
}

/* ---------- Cabeçalho: transparente no topo, vidro ao rolar ---------- */
.site-header {
  transition:
    background 0.35s,
    backdrop-filter 0.35s,
    border-color 0.35s,
    box-shadow 0.35s;
}
.js .site-header:not(.scrolled) {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}
.js .site-header.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Hero: linhas de varredura, brilho no título, indicador ---------- */
.hero {
  overflow: hidden;
}
.hero-scanlines {
  position: absolute;
  inset: -40px 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 2px,
    rgba(139, 92, 246, 0.05) 2px 4px
  );
  animation: scanline-move 8s linear infinite;
}
@keyframes scanline-move {
  to {
    transform: translateY(40px);
  }
}

.typed-wrap {
  animation: title-glow 3s ease-in-out infinite alternate;
}
@keyframes title-glow {
  from {
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.25));
  }
  to {
    filter: drop-shadow(0 0 22px rgba(139, 92, 246, 0.6));
  }
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(-50%);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  animation: scroll-bounce 2s ease-in-out infinite;
  transition: color 0.3s;
}
.hero-scroll:hover,
.hero-scroll:focus-visible {
  color: var(--fg);
}
.hero-scroll i {
  display: block;
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, var(--purple), transparent);
}
@keyframes scroll-bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(8px);
  }
}
@media (max-height: 620px) {
  .hero-scroll {
    display: none;
  }
}

/* Paralaxe: a camada de partículas é maior que o hero para não deixar vão */
.hero canvas#particles {
  top: -15%;
  left: 0;
  width: 100%;
  height: 130%;
  will-change: transform;
}

/* ---------- Contato: pulso de brilho ---------- */
.contact-box {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.contact-box::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(560px, 100%);
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--star-color) 55%, transparent) 0%,
    color-mix(in srgb, var(--star-color) 20%, transparent) 50%,
    color-mix(in srgb, var(--star-color) 4%, transparent) 100%
  );
  animation:
    cta-pulse 4s ease-in-out infinite,
    cta-color 12s ease-in-out infinite;
  clip-path: polygon(
    50% 0,
    53% 45%,
    100% 50%,
    53% 55%,
    50% 100%,
    47% 55%,
    0 50%,
    47% 45%
  );
}
@keyframes cta-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: translateX(-50%) scaleX(1);
  }
  50% {
    opacity: 0.75;
    transform: translateX(-50%) scaleX(1.08);
  }
}
/* Cor da estrela: 4 s em cada cor (vermelho → azul → roxo), em loop de 12 s */
@property --star-color {
  syntax: "<color>";
  inherits: false;
  initial-value: #8b5cf6;
}
@keyframes cta-color {
  0%,
  28% {
    --star-color: #ef4444;
  }
  33%,
  61% {
    --star-color: #3b82ff;
  }
  66%,
  94% {
    --star-color: #8b5cf6;
  }
  100% {
    --star-color: #ef4444;
  }
}
/* ---------- Cartões: brilho no hover + inclinação 3D ---------- */
.tilt {
  transform: perspective(600px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s,
    box-shadow 0.3s;
}
.tilt:hover,
.tilt:focus-within {
  --lift: -8px;
}

.project-card {
  position: relative;
  overflow: hidden;
  height: 100%;
}
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(139, 92, 246, 0.28) 0%,
    transparent 70%
  );
  transition: opacity 0.35s;
}
.project-card:hover::before,
.project-card:focus-within::before {
  opacity: 1;
}
.project-card > * {
  position: relative;
}

/* ---------- Galeria: zoom no hover, legenda sobe, botão de ampliar ---------- */
.gallery figure {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.35s,
    box-shadow 0.35s;
}
.gallery figure:hover,
.gallery figure:focus-within {
  transform: scale(1.02);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(139, 92, 246, 0.25);
}
.gallery-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  overflow: hidden;
}
.gallery-open img {
  transition: transform 0.5s ease;
}
.gallery-open:hover img,
.gallery-open:focus-visible img {
  transform: scale(1.08);
}

@media (hover: hover) and (pointer: fine) {
  .gallery figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(to top, rgba(5, 5, 7, 0.92), transparent);
    padding-top: 28px;
    transform: translateY(100%);
    transition: transform 0.35s;
  }
  .gallery figure:hover figcaption,
  .gallery figure:focus-within figcaption {
    transform: translateY(0);
  }
}

/* ---------- Lightbox (<dialog> nativo) ---------- */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
}
.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lightbox[open] {
  display: grid;
  place-items: center;
  animation: lb-in 0.35s ease both;
}
@keyframes lb-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.lightbox-figure {
  margin: 0;
  display: grid;
  gap: 12px;
  max-width: min(92vw, 1100px);
}
.lightbox-figure img {
  justify-self: center;
  width: auto;
  max-width: 100%;
  max-height: 76vh;
  height: auto;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.lightbox-caption {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}
.lightbox-btn {
  position: fixed;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 7, 0.6);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--fg);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 0.3s,
    color 0.3s,
    box-shadow 0.3s;
}
.lightbox-btn:hover,
.lightbox-btn:focus-visible {
  border-color: var(--purple);
  color: #fff;
  box-shadow: 0 0 18px -2px var(--purple);
}
.lightbox-close {
  top: 1.25rem;
  right: 1.25rem;
}
.lightbox-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal-left,
  .js .reveal-right {
    opacity: 1;
    transform: none;
  }
  .tilt {
    transform: none;
  }
  .hero-scroll {
    transform: translateX(-50%);
  }
  .gallery figure:hover,
  .gallery figure:focus-within {
    transform: none;
  }
  .gallery-open:hover img,
  .gallery-open:focus-visible img {
    transform: none;
  }
}
